fix: 企标复审流程自动发起及相关逻辑修正

This commit is contained in:
2024-05-27 17:41:21 +08:00
parent a07505eaeb
commit 35001b0270
4 changed files with 42 additions and 10 deletions
@@ -63,6 +63,9 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
recheckPlan.setInProcessFlag(YesOrNoEnum.NO.getValue());
esRecheckPlanService.updateById(recheckPlan);
String standNo = recheck.getStandardNumber();
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
wrapper.set(EnterpriseStandardRecheckPlan::getInProcessFlag, YesOrNoEnum.NO.getValue());
log.info("企标复审流程结束 监听执行器开始执行,企标编号为:{}", standNo);
if (RECHECK_CONTINUE_VALID.equals(recheckAdvice)) {
// 获取复审计划记录
@@ -81,19 +84,13 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
}
if (RECHECK_INIT_CHANGE.equals(recheckAdvice)) {
// 废止
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
wrapper.set(EnterpriseStandardRecheckPlan::getRecheckResult, RECHECK_INIT_CHANGE);
esRecheckPlanService.update(wrapper);
// 修订 自动发起企标立项/变更流程(修订模式)
esInitChangeService.autoStartProcessByRecheck(standNo);
}
if (RECHECK_ABOLISH.equals(recheckAdvice)) {
// 废止
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
wrapper.set(EnterpriseStandardRecheckPlan::getRecheckResult, RECHECK_ABOLISH);
esRecheckPlanService.update(wrapper);
LambdaUpdateWrapper<LawsEnterpriseStandard> esWrapper = new LambdaUpdateWrapper<>();
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standNo);
esWrapper.set(LawsEnterpriseStandard::getStandardState, StandardStateEnum.ABOLISH.getStateValue());
@@ -101,15 +98,13 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
}
if (RECHECK_ARCHIVE.equals(recheckAdvice)) {
// 封存
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
wrapper.set(EnterpriseStandardRecheckPlan::getRecheckResult, RECHECK_ARCHIVE);
esRecheckPlanService.update(wrapper);
LambdaUpdateWrapper<LawsEnterpriseStandard> esWrapper = new LambdaUpdateWrapper<>();
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standNo);
esWrapper.set(LawsEnterpriseStandard::getStandardState, StandardStateEnum.ARCHIVE.getStateValue());
esService.update(esWrapper);
}
esRecheckPlanService.update(wrapper);
log.info("企标复审流程监听执行器执行结束");
}
}
@@ -20,6 +20,8 @@ import com.jero.modules.activiti.process.fb.dto.BasicProcessInfoDTO;
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
import com.jero.modules.activiti.service.ProcessNodeLinkService;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
import com.jero.modules.sys.utils.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
@@ -64,10 +66,21 @@ public class ProcessEsRecheckServiceImpl extends ServiceImpl<ProcessEsRecheckMap
@Resource
private TranslationAspect translationAspect;
@Resource
private EnterpriseStandardRecheckPlanService esRecheckService;
@Override
public void startProcess(ESRecheckDataVO recheckData) {
// 执行流程发起前的操作
this.startRunTask(recheckData);
// 将计划设为流程进行中
String recheckPlanId = recheckData.getData().getRecheckPlanId();
EnterpriseStandardRecheckPlan recheckPlan = esRecheckService.getById(recheckPlanId);
if (recheckPlan == null) {
throw new JeroBootException("企标复审计划无效,请重新提交");
}
recheckPlan.setInProcessFlag(YesOrNoEnum.YES.getValue());
esRecheckService.updateById(recheckPlan);
// 流程Key
String processDefinitionKey = ProcessType.ES_RECHECK.getProcessKey();
// 当前用户Id
@@ -28,6 +28,8 @@ import com.jero.modules.activiti.process.common.common.DraftCommon;
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectStatus;
import com.jero.modules.activiti.process.esRecheck.entity.ProcessEsRecheck;
import com.jero.modules.activiti.process.esRecheck.service.ProcessEsRecheckService;
import com.jero.modules.activiti.process.esRevision.entity.ProcessEsRevision;
import com.jero.modules.activiti.process.esRevision.service.EsRevisionService;
import com.jero.modules.activiti.process.esinspectdelayapply.common.EsInspectDelayApplyCommon;
@@ -39,7 +41,9 @@ import com.jero.modules.activiti.vo.ResolveTaskParam;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RuntimeService;
@@ -84,6 +88,10 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
private EnterpriseStandardPlanService espService;
@Resource
private PushWorkflowIntegrationAPI pushWorkflowIntegrationAPI;
@Resource
private EnterpriseStandardRecheckPlanService esRecheckService;
@Resource
private ProcessEsRecheckService processEsRecheckService;
private static final List<Integer> INSPECT_PROCESS = Arrays.asList(
ProcessTypeEnum.FB_ENTRY_CHANGE.getValue(),
@@ -255,6 +263,10 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
if (Objects.equals(prcType, ProcessTypeEnum.ES_REVISION.getValue())) {
this.revisionForcedWithdrawalProcess(processInstanceId);
}
// 企标复审流程强制撤回后需要更改企标复审计划的内置状态为未开始
if (Objects.equals(prcType, ProcessTypeEnum.ES_RECHECK.getValue())) {
this.recheckForcedWithdrawalProcess(processInstanceId);
}
//todo 同步删除操作到统一待办
//查询所有待办任务
LambdaQueryWrapper<ProcessApprovalRecord> wrapper = new LambdaQueryWrapper<>();
@@ -286,6 +298,18 @@ public class ProcessAllService extends ServiceImpl<ProcessAllMapper, ProcessAll>
.set(EnterpriseStandardPlan::getProjectStatus, ESPProjectStatus.NOT_STARTED.getValue()));
}
private void recheckForcedWithdrawalProcess(String processInstanceId) {
ProcessEsRecheck recheckProcess = processEsRecheckService.getOne(new LambdaQueryWrapper<ProcessEsRecheck>()
.eq(ProcessEsRecheck::getProcessInstanceId, processInstanceId));
String recheckPlanId = recheckProcess.getRecheckPlanId();
if (StrUtil.isBlank(recheckPlanId)) {
throw new JeroBootException("强制撤回企标更改流程失败,找不到对应的企标复审计划");
}
esRecheckService.update(new LambdaUpdateWrapper<EnterpriseStandardRecheckPlan>()
.eq(EnterpriseStandardRecheckPlan::getId, recheckPlanId)
.set(EnterpriseStandardRecheckPlan::getInProcessFlag, YesOrNoEnum.NO.getValue()));
}
public void delegateTask(DelegateTaskParam param) {
String taskId = param.getTaskId();
String userId = param.getUserId();
@@ -135,7 +135,7 @@ public class ESRecheckPlanJob implements Job {
log.info("企标编号为{}的企标已经达到复审日期前一个月,但是已经发起过复审流程,无需重复发起", es.getStandardNumber());
continue;
}
if (minusMonths.isBefore(recheckLocalDate)) {
if (now.isAfter(minusMonths) && now.isBefore(recheckLocalDate)) {
autoStartProcess(es, recheckPlan);
log.info("企标编号为{}的企标已经达到复审日期前一个月,已经自动发起复审流程", es.getStandardNumber());
}