diff --git a/SGGL/Model/APIItem/PersonInOutItem.cs b/SGGL/Model/APIItem/PersonInOutItem.cs new file mode 100644 index 00000000..d1f91348 --- /dev/null +++ b/SGGL/Model/APIItem/PersonInOutItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.APIItem +{ + public class PersonInOutItem + { + public string projectId { get; set; } + public string idCard { get; set; } + public int isIn { get; set; } + public DateTime changeTime { get; set; } + public string deviceIp { get; set; } + + + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 0eab9e38..602ccebb 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -146,6 +146,7 @@ + diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index f4d14b98..eb183c90 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -1,12 +1,14 @@ using BLL; +using Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using SgManager.AI; using System; using System.Collections.Generic; -using System.Linq; -using System.Web.Http; -using SgManager.AI; using System.Configuration; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json; +using System.Linq; +using System.Threading.Tasks; +using System.Web.Http; namespace WebAPI.Controllers { @@ -778,8 +780,39 @@ namespace WebAPI.Controllers } return responeData; } + + [HttpPost] + public Model.ResponeData getPersonInOut([FromBody] List personInOutItem) + { + var responeData = new Model.ResponeData(); + if (personInOutItem.Count > 0) + { + try + { + foreach (var item in personInOutItem) + { + Task task = Task.Run(() => + { + APIDoorServerService.SaveDoorInOutRecord(item.projectId, item.idCard, item.isIn, item.changeTime, "白名单"); + Task.Delay(1000).Wait(); // 模拟异步操作 + + }); + } + + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + } + return responeData; + } + #endregion + + #region 获取发卡人员 /// /// 获取发卡人员