|
@@ -1,6 +1,7 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -40,6 +41,8 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.IWbsTreeContractService;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
@@ -72,6 +75,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
private final InformationQueryClient informationQueryClient;
|
|
|
private final ContractClient contractClient;
|
|
|
+ @Autowired
|
|
|
+ StringRedisTemplate redisTemplate;
|
|
|
|
|
|
@Override
|
|
|
public List<WbsTreeContract> selectQueryCurrentNodeByAncestors(List<String> ids, String contractId) {
|
|
@@ -559,16 +564,27 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
@Override
|
|
|
public List<WbsTreeContractLazyVO> lazyQueryContractWbsTree(String id, String contractId, String contractIdRelation) {
|
|
|
if (ObjectUtil.isNotEmpty(contractId)) {
|
|
|
- //获取当前合同段名称
|
|
|
ContractInfo contractInfo = jdbcTemplate.query("select contract_name,contract_type from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (contractInfo != null) {
|
|
|
- //施工合同段
|
|
|
+ //TODO 施工合同段
|
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
|
+ //获取当前合同段所有缓存节点信息
|
|
|
+ List<WbsTreeContractLazyVO> nodesAll;
|
|
|
+ Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + contractId);
|
|
|
+ if (data != null) {
|
|
|
+ nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
+ } else {
|
|
|
+ nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND type = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where type = 1 and status = 1 and is_deleted = 0 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ if (nodesAll.size() > 0) {
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + contractId, JSON.toJSON(array).toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
//获取当前层懒加载节点
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select a.*,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
- if (lazyNodes.size() > 0) {
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.node_type != 111 and a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + contractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ if (lazyNodes.size() > 0 && nodesAll.size() > 0) {
|
|
|
//所有最底层节点
|
|
|
- List<WbsTreeContractLazyVO> lowestNodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND type = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where type = 1 and status = 1 and is_deleted = 0 and contract_id = " + contractId + " HAVING hasChildren = 0", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesAll = nodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.toList());
|
|
|
|
|
|
//获取当前合同段所有填报资料信息
|
|
|
List<WbsTreeContractLazyQueryInfoVO> queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
@@ -578,16 +594,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
//填报过的所有最底层节点
|
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = lowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
|
-
|
|
|
//获取所有填报过的父级节点,处理数量
|
|
|
- List<WbsTreeContractLazyVO> resultParentNodes = new ArrayList<>();
|
|
|
- this.recursiveGetParentNodes(resultParentNodes, lowestNodeParentIdsTB, contractId);
|
|
|
-
|
|
|
- //所有节点Map
|
|
|
- List<WbsTreeContractLazyVO> distinctResultParentNodes = resultParentNodes.stream().distinct().collect(Collectors.toList());
|
|
|
- Map<Long, WbsTreeContractLazyVO> nodeMap = new HashMap<>();
|
|
|
- for (WbsTreeContractLazyVO node : distinctResultParentNodes) {
|
|
|
- nodeMap.put(node.getId(), node);
|
|
|
+ List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
+ this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
+
|
|
|
+ //所有父级节点Map
|
|
|
+ Map<Long, WbsTreeContractLazyVO> nodesAllMap = new HashMap<>();
|
|
|
+ List<WbsTreeContractLazyVO> collect = resultParentNodesTB.stream().distinct().collect(Collectors.toList());
|
|
|
+ for (WbsTreeContractLazyVO node : collect) {
|
|
|
+ nodesAllMap.put(node.getId(), node);
|
|
|
}
|
|
|
|
|
|
//最底层节点Map
|
|
@@ -603,15 +618,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
})
|
|
|
.collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity(), (obj1, obj2) -> obj1));
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesReList = new ArrayList<>(lowestNodesMap.values());
|
|
|
|
|
|
//构造完成的所有最底层节点,处理父节点颜色
|
|
|
- this.recursiveParentNodeColorStatus(lowestNodesAll, nodeMap);
|
|
|
+ this.recursiveParentNodeColorStatus(lowestNodesReList, nodesAllMap);
|
|
|
|
|
|
//处理最终结果集
|
|
|
- if (lowestNodesAll.size() > 0) {
|
|
|
+ if (lazyNodes.size() > 0) {
|
|
|
//处理填报数量
|
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
|
- for (WbsTreeContractLazyVO node : resultParentNodes) {
|
|
|
+ for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
|
Long key = node.getPKeyId();
|
|
|
if (countMap.containsKey(key)) {
|
|
|
countMap.put(key, countMap.get(key) + 1);
|
|
@@ -632,9 +648,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
lazyNodeVO.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(lazyNodeVO.getPKeyId())) ? countMap.get(lazyNodeVO.getPKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(lazyNodeVO.getPKeyId())) ? 1 : 0));
|
|
|
|
|
|
- WbsTreeContractLazyVO vo = nodeMap.get(lazyNodeVO.getId());
|
|
|
+ WbsTreeContractLazyVO vo = nodesAllMap.get(lazyNodeVO.getId());
|
|
|
if (vo != null) {
|
|
|
- lazyNodeVO.setColorStatus(ObjectUtil.isNotEmpty(vo.getColorStatus()) ? vo.getColorStatus() : 1);
|
|
|
+ lazyNodeVO.setColorStatus(vo.getColorStatus());
|
|
|
} else {
|
|
|
WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(lazyNodeVO.getPKeyId());
|
|
|
lazyNodeVO.setColorStatus(ObjectUtil.isNotEmpty(lowestNode) ? lowestNode.getColorStatus() : 1);
|
|
@@ -645,9 +661,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
return lazyNodes;
|
|
|
}
|
|
|
|
|
|
+ //TODO 监理、业主合同段
|
|
|
} else if (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) {
|
|
|
List<WbsTreeContractLazyVO> lazyNodesAll = new ArrayList<>();
|
|
|
- //监理、总监办合同段
|
|
|
List<String> contractIds = new ArrayList<>();
|
|
|
if (ObjectUtil.isNotEmpty(contractIdRelation) && ObjectUtil.isNotEmpty(id)) {
|
|
|
//非根节点时选择加载施工合同段的树
|
|
@@ -659,12 +675,24 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
for (String sgContractId : contractIds) {
|
|
|
ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (sgContractInfo != null) {
|
|
|
- //获取当前层懒加载节点
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select a.*,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ //获取当前合同段所有缓存节点信息
|
|
|
+ List<WbsTreeContractLazyVO> nodesAll;
|
|
|
+ Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
|
|
|
+ if (data != null) {
|
|
|
+ nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
+ } else {
|
|
|
+ nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND type = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where type = 1 and status = 1 and is_deleted = 0 and contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ if (nodesAll.size() > 0) {
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + sgContractId, JSON.toJSON(array).toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (lazyNodes.size() > 0) {
|
|
|
+ //获取当前层懒加载节点
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.node_type != 111 and a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ if (lazyNodes.size() > 0 && nodesAll.size() > 0) {
|
|
|
//所有最底层节点
|
|
|
- List<WbsTreeContractLazyVO> lowestNodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND type = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where type = 1 and status = 1 and is_deleted = 0 and contract_id = " + sgContractId + " HAVING hasChildren = 0", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesAll = nodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.toList());
|
|
|
|
|
|
//获取当前合同段所有填报资料信息
|
|
|
List<WbsTreeContractLazyQueryInfoVO> queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
@@ -674,16 +702,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
//填报过的所有最底层节点
|
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = lowestNodesAll.stream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
List<Long> lowestNodeParentIdsTB = lowestNodesTB.stream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
|
|
|
-
|
|
|
//获取所有填报过的父级节点,处理数量
|
|
|
- List<WbsTreeContractLazyVO> resultParentNodes = new ArrayList<>();
|
|
|
- this.recursiveGetParentNodes(resultParentNodes, lowestNodeParentIdsTB, sgContractId);
|
|
|
-
|
|
|
- //所有节点Map
|
|
|
- List<WbsTreeContractLazyVO> distinctResultParentNodes = resultParentNodes.stream().distinct().collect(Collectors.toList());
|
|
|
- Map<Long, WbsTreeContractLazyVO> nodeMap = new HashMap<>();
|
|
|
- for (WbsTreeContractLazyVO node : distinctResultParentNodes) {
|
|
|
- nodeMap.put(node.getId(), node);
|
|
|
+ List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
+ this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
+
|
|
|
+ //所有父级节点Map
|
|
|
+ Map<Long, WbsTreeContractLazyVO> nodesAllMap = new HashMap<>();
|
|
|
+ List<WbsTreeContractLazyVO> collect = resultParentNodesTB.stream().distinct().collect(Collectors.toList());
|
|
|
+ for (WbsTreeContractLazyVO node : collect) {
|
|
|
+ nodesAllMap.put(node.getId(), node);
|
|
|
}
|
|
|
|
|
|
//最底层节点Map
|
|
@@ -699,15 +726,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
})
|
|
|
.collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity(), (obj1, obj2) -> obj1));
|
|
|
+ List<WbsTreeContractLazyVO> lowestNodesReList = new ArrayList<>(lowestNodesMap.values());
|
|
|
|
|
|
//构造完成的所有最底层节点,处理父节点颜色
|
|
|
- this.recursiveParentNodeColorStatus(lowestNodesAll, nodeMap);
|
|
|
+ this.recursiveParentNodeColorStatus(lowestNodesReList, nodesAllMap);
|
|
|
|
|
|
//处理最终结果集
|
|
|
- if (lowestNodesAll.size() > 0) {
|
|
|
+ if (lazyNodes.size() > 0) {
|
|
|
//处理填报数量
|
|
|
Map<Long, Integer> countMap = new HashMap<>();
|
|
|
- for (WbsTreeContractLazyVO node : resultParentNodes) {
|
|
|
+ for (WbsTreeContractLazyVO node : resultParentNodesTB) {
|
|
|
Long key = node.getPKeyId();
|
|
|
if (countMap.containsKey(key)) {
|
|
|
countMap.put(key, countMap.get(key) + 1);
|
|
@@ -729,9 +757,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
lazyNodeVO.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(lazyNodeVO.getPKeyId())) ? countMap.get(lazyNodeVO.getPKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(lazyNodeVO.getPKeyId())) ? queryInfoMaps.get(lazyNodeVO.getPKeyId()) : 0));
|
|
|
|
|
|
- WbsTreeContractLazyVO vo = nodeMap.get(lazyNodeVO.getId());
|
|
|
+ WbsTreeContractLazyVO vo = nodesAllMap.get(lazyNodeVO.getId());
|
|
|
if (vo != null) {
|
|
|
- lazyNodeVO.setColorStatus(ObjectUtil.isNotEmpty(vo.getColorStatus()) ? vo.getColorStatus() : 1);
|
|
|
+ lazyNodeVO.setColorStatus(vo.getColorStatus());
|
|
|
} else {
|
|
|
WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(lazyNodeVO.getPKeyId());
|
|
|
lazyNodeVO.setColorStatus(ObjectUtil.isNotEmpty(lowestNode) ? lowestNode.getColorStatus() : 1);
|
|
@@ -754,9 +782,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
*
|
|
|
* @param result 结果集
|
|
|
* @param lowestNodeParentIds 最底层节点ParentIds
|
|
|
- * @param contractId 施工合同段id
|
|
|
+ * @param nodesAll 所有节点
|
|
|
*/
|
|
|
- private void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, String contractId) {
|
|
|
+ private void recursiveGetParentNodes(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
|
|
|
if (lowestNodeParentIds.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
@@ -779,7 +807,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
//批量查询单次节点
|
|
|
List<WbsTreeContractLazyVO> parentNodes = new ArrayList<>();
|
|
|
if (keysWithValueOne.size() > 0) {
|
|
|
- parentNodes = jdbcTemplate.query("select p_key_id,id,parent_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and type = 1 and id in (" + StringUtils.join(keysWithValueOne, ",") + ") and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ parentNodes = nodesAll.stream().filter(f -> keysWithValueOne.contains(f.getId().toString())).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
//批量查询多次节点
|
|
@@ -788,7 +816,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
Long key = entry.getKey();
|
|
|
Long count = entry.getValue();
|
|
|
|
|
|
- List<WbsTreeContractLazyVO> nodes = jdbcTemplate.query("select p_key_id,id,parent_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and type = 1 and id = " + key + " and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ 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)));
|
|
|
}
|
|
@@ -802,7 +830,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
if (!collect.isEmpty()) {
|
|
|
result.addAll(parentNodes);
|
|
|
result.addAll(multipleParentNodes);
|
|
|
- this.recursiveGetParentNodes(result, collect, contractId);
|
|
|
+ this.recursiveGetParentNodes(result, collect, nodesAll);
|
|
|
}
|
|
|
}
|
|
|
|