fix: 81855 企标计划变更--合并--制修订流程没有自动发起
This commit is contained in:
+61
-39
@@ -28,6 +28,7 @@ import org.activiti.engine.delegate.ExecutionListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -82,7 +83,7 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
processEsInitChange.setChangeStatus(ESPChangeType.ADD.getValue());
|
||||
if (ESPProjectType.MODIFY.getValue().equals(projectType)) {
|
||||
processEsInitChange.setApplicationCategory(ESPProjectType.MODIFY.getValue());
|
||||
if (!esUtil.verifyEnStandardNumber(processEsInitChanges.get(0).getNewEnStandardNo())) {
|
||||
if (!this.verifyEnStandardNumberInitChangeLast(processEsInitChanges.get(0).getNewEnStandardNo())) {
|
||||
throw new JeroBootException(ResultCommon.NEW_EN_STANDARD_NUMBER_CONFLICT);
|
||||
}
|
||||
} else {
|
||||
@@ -98,44 +99,8 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
EnterpriseStandardPlan esp = enterpriseStandardPlans.get(0);
|
||||
esRevisionService.autoStartProcess(getRevisionDataVO(esp));
|
||||
} else {
|
||||
// 如果是变更流程且不是完成时间变更,则需要撤回制修订流程
|
||||
if (!ESPProjectType.COMPLETE_TIME_CHANGE.getValue().equals(projectType)) {
|
||||
List<String> espIdList = processEsInitChanges.stream().map(ProcessEsInitChange::getEspId).collect(Collectors.toList());
|
||||
// 未开始的企标计划不需要强制撤回
|
||||
espService.listByIds(espIdList).forEach(esp -> {
|
||||
if (esp.getProjectStatus().equals(ESPProjectStatus.NOT_STARTED.getValue())) {
|
||||
espIdList.remove(esp.getId());
|
||||
}
|
||||
});
|
||||
if (espIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
LambdaQueryWrapper<ProcessEsRevision> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(ProcessEsRevision::getEspId, espIdList);
|
||||
lambdaQueryWrapper.eq(ProcessEsRevision::getDelFlag, YesOrNoEnum.NO.getValue());
|
||||
List<ProcessEsRevision> enactList = revisionService.list(lambdaQueryWrapper);
|
||||
if (enactList == null || enactList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> revisionProcessInstanceIdList = enactList.stream().map(ProcessEsRevision::getProcessInstanceId)
|
||||
.collect(Collectors.toList());
|
||||
// 根据流程主表筛选出未完成的流程
|
||||
LambdaQueryWrapper<ProcessAll> paWrapper = new LambdaQueryWrapper<>();
|
||||
paWrapper.in(ProcessAll::getProcessInstanceId, revisionProcessInstanceIdList);
|
||||
paWrapper.eq(ProcessAll::getPrcStatus, ProcessStatusEnum.INCOMPLETE.getValue());
|
||||
List<ProcessAll> list = processAllService.list(paWrapper);
|
||||
Map<String, ProcessAll> validProcessAllMap = list.stream()
|
||||
.collect(Collectors.toMap(ProcessAll::getProcessInstanceId, e -> e));
|
||||
|
||||
// 根据流程表
|
||||
for (ProcessEsRevision esRevision : enactList) {
|
||||
if (!validProcessAllMap.containsKey(esRevision.getProcessInstanceId())) {
|
||||
continue;
|
||||
}
|
||||
processAllService.forcedWithdrawal(esRevision.getProcessInstanceId());
|
||||
processAllService.updateDraftStatusByProjectId(esRevision.getId());
|
||||
}
|
||||
}
|
||||
// 如果是变更流程且不是完成时间变更,则需要撤回制修订流程
|
||||
this.judgeForcedWithdrawal(projectType, processEsInitChanges);
|
||||
|
||||
// 将Id设为企标计划的Id
|
||||
for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
@@ -199,6 +164,52 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
log.info("数据存入企标计划数据库");
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果是变更流程且不是完成时间变更,则需要撤回制修订流程
|
||||
* @param projectType 变更类型
|
||||
* @param processEsInitChanges 流程业务数据
|
||||
*/
|
||||
public void judgeForcedWithdrawal(String projectType, List<ProcessEsInitChange> processEsInitChanges) {
|
||||
// 如果是变更流程且不是完成时间变更,则需要撤回制修订流程
|
||||
if (!ESPProjectType.COMPLETE_TIME_CHANGE.getValue().equals(projectType)) {
|
||||
List<String> espIdList = processEsInitChanges.stream().map(ProcessEsInitChange::getEspId).collect(Collectors.toList());
|
||||
// 未开始的企标计划不需要强制撤回
|
||||
espService.listByIds(espIdList).forEach(esp -> {
|
||||
if (esp.getProjectStatus().equals(ESPProjectStatus.NOT_STARTED.getValue())) {
|
||||
espIdList.remove(esp.getId());
|
||||
}
|
||||
});
|
||||
if (espIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
LambdaQueryWrapper<ProcessEsRevision> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(ProcessEsRevision::getEspId, espIdList);
|
||||
lambdaQueryWrapper.eq(ProcessEsRevision::getDelFlag, YesOrNoEnum.NO.getValue());
|
||||
List<ProcessEsRevision> enactList = revisionService.list(lambdaQueryWrapper);
|
||||
if (enactList == null || enactList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> revisionProcessInstanceIdList = enactList.stream().map(ProcessEsRevision::getProcessInstanceId)
|
||||
.collect(Collectors.toList());
|
||||
// 根据流程主表筛选出未完成的流程
|
||||
LambdaQueryWrapper<ProcessAll> paWrapper = new LambdaQueryWrapper<>();
|
||||
paWrapper.in(ProcessAll::getProcessInstanceId, revisionProcessInstanceIdList);
|
||||
paWrapper.eq(ProcessAll::getPrcStatus, ProcessStatusEnum.INCOMPLETE.getValue());
|
||||
List<ProcessAll> list = processAllService.list(paWrapper);
|
||||
Map<String, ProcessAll> validProcessAllMap = list.stream()
|
||||
.collect(Collectors.toMap(ProcessAll::getProcessInstanceId, e -> e));
|
||||
|
||||
// 根据流程表
|
||||
for (ProcessEsRevision esRevision : enactList) {
|
||||
if (!validProcessAllMap.containsKey(esRevision.getProcessInstanceId())) {
|
||||
continue;
|
||||
}
|
||||
processAllService.forcedWithdrawal(esRevision.getProcessInstanceId());
|
||||
processAllService.updateDraftStatusByProjectId(esRevision.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ESRevisionDataVO getRevisionDataVO(EnterpriseStandardPlan esp) {
|
||||
ESRevisionDataVO revisionDataVO = new ESRevisionDataVO();
|
||||
ProcessEsRevision revision = new ProcessEsRevision();
|
||||
@@ -206,4 +217,15 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
revisionDataVO.setData(revision);
|
||||
return revisionDataVO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 立项变更流程修订最后一个节点提交的时候需要判断是否已经有另外一个重复的企标编号了, 但此时需要排除掉自己
|
||||
*/
|
||||
public boolean verifyEnStandardNumberInitChangeLast(String StandardNumber) {
|
||||
List<String> duplicateStandardNumbers = esUtil.verifyBatchEsNumber(Collections.singletonList(StandardNumber));
|
||||
if (duplicateStandardNumbers == null || duplicateStandardNumbers.isEmpty()) {
|
||||
return true;
|
||||
} else return duplicateStandardNumbers.size() == 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user