diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs index 7cdd5b8..ae4864f 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs @@ -1956,6 +1956,18 @@ namespace APT.PP.WebApi.Controllers.Api.PP notify1.NOTICE_STATUS = 4; } SendNotices = NotificationTaskService.InsertUserNoticeTaskModels(allSendTitles, allSendDataIds, orgId, allSendUserIds, allSendUserNames, DateTime.Now, DateTime.Now.AddDays(10), (int)FMNoticeTypeEnum.消息, "SE018"); + + T_FM_SYNC_TASK task = null; + if (!string.IsNullOrEmpty(filter.Parameter1)) + { + task = GetEntity(filter.Keyword); + if (task != null) + { + task.UPDATE_SUCCES_TIME = DateTime.Now;//上次同步结束时间 + task.SYNC_PARAM = "";//清空参数 + } + } + UnifiedCommit(() => { if (notifys.Any()) @@ -1968,8 +1980,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP BantchAddEntityNoCommit(joinUsers); if (files.Any()) BantchAddEntityNoCommit(files); - if (finishNotifys1.Any()) - BantchUpdateEntity(finishNotifys1); + if (task != null) + UpdateEntityNoCommit(task); }); } } diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/6SETrainRecordController.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/6SETrainRecordController.cs index d74da21..89f9412 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/6SETrainRecordController.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/6SETrainRecordController.cs @@ -77,7 +77,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE } //if (data.Nav_Notify != null && data.Nav_Notify.Nav_TrainCheckType != null && data.Nav_Notify.Nav_TrainCheckType.NAME == "笔试") - if (data.Nav_Notify != null && data.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine) + if (data.Nav_Notify != null && data.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine && data.Nav_Notify.IN_OUT == TrainInOut.In) { if (data.Nav_Notify.Nav_ListCour != null && data.Nav_Notify.Nav_ListCour.Count() > 0) { @@ -409,6 +409,35 @@ namespace APT.SC.WebApi.Controllers.Api.SE #endregion + #region 如果考试合格并且是最后一个考试 培训记录完成待审阅 + + T_SE_TRAIN_RECORD record = null; + T_FM_NOTIFICATION_TASK sendNotices = null; + if (RecordUser.EXAMINATION_RESULTS == SEExaminationResultsEnum.合格) + { + var check = GetEntity(e => e.RECORD_ID == modelText.RECORD_ID && e.STATUS == SETrainRecordUserStatusEnum.参与 && e.OK == false && e.USER_ID != APT.Infrastructure.Api.AppContext.CurrentSession.UserID); + if (check == null || check.ID == Guid.Empty) + { + record = GetEntity(e => e.ID == modelText.RECORD_ID, "Nav_Notify"); + record.STATUS = SETrainRecordStatus.审阅中; + T_FM_USER chargeUser = UserService.GetSafeApproveUser(modelText.ORG_ID.Value, 10); + + //var chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部负责人"); + //if (chargeUser == null) + //{ + // chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部安全员"); + //} + if (chargeUser != null) + { + sendNotices = NotificationTaskService.InsertUserNoticeTaskModel("培训记录完成待审阅-" + record.Nav_Notify.NAME, record.ID, record.ORG_ID, chargeUser.ID, chargeUser.NAME, DateTime.Now, DateTime.Now.AddDays(2), 1, "SE017_SHOWPRINT"); + } + record.Nav_Notify = null; + } + } + + #endregion + + UnifiedCommit(() => { if (finishNotice != null) @@ -424,21 +453,27 @@ namespace APT.SC.WebApi.Controllers.Api.SE UpdateEntityNoCommit(modelTextNew); if (listPaperNew != null && listPaperNew.Count > 0) BantchSaveEntityNoCommit(listPaperNew); + + //培训记录完成待审阅 + if (record != null) + UpdateEntityNoCommit(record); + if (sendNotices != null) + UpdateEntityNoCommit(sendNotices); }); SavePapersResult result = new SavePapersResult(); result.IsOperateSuccessful = true; if (RecordUser.EXAMINATION_RESULTS == SEExaminationResultsEnum.合格) { result.IsPass = true; - result.Msg = "此次考试成绩为【" + modelText.SCORE + "】,恭喜通过考试!"; + result.Msg = "此次考试成绩为【" + modelText.SCORE + "】分,恭喜通过考试!"; } else { result.IsPass = false; if (reSendNotice != null) - result.Msg = "此次考试成绩为【" + modelText.SCORE + " 】,考试不合格,请重新考试!"; + result.Msg = "此次考试成绩为【" + modelText.SCORE + " 】分,考试不合格,请重新考试!"; else - result.Msg = "此次考试成绩为【" + modelText.SCORE + " 】,考试不合格,请关注重考培训通知!"; + result.Msg = "此次考试成绩为【" + modelText.SCORE + " 】分,考试不合格,请关注重考培训通知!"; } return result; }); @@ -537,7 +572,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE // 原版 重新获取试题 if (config == null) config = GetEntity(t => true); - if (config.COUNT_RETRY > modelText.TEXT_TIMES) + if (config.COUNT_RETRY < modelText.TEXT_TIMES) return; modelTextNew = new T_SE_TRAIN_RECORD_TEXT(); @@ -595,6 +630,10 @@ namespace APT.SC.WebApi.Controllers.Api.SE string title = NoticeTitle; if (modelTextNew.TEXT_TIMES > 1) { + if (title.Contains(" 重考(")) + { + title = title.Split(" 重考(")[0]; + } title += " 重考(" + modelTextNew.TEXT_TIMES + ")"; } sendNotice = NotificationTaskService.InsertUserNoticeTaskModel(title, modelTextNew.ID, modelTextNew.ORG_ID, login.ID, login.NAME, DateTime.Now, DateTime.Now.AddDays(2), 1, "SE018_PAPERPAGE"); @@ -779,7 +818,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE T_SE_TRAIN_RECORD_TEXT modelRecordText = null; IEnumerable listCheckPaper = null; //if (record.Nav_Notify != null && record.Nav_Notify.Nav_TrainCheckType != null && record.Nav_Notify.Nav_TrainCheckType.NAME == "笔试") - if (record.Nav_Notify != null && record.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine) + if (record.Nav_Notify != null && record.Nav_Notify.CHECKTYPE == PlanCheckType.InOnLine && record.Nav_Notify.IN_OUT == TrainInOut.In) { listCheckPaper = GetEntities(t => t.RECORD_ID == record.ID && t.USER_ID == userID, null, null); if (isReSend) @@ -918,7 +957,11 @@ namespace APT.SC.WebApi.Controllers.Api.SE #endregion if (testidlist.Count == 0) { - throw new Exception("当前题库数据不足,未能正常生成问卷"); + throw new Exception("当前题库数据不足,未能正常生成问卷,请联系管理员完善题库信息"); + } + else if (testidlist.Count < CCount + SCount + MCount) + { + throw new Exception("当前题库数据不足,未能正常生成问卷,请联系管理员完善题库信息"); } testidlist.ForEach(testid => @@ -979,22 +1022,27 @@ namespace APT.SC.WebApi.Controllers.Api.SE //sendNotices.Add(NotificationTaskService.InsertUserNoticeTaskModel("培训效果评估调查-" + record.Nav_Notify.NAME, effect.ID, filter.GetOrgId(), (Guid)effect.USER_ID, "", DateTime.Now, DateTime.Now.AddDays(2), 1, "SE022")); sendNotices.Add(NotificationTaskService.InsertUserNoticeTaskModel("培训效果评估调查-" + record.Nav_Notify.NAME, effect.ID, filter.GetOrgId(), (Guid)effect.USER_ID, login.NAME, DateTime.Now, 1, "SE022", FMTASKTYPE.Default)); } - var userCount = record.Nav_Users.Count(t => t.STATUS == SETrainRecordUserStatusEnum.参与 && t.OK == false); - if (userCount == 0 && !isReSend) - { - record.STATUS = SETrainRecordStatus.审阅中; - T_FM_USER chargeUser = UserService.GetSafeApproveUser(record.ORG_ID.Value, 10); - //var chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部负责人"); - //if (chargeUser == null) - //{ - // chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部安全员"); - //} - if (chargeUser != null) + if (record.Nav_Notify != null && (record.Nav_Notify.CHECKTYPE != PlanCheckType.InOnLine || record.Nav_Notify.IN_OUT != TrainInOut.In)) + { + //不考试 + var userCount = record.Nav_Users.Count(t => t.STATUS == SETrainRecordUserStatusEnum.参与 && t.OK == false); + if (userCount == 0 && !isReSend) { - sendNotices.Add(NotificationTaskService.InsertUserNoticeTaskModel("培训记录完成待审阅-" + record.Nav_Notify.NAME, Guid.Parse(filter.Keyword), filter.GetOrgId(), chargeUser.ID, chargeUser.NAME, DateTime.Now, DateTime.Now.AddDays(2), 1, "SE017_SHOWPRINT")); + record.STATUS = SETrainRecordStatus.审阅中; + T_FM_USER chargeUser = UserService.GetSafeApproveUser(record.ORG_ID.Value, 10); + //var chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部负责人"); + //if (chargeUser == null) + //{ + // chargeUser = GetEntity(t => t.Nav_ApproveRole.NAME == "安环部安全员"); + //} + if (chargeUser != null) + { + sendNotices.Add(NotificationTaskService.InsertUserNoticeTaskModel("培训记录完成待审阅-" + record.Nav_Notify.NAME, Guid.Parse(filter.Keyword), filter.GetOrgId(), chargeUser.ID, chargeUser.NAME, DateTime.Now, DateTime.Now.AddDays(2), 1, "SE017_SHOWPRINT")); + } } } + UnifiedCommit(() => { UpdateEntityNoCommit(record, "STATUS");