1
This commit is contained in:
parent
37a09e9746
commit
b52b4de71b
@ -550,12 +550,12 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
var listDepChange = entityUpdateList;
|
var listDepChange = new List<T_FM_DEPARTMENT>();
|
||||||
if (entityUpdateList != null && entityUpdateList.Count() > 0)
|
if (entityUpdateList != null && entityUpdateList.Count() > 0)
|
||||||
{
|
{
|
||||||
var listDepID = entityUpdateList.Select(e => e.ID);
|
var listDepID = entityUpdateList.Select(e => e.ID);
|
||||||
entityUpdateList = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null).ToList();
|
listDepChange = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null).ToList();
|
||||||
listDepChange = listDepChange.Where(e => !e.IS_DELETED).ToList();
|
//listDepChange = listDepChange.Where(e => !e.IS_DELETED).ToList();
|
||||||
}
|
}
|
||||||
this.UnifiedCommit(() =>
|
this.UnifiedCommit(() =>
|
||||||
{
|
{
|
||||||
@ -578,10 +578,16 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
this.BantchUpdateEntity_noneBase(departUpdateList);
|
this.BantchUpdateEntity_noneBase(departUpdateList);
|
||||||
if (teamInfos != null && teamInfos.Any())
|
if (teamInfos != null && teamInfos.Any())
|
||||||
this.BantchUpdateEntity_noneBase(teamInfos);
|
this.BantchUpdateEntity_noneBase(teamInfos);
|
||||||
if (entityUpdateList != null && entityUpdateList.Any())
|
|
||||||
this.BantchUpdateEntity_noneBase(entityUpdateList);
|
|
||||||
if (listDepChange != null && listDepChange.Any())
|
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)
|
//if (entity != null)
|
||||||
// this.UpdateEntityNoCommit(entity);
|
// this.UpdateEntityNoCommit(entity);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6782,5 +6782,89 @@ namespace APT.PP.WebApi.Controllers.Api
|
|||||||
return true;
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
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 areaIds = details.Select(t => t.AREA_ID).Distinct().ToList();
|
||||||
var riskNames = details.Select(t => t.RISK_NAME).Distinct().ToList();
|
var riskNames = details.Select(t => t.RISK_NAME).Distinct().ToList();
|
||||||
var measures = details.Select(t => t.MEASURES_NAME).Distinct().ToList();
|
var measures = details.Select(t => t.MEASURES_NAME).Distinct().ToList();
|
||||||
|
|||||||
@ -1359,7 +1359,7 @@ namespace APT.SK.WebApi.Controllers.Api
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
//result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrEmpty(pageFilter.Keyword))
|
else if (!string.IsNullOrEmpty(pageFilter.Keyword))
|
||||||
@ -1372,12 +1372,12 @@ namespace APT.SK.WebApi.Controllers.Api
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
//result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
//result = null;//this.GetOrderPageEntities<T_FM_USER_POST>(null, pageFilter);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -133,6 +133,13 @@ namespace APT.SK.WebApi.Controllers.Api
|
|||||||
de.MARK = item.MARK;
|
de.MARK = item.MARK;
|
||||||
de.EMERGENCY = item.EMERGENCY;
|
de.EMERGENCY = item.EMERGENCY;
|
||||||
de.ENTERPRISE_LIBRARY_ID = item.ENTERPRISE_LIBRARY_ID;
|
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())
|
if (item.Nav_DetailMeasures != null && item.Nav_DetailMeasures.Any())
|
||||||
{
|
{
|
||||||
foreach (var mm in item.Nav_DetailMeasures)
|
foreach (var mm in item.Nav_DetailMeasures)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user