三级安全教育 修改为 不一定就每天触发 按小时轮询 8、9 小时 可以有触发单子 但是每天只有一单

This commit is contained in:
wyw 2025-11-23 20:29:15 +08:00
parent 28f525faa3
commit 044a779da0

View File

@ -218,19 +218,29 @@ namespace APT.PP.WebApi.Controllers.Api.PP
catch { } catch { }
} }
if (currTime.Hour < 15) //金源培训 9 ~ 15 可以触发一次
if (currTime.Hour == 8 || currTime.Hour == 9)
{ {
return true; return true;
} }
var orgId = filter.GetOrgId();
var newUsers = GetEntities<T_SE_USER_TEMP>(t => t.IS_SEND == 0, new BaseFilter(orgId));
if (!newUsers.Any() || newUsers.Count() < 1)
{
return true;
}
//如果今天触发过三级安全教育 直接返回
var NewCheck = GetEntity<T_SE_NEW_USERS>(e => !e.IS_DELETED && e.TRAIN_STATUS == SEThreeLevelSafeTrainType. && e.CREATE_TIME.HasValue && e.CREATE_TIME.Value.Date == currTime.Date);
if (NewCheck != null)
{
return true;
}
T_SE_NEW_USERS eduCard = null; T_SE_NEW_USERS eduCard = null;
List<T_FM_NOTIFICATION_TASK> sendNotice = new List<T_FM_NOTIFICATION_TASK>(); List<T_FM_NOTIFICATION_TASK> sendNotice = new List<T_FM_NOTIFICATION_TASK>();
List<T_SE_NEW_USER_DETAIL> userDetails = new List<T_SE_NEW_USER_DETAIL>(); List<T_SE_NEW_USER_DETAIL> userDetails = new List<T_SE_NEW_USER_DETAIL>();
var orgId = filter.GetOrgId();
var newUsers = GetEntities<T_SE_USER_TEMP>(t => t.IS_SEND == 0, new BaseFilter(orgId));
if (!newUsers.Any())
{
return true;
}
var newUsersId = newUsers.Select(t => t.USER_ID); var newUsersId = newUsers.Select(t => t.USER_ID);
var newAllUsers = GetEntities<T_FM_USER>(t => newUsersId.Contains(t.ID), new BaseFilter(orgId)); var newAllUsers = GetEntities<T_FM_USER>(t => newUsersId.Contains(t.ID), new BaseFilter(orgId));
var sendUser = GetEntity<T_FM_USER>(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME == "安环部安全员" && t.IS_DELETED == false && t.ENABLE_STATUS == 0); var sendUser = GetEntity<T_FM_USER>(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME == "安环部安全员" && t.IS_DELETED == false && t.ENABLE_STATUS == 0);
@ -241,6 +251,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
eduCard.USER_ID = sendUser.ID; eduCard.USER_ID = sendUser.ID;
eduCard.ORG_ID = orgId; eduCard.ORG_ID = orgId;
eduCard.TRAIN_STATUS = SEThreeLevelSafeTrainType.; eduCard.TRAIN_STATUS = SEThreeLevelSafeTrainType.;
eduCard.CREATE_TIME = currTime;
if (train_contents != null) if (train_contents != null)
{ {
eduCard.CONTENT_ID = train_contents.ID; eduCard.CONTENT_ID = train_contents.ID;