feat: 企标复审复审日期更新逻辑
This commit is contained in:
+5
-1
@@ -74,10 +74,14 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
|
||||
// 继续有效
|
||||
plan.setRecheckResult(RECHECK_CONTINUE_VALID);
|
||||
Date recheckDate = plan.getRecheckDate();
|
||||
// 发布日期加6年
|
||||
// 复审日期再加3年
|
||||
Date nextRecheckDate = new Date(recheckDate.getTime() + (3 * 365 - 1) * 24 * 60 * 60 * 1000L);
|
||||
plan.setRecheckDate(nextRecheckDate);
|
||||
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)) {
|
||||
// 修订 自动发起企标立项/变更流程(修订模式)
|
||||
|
||||
+4
@@ -75,4 +75,8 @@ public class EnterpriseStandardRecheckPlan implements Serializable {
|
||||
/**复审结果*/
|
||||
@ApiModelProperty(value = "复审结果")
|
||||
private String recheckResult;
|
||||
|
||||
/**是否在流程中 0不在 1在*/
|
||||
@ApiModelProperty(value = "是否在流程中 0不在 1在")
|
||||
private String inProcessFlag;
|
||||
}
|
||||
|
||||
+42
-19
@@ -57,8 +57,6 @@ public class ESRecheckPlanJob implements Job {
|
||||
|
||||
for (LawsEnterpriseStandard es : allEs) {
|
||||
// 根据企标发布日期判断是否当前已经达到35个月
|
||||
|
||||
// 请确保es.getReleaseDate()返回的是Date类型的实例
|
||||
if (es.getReleaseDate() == null) {
|
||||
log.info("无法找到企标编号为{}的发布日期,无法进行复审计划定时任务", es.getStandardNumber());
|
||||
continue;
|
||||
@@ -85,32 +83,57 @@ public class ESRecheckPlanJob implements Job {
|
||||
recheckPlan.setRecheckDate(recheckDate);
|
||||
esRecheckPlanService.save(recheckPlan);
|
||||
// 自动发起流程
|
||||
// 找到各自企标的联络人,如果找不到联络人则发给标准化工程师
|
||||
String deptId = es.getMainDraftingUnit();
|
||||
String standardNo = es.getStandardNumber();
|
||||
if (StrUtil.isBlank(deptId)) {
|
||||
log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo);
|
||||
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;
|
||||
}
|
||||
String standardizationUser = contactManageService.findContactUserByDept(deptId);
|
||||
String standardEngineer = null;
|
||||
if (StrUtil.isBlank(standardizationUser)) {
|
||||
standardEngineer = contactManageService.findStandardEngineerByDept(deptId);
|
||||
if (minusMonths.isBefore(recheckLocalDate)) {
|
||||
autoStartProcess(es, recheckPlan);
|
||||
}
|
||||
if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) {
|
||||
log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo);
|
||||
continue;
|
||||
}
|
||||
// 构建发起流程数据
|
||||
ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
|
||||
// 发起流程
|
||||
recheckService.autoStartProcess(esRecheckDataVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("企标复审计划定时任务执行完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动发起流程
|
||||
* @param es 企标
|
||||
* @param recheckPlan 复审计划
|
||||
*/
|
||||
private void autoStartProcess(LawsEnterpriseStandard es, EnterpriseStandardRecheckPlan recheckPlan) {
|
||||
// 找到各自企标的联络人,如果找不到联络人则发给标准化工程师
|
||||
String deptId = es.getMainDraftingUnit();
|
||||
String standardNo = es.getStandardNumber();
|
||||
if (StrUtil.isBlank(deptId)) {
|
||||
log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo);
|
||||
return;
|
||||
}
|
||||
String standardizationUser = contactManageService.findContactUserByDept(deptId);
|
||||
String standardEngineer = null;
|
||||
if (StrUtil.isBlank(standardizationUser)) {
|
||||
standardEngineer = contactManageService.findStandardEngineerByDept(deptId);
|
||||
}
|
||||
if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) {
|
||||
log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo);
|
||||
return;
|
||||
}
|
||||
// 构建发起流程数据
|
||||
ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
|
||||
// 发起流程
|
||||
recheckService.autoStartProcess(esRecheckDataVO);
|
||||
// 更新标识
|
||||
recheckPlan.setInProcessFlag(YesOrNoEnum.YES.getValue());
|
||||
esRecheckPlanService.updateById(recheckPlan);
|
||||
}
|
||||
|
||||
public static ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser
|
||||
, String standardEngineer, EnterpriseStandardRecheckPlan recheckPlan) {
|
||||
ESRecheckDataVO esRecheckDataVO = new ESRecheckDataVO();
|
||||
|
||||
Reference in New Issue
Block a user