培训签到 通知反馈 跑批修改

培训签到 手动触发修改
This commit is contained in:
wyw 2026-07-17 17:39:33 +08:00
parent 53092e7d7a
commit 8c02e734b4
3 changed files with 120 additions and 73 deletions

View File

@ -299,7 +299,7 @@ namespace APT.MS.Domain.Entities.SE
public DateTime? DT_START_SIGN { get; set; }
/// <summary>
/// 是否触发培训通知
/// 是否触发培训通知反馈
/// </summary>
[Description("是否触发培训通知")]
public bool ISSENDNOTICE { get; set; }

View File

@ -1930,8 +1930,11 @@ namespace APT.PP.WebApi.Controllers.Api.PP
var notifys = GetEntities<T_SE_TRAIN_NOTIFY>(t => (t.STATUS == SETrainNotifyStatus. || t.STATUS == SETrainNotifyStatus.) && t.TRAIN_START_TIME.Value < maxTime && t.CREATE_NOTIFY_RECORD == true, baseFilter).ToList();
#region
if (notifys != null && notifys.Any())
if (notifys != null && notifys.Any() && notifys.Count() > 0)
{
var listNoticeID = notifys.Select(e => e.ID);
var listRecordCheck = GetEntities<T_SE_TRAIN_RECORD>(e => listNoticeID.Contains(e.ID), null, null);
List<T_FM_NOTIFICATION_TASK> SendNotices = null;
List<T_SE_TRAIN_RECORD> TrainRecords = new List<T_SE_TRAIN_RECORD>();
List<T_SE_TRAIN_RECORD_USER> joinUsers = new List<T_SE_TRAIN_RECORD_USER>();
@ -1949,7 +1952,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP
try
{
notify.STATUS = SETrainNotifyStatus.;
var record = new T_SE_TRAIN_RECORD
T_SE_TRAIN_RECORD record = null;
if (listRecordCheck != null && listRecordCheck.Count() > 0)
{
record = listRecordCheck.FirstOrDefault(e => e.NOTIFY_ID == notify.ID);
}
if (record == null)
{
record = new T_SE_TRAIN_RECORD
{
ID = Guid.NewGuid(),
ORG_ID = orgId,
@ -1989,6 +1999,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
};
files.Add(recordFile);
}
}
TrainRecords.Add(record);
allSendTitles.Add("培训记录-" + notify.NAME);
allSendDataIds.Add(record.ID);
@ -2004,7 +2015,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
notify.Nav_RecordUser = null;
};
var notifyids = notifys.Select(t => t.ID).ToList();
var finishNotifys1 = GetEntities<T_FM_NOTIFICATION_TASK>(t => notifyids.Contains((Guid)t.SOURCE_DATA_ID) && t.NOTICE_STATUS == 0, new BaseFilter(orgId));
var finishNotifys1 = GetEntities<T_FM_NOTIFICATION_TASK>(t => notifyids.Contains((Guid)t.SOURCE_DATA_ID) && t.NOTICE_STATUS == 0 && t.NOTICE_TITLE.EndsWith("-确认"), new BaseFilter(orgId));
foreach (var notify1 in finishNotifys1)
{
@ -2018,7 +2029,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
if (notifys.Any())
BantchUpdateEntityNoCommit(notifys, "STATUS");
if (TrainRecords.Any())
BantchAddEntityNoCommit(TrainRecords);
BantchSaveEntityNoCommit(TrainRecords);
if (SendNotices.Any())
BantchAddEntityNoCommit(SendNotices);
if (joinUsers.Any())
@ -2030,44 +2041,42 @@ namespace APT.PP.WebApi.Controllers.Api.PP
});
}
#region
//#region 先签到 再触发培训通知给记录人
//var listSend = GetEntities<T_SE_TRAIN_RECORD>(e => !e.IS_SENDNOTICE && e.Nav_Notify != null && e.Nav_Notify.TRAIN_START_TIME.HasValue && e.Nav_Notify.TRAIN_START_TIME.Value < maxTime, null, "Nav_Notify.Nav_RecordUser");
//if (listSend != null && listSend.Count() > 0)
//{
// List<T_FM_NOTIFICATION_TASK> SendNotices = null;
// var allSendUserIds = new List<Guid>();
// var allSendUserNames = new List<string>();
// var allSendTitles = new List<string>();
// var allSendDataIds = new List<Guid>();
// foreach (var item in listSend)
// {
// if (item.Nav_Notify.RECORD_USER_ID.HasValue)
// {
// item.IS_SENDNOTICE = true;
var listSend = GetEntities<T_SE_TRAIN_RECORD>(e => !e.IS_SENDNOTICE && e.Nav_Notify != null && e.Nav_Notify.TRAIN_START_TIME.HasValue && e.Nav_Notify.TRAIN_START_TIME.Value < maxTime, null, "Nav_Notify.Nav_RecordUser");
if (listSend != null && listSend.Count() > 0)
{
List<T_FM_NOTIFICATION_TASK> SendNotices = null;
var allSendUserIds = new List<Guid>();
var allSendUserNames = new List<string>();
var allSendTitles = new List<string>();
var allSendDataIds = new List<Guid>();
foreach (var item in listSend)
{
if (item.Nav_Notify.RECORD_USER_ID.HasValue)
{
item.IS_SENDNOTICE = true;
// allSendTitles.Add("培训记录-" + item.Nav_Notify.NAME);
// allSendDataIds.Add(item.ID);
// allSendUserIds.Add(item.Nav_Notify.RECORD_USER_ID.Value);
// allSendUserNames.Add(item.Nav_Notify.Nav_RecordUser.NAME);
// }
// }
allSendTitles.Add("培训记录-" + item.Nav_Notify.NAME);
allSendDataIds.Add(item.ID);
allSendUserIds.Add(item.Nav_Notify.RECORD_USER_ID.Value);
allSendUserNames.Add(item.Nav_Notify.Nav_RecordUser.NAME);
}
}
SendNotices = NotificationTaskService.InsertUserNoticeTaskModels(allSendTitles, allSendDataIds, orgId, allSendUserIds, allSendUserNames, DateTime.Now, DateTime.Now.AddDays(10), (int)FMNoticeTypeEnum., "SE018");
if (SendNotices != null && SendNotices.Count > 0)
{
isClear = true;
UnifiedCommit(() =>
{
if (SendNotices.Any())
BantchAddEntityNoCommit(SendNotices);
if (listSend.Any())
BantchSaveEntityNoCommit(listSend);
});
}
}
#endregion
// SendNotices = NotificationTaskService.InsertUserNoticeTaskModels(allSendTitles, allSendDataIds, orgId, allSendUserIds, allSendUserNames, DateTime.Now, DateTime.Now.AddDays(10), (int)FMNoticeTypeEnum.消息, "SE018");
// if (SendNotices != null && SendNotices.Count > 0)
// {
// isClear = true;
// UnifiedCommit(() =>
// {
// if (SendNotices.Any())
// BantchAddEntityNoCommit(SendNotices);
// if (listSend.Any())
// BantchSaveEntityNoCommit(listSend);
// });
// }
//}
//#endregion
#endregion
@ -2191,6 +2200,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
List<string> allSendUserNames = null;
List<T_FM_NOTIFICATION_TASK> sendNotice = null;
List<T_SE_TRAIN_RECORD_USER> listUserDoAuto = null;
List<Guid> listNoticeIDEnd = new List<Guid>();
foreach (var item in iListR)
{
try
@ -2255,6 +2266,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
item.DT_SSEND_SIGN = DateTime.Now;
item.STATUS = SETrainRecordStatus.;
isClear = true;
listNoticeIDEnd.Add(item.NOTIFY_ID);
UnifiedCommit(() =>
{
UpdateEntityNoCommit(modelTr);
@ -2270,6 +2282,20 @@ namespace APT.PP.WebApi.Controllers.Api.PP
#endregion
if (listNoticeIDEnd != null && listNoticeIDEnd.Count() > 0)
{
//发送签到 待办去除
var finishNotifysSignEnd = GetEntities<T_FM_NOTIFICATION_TASK>(t => listNoticeIDEnd.Contains((Guid)t.SOURCE_DATA_ID) && t.NOTICE_STATUS == 0 && t.NOTICE_TITLE.EndsWith("-确认"), new BaseFilter(orgId));
foreach (var notify1 in finishNotifysSignEnd)
{
notify1.NOTICE_STATUS = 4;//待办 处理
}
UnifiedCommit(() =>
{
if (finishNotifysSignEnd != null && finishNotifysSignEnd.Any())
BantchSaveEntityNoCommit(finishNotifysSignEnd);
});
}
}
#endregion

View File

@ -71,9 +71,30 @@ namespace APT.SC.WebApi.Controllers.Api.SE
}
var taskCheck = GetEntity<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID.HasValue && e.SOURCE_DATA_ID.Value == ru.RECORD_ID && e.USER_ID == ru.USER_ID && e.SOURCE_FORMCODE == "SE017_SHOWPRINT");
if (taskCheck != null)
{
if (taskCheck.NOTICE_STATUS == 1)
{
throw new Exception("该用户已操签到过,请勿重复触发签到通知!");
}
else if (taskCheck.NOTICE_STATUS == 0)
{
return true;
}
else if (taskCheck.NOTICE_STATUS == 4)
{
taskCheck.NOTICE_STATUS = 0;
ru.IS_RESEND = true;
UnifiedCommit(() =>
{
UpdateEntityNoCommit(taskCheck);
UpdateEntityNoCommit(ru);
});
}
else
{
throw new Exception("该用户已有此签到单,请勿重复触发签到通知!");
}
}
DateTime dtEnd = ru.Nav_Record.Nav_Notify.TRAIN_END_TIME.HasValue ? ru.Nav_Record.Nav_Notify.TRAIN_END_TIME.Value : DateTime.Now.AddHours(12);
T_FM_NOTIFICATION_TASK notice = NotificationTaskService.InsertUserNoticeTaskModel("培训记录签到-" + ru.Nav_Record.Nav_Notify.NAME, ru.RECORD_ID, ru.ORG_ID, ru.USER_ID, ru.Nav_User.NAME, DateTime.Now, dtEnd, 1, "SE017_SHOWPRINT");
ru.IS_RESEND = true;