|
@@ -35,6 +35,7 @@ import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringPool;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.manager.dto.FormElementDTO;
|
|
|
import org.springblade.manager.dto.WbsTreeBatchImportDTO;
|
|
|
import org.springblade.manager.dto.WbsTreeContractDTO;
|
|
@@ -56,6 +57,7 @@ import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* 服务实现类
|
|
@@ -73,6 +75,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
private final WbsTreePrivateServiceImpl wbsTreePrivateService;
|
|
|
private final ProjectInfoMapper projectInfoMapper;
|
|
|
+ private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
|
+ private final ContractInfoMapper contractInfoMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -756,9 +760,49 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
});
|
|
|
}
|
|
|
if (pawDTO.getReferenceType().equals("public")) {
|
|
|
+ //判断是否被合同段引用
|
|
|
+ List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getWbsId, pawDTO.getWbsId())
|
|
|
+ .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
+ .eq(WbsTreeContract::getParentId, 0)
|
|
|
+ );
|
|
|
+ if (wbsTreeContract.size() > 0) {
|
|
|
+ List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
+ wbsTreeContract.stream().forEach(list -> {
|
|
|
+ ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
+ .eq(ContractInfo::getId, list.getContractId())
|
|
|
+ );
|
|
|
+ contractInfoArrayList.add(contractInfos);
|
|
|
+ });
|
|
|
+ List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
+ if (wbsTreeContract.size() > 0) {
|
|
|
+ String join = StringUtils.join(names, ",");
|
|
|
+ throw new ServiceException(StringUtil.format("当前项目wbs树已被合同段 {} 引用中,请先取消合同段关联后再删除", join));
|
|
|
+ }
|
|
|
+ }
|
|
|
baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
|
baseMapper.deleteBatch2(ids1, pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
|
} else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
+ //判断是否被合同段引用
|
|
|
+ List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getWbsId, pawDTO.getPrimaryKeyId())
|
|
|
+ .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
+ .eq(WbsTreeContract::getParentId, 0)
|
|
|
+ );
|
|
|
+ if (wbsTreeContract.size() > 0) {
|
|
|
+ List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
+ wbsTreeContract.stream().forEach(list -> {
|
|
|
+ ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
+ .eq(ContractInfo::getId, list.getContractId())
|
|
|
+ );
|
|
|
+ contractInfoArrayList.add(contractInfos);
|
|
|
+ });
|
|
|
+ List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
+ if (wbsTreeContract.size() > 0) {
|
|
|
+ String join = StringUtils.join(names, ",");
|
|
|
+ throw new ServiceException(StringUtil.format("当前项目wbs树已被合同段 {} 引用中,请先取消合同段关联后再删除", join));
|
|
|
+ }
|
|
|
+ }
|
|
|
baseMapper.deleteBatch(ids2, pawDTO.getPrimaryKeyId(), pawDTO.getProjectId());
|
|
|
baseMapper.deleteBatch2(ids2, pawDTO.getPrimaryKeyId(), pawDTO.getProjectId());
|
|
|
}
|