diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs index 70f142f..b3908b2 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs @@ -225,14 +225,11 @@ namespace APT.SC.WebApi.Controllers.Api.SE errorMsg = "题库中题目数量不足!\n" + errorMsg; throw new Exception(errorMsg); } - #endregion - } #endregion - if (entity.ISSENDNOTICE) { entity.STATUS = SETrainNotifyStatus.通知中; @@ -245,13 +242,39 @@ namespace APT.SC.WebApi.Controllers.Api.SE userFilter.Include = new string[] { "Nav_Person.Nav_Post", "Nav_Department" }; IEnumerable userNames = GetEntities(t => sendUserAll.Contains(t.ID), userFilter); + T_FM_USER userCheck = null; foreach (var user in Nav_TrainUserList) { if (user.IS_DELETED) continue; + userCheck = userNames.FirstOrDefault(t => t.ID == user.USER_ID); + if (userCheck == null) + { + var modelDel = GetEntity(user.USER_ID); + if (modelDel != null && modelDel.IS_DELETED) + { + throw new Exception("人员【" + modelDel.NAME + " " + (String.IsNullOrEmpty(user.POST_NAME) ? "" : user.POST_NAME) + "】已删除,不能进行培训,请移除此人后再发布通知!"); + } + else + { + throw new Exception("查找人员失败【ID:" + user.USER_ID + " " + (String.IsNullOrEmpty(user.POST_NAME) ? "" : user.POST_NAME) + "】失败,如果已删除活禁用,请移除此人!"); + } + } + if (userCheck.Nav_Department == null) + { + throw new Exception("人员组织异常【" + userCheck.NAME + "】,请先处理对应组织后再提交!"); + } + if (userCheck.Nav_Person == null) + { + throw new Exception("人员信息异常【" + userCheck.NAME + "】,请联系管理员处理对应信息!"); + } + if (userCheck.Nav_Person.Nav_Post == null) + { + throw new Exception("人员岗位信息异常【" + userCheck.NAME + "】,请联系管理员处理对应信息!"); + } - user.DEPARTMENT_NAME = userNames.FirstOrDefault(t => t.ID == user.USER_ID)?.Nav_Department?.NAME; - user.POST_NAME = userNames.FirstOrDefault(t => t.ID == user.USER_ID).Nav_Person?.Nav_Post?.NAME; + user.DEPARTMENT_NAME = userCheck.Nav_Department?.NAME; + user.POST_NAME = userCheck.Nav_Person?.Nav_Post?.NAME; } foreach (var user in sendUsers) {