From e80f4482c9245c30ad0a86b5ea78a00bcc0b18c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=BE=8E=E8=8D=A3?= <10755671+mei-rong-he@user.noreply.gitee.com> Date: Thu, 16 Apr 2026 09:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=A8=E8=AF=86=E7=BB=93=E6=9E=9C=E6=89=BE?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=BB=E7=9B=91=EF=BC=8C=E9=9A=90=E6=82=A3?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E8=A7=A6=E5=8F=91=E6=95=B4=E6=94=B9=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=89=BE=E5=AE=89=E5=85=A8=E6=80=BB=E7=9B=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/PF/PFApproveCallBackService.cs | 170 ++++++++++++++---- .../Controllers/Api/SKController.cs | 18 +- .../Api/IdentifyEvaluationPlanController.cs | 4 +- 3 files changed, 144 insertions(+), 48 deletions(-) diff --git a/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs b/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs index abaef01..f4675e9 100644 --- a/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs +++ b/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs @@ -12142,7 +12142,11 @@ namespace APT.BaseData.Services.DomainServices } if (user == null) { - throw new Exception("未找到整改责任人对应组织的安全员和负责人,请确认基础配置已完善"); + GetUserInfo(departFist.PARENT_ID, ref user); + } + if (user == null) + { + throw new Exception("未找到整改责任人对应组织的安全员和负责人,也未配置安全总监,请确认基础配置已完善"); } notice = new T_SK_HIDDEN_DANGER_RECTIFY_NOTICE(); notice.ORG_ID = entity.ORG_ID; @@ -12260,8 +12264,53 @@ namespace APT.BaseData.Services.DomainServices }); } return true; + } + /// + /// 向上逐级找人,部门级负责人找不到直接给安全总监 + /// + /// + /// + private void GetUserInfo(Guid? departmentId, ref T_FM_USER userInfo) + { + var department = GetEntity(t => t.ID == departmentId); + if (department != null) + { + if (department.DEPARTMENT_TYPE != (int)FMDepartmentType.Company) + { + userInfo = GetEntity(t => t.DEPARTMENT_ID == department.ID && t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全员")); + if (userInfo == null) + { + if (department.USER_ID != null) + { + userInfo = GetEntity(t => t.ID == department.USER_ID); + } + if (userInfo == null) + { + GetUserInfo(department.PARENT_ID, ref userInfo); + return; + } + else + { + return; + } + } + else + { + return; + } + } + else + { + userInfo = GetEntity(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + return; + } + } + else + { + userInfo = null; + return; + } } - private bool BackUpdate_SKHiddenDangerRectifyRecord(T_PF_APPROVE entityInt, T_PF_APPROVE modelApp, List listAppDetail, T_FM_NOTIFICATION_TASK taskFinish, List listTaskNext, bool isLast = false, bool isApprovel = true) { #region 审批公用 @@ -13168,11 +13217,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -13208,11 +13262,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUserUp.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -13256,11 +13315,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUserUp.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -13559,11 +13623,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -13598,11 +13667,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -13640,11 +13714,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -14292,11 +14371,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -14331,11 +14415,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } @@ -14375,11 +14464,16 @@ namespace APT.BaseData.Services.DomainServices } else { - userId = departs.FirstOrDefault(t => t.ID == departUser.PARENT_ID)?.USER_ID; - if (userId != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - //公司负责人 - user = users.FirstOrDefault(t => t.ID == userId); + //总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); + } + if (user != null) + { + userId = user.ID; } } } diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs index 4914ed9..32b6035 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs @@ -1854,11 +1854,12 @@ namespace APT.PP.WebApi.Controllers.Api } else { - //找公司 - var companyInfo = departs.FirstOrDefault(t => t.ID == departUser?.PARENT_ID); - if (companyInfo != null && companyInfo.USER_ID != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if (user == null) { - user = users.FirstOrDefault(t => t.ID == companyInfo.USER_ID); + //找总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); } } } @@ -2046,11 +2047,12 @@ namespace APT.PP.WebApi.Controllers.Api } else { - //找公司 - var companyInfo = departs.FirstOrDefault(t => t.ID == parentId); - if (companyInfo != null && companyInfo.USER_ID != null) + //安全总监 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监")); + if(user == null) { - user = users.FirstOrDefault(t => t.ID == companyInfo.USER_ID); + //找总经理 + user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("总经理")); } } } diff --git a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/IdentifyEvaluationPlanController.cs b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/IdentifyEvaluationPlanController.cs index aa5f0b7..6491de9 100644 --- a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/IdentifyEvaluationPlanController.cs +++ b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/IdentifyEvaluationPlanController.cs @@ -56,9 +56,9 @@ namespace APT.SK.WebApi.Controllers.Api entity.Nav_Evaluations = null; entity.ApplyDepartmentName = this.GetEntity(t => t.ID == departId).NAME; entity.ApplyPostName = this.GetEntity(t => t.ID == userId, "Nav_Person.Nav_Post")?.Nav_Person?.Nav_Post?.NAME; - if (entity.START_DATE < DateTime.Now.AddDays(3)) + if (entity.START_DATE.Value.Date < DateTime.Now.AddDays(3).Date) { - throw new Exception("辨识开始时间必须大于"+ DateTime.Now.AddDays(3)); + throw new Exception("辨识开始时间必须大于"+ DateTime.Now.AddDays(3).Date.ToString("yyyy-MM-dd")); } List deleteUserIds = new List(); List deleteIds = new List();