From 26b921cab23bebfb757df18710c7e1b649c44ec3 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Wed, 24 Dec 2025 16:27:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=80=83=E5=8B=A4=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E9=9C=80=E8=A6=81=E4=BA=BA=E5=91=98=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E8=80=83=E5=8B=A4=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/API/APIPersonService.cs | 127 ++++++++++++++++++++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 2 +- SGGL/Model/HSSE/ProjectPersonInput.cs | 96 +++++++++++++++ SGGL/Model/Model.csproj | 1 + SGGL/WebAPI/Controllers/PersonController.cs | 33 +++++ 5 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 SGGL/Model/HSSE/ProjectPersonInput.cs diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 22fc70d4..c111966b 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -293,6 +293,133 @@ namespace BLL } #endregion + #region 根据条件获取项目人员信息(支持多条件过滤) + /// + /// 根据条件获取项目人员信息(支持多条件过滤) + /// + /// 查询过滤条件 + /// + public static List getPersonByFilter(Model.ProjectPersonInput filter) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var query = from x in db.View_SitePerson_Person + select x; + + // 添加过滤条件 + if (filter != null) + { + // 项目ID过滤 + if (!string.IsNullOrEmpty(filter.ProjectId)) + { + query = query.Where(x => x.ProjectId == filter.ProjectId); + } + + // 人员ID过滤 + if (!string.IsNullOrEmpty(filter.PersonId)) + { + query = query.Where(x => x.PersonId == filter.PersonId); + } + + // 项目人员ID过滤 + if (!string.IsNullOrEmpty(filter.SitePersonId)) + { + query = query.Where(x => x.SitePersonId == filter.SitePersonId); + } + + // 姓名过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.PersonName)) + { + query = query.Where(x => x.PersonName.Contains(filter.PersonName)); + } + + // 身份证号过滤 + if (!string.IsNullOrEmpty(filter.IdentityCard)) + { + query = query.Where(x => x.IdentityCard == filter.IdentityCard); + } + + // 卡号过滤 + if (!string.IsNullOrEmpty(filter.CardNo)) + { + query = query.Where(x => x.CardNo == filter.CardNo); + } + + // 单位名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.UnitName)) + { + query = query.Where(x => x.UnitName.Contains(filter.UnitName)); + } + + // 班组名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.TeamGroupName)) + { + query = query.Where(x => x.TeamGroupName.Contains(filter.TeamGroupName)); + } + + // 岗位名称过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.WorkPostName)) + { + query = query.Where(x => x.WorkPostName.Contains(filter.WorkPostName)); + } + + // 性别过滤 + if (!string.IsNullOrEmpty(filter.Sex)) + { + query = query.Where(x => x.Sex == filter.Sex); + } + + // 电话号码过滤(模糊查询) + if (!string.IsNullOrEmpty(filter.Telephone)) + { + query = query.Where(x => x.Telephone.Contains(filter.Telephone)); + } + } + + // 默认只返回在岗人员 + query = query.Where(x => x.States == Const.ProjectPersonStates_1); + + var persons = from x in query orderby x.CardNo descending + select new Model.PersonItem + { + PersonId = x.PersonId, + SitePersonId = x.SitePersonId, + CardNo = x.CardNo, + PersonName = x.PersonName, + SexName = x.SexName, + Sex = x.Sex, + IdentityCard = x.IdentityCard, + Address = x.Address, + ProjectId = x.ProjectId, + ProjectCode = x.ProjectCode, + ProjectName = x.ProjectName, + UnitId = x.UnitId, + UnitCode = x.UnitCode, + UnitName = x.UnitName, + TeamGroupId = x.TeamGroupId, + TeamGroupName = x.TeamGroupName, + WorkPostId = x.WorkPostId, + WorkPostName = x.WorkPostName, + InTime = string.Format("{0:yyyy-MM-dd}", x.InTime), + OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime), + OutResult = x.OutResult, + Telephone = x.Telephone, + PhotoUrl = x.PhotoUrl, + DepartName = x.DepartName, + WorkAreaId = x.WorkAreaId, + WorkAreaName = x.WorkAreaName, + PostType = x.PostType, + IsForeign = x.IsForeign.HasValue ? x.IsForeign : false, + PersonType = x.PersonType, + PersonTypeName = x.PersonType == "2" ? "外聘" : (x.PersonType == "3" ? "第三方" : "员工"), + PostTypeName = db.Sys_Const.FirstOrDefault(z => z.GroupId == ConstValue.Group_PostType && z.ConstValue == x.PostType).ConstText, + }; + + return persons.ToList(); + } + } + #endregion + #region 获取在岗、离岗、待审人员列表 /// /// 记录数 diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index a4dfcd34..ba58f7e9 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -16838,7 +16838,7 @@ - + diff --git a/SGGL/Model/HSSE/ProjectPersonInput.cs b/SGGL/Model/HSSE/ProjectPersonInput.cs new file mode 100644 index 00000000..68c2d405 --- /dev/null +++ b/SGGL/Model/HSSE/ProjectPersonInput.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class ProjectPersonInput + { + /// + /// 人员主键ID + /// + public string PersonId { get; set; } + /// + /// 项目人员主键ID + /// + public string SitePersonId { get; set; } + + /// + /// 卡号 + /// + public string CardNo { get; set; } + /// + /// 姓名 + /// + public string PersonName { get; set; } + /// + /// 性别 + /// + public string SexName { get; set; } + /// + /// 性别 + /// + public string Sex { get; set; } + /// + /// 身份证号码 + /// + public string IdentityCard { get; set; } + + /// + /// 项目id + /// + public string ProjectId { get; set; } + + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 班组名称 + /// + public string TeamGroupName { get; set; } + /// + /// 岗位名称 + /// + public string WorkPostName { get; set; } + + /// + /// 电话 + /// + public string Telephone { get; set; } + /// + /// 照片路径 + /// + public string PhotoUrl { get; set; } + /// + /// 照片二进制 + /// + public string headImage { get; set; } + /// + /// 部门名称 + /// + public string DepartName { get; set; } + /// + /// 岗位类型名称 + /// + public string PostTypeName + { + get; + set; + } + /// + /// 人员类型 + /// + public string PersonTypeName + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 016a5a9d..bddb95ec 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -252,6 +252,7 @@ + diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 86800b99..fd8a1989 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -98,6 +98,39 @@ namespace WebAPI.Controllers } #endregion + #region 根据条件获取项目人员信息(支持分页和过滤) + /// + /// 根据条件获取项目人员信息(支持分页和过滤) + /// + /// 查询过滤条件 + /// 每页条数 + /// 页码(从1开始) + /// 是否返回全部数据 + /// + public Model.ResponeData getPersonByFilter([FromUri] Model.ProjectPersonInput filter, int pagesize = 15, int pageindex = 1, bool returnAll = false) + { + var responeData = new Model.ResponeData(); + try + { + var getDataList = APIPersonService.getPersonByFilter(filter); + int pageCount = getDataList.Count; + + if (!returnAll && pageCount > 0 && pageindex > 0 && pagesize > 0) + { + getDataList = getDataList.Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList(); + } + + responeData.data = new { pageCount, pageindex, pagesize, getDataList }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion + #region 获取在岗、离岗、待审人员数量 /// /// 获取在岗、离岗、待审人员列表