|
@@ -40,7 +40,11 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
|
|
|
|
|
|
@Override
|
|
|
public Boolean updateInformationNumber(Long wbsId, Integer classify, Long contractId) {
|
|
|
- InformationQuery query = getInformationQueryByWbsId(wbsId, classify, contractId);
|
|
|
+ WbsTreeContract wbsTreeContract = getWbsTreeContractByPKeyId(wbsId);
|
|
|
+ if (wbsTreeContract == null || wbsTreeContract.getIsDeleted() == 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ InformationQuery query = getInformationQueryByWbsId(wbsId, classify, Long.parseLong(wbsTreeContract.getContractId()));
|
|
|
if (query == null || query.getStatus() == null) {
|
|
|
return false;
|
|
|
}
|
|
@@ -165,19 +169,21 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
|
|
|
createWbsTreeContractStatisticsChildren(wbsTreeContract, wbsTreeContractStatistics, parentList);
|
|
|
parentList.add(wbsTreeContractStatistics);
|
|
|
saveBatch(parentList);
|
|
|
- Set<String> ancestors = new HashSet<>();
|
|
|
+ Set<Long> ancestors = new HashSet<>();
|
|
|
for (WbsTreeContractStatistics statistics : parentList) {
|
|
|
- if (statistics.getIsLeaf() != 1 && statistics.getAncestors() != null) {
|
|
|
+ if (statistics.getAncestors() != null) {
|
|
|
String[] split = statistics.getAncestors().split(",");
|
|
|
for (String s : split) {
|
|
|
- if (!StringUtil.isNumeric(s)) {
|
|
|
+ if (!StringUtil.isNumeric(s) && s.equals("0")) {
|
|
|
continue;
|
|
|
}
|
|
|
- ancestors.add(s);
|
|
|
+ ancestors.add(Long.parseLong(s));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.baseMapper.updateLeafNum(String.join(",", ancestors));
|
|
|
+ if (!ancestors.isEmpty()) {
|
|
|
+ this.baseMapper.updateLeafNum(ancestors);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -192,7 +198,7 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
|
|
|
return transactionTemplate.execute(status -> {
|
|
|
this.baseMapper.updateDeleteStatus(id);
|
|
|
if (statistics.getIsLeaf() == 1) {
|
|
|
- this.baseMapper.updateLeafNum(statistics.getAncestors());
|
|
|
+ this.updateLeafNum(statistics.getAncestors());
|
|
|
}
|
|
|
return true;
|
|
|
});
|
|
@@ -208,14 +214,22 @@ public class WbsTreeContractStatisticsServiceImpl extends ServiceImpl<WbsTreeCon
|
|
|
return transactionTemplate.execute( status -> {
|
|
|
this.update(Wrappers.<WbsTreeContractStatistics>lambdaUpdate().set(WbsTreeContractStatistics::getIsDeleted, 1).in(WbsTreeContractStatistics::getId, ids));
|
|
|
// 2 更新父节点的子节点数
|
|
|
- this.baseMapper.updateLeafNum(statistics.getAncestors());
|
|
|
- return true;
|
|
|
+ return updateLeafNum(statistics.getAncestors());
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ public Boolean updateLeafNum(String ids) {
|
|
|
+ if (ids != null && !ids.isEmpty()) {
|
|
|
+ String[] split = ids.split(",");
|
|
|
+ Set<Long> ids1 = Arrays.stream(split).filter(StringUtil::isNumeric).map(Long::parseLong).filter(id -> id > 0).collect(Collectors.toSet());
|
|
|
+ return this.baseMapper.updateLeafNum(ids1);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public void createWbsTreeContractStatisticsParent(WbsTreeContract wbsTreeContract, WbsTreeContractStatistics wbsTreeContractStatistics, List<WbsTreeContractStatistics> wbsTreeContractStatisticsList) {
|
|
|
if (wbsTreeContract.getParentId() == null || wbsTreeContract.getParentId() <= 0) {
|
|
|
wbsTreeContractStatistics.setParentId(0L);
|