This commit is contained in:
wyw 2026-04-16 10:31:25 +08:00
commit 19f02ebab9
5 changed files with 155 additions and 59 deletions

View File

@ -12142,7 +12142,11 @@ namespace APT.BaseData.Services.DomainServices
} }
if (user == null) 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 = new T_SK_HIDDEN_DANGER_RECTIFY_NOTICE();
notice.ORG_ID = entity.ORG_ID; notice.ORG_ID = entity.ORG_ID;
@ -12260,8 +12264,53 @@ namespace APT.BaseData.Services.DomainServices
}); });
} }
return true; return true;
}
/// <summary>
/// 向上逐级找人,部门级负责人找不到直接给安全总监
/// </summary>
/// <param name="departmentId"></param>
/// <param name="chargeId"></param>
private void GetUserInfo(Guid? departmentId, ref T_FM_USER userInfo)
{
var department = GetEntity<T_FM_DEPARTMENT>(t => t.ID == departmentId);
if (department != null)
{
if (department.DEPARTMENT_TYPE != (int)FMDepartmentType.Company)
{
userInfo = GetEntity<T_FM_USER>(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_FM_USER>(t => t.ID == department.USER_ID);
}
if (userInfo == null)
{
GetUserInfo(department.PARENT_ID, ref userInfo);
return;
}
else
{
return;
}
}
else
{
return;
}
}
else
{
userInfo = GetEntity<T_FM_USER>(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<T_PF_APPROVE_DETAIL> listAppDetail, T_FM_NOTIFICATION_TASK taskFinish, List<T_FM_NOTIFICATION_TASK> listTaskNext, bool isLast = false, bool isApprovel = true) private bool BackUpdate_SKHiddenDangerRectifyRecord(T_PF_APPROVE entityInt, T_PF_APPROVE modelApp, List<T_PF_APPROVE_DETAIL> listAppDetail, T_FM_NOTIFICATION_TASK taskFinish, List<T_FM_NOTIFICATION_TASK> listTaskNext, bool isLast = false, bool isApprovel = true)
{ {
#region #region
@ -13168,11 +13217,16 @@ namespace APT.BaseData.Services.DomainServices
} }
else 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 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 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 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 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 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 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 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 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;
} }
} }
} }

View File

@ -557,14 +557,14 @@ namespace APT.FM.WebApi.Controllers.Api.FM
if (entity.Nav_Person.POST_ID == null) if (entity.Nav_Person.POST_ID == null)
{ {
throw new Exception("岗位不允许为空!"); throw new Exception("岗位不允许为空!");
} }
var isRepeat = allUsers.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null)
this.ThrowError("050001");
if (isAdd == null) if (isAdd == null)
{ {
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList(); userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null)
this.ThrowError("050001");
if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa")) if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa"))
{ {
#region // #region //
@ -681,9 +681,9 @@ namespace APT.FM.WebApi.Controllers.Api.FM
{ {
dbRuleStr = string.Join(',', isAdd.Nav_BelongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList()); dbRuleStr = string.Join(',', isAdd.Nav_BelongRoles.OrderBy(x => x.BELONG_ROLE_ID).Select(x => x.BELONG_ROLE_ID).Distinct().ToList());
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ID != entity.ID && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList(); userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ID != entity.ID && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE); //var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
if (isRepeat != null) //if (isRepeat != null)
this.ThrowError("050001"); // this.ThrowError("050001");
} }
if (entity.DEPARTMENT_ID == null) if (entity.DEPARTMENT_ID == null)
{ {

View File

@ -1854,11 +1854,12 @@ namespace APT.PP.WebApi.Controllers.Api
} }
else else
{ {
//找公司 //安全总监
var companyInfo = departs.FirstOrDefault(t => t.ID == departUser?.PARENT_ID); user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监"));
if (companyInfo != null && companyInfo.USER_ID != null) 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 else
{ {
//找公司 //安全总监
var companyInfo = departs.FirstOrDefault(t => t.ID == parentId); user = users.FirstOrDefault(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME.Contains("安全总监"));
if (companyInfo != null && companyInfo.USER_ID != null) 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("总经理"));
} }
} }
} }

View File

@ -56,9 +56,9 @@ namespace APT.SK.WebApi.Controllers.Api
entity.Nav_Evaluations = null; entity.Nav_Evaluations = null;
entity.ApplyDepartmentName = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == departId).NAME; entity.ApplyDepartmentName = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == departId).NAME;
entity.ApplyPostName = this.GetEntity<T_FM_USER>(t => t.ID == userId, "Nav_Person.Nav_Post")?.Nav_Person?.Nav_Post?.NAME; entity.ApplyPostName = this.GetEntity<T_FM_USER>(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<Guid> deleteUserIds = new List<Guid>(); List<Guid> deleteUserIds = new List<Guid>();
List<Guid> deleteIds = new List<Guid>(); List<Guid> deleteIds = new List<Guid>();

View File

@ -93,13 +93,13 @@ namespace APT.SK.WebApi.Controllers.Api
/// <param name="id">主键ID</param> /// <param name="id">主键ID</param>
/// <returns></returns> /// <returns></returns>
[HttpGet, Route("SKDelete")] [HttpGet, Route("SKDelete")]
public JsonActionResult<bool> SKDelete(string id) public JsonActionResult<bool> SKDelete(string ids)
{ {
return SafeExecute(() => return SafeExecute(() =>
{ {
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(ids))
this.ThrowError("060010"); this.ThrowError("060010");
var area = this.GetEntity<T_SK_RISK_AREA>(id); var area = this.GetEntity<T_SK_RISK_AREA>(ids);
var areas = new List<T_SK_RISK_AREA>(); var areas = new List<T_SK_RISK_AREA>();
if (area != null) if (area != null)
{ {