培训通知发送 已删除人员、部门、岗位 做提示

This commit is contained in:
wyw 2026-05-26 13:51:22 +08:00
parent 87bf5bbe61
commit 4e67753474

View File

@ -225,14 +225,11 @@ namespace APT.SC.WebApi.Controllers.Api.SE
errorMsg = "题库中题目数量不足!\n" + errorMsg; errorMsg = "题库中题目数量不足!\n" + errorMsg;
throw new Exception(errorMsg); throw new Exception(errorMsg);
} }
#endregion #endregion
} }
#endregion #endregion
if (entity.ISSENDNOTICE) if (entity.ISSENDNOTICE)
{ {
entity.STATUS = SETrainNotifyStatus.; entity.STATUS = SETrainNotifyStatus.;
@ -245,13 +242,39 @@ namespace APT.SC.WebApi.Controllers.Api.SE
userFilter.Include = new string[] { "Nav_Person.Nav_Post", "Nav_Department" }; userFilter.Include = new string[] { "Nav_Person.Nav_Post", "Nav_Department" };
IEnumerable<T_FM_USER> userNames = GetEntities<T_FM_USER>(t => sendUserAll.Contains(t.ID), userFilter); IEnumerable<T_FM_USER> userNames = GetEntities<T_FM_USER>(t => sendUserAll.Contains(t.ID), userFilter);
T_FM_USER userCheck = null;
foreach (var user in Nav_TrainUserList) foreach (var user in Nav_TrainUserList)
{ {
if (user.IS_DELETED) if (user.IS_DELETED)
continue; continue;
userCheck = userNames.FirstOrDefault(t => t.ID == user.USER_ID);
if (userCheck == null)
{
var modelDel = GetEntity<T_FM_USER>(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.DEPARTMENT_NAME = userCheck.Nav_Department?.NAME;
user.POST_NAME = userNames.FirstOrDefault(t => t.ID == user.USER_ID).Nav_Person?.Nav_Post?.NAME; user.POST_NAME = userCheck.Nav_Person?.Nav_Post?.NAME;
} }
foreach (var user in sendUsers) foreach (var user in sendUsers)
{ {