This commit is contained in:
何美荣 2026-05-17 18:59:30 +08:00
parent 37a09e9746
commit b52b4de71b
5 changed files with 2540 additions and 2439 deletions

View File

@ -550,12 +550,12 @@ namespace APT.FM.WebApi.Controllers.Api.FM
throw new Exception(message);
}
var listDepChange = entityUpdateList;
var listDepChange = new List<T_FM_DEPARTMENT>();
if (entityUpdateList != null && entityUpdateList.Count() > 0)
{
var listDepID = entityUpdateList.Select(e => e.ID);
entityUpdateList = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null).ToList();
listDepChange = listDepChange.Where(e => !e.IS_DELETED).ToList();
listDepChange = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null).ToList();
//listDepChange = listDepChange.Where(e => !e.IS_DELETED).ToList();
}
this.UnifiedCommit(() =>
{
@ -578,10 +578,16 @@ namespace APT.FM.WebApi.Controllers.Api.FM
this.BantchUpdateEntity_noneBase(departUpdateList);
if (teamInfos != null && teamInfos.Any())
this.BantchUpdateEntity_noneBase(teamInfos);
if (entityUpdateList != null && entityUpdateList.Any())
this.BantchUpdateEntity_noneBase(entityUpdateList);
if (listDepChange != null && listDepChange.Any())
BantchSaveEntityNoCommit(listDepChange);
{
this.BantchUpdateEntity_noneBase(entityUpdateList);
}
else
{
this.UpdateEntityNoCommit(entity);
}
//if (listDepChange != null && listDepChange.Any())
// BantchSaveEntityNoCommit(listDepChange);
//if (entity != null)
// this.UpdateEntityNoCommit(entity);
});

View File

@ -6781,6 +6781,90 @@ namespace APT.PP.WebApi.Controllers.Api
}
return true;
});
}
/// <summary>
/// 岗位风险辨识结束时间到,提醒本人及上级领导
/// </summary>
/// <param name="pageFilter"></param>
/// <returns></returns>
[HttpPost, Route("IdentifyNoticeSync")]
public JsonActionResult<bool> IdentifyNoticeSync([FromBody] KeywordFilter filter)
{
return SafeExecute<bool>(() =>
{
try
{
var dt = DateTime.Now;
if (filter.Parameter1 != null)
{
dt = DateTime.Parse(filter.Parameter1);
}
List<Guid> userIds = new List<Guid>();
List<Guid> userLeaderIds = new List<Guid>();
List<T_FM_NOTIFICATION_TASK> notices = new List<T_FM_NOTIFICATION_TASK>();
var users = GetEntities<T_FM_USER>(i => i.ENABLE_STATUS == 0, new BaseFilter(filter.OrgId)).ToList();
var departs = GetEntities<T_FM_DEPARTMENT>(i => i.ENABLE_STATUS == 0, new BaseFilter(filter.OrgId)).ToList();
var identifys = GetEntities<T_SK_RISK_IDENTIFY>(i => i.END_DATE <= dt, new BaseFilter(filter.OrgId)).ToList();
var idetifyIds = identifys.Select(t => t.ID).ToList();
var tasks=this.GetEntities<T_FM_NOTIFICATION_TASK>(i => i.SOURCE_DATA_ID!=null &&idetifyIds.Contains((Guid)i.SOURCE_DATA_ID) && i.NOTICE_STATUS == 0, new BaseFilter(filter.OrgId)).ToList();
userIds = tasks.Select(t => t.USER_ID).Distinct().ToList();
if (userIds != null && userIds.Any())
{
//找负责人
foreach (var user in userIds)
{
var userDepartId = users.FirstOrDefault(t => t.ID == user)?.DEPARTMENT_ID;
var departUserId = departs.FirstOrDefault(t=>t.ID == userDepartId)?.USER_ID;
if (departUserId != null)
{
userLeaderIds.Add((Guid)departUserId);
}
}
}
userIds = userIds.Where(t => t != null).Distinct().ToList();
userLeaderIds = userLeaderIds.Where(t => t != null).Distinct().ToList();
if (userIds!=null && userIds.Any() && dt.Hour == 8)//跑批设置每小时执行每天8点触发一次
{
foreach (var id in userIds)
{
var user = users.FirstOrDefault(t => t.ID == id);
if (user != null)
{
var sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("你的岗位风险辨识表结束时间已到,请及时到待办处理!", user.ID, user.ORG_ID, user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(1), (int)FMNoticeTypeEnum., "PF135");
notices.Add(sendNotice);
}
}
}
if (userLeaderIds != null && userLeaderIds.Any() && dt.Hour == 8)//跑批设置每小时执行每天8点触发一次
{
foreach (var id in userIds)
{
var user = users.FirstOrDefault(t => t.ID == id);
if (user != null)
{
//查出他组织下的没做的人
var userList = users.Where(t => t.DEPARTMENT_ID == user.DEPARTMENT_ID && userIds.Contains(t.ID)).Select(m=>m.NAME).ToList();
var userNames = string.Join(",", userList);
var sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("你组织下的成员"+ userNames + ",岗位风险辨识表已到期仍未处理,请及时提醒成员到待办处理!", user.ID, user.ORG_ID, user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(1), (int)FMNoticeTypeEnum., "PF135");
notices.Add(sendNotice);
}
}
}
UnifiedCommit(() =>
{
if (notices != null && notices.Any())
BantchSaveEntityNoCommit(notices);
});
}
catch (Exception ex)
{
if (!string.IsNullOrEmpty(ex.StackTrace))
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
else
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
}
return true;
});
}
}
}

View File

@ -152,6 +152,10 @@ namespace APT.SK.WebApi.Controllers.Api
}
}
}
else
{
throw new Exception("当前组织没有安全员也没有负责人,请先到用户列表维护!");
}
}
}
var record = this.GetEntity<T_SK_CHECK_SET>(t => t.ID != entity.ID && t.PRODUCTION_UNIT_ID == entity.PRODUCTION_UNIT_ID && t.CHECK_TYPE == entity.CHECK_TYPE && t.CHECK_TYPE_ID == entity.CHECK_TYPE_ID && t.CHECK_CYCLE == entity.CHECK_CYCLE && t.DEPARTMENT_ID == entity.DEPARTMENT_ID && t.POST_ID == entity.POST_ID);
@ -208,7 +212,7 @@ namespace APT.SK.WebApi.Controllers.Api
}
}
//同步到企业库
var checkUserIds = checkUsers.Select(t => t.USER_ID).Distinct().ToList();
var checkUserIds = checkUsers?.Select(t => t.USER_ID).Distinct().ToList();
var areaIds = details.Select(t => t.AREA_ID).Distinct().ToList();
var riskNames = details.Select(t => t.RISK_NAME).Distinct().ToList();
var measures = details.Select(t => t.MEASURES_NAME).Distinct().ToList();

View File

@ -133,6 +133,13 @@ namespace APT.SK.WebApi.Controllers.Api
de.MARK = item.MARK;
de.EMERGENCY = item.EMERGENCY;
de.ENTERPRISE_LIBRARY_ID = item.ENTERPRISE_LIBRARY_ID;
de.SCOREL_ID = item.SCOREL_ID;
de.SCOREE_ID = item.SCOREE_ID;
de.SCOREC_ID = item.SCOREC_ID;
if (item.SCOREL_ID == null || item.SCOREE_ID == null || item.SCOREC_ID == null)
{
throw new Exception("第" + item.NUM + "行LEC都不能为空");
}
if (item.Nav_DetailMeasures != null && item.Nav_DetailMeasures.Any())
{
foreach (var mm in item.Nav_DetailMeasures)