fix(标准法规流程): 79947

This commit is contained in:
yjz
2024-01-16 14:38:44 +08:00
parent 98400cb036
commit 1cac74e022
@@ -13,6 +13,7 @@ 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.ProcessTypeEnum;
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
import com.jero.modules.activiti.process.fb.common.ProcessDefinitionKey;
import com.jero.modules.activiti.process.fb.dto.BasicProcessInfoDTO;
@@ -29,8 +30,12 @@ import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.mapper.LawsCommonMapper;
import com.jero.modules.laws.common.service.ILawsCommonService;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.laws.standardization.entity.LawsStandardization;
import com.jero.modules.laws.standardization.service.ILawsStandardizationService;
import com.jero.modules.system.service.ISysDictService;
@@ -84,6 +89,10 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
@Resource
private ILawsStandardizationService lawsStandardizationService;
@Resource
private ILawsDomesticStandardService lawsDomesticStandardService;
@Resource
private ILawsOverseasStandardService lawsOverseasStandardService;
/**
* @Author: liao
@@ -154,15 +163,48 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
basicProcessInfoDTO.setProcessDefinitionId(processHandleService.getDefinitionIdByKey(ProcessDefinitionKey.FB_ENTRY_CHANGE)); // 流程定义id
// basicProcessInfoDTO.setProcessName(getProcessNameByBusinessId(processInfoVO.getBusinessId())); // 流程名称
basicProcessInfoDTO.setProcessType(ProcessTypeEnum.FB_ENTRY_CHANGE.getValue()); // 流程类型
// 重复性校验
duplicateCheck(processInfoVO.getBusinessId());
processHandleService.startProcess(processInfoVO);
// 保存草稿用于强制撤销
processInfoVO.setSaveSource("3");
processInfoVO.getBasicTaskInfoDTO().setTaskId(null);
processInfoVO.setInfoJsonStr(processInfoVO.getInfoJsonStr().replaceFirst("\\{", "{\"revocation\": true,"));
saveToDraft(processInfoVO);
}
private void duplicateCheck(String businessId) {
ProcessFbEntryChange businessData = getById(businessId);
String businessJson = businessData.getBusinessJson();
Map<String, Object> map = JSON.parseObject(businessJson, Map.class);
if ("1".equals(businessData.getOperateType())) {
int documentCount = lawsDomesticStandardService.count(
new LambdaQueryWrapper<LawsDomesticStandard>()
.eq(LawsDomesticStandard::getStandardNumber, map.get(FieldCommon.STANDARD_NUMBER)));
int overseasCount = lawsOverseasStandardService.count(
new LambdaQueryWrapper<LawsOverseasStandard>()
.eq(LawsOverseasStandard::getStandardNumber, map.get(FieldCommon.STANDARD_NUMBER)));
if (documentCount > 0 || overseasCount > 0){
throw new JeroBootException("标准编号已入库或已发起入库流程,不可重复发起!");
}
List<ProcessFbEntryChange> list = list(
new LambdaQueryWrapper<ProcessFbEntryChange>()
.ne(ProcessFbEntryChange::getId, businessId)
.eq(ProcessFbEntryChange::getStandardNumber, map.get(FieldCommon.STANDARD_NUMBER)));
for (ProcessFbEntryChange processFbEntryChange : list) {
int count = processDraftService.count(
new LambdaQueryWrapper<ProcessDraft>()
.eq(ProcessDraft::getProjectId, processFbEntryChange.getId())
.and(qw -> qw.ne(ProcessDraft::getSaveSource, "3")
.or().isNull(ProcessDraft::getSaveSource)));
if (count == 0){
throw new JeroBootException("标准编号已入库或已发起入库流程,不可重复发起!");
}
}
}
}
/**
* @Author: liao
* @Date: 2023/11/6 14:52