|
@@ -1013,24 +1013,20 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
if (pawDTO.getReferenceType().equals("public")) {
|
|
if (pawDTO.getReferenceType().equals("public")) {
|
|
List<Long> ids1 = delIds.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
List<Long> ids1 = delIds.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
//判断是否被合同段引用
|
|
//判断是否被合同段引用
|
|
- List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
|
- .eq(WbsTreeContract::getWbsId, pawDTO.getWbsId())
|
|
|
|
- .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
|
- .eq(WbsTreeContract::getParentId, 0)
|
|
|
|
- );
|
|
|
|
|
|
+ List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectContractList(pawDTO.getWbsId(),pawDTO.getProjectId(),ids1);
|
|
|
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
|
|
|
+ if (wbsTreeContractList.size() > 0) {
|
|
List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
- wbsTreeContract.stream().forEach(list -> {
|
|
|
|
|
|
+ wbsTreeContractList.stream().forEach(list -> {
|
|
ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
.eq(ContractInfo::getId, list.getContractId())
|
|
.eq(ContractInfo::getId, list.getContractId())
|
|
);
|
|
);
|
|
contractInfoArrayList.add(contractInfos);
|
|
contractInfoArrayList.add(contractInfos);
|
|
});
|
|
});
|
|
- List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
|
|
|
+ List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
|
+ if (wbsTreeContractList.size() > 0) {
|
|
String join = StringUtils.join(names, ",");
|
|
String join = StringUtils.join(names, ",");
|
|
- throw new ServiceException(StringUtil.format("当前项目wbs树已被 {} 引用中,删除失败", join));
|
|
|
|
|
|
+ throw new ServiceException(StringUtil.format("当前项目wbs树的节点已被 {} 引用中,删除失败", join));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1040,24 +1036,20 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
} else if (pawDTO.getReferenceType().equals("private")) {
|
|
} else if (pawDTO.getReferenceType().equals("private")) {
|
|
List<Long> ids2 = delIds.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
List<Long> ids2 = delIds.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
//判断是否被合同段引用
|
|
//判断是否被合同段引用
|
|
- List<WbsTreeContract> wbsTreeContract = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
|
- .eq(WbsTreeContract::getWbsId, pawDTO.getPrimaryKeyId())
|
|
|
|
- .eq(WbsTreeContract::getProjectId, pawDTO.getProjectId())
|
|
|
|
- .eq(WbsTreeContract::getParentId, 0)
|
|
|
|
- );
|
|
|
|
|
|
+ List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectContractList(pawDTO.getPrimaryKeyId(), pawDTO.getProjectId(), ids2);
|
|
|
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
|
|
|
+ if (wbsTreeContractList.size() > 0) {
|
|
List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
- wbsTreeContract.stream().forEach(list -> {
|
|
|
|
|
|
+ wbsTreeContractList.stream().forEach(list -> {
|
|
ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
.eq(ContractInfo::getId, list.getContractId())
|
|
.eq(ContractInfo::getId, list.getContractId())
|
|
);
|
|
);
|
|
contractInfoArrayList.add(contractInfos);
|
|
contractInfoArrayList.add(contractInfos);
|
|
});
|
|
});
|
|
- List<String> names = contractInfoArrayList.stream().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
|
- if (wbsTreeContract.size() > 0) {
|
|
|
|
|
|
+ List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
|
+ if (wbsTreeContractList.size() > 0) {
|
|
String join = StringUtils.join(names, ",");
|
|
String join = StringUtils.join(names, ",");
|
|
- throw new ServiceException(StringUtil.format("当前项目wbs树已被 {} 引用中,删除失败", join));
|
|
|
|
|
|
+ throw new ServiceException(StringUtil.format("当前项目wbs树的节点已被 {} 引用中,删除失败", join));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|