fix(87554): 标准解读流程--外来标准删除后,流程基础信息回显标准为空了

This commit is contained in:
yjz
2024-07-31 21:08:01 +08:00
parent db1c90bddb
commit af71b90c28
5 changed files with 69 additions and 0 deletions
@@ -1,13 +1,26 @@
package com.jero.modules.laws.standard.util;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.activiti.entity.ProcessAll;
import com.jero.modules.activiti.enums.ProcessStatusEnum;
import com.jero.modules.activiti.process.standardinterpret.entity.ProcessStandardInterpret;
import com.jero.modules.activiti.process.standardinterpret.service.ProcessStandardInterpretService;
import com.jero.modules.activiti.service.ProcessAllService;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.service.DoNotSplitStandardProvider;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Component
public class StandardUtil {
@@ -15,6 +28,18 @@ public class StandardUtil {
@Resource
private List<DoNotSplitStandardProvider> providers;
@Resource
private ISarFileSplitInfoService sarFileSplitInfoService;
@Resource
private ILawsDomesticStandardService lawsDomesticStandardService;
@Resource
private ProcessStandardInterpretService processStandardInterpretService;
@Resource
private ProcessAllService processAllService;
/**
* 判断是否可以删除
*
@@ -41,6 +66,40 @@ public class StandardUtil {
}
}
}
List<LawsDomesticStandard> list = lawsDomesticStandardService.list(
new LambdaQueryWrapper<LawsDomesticStandard>()
.select(LawsDomesticStandard::getStandardNumber)
.in(LawsDomesticStandard::getId, needDelStandardIdList));
if (CollectionUtils.isNotEmpty(list)){
// 查询拆分数据
List<String> standardNumberList = list.stream()
.map(LawsDomesticStandard::getStandardNumber)
.collect(Collectors.toList());
int count = sarFileSplitInfoService.count(
new LambdaQueryWrapper<SarFileSplitInfoEO>()
.in(SarFileSplitInfoEO::getStandardId, needDelStandardIdList)
.or().in(SarFileSplitInfoEO::getSerialNumber, standardNumberList));
if (count > 0) {
throw new JeroBootException(ResultCommon.SCC_DELETE_STANDARD_ERROR2);
}
// 查询标准解读流程
List<ProcessStandardInterpret> list1 = processStandardInterpretService.list(
new LambdaQueryWrapper<ProcessStandardInterpret>()
.in(ProcessStandardInterpret::getStandardId, needDelStandardIdList));
if (CollectionUtils.isNotEmpty(list1)){
List<String> projectIdList = list1.stream()
.map(ProcessStandardInterpret::getProjectId)
.collect(Collectors.toList());
int count1 = processAllService.count(new LambdaQueryWrapper<ProcessAll>()
.in(ProcessAll::getProjectId, projectIdList)
.ne(ProcessAll::getPrcStatus, ProcessStatusEnum.WITHDRAWN.getValue()));
if (count1 > 0) {
throw new JeroBootException(ResultCommon.SCC_DELETE_STANDARD_ERROR3);
}
}
}
}
}