培训签到 通知反馈 跑批修改
培训签到 手动触发修改
This commit is contained in:
parent
53092e7d7a
commit
8c02e734b4
@ -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; }
|
||||
|
||||
@ -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,45 +1952,53 @@ 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)
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = orgId,
|
||||
NOTIFY_ID = notify.ID,
|
||||
STATUS = SETrainRecordStatus.草稿,
|
||||
CREATER_ID = notify.RECORD_USER_ID,
|
||||
};
|
||||
foreach (var user in notify.Nav_TrainUserList)
|
||||
{
|
||||
var joinUser = new T_SE_TRAIN_RECORD_USER
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = orgId,
|
||||
RECORD_ID = record.ID,
|
||||
USER_ID = user.USER_ID,
|
||||
DEPARTMENT_NAME = user.Nav_User.Nav_Department.NAME,
|
||||
POST_NAME = user.Nav_User.Nav_Person.Nav_Post.NAME
|
||||
};
|
||||
if (user.IS_LEAVE == SETrainYesNoEnum.请假)
|
||||
{
|
||||
joinUser.STATUS = SETrainRecordUserStatusEnum.请假;
|
||||
}
|
||||
else
|
||||
{
|
||||
joinUser.STATUS = SETrainRecordUserStatusEnum.参与;
|
||||
}
|
||||
joinUsers.Add(joinUser);
|
||||
record = listRecordCheck.FirstOrDefault(e => e.NOTIFY_ID == notify.ID);
|
||||
}
|
||||
foreach (var file in notify.Nav_Files)
|
||||
if (record == null)
|
||||
{
|
||||
var recordFile = new T_SE_TRAIN_RECORD_FILE
|
||||
record = new T_SE_TRAIN_RECORD
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = orgId,
|
||||
RECORD_ID = record.ID,
|
||||
IMG_FILE_ID = file.IMG_FILE_ID
|
||||
NOTIFY_ID = notify.ID,
|
||||
STATUS = SETrainRecordStatus.草稿,
|
||||
CREATER_ID = notify.RECORD_USER_ID,
|
||||
};
|
||||
files.Add(recordFile);
|
||||
foreach (var user in notify.Nav_TrainUserList)
|
||||
{
|
||||
var joinUser = new T_SE_TRAIN_RECORD_USER
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = orgId,
|
||||
RECORD_ID = record.ID,
|
||||
USER_ID = user.USER_ID,
|
||||
DEPARTMENT_NAME = user.Nav_User.Nav_Department.NAME,
|
||||
POST_NAME = user.Nav_User.Nav_Person.Nav_Post.NAME
|
||||
};
|
||||
if (user.IS_LEAVE == SETrainYesNoEnum.请假)
|
||||
{
|
||||
joinUser.STATUS = SETrainRecordUserStatusEnum.请假;
|
||||
}
|
||||
else
|
||||
{
|
||||
joinUser.STATUS = SETrainRecordUserStatusEnum.参与;
|
||||
}
|
||||
joinUsers.Add(joinUser);
|
||||
}
|
||||
foreach (var file in notify.Nav_Files)
|
||||
{
|
||||
var recordFile = new T_SE_TRAIN_RECORD_FILE
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = orgId,
|
||||
RECORD_ID = record.ID,
|
||||
IMG_FILE_ID = file.IMG_FILE_ID
|
||||
};
|
||||
files.Add(recordFile);
|
||||
}
|
||||
}
|
||||
TrainRecords.Add(record);
|
||||
allSendTitles.Add("培训记录-" + notify.NAME);
|
||||
@ -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
|
||||
|
||||
@ -72,7 +72,28 @@ 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)
|
||||
{
|
||||
throw new Exception("该用户已有此签到单,请勿重复触发签到通知!");
|
||||
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");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user