(OA撤销提醒)

This commit is contained in:
gaojiabao
2023-03-26 10:11:45 +08:00
parent 23ff58a619
commit 09ddb5a96c
@@ -42,53 +42,53 @@ public class ScheduledJobEsPlan {
@Autowired
WebServiceOAServiceImpl webServiceOAService;
@Scheduled(cron = "0 0 2 * * ?") //每天的凌晨2点执行
@Async
public void SchedulingTask() {
if(isNotScheduled) {
logger.info("============企标计划定时任务开始===========");
LawsUserInfoService lawsUserInfoService = SpringContextUtil.getBean(LawsUserInfoService.class);
IEsPrcRelationService esPrcRelationService = SpringContextUtil.getBean(IEsPrcRelationService.class);
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
List<EsRevisePlanDTO> esRevisePlanDTOList = lawsUserInfoService.getAllPlansByWk(null); // 查询 制定中,修订中的企标计划
// 计划标准初稿时间前一个月的企标计划
SimpleDateFormat sdfQuery = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, 1);
String endDate = sdfQuery.format(calendar.getTime());
List<EsRevisePlanDTO> esRevisePlanDTOList2 = esRevisePlanDTOList.stream()
.filter(e -> endDate.equals(sdfQuery.format(e.getDraftTime())))
.collect(Collectors.toList());
if (!esRevisePlanDTOList2.isEmpty()) {
for (EsRevisePlanDTO esRevisePlanDTO : esRevisePlanDTOList2) {
List<EsPrcRelation> esPrcRelationList = esPrcRelationService.list(esRevisePlanDTO.getId());
if (esPrcRelationList.isEmpty()) {
continue;
}
String esId = esPrcRelationList.get(0).getEsId();
String prcIdGk = esPrcRelationList.get(0).getPrcIdGk();
String oaFlag = esPrcRelationList.get(0).getOaFlag();
// 判断对应 管控流程是否还在 技术标准起草节点, 且之前点过接受任务
if (StringUtils.isNotBlank(prcIdGk)) {
List<Task> list2 = taskService.createTaskQuery().processInstanceId(prcIdGk).active().list();
if (!list2.isEmpty()) {
String nowTaskInfo = list2.get(0).getName();
if ("技术标准起草".equals(nowTaskInfo) && "0".equals(oaFlag)) {
// 再次发送待办
logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
sendOATodo(list2.get(0));
// 更新 状态为待办
esPrcRelationService.modifyEsPrcRelation(esId, null, "1", null);
}
}
}
}
}
logger.info("============企标计划定时任务结束===========");
}
}
// @Scheduled(cron = "0 0 2 * * ?") //每天的凌晨2点执行
// @Async
// public void SchedulingTask() {
// if(isNotScheduled) {
// logger.info("============企标计划定时任务开始===========");
// LawsUserInfoService lawsUserInfoService = SpringContextUtil.getBean(LawsUserInfoService.class);
// IEsPrcRelationService esPrcRelationService = SpringContextUtil.getBean(IEsPrcRelationService.class);
// TaskService taskService = SpringContextUtil.getBean(TaskService.class);
//
// List<EsRevisePlanDTO> esRevisePlanDTOList = lawsUserInfoService.getAllPlansByWk(null); // 查询 制定中,修订中的企标计划
// // 计划标准初稿时间前一个月的企标计划
// SimpleDateFormat sdfQuery = new SimpleDateFormat("yyyy-MM-dd");
// Calendar calendar = Calendar.getInstance();
// calendar.add(Calendar.MONTH, 1);
// String endDate = sdfQuery.format(calendar.getTime());
// List<EsRevisePlanDTO> esRevisePlanDTOList2 = esRevisePlanDTOList.stream()
// .filter(e -> endDate.equals(sdfQuery.format(e.getDraftTime())))
// .collect(Collectors.toList());
// if (!esRevisePlanDTOList2.isEmpty()) {
// for (EsRevisePlanDTO esRevisePlanDTO : esRevisePlanDTOList2) {
// List<EsPrcRelation> esPrcRelationList = esPrcRelationService.list(esRevisePlanDTO.getId());
// if (esPrcRelationList.isEmpty()) {
// continue;
// }
// String esId = esPrcRelationList.get(0).getEsId();
// String prcIdGk = esPrcRelationList.get(0).getPrcIdGk();
// String oaFlag = esPrcRelationList.get(0).getOaFlag();
// // 判断对应 管控流程是否还在 技术标准起草节点, 且之前点过接受任务
// if (StringUtils.isNotBlank(prcIdGk)) {
// List<Task> list2 = taskService.createTaskQuery().processInstanceId(prcIdGk).active().list();
// if (!list2.isEmpty()) {
// String nowTaskInfo = list2.get(0).getName();
// if ("技术标准起草".equals(nowTaskInfo) && "0".equals(oaFlag)) {
// // 再次发送待办
// logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
// sendOATodo(list2.get(0));
//
// // 更新 状态为待办
// esPrcRelationService.modifyEsPrcRelation(esId, null, "1", null);
// }
// }
// }
// }
// }
// logger.info("============企标计划定时任务结束===========");
// }
// }
@Scheduled(cron = "0 0 2 * * ?") //每天的凌晨2点执行
@Async
@@ -121,6 +121,7 @@ public class ScheduledJobEsPlan {
lawsUserInfoService.updateEsRevisePlan(esId,new Date(),"0");
if(esPrcRelationList.get(0) != null && StringUtils.isNotBlank(esPrcRelationList.get(0).getPrcId())) {
webServiceOAService.deleteOAByPid(esPrcRelationList.get(0).getPrcId());
logger.info("============撤销OA待办消息===========");
}
}
}
@@ -152,12 +153,12 @@ public class ScheduledJobEsPlan {
String nowTaskInfo = list2.get(0).getName();
if ("技术标准起草".equals(nowTaskInfo) && "0".equals(oaFlag)) {
// 再次发送待办
logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
sendOATodo(list2.get(0));
// 更新 状态为待办
esPrcRelationService.modifyEsPrcRelation(esId, null, "1", null);
//存储 OA发的时间 和 修改是否发送过
lawsUserInfoService.updateEsRevisePlan(esId,new Date(),"1");
logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
}
}
}