fix(标准变更流程): 79949

This commit is contained in:
yjz
2024-01-25 16:11:13 +08:00
parent dc8782e5dc
commit c4b7ecaa43
@@ -12,6 +12,7 @@ import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.UUIDUtils;
import com.jero.modules.activiti.entity.ProcessAll;
import com.jero.modules.activiti.enums.ProcessStatusEnum;
import com.jero.modules.activiti.enums.ProcessTypeEnum;
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
@@ -178,6 +179,8 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
if (StringUtils.isNotBlank(draftId)) {
processDraftService.removeById(draftId);
}
// 同一个标准编号不能同时有多个进行中的标准变更流程
verify(processInfoVO.getBusinessId());
processHandleService.startProcess(processInfoVO);
// 保存草稿用于强制撤销
@@ -187,6 +190,28 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
saveToDraft(processInfoVO);
}
private void verify(String businessId) {
ProcessFbEntryChange businessData = getById(businessId);
String businessJson = businessData.getBusinessJson();
Map<String, Object> map = JSON.parseObject(businessJson, Map.class);
if ("2".equals(businessData.getOperateType())) {
List<ProcessFbEntryChange> list = list(
new LambdaQueryWrapper<ProcessFbEntryChange>()
.ne(ProcessFbEntryChange::getId, businessId)
.eq(ProcessFbEntryChange::getStandardNumber, map.get(FieldCommon.STANDARD_NUMBER))
.eq(ProcessFbEntryChange::getOperateType, "2"));
if (!list.isEmpty()){
int count = processAllService.count(
new LambdaQueryWrapper<ProcessAll>()
.in(ProcessAll::getProjectId, list.stream().map(ProcessFbEntryChange::getId).collect(Collectors.toList()))
.eq(ProcessAll::getPrcStatus, ProcessStatusEnum.INCOMPLETE.getValue()));
if (count > 0){
throw new JeroBootException("标准编号已在标准变更流程进行中,不可重复发起!");
}
}
}
}
private void duplicateCheck(String businessId) {
ProcessFbEntryChange businessData = getById(businessId);
String businessJson = businessData.getBusinessJson();