|
@@ -458,40 +458,49 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
tableOwnerList = Func.toStrList(tableOwners);
|
|
|
}
|
|
|
List<AppWbsTreeContractVO> resultTabs = baseMapper.selectWbsTreeContractList(tableOwnerNumbers, wbsTreeContract.getProjectId(), wbsTreeContract.getWbsId(), wbsTreeContract.getContractId(), wbsTreeContract.getId(), wbsTreeContract.getContractIdRelation(), tableOwnerList);
|
|
|
- return this.sortTabs(resultTabs);
|
|
|
+ /*List<AppWbsTreeContractVO> sortTabsCopyResult = this.sortTabsCopy(resultTabs);
|
|
|
+ return this.sortTabsPL(sortTabsCopyResult);*/
|
|
|
+ List<AppWbsTreeContractVO> r = sortTabs(resultTabs, "__");
|
|
|
+ return this.sortTabs(resultTabs, "_PL_");
|
|
|
}
|
|
|
|
|
|
- private List<AppWbsTreeContractVO> sortTabs(List<AppWbsTreeContractVO> tabs) {
|
|
|
- List<AppWbsTreeContractVO> tabsWithPL = new ArrayList<>();
|
|
|
- List<AppWbsTreeContractVO> tabsWithoutPL = new ArrayList<>();
|
|
|
- //分离带有_PL_关键字和不带关键字的数据
|
|
|
+ /**
|
|
|
+ * 元素表排序
|
|
|
+ *
|
|
|
+ * @param tabs
|
|
|
+ * @param keyword
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<AppWbsTreeContractVO> sortTabs(List<AppWbsTreeContractVO> tabs, String keyword) {
|
|
|
+ List<AppWbsTreeContractVO> tabsWithKeyword = new ArrayList<>();
|
|
|
+ List<AppWbsTreeContractVO> tabsWithoutKeyword = new ArrayList<>();
|
|
|
+ //分离带有关键字和不带关键字的数据
|
|
|
for (AppWbsTreeContractVO tab : tabs) {
|
|
|
- if (tab.getNodeName().contains("_PL_")) {
|
|
|
- tabsWithPL.add(tab);
|
|
|
+ if (tab.getNodeName().contains(keyword)) {
|
|
|
+ tabsWithKeyword.add(tab);
|
|
|
} else {
|
|
|
- tabsWithoutPL.add(tab);
|
|
|
+ tabsWithoutKeyword.add(tab);
|
|
|
}
|
|
|
}
|
|
|
- //如果没有带有_PL_关键字的数据,直接返回原列表
|
|
|
- if (tabsWithPL.isEmpty()) {
|
|
|
- return tabsWithoutPL;
|
|
|
+ //如果没有带有关键字的数据,直接返回原列表
|
|
|
+ if (tabsWithKeyword.isEmpty()) {
|
|
|
+ return tabsWithoutKeyword;
|
|
|
}
|
|
|
- //将带有_PL_关键字的数据插入到对应表名后面
|
|
|
+ //将带有关键字的数据插入到对应表名后面
|
|
|
List<AppWbsTreeContractVO> sortedTabs = new ArrayList<>();
|
|
|
- for (AppWbsTreeContractVO tabWithoutPL : tabsWithoutPL) {
|
|
|
- sortedTabs.add(tabWithoutPL);
|
|
|
- String tabName = tabWithoutPL.getNodeName();
|
|
|
- String tabNameWithPLPrefix = tabName + "_PL_";
|
|
|
- for (AppWbsTreeContractVO tabWithPL : tabsWithPL) {
|
|
|
- if (tabWithPL.getNodeName().startsWith(tabNameWithPLPrefix)) {
|
|
|
- sortedTabs.add(tabWithPL);
|
|
|
+ for (AppWbsTreeContractVO tabWithoutKeyword : tabsWithoutKeyword) {
|
|
|
+ sortedTabs.add(tabWithoutKeyword);
|
|
|
+ String tabName = tabWithoutKeyword.getNodeName();
|
|
|
+ String tabNameWithKeywordPrefix = tabName + keyword;
|
|
|
+ for (AppWbsTreeContractVO tabWithKeyword : tabsWithKeyword) {
|
|
|
+ if (tabWithKeyword.getNodeName().startsWith(tabNameWithKeywordPrefix)) {
|
|
|
+ sortedTabs.add(tabWithKeyword);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return sortedTabs;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public List<WbsTreeContract> searchParentAllNode(long primaryKeyId, Long contractId) {
|
|
|
return baseMapper.searchParentAllNode(primaryKeyId, contractId);
|
|
@@ -689,7 +698,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
} else {
|
|
|
queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
|
}
|
|
|
- Map<Long, Integer> queryInfoMaps = queryInfoList.stream()
|
|
|
+ Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
|
|
|
@@ -820,7 +829,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
} else {
|
|
|
queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + sgContractId + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
|
}
|
|
|
- Map<Long, Integer> queryInfoMaps = queryInfoList.stream()
|
|
|
+ Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
|
|
|
@@ -943,6 +952,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and is_deleted = 0 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
|
|
|
//最底层节点与存储文件数量map
|
|
|
Map<Long, Integer> queryFileMaps = queryFileList.stream()
|
|
|
+ .filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
|
.collect(Collectors.groupingBy(
|
|
|
WbsTreeContractLazyFileVO::getWbsId,
|
|
|
Collectors.collectingAndThen(Collectors.toList(), List::size)
|
|
@@ -1048,6 +1058,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
|
|
|
//最底层节点与存储文件数量map
|
|
|
Map<Long, Integer> queryFileMaps = queryFileList.stream()
|
|
|
+ .filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
|
.collect(Collectors.groupingBy(
|
|
|
WbsTreeContractLazyFileVO::getWbsId,
|
|
|
Collectors.collectingAndThen(Collectors.toList(), List::size)
|
|
@@ -1322,56 +1333,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void recursiveGetParentNodes2(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
|
- if (lowestNodeParentIds.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //父级Id与出现的次数Map
|
|
|
- Map<Long, Long> parentIdGroup = lowestNodeParentIds.stream()
|
|
|
- .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
|
|
|
-
|
|
|
- List<String> keysWithValueOne = new ArrayList<>();
|
|
|
- Map<Long, Long> keysWithValueSome = new HashMap<>();
|
|
|
-
|
|
|
- for (Map.Entry<Long, Long> entry : parentIdGroup.entrySet()) {
|
|
|
- if (entry.getValue() == 1L) {
|
|
|
- keysWithValueOne.add(entry.getKey().toString());
|
|
|
- } else {
|
|
|
- keysWithValueSome.put(entry.getKey(), entry.getValue());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //批量查询单次节点
|
|
|
- List<WbsTreeContractLazyVO> parentNodes = new ArrayList<>();
|
|
|
- if (keysWithValueOne.size() > 0) {
|
|
|
- parentNodes = nodesAll.stream().filter(f -> keysWithValueOne.contains(f.getId().toString())).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- //批量查询多次节点
|
|
|
- List<WbsTreeContractLazyVO> multipleParentNodes = new ArrayList<>();
|
|
|
- for (Map.Entry<Long, Long> entry : keysWithValueSome.entrySet()) {
|
|
|
- Long key = entry.getKey();
|
|
|
- Long count = entry.getValue();
|
|
|
-
|
|
|
- List<WbsTreeContractLazyVO> nodes = nodesAll.stream().filter(f -> key.equals(f.getId())).collect(Collectors.toList());
|
|
|
- if (!nodes.isEmpty()) {
|
|
|
- multipleParentNodes.addAll(Collections.nCopies(count.intValue(), nodes.get(0)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //结果集
|
|
|
- List<Long> collect = Stream.concat(parentNodes.stream(), multipleParentNodes.stream())
|
|
|
- .map(WbsTreeContractLazyVO::getParentId)
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- if (!collect.isEmpty()) {
|
|
|
- result.addAll(parentNodes);
|
|
|
- result.addAll(multipleParentNodes);
|
|
|
- this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 反向递归处理父节点颜色
|
|
|
*/
|