1、跑批 添加 时间参数 进入跑批
2、培训结束时间到了 跑批关闭代办 3、 安全意识调查 taskID 判断 4、培训需求 如果最后一个提交试卷 但是还没到结束时间 直接触发下级
This commit is contained in:
parent
942c6d2413
commit
77c516c464
@ -139,22 +139,53 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
|
||||
DateTime dtNow = DateTime.Now;
|
||||
var Parameter1 = filter.Parameter1;
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1))
|
||||
{
|
||||
try
|
||||
{
|
||||
//接收来自页面的参数
|
||||
DateTime deParm = Convert.ToDateTime(filter.Parameter1);
|
||||
dtNow = deParm;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
#region SE安全教育培训
|
||||
//触发教育培训调查汇总
|
||||
CheckTrainEffectSuveyEvaluation(filter);
|
||||
CheckTrainEffectSuveyEvaluation(filter, dtNow);
|
||||
//安全意识调查结束部门汇总
|
||||
CheckSafeSuveyDepartReport(filter);
|
||||
CheckSafeSuveyDepartReport(filter, dtNow);
|
||||
//安全意识调查所有结束公司汇总
|
||||
CheckSafeSuveyCompanyReport(filter);
|
||||
CheckSafeSuveyCompanyReport(filter, dtNow);
|
||||
//培训需求调查结束汇总
|
||||
CheckTrainSuveyFinishByDepartment(filter);
|
||||
CheckTrainSuveyFinishByDepartment(filter, dtNow);
|
||||
#endregion
|
||||
#region LR法律法规
|
||||
//触发需求分析,通知安环部负责人安全生产法律法规获取清单
|
||||
NoticeEndDemandDistinguish(filter);
|
||||
NoticeEndDemandDistinguish(filter, dtNow);
|
||||
#endregion
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1))
|
||||
{
|
||||
//去除参数
|
||||
var task = GetEntity<T_FM_SYNC_TASK>(filter.Keyword);
|
||||
if (task != null)
|
||||
{
|
||||
//不能新增去年的
|
||||
task.CURR_TASK_START_TIME = DateTime.Now;//上次同步结束时间
|
||||
task.UPDATE_SUCCES_TIME = DateTime.Now;//上次同步结束时间
|
||||
task.SYNC_PARAM = "";//清空参数
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
UpdateEntityNoCommit(task);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -573,9 +604,10 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
/// 通知安环部所有人员和各个部门安全员相关的安全生产法律法规需求分析表
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <param name="nowTime"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("NoticeEndDemandDistinguish")]
|
||||
public JsonActionResult<bool> NoticeEndDemandDistinguish([FromBody] KeywordFilter filter)
|
||||
public JsonActionResult<bool> NoticeEndDemandDistinguish(KeywordFilter filter, DateTime nowTime)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
@ -593,7 +625,6 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
List<T_LR_LEGAL_LIST_DETAIL_USER> lrDemandUsers = new List<T_LR_LEGAL_LIST_DETAIL_USER>();
|
||||
List<T_FM_NOTIFICATION_TASK> sendNotices = null;
|
||||
T_LR_LEGAL_LIST legalList = null;
|
||||
DateTime nowTime = DateTime.Now;
|
||||
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
||||
var config = GetEntity<T_LR_LRCONFIG>(null, baseFilter);
|
||||
if (config != null)
|
||||
@ -1233,12 +1264,11 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public JsonActionResult<bool> CheckSafeSuveyDepartReport([FromBody] KeywordFilter filter)
|
||||
public JsonActionResult<bool> CheckSafeSuveyDepartReport(KeywordFilter filter, DateTime dt)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
//各部门截止时间后生成部门统计报表发送发起人
|
||||
var dt = DateTime.Now;
|
||||
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
||||
baseFilter.Include = new string[] { "Nav_LaunchUser" };
|
||||
var surveys = GetEntities<T_SE_SAFE_SURVEY>(
|
||||
@ -1274,12 +1304,11 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
return true;
|
||||
});
|
||||
}
|
||||
private JsonActionResult<bool> CheckTrainSuveyFinishByDepartment([FromBody] KeywordFilter filter)
|
||||
private JsonActionResult<bool> CheckTrainSuveyFinishByDepartment(KeywordFilter filter, DateTime dt)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
//各部门截止时间后生成部门统计报表发送发起人
|
||||
var dt = DateTime.Now;
|
||||
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
||||
baseFilter.Include = new string[] { "Nav_LaunchUser" };
|
||||
var surveys = GetEntities<T_SE_TRAIN_SURVEY>(t => t.LAUNCH_TIME.Value.Year == dt.Year &&
|
||||
@ -1300,13 +1329,31 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
allSendUserNames.Add(survey.Nav_LaunchUser.NAME);
|
||||
survey.STATUS = SETrainSurveyStatus.汇总中;
|
||||
survey.Nav_LaunchUser = null;
|
||||
UpdateEntity(survey);
|
||||
//UpdateEntity(survey);//待测试会不会有bug
|
||||
}
|
||||
var sendNotices = NotificationTaskService.InsertUserNoticeTaskModels(allSendTitles, allSendDataIds, filter.GetOrgId(), allSendUserIds, allSendUserNames, DateTime.Now, DateTime.Now.AddDays(1), (int)FMFormTypeEnum.计划任务通知, "SE007_SHOWPRINT");
|
||||
|
||||
var listDemandID = GetEntities<T_SE_TRAIN_SURVEY_LIST_DEMAND>(e => allSendDataIds.Contains(e.SURVEY_ID), null, null).Select(e => e.ID);
|
||||
IEnumerable<T_FM_NOTIFICATION_TASK> listTaskStop = null;
|
||||
if (listDemandID != null && listDemandID.Count() > 0)
|
||||
{
|
||||
listTaskStop = GetEntities<T_FM_NOTIFICATION_TASK>(e => e.NOTICE_STATUS == 0 && e.SOURCE_FORMCODE == "SE007_INPUTPAGE" && e.SOURCE_DATA_ID.HasValue && listDemandID.Contains(e.SOURCE_DATA_ID.Value), null, null);
|
||||
listTaskStop.ForEach(e =>
|
||||
{
|
||||
e.NOTICE_STATUS = 4; // 未处理 = 0,正常已办 = 1, 超期办理 = 2, 已阅 = 3, 超时无需办理 = 4, 关闭 = 9
|
||||
e.TASK_DT = dt;
|
||||
});
|
||||
}
|
||||
|
||||
//待测试会不会有bug BantchSaveEntityNoCommit(surveys); 检查 LAUNCH_USER_ID 报错?
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (surveys != null && surveys.Count() > 0)
|
||||
BantchSaveEntityNoCommit(surveys);
|
||||
if (sendNotices.Any())
|
||||
BantchAddEntityNoCommit(sendNotices);
|
||||
if (listTaskStop != null && listTaskStop.Count() > 0)
|
||||
BantchSaveEntityNoCommit(listTaskStop);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
@ -1631,10 +1678,9 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
private void CheckSafeSuveyCompanyReport([FromBody] KeywordFilter filter)
|
||||
private void CheckSafeSuveyCompanyReport(KeywordFilter filter, DateTime dt)
|
||||
{
|
||||
//安全意识调查全部完成后发送给安环部负责人
|
||||
var dt = DateTime.Now;
|
||||
var surveysAll = GetEntities<T_SE_SAFE_SURVEY>(t => t.LAUNCH_TIME.Value.Year == dt.Year &&
|
||||
t.STATUS == SESafeSurveyStatus.完成 && !t.COMPNAY_REPORT && t.TASK_ID != null, new BaseFilter(filter.GetOrgId())).ToList();
|
||||
if (surveysAll == null || surveysAll.Count == 0)
|
||||
@ -1791,14 +1837,13 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
/// <summary>
|
||||
/// 每天5点触发教育培训调查汇总
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
public JsonActionResult<bool> CheckTrainEffectSuveyEvaluation([FromBody] KeywordFilter filter)
|
||||
public JsonActionResult<bool> CheckTrainEffectSuveyEvaluation(KeywordFilter filter, DateTime dt)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
//截止时间后生成,发送给培训通知的发起人及安环部负责人
|
||||
var dt = DateTime.Now;
|
||||
var minDate = dt.AddDays(-10);
|
||||
var maxDate = dt;
|
||||
|
||||
|
||||
@ -370,11 +370,18 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
item.SCORE = score;
|
||||
}
|
||||
var noticeTask = NotificationTaskService.GetTaskFinishModel((Guid)entity.TaskID);
|
||||
|
||||
T_FM_NOTIFICATION_TASK noticeTask = null;
|
||||
if (entity.TaskID.HasValue && entity.TaskID != Guid.Empty)
|
||||
{
|
||||
noticeTask = NotificationTaskService.GetTaskFinishModel((Guid)entity.TaskID);
|
||||
}
|
||||
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
BantchSaveEntityNoCommit(entity.Nav_Papers);
|
||||
UpdateEntityNoCommit(noticeTask);
|
||||
if (noticeTask != null)
|
||||
UpdateEntityNoCommit(noticeTask);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -202,7 +202,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("SubmitUserDemand")]
|
||||
public JsonActionResult<bool> SubmitUserDemand([FromBody] T_SE_TRAIN_SURVEY_LIST_DEMAND entity)
|
||||
@ -214,6 +214,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
throw new Exception("已提交的数据不可更改");
|
||||
}
|
||||
T_FM_NOTIFICATION_TASK finishNotice = null;
|
||||
T_FM_NOTIFICATION_TASK sendNotices = null;
|
||||
var items = entity.Nav_Items;
|
||||
entity.Nav_Items = null;
|
||||
foreach (var item in items)
|
||||
@ -243,6 +244,14 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
}
|
||||
entity.OK = 1;
|
||||
finishNotice = NotificationTaskService.GetTaskFinishModel(entity.TaskID);
|
||||
|
||||
//如果是最后一个人 并且当前时间不到结束时间 直接走汇总功能
|
||||
var check = GetEntity<T_SE_TRAIN_SURVEY_LIST_DEMAND>(e => e.SURVEY_ID == survry.ID && e.OK == 0);
|
||||
if (check == null)
|
||||
{
|
||||
var user = GetEntity<T_FM_USER>(survry.LAUNCH_USER_ID);
|
||||
sendNotices = NotificationTaskService.InsertUserNoticeTaskModel("培训需求调查汇总-" + survry.NAME, survry.ID, survry.ORG_ID, survry.LAUNCH_USER_ID, user.NAME, DateTime.Now, 0, "SE007_SHOWPRINT", FMTASKTYPE.Default);
|
||||
}
|
||||
}
|
||||
|
||||
UnifiedCommit(() =>
|
||||
@ -251,6 +260,8 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
BantchSaveEntityNoCommit(items);
|
||||
if (finishNotice != null)
|
||||
UpdateEntityNoCommit(finishNotice);
|
||||
if (sendNotices != null)
|
||||
UpdateEntityNoCommit(sendNotices);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
@ -320,7 +331,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_SE_TRAIN_SURVEY> OrderPaged([FromBody] BasePageFilter filter)
|
||||
{
|
||||
var result = WitOrderPaged(t=>t.TASK_ID!=null, filter);
|
||||
var result = WitOrderPaged(t => t.TASK_ID != null, filter);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user