diff --git a/SGGL/BLL/Score/ScoreFlowLogService.cs b/SGGL/BLL/Score/ScoreFlowLogService.cs index d086d9de..2da9e12c 100644 --- a/SGGL/BLL/Score/ScoreFlowLogService.cs +++ b/SGGL/BLL/Score/ScoreFlowLogService.cs @@ -73,6 +73,17 @@ namespace BLL return (from x in Funs.DB.ScoreFlowLog where x.IdentityCard == IdentityCard && x.Year == year && x.CompileDate > compliedate select x).ToList(); } + /// + /// 根据年份、身份证号码获取人员流水日志记录 + /// + /// + /// + /// + public static List GetScoreLogByIdentityCard(int year, string IdentityCard) + { + return (from x in Funs.DB.ScoreFlowLog where x.IdentityCard == IdentityCard && x.Year == year orderby x.CompileDate descending select x).ToList(); + } + /// /// 增加人员记分流水 /// diff --git a/SGGL/Model/APIItem/HSSE/ScoreFlowLogItem.cs b/SGGL/Model/APIItem/HSSE/ScoreFlowLogItem.cs new file mode 100644 index 00000000..3c6f5d0c --- /dev/null +++ b/SGGL/Model/APIItem/HSSE/ScoreFlowLogItem.cs @@ -0,0 +1,43 @@ + +using System; + +namespace Model +{ + public class ScoreFlowLogItem + { + /// + /// 类型 + /// + public int Type { get; set; } + /// + /// 类型 + /// + public string TypeName { get; set; } + /// + /// 加分/扣分值 + /// + public int Score { get; set; } + + /// + /// 记分后分值 + /// + public int CurrentScore { get; set; } + /// + /// 记分事项 + /// + public string Item { get; set; } + /// + /// 记分内容 + /// + public string LogContent { get; set; } + /// + /// 记分时间 + /// + public DateTime CompileDate { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index b1fec937..9e66d28c 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -124,6 +124,7 @@ + diff --git a/SGGL/WebAPI/Controllers/Person/PersonController.cs b/SGGL/WebAPI/Controllers/Person/PersonController.cs index f3d3af1d..cee72120 100644 --- a/SGGL/WebAPI/Controllers/Person/PersonController.cs +++ b/SGGL/WebAPI/Controllers/Person/PersonController.cs @@ -1,6 +1,9 @@ -using BLL; +using Aspose.Words.Lists; +using BLL; +using Microsoft.SqlServer.Server; using Model; using System; +using System.Collections.Generic; using System.Linq; using System.Web.Http; @@ -51,6 +54,67 @@ namespace WebAPI.Controllers } return responeData; } + + /// + /// 根据personid获取人员HSE积分流水记录 + /// + /// 年份 + /// 人员id + /// + public Model.ResponeData getScoreLogByPersonId(int year, string personId) + { + var responeData = new Model.ResponeData(); + try + { + var personData = APIPersonService.getPersonByPersonId(personId); + List lstLog = new List(); + if (personData != null && !string.IsNullOrWhiteSpace(personData.IdentityCard)) + { + if (!string.IsNullOrWhiteSpace(personData.IdentityCard)) + { + string identityCard = personData.IdentityCard; + if (year < 2025 || year == null) + { + year = DateTime.Now.Year; + } + var logs = ScoreFlowLogService.GetScoreLogByIdentityCard(year, personData.IdentityCard); + foreach (var obj in logs) + { + var data = new ScoreFlowLogItem(); + data.Type = obj.Type; + data.TypeName = obj.Type == 1 ? "加分" : "扣分"; + data.Score = obj.Score; + data.CurrentScore = obj.CurrentScore; + data.Item = obj.Item; + data.LogContent = obj.LogContent; + data.CompileDate = obj.CompileDate; + data.Remark = !string.IsNullOrWhiteSpace(obj.Remark) ? obj.Remark : string.Empty; + lstLog.Add(data); + } + //responeData.data = logs; + responeData.data = lstLog; + } + else + { + responeData.code = 0; + responeData.message = "身份证件号码为空!"; + } + } + else + { + responeData.code = 0; + responeData.message = "请确定人员是否存在!"; + } + //responeData.data = lstLog; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion #region 根据personid获取人员信息