feat: 企标复审复审日期更新逻辑

This commit is contained in:
2024-01-15 16:01:55 +08:00
parent 0c2d60fe5e
commit e333f900aa
3 changed files with 51 additions and 20 deletions
@@ -74,10 +74,14 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
// 继续有效 // 继续有效
plan.setRecheckResult(RECHECK_CONTINUE_VALID); plan.setRecheckResult(RECHECK_CONTINUE_VALID);
Date recheckDate = plan.getRecheckDate(); Date recheckDate = plan.getRecheckDate();
// 发布日期加6年 // 复审日期再加3年
Date nextRecheckDate = new Date(recheckDate.getTime() + (3 * 365 - 1) * 24 * 60 * 60 * 1000L); Date nextRecheckDate = new Date(recheckDate.getTime() + (3 * 365 - 1) * 24 * 60 * 60 * 1000L);
plan.setRecheckDate(nextRecheckDate); plan.setRecheckDate(nextRecheckDate);
esRecheckPlanService.updateById(plan); esRecheckPlanService.updateById(plan);
LambdaUpdateWrapper<LawsEnterpriseStandard> esWrapper = new LambdaUpdateWrapper<>();
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standNo);
esWrapper.set(LawsEnterpriseStandard::getStandardState, StandardStateEnum.CURRENTLY_EFFECTIVE.getStateValue());
esService.update(esWrapper);
} }
if (RECHECK_INIT_CHANGE.equals(recheckAdvice)) { if (RECHECK_INIT_CHANGE.equals(recheckAdvice)) {
// 修订 自动发起企标立项/变更流程(修订模式) // 修订 自动发起企标立项/变更流程(修订模式)
@@ -75,4 +75,8 @@ public class EnterpriseStandardRecheckPlan implements Serializable {
/**复审结果*/ /**复审结果*/
@ApiModelProperty(value = "复审结果") @ApiModelProperty(value = "复审结果")
private String recheckResult; private String recheckResult;
/**是否在流程中 0不在 1在*/
@ApiModelProperty(value = "是否在流程中 0不在 1在")
private String inProcessFlag;
} }
@@ -57,8 +57,6 @@ public class ESRecheckPlanJob implements Job {
for (LawsEnterpriseStandard es : allEs) { for (LawsEnterpriseStandard es : allEs) {
// 根据企标发布日期判断是否当前已经达到35个月 // 根据企标发布日期判断是否当前已经达到35个月
// 请确保es.getReleaseDate()返回的是Date类型的实例
if (es.getReleaseDate() == null) { if (es.getReleaseDate() == null) {
log.info("无法找到企标编号为{}的发布日期,无法进行复审计划定时任务", es.getStandardNumber()); log.info("无法找到企标编号为{}的发布日期,无法进行复审计划定时任务", es.getStandardNumber());
continue; continue;
@@ -85,12 +83,38 @@ public class ESRecheckPlanJob implements Job {
recheckPlan.setRecheckDate(recheckDate); recheckPlan.setRecheckDate(recheckDate);
esRecheckPlanService.save(recheckPlan); esRecheckPlanService.save(recheckPlan);
// 自动发起流程 // 自动发起流程
autoStartProcess(es, recheckPlan);
} else {
// 如果已经有复审计划,则需要判断是否到达复审日期前一个月,如果到达则需要发起流程,已经发起过流程的不能重复发送
EnterpriseStandardRecheckPlan recheckPlan = recheckPlans.get(0);
Date recheckDate = recheckPlan.getRecheckDate();
LocalDate recheckLocalDate = recheckDate.toInstant().atZone(ZoneId.of("Asia/Shanghai")).toLocalDate();
LocalDate minusMonths = recheckLocalDate.minusMonths(1);
if (recheckPlan.getInProcessFlag().equals(YesOrNoEnum.YES.getValue())) {
// 已经发起过流程,不需要重复发起
continue;
}
if (minusMonths.isBefore(recheckLocalDate)) {
autoStartProcess(es, recheckPlan);
}
}
}
}
log.info("企标复审计划定时任务执行完成");
}
/**
* 自动发起流程
* @param es 企标
* @param recheckPlan 复审计划
*/
private void autoStartProcess(LawsEnterpriseStandard es, EnterpriseStandardRecheckPlan recheckPlan) {
// 找到各自企标的联络人,如果找不到联络人则发给标准化工程师 // 找到各自企标的联络人,如果找不到联络人则发给标准化工程师
String deptId = es.getMainDraftingUnit(); String deptId = es.getMainDraftingUnit();
String standardNo = es.getStandardNumber(); String standardNo = es.getStandardNumber();
if (StrUtil.isBlank(deptId)) { if (StrUtil.isBlank(deptId)) {
log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo); log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo);
continue; return;
} }
String standardizationUser = contactManageService.findContactUserByDept(deptId); String standardizationUser = contactManageService.findContactUserByDept(deptId);
String standardEngineer = null; String standardEngineer = null;
@@ -99,16 +123,15 @@ public class ESRecheckPlanJob implements Job {
} }
if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) { if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) {
log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo); log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo);
continue; return;
} }
// 构建发起流程数据 // 构建发起流程数据
ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan); ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
// 发起流程 // 发起流程
recheckService.autoStartProcess(esRecheckDataVO); recheckService.autoStartProcess(esRecheckDataVO);
} // 更新标识
} recheckPlan.setInProcessFlag(YesOrNoEnum.YES.getValue());
} esRecheckPlanService.updateById(recheckPlan);
log.info("企标复审计划定时任务执行完成");
} }
public static ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser public static ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser