|
@@ -68,6 +68,11 @@ import java.util.stream.Stream;
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractMapper, WbsTreeContract> implements IWbsTreeContractService {
|
|
public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractMapper, WbsTreeContract> implements IWbsTreeContractService {
|
|
|
|
|
|
|
|
+ static {
|
|
|
|
+ /*parallelStream并行流粒度*/
|
|
|
|
+ System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "4");
|
|
|
|
+ }
|
|
|
|
+
|
|
private static final Logger logger = LoggerFactory.getLogger(WbsTreeContractServiceImpl.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(WbsTreeContractServiceImpl.class);
|
|
private final ConstructionLedgerFeignClient constructionLedgerFeign;
|
|
private final ConstructionLedgerFeignClient constructionLedgerFeign;
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
@@ -773,8 +778,13 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
//获取本地缓存节点数量统计
|
|
//获取本地缓存节点数量统计
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = this.getCachedParentCountNodes(contractId, lowestNodeParentIdsTB, nodesAll, tableOwner);
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = this.getCachedParentCountNodes(contractId, lowestNodeParentIdsTB, nodesAll, tableOwner);
|
|
- //List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
|
- //this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
|
|
+
|
|
|
|
+ /*List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
|
+ long startTime1 = System.currentTimeMillis();
|
|
|
|
+ this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
+ long endTime1 = System.currentTimeMillis();
|
|
|
|
+ long executionTime1 = endTime1 - startTime1;
|
|
|
|
+ logger.info("合同段 " + contractId + " wbs节点树 数量计算 耗时:" + executionTime1 + " ms");*/
|
|
|
|
|
|
//最底层节点颜色构造后Map
|
|
//最底层节点颜色构造后Map
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
@@ -1542,24 +1552,24 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
* @param lowestNodeParentIds 最底层节点ParentIds
|
|
* @param lowestNodeParentIds 最底层节点ParentIds
|
|
* @param nodesAll 所有节点
|
|
* @param nodesAll 所有节点
|
|
*/
|
|
*/
|
|
- /*public void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
|
|
|
|
+ public void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
if (lowestNodeParentIds.isEmpty()) {
|
|
if (lowestNodeParentIds.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
//父级Id与出现的次数Map
|
|
//父级Id与出现的次数Map
|
|
- Map<Long, Long> parentIdGroup = lowestNodeParentIds.stream()
|
|
|
|
|
|
+ Map<Long, Long> parentIdGroup = lowestNodeParentIds.parallelStream()
|
|
.collect(Collectors.groupingByConcurrent(Function.identity(), Collectors.counting()));
|
|
.collect(Collectors.groupingByConcurrent(Function.identity(), Collectors.counting()));
|
|
|
|
|
|
//批量查询单次节点
|
|
//批量查询单次节点
|
|
- List<WbsTreeContractLazyVO> parentNodes = parentIdGroup.entrySet().stream()
|
|
|
|
|
|
+ List<WbsTreeContractLazyVO> parentNodes = parentIdGroup.entrySet().parallelStream()
|
|
.filter(entry -> entry.getValue() == 1L)
|
|
.filter(entry -> entry.getValue() == 1L)
|
|
.flatMap(entry -> nodesAll.stream()
|
|
.flatMap(entry -> nodesAll.stream()
|
|
.filter(f -> entry.getKey().equals(f.getId())))
|
|
.filter(f -> entry.getKey().equals(f.getId())))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
//批量查询多次节点
|
|
//批量查询多次节点
|
|
- List<WbsTreeContractLazyVO> multipleParentNodes = parentIdGroup.entrySet().stream()
|
|
|
|
|
|
+ List<WbsTreeContractLazyVO> multipleParentNodes = parentIdGroup.entrySet().parallelStream()
|
|
.filter(entry -> entry.getValue() > 1L)
|
|
.filter(entry -> entry.getValue() > 1L)
|
|
.flatMap(entry -> nodesAll.stream()
|
|
.flatMap(entry -> nodesAll.stream()
|
|
.filter(f -> entry.getKey().equals(f.getId()))
|
|
.filter(f -> entry.getKey().equals(f.getId()))
|
|
@@ -1577,9 +1587,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
result.addAll(multipleParentNodes);
|
|
result.addAll(multipleParentNodes);
|
|
this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
}
|
|
}
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- public void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
|
|
|
|
+ /*public void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
if (lowestNodeParentIds.isEmpty()) {
|
|
if (lowestNodeParentIds.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -1622,7 +1632,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
result.addAll(multipleParentNodesFuture.join());
|
|
result.addAll(multipleParentNodesFuture.join());
|
|
this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean syncTabData(String pKeyId) throws Exception {
|
|
public boolean syncTabData(String pKeyId) throws Exception {
|