diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs index 8d0f629..9892269 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs @@ -218,19 +218,29 @@ namespace APT.PP.WebApi.Controllers.Api.PP catch { } } - if (currTime.Hour < 15) + //金源培训 9 ~ 15 可以触发一次 + if (currTime.Hour == 8 || currTime.Hour == 9) { return true; } + + var orgId = filter.GetOrgId(); + var newUsers = GetEntities(t => t.IS_SEND == 0, new BaseFilter(orgId)); + if (!newUsers.Any() || newUsers.Count() < 1) + { + return true; + } + //如果今天触发过三级安全教育 直接返回 + var NewCheck = GetEntity(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; List sendNotice = new List(); List userDetails = new List(); - var orgId = filter.GetOrgId(); - var newUsers = GetEntities(t => t.IS_SEND == 0, new BaseFilter(orgId)); - if (!newUsers.Any()) - { - return true; - } + var newUsersId = newUsers.Select(t => t.USER_ID); var newAllUsers = GetEntities(t => newUsersId.Contains(t.ID), new BaseFilter(orgId)); var sendUser = GetEntity(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.ORG_ID = orgId; eduCard.TRAIN_STATUS = SEThreeLevelSafeTrainType.公司级; + eduCard.CREATE_TIME = currTime; if (train_contents != null) { eduCard.CONTENT_ID = train_contents.ID;