|
@@ -14,6 +14,8 @@ import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.select.Elements;
|
|
import org.jsoup.select.Elements;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
import org.springblade.business.feign.ConstructionLedgerFeignClient;
|
|
import org.springblade.business.feign.ConstructionLedgerFeignClient;
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
@@ -25,7 +27,6 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
-import org.springblade.core.secure.utils.SecureUtil;
|
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.manager.bean.NodeVO;
|
|
import org.springblade.manager.bean.NodeVO;
|
|
@@ -52,10 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.LinkedCaseInsensitiveMap;
|
|
import org.springframework.util.LinkedCaseInsensitiveMap;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
-import java.io.FileInputStream;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.io.InputStream;
|
|
|
|
|
|
+import java.io.*;
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -69,6 +67,7 @@ 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 {
|
|
|
|
|
|
|
|
+ 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;
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
@@ -79,6 +78,10 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
@Autowired
|
|
@Autowired
|
|
StringRedisTemplate redisTemplate;
|
|
StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
+ //存储当前合同段contractId对应的合同段树
|
|
|
|
+ private final Map<String, List<WbsTreeContractLazyVO>> localCacheNodes = new ConcurrentHashMap<>();
|
|
|
|
+ //存储当前合同段contractId_tableOwner对应的资料查询信息缓存
|
|
|
|
+ private final Map<String, List<WbsTreeContractLazyQueryInfoVO>> localCacheQueryInfos = new ConcurrentHashMap<>();
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<WbsTreeContract> selectQueryCurrentNodeByAncestors(List<String> ids, String contractId) {
|
|
public List<WbsTreeContract> selectQueryCurrentNodeByAncestors(List<String> ids, String contractId) {
|
|
@@ -682,52 +685,55 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
@Override
|
|
@Override
|
|
public List<WbsTreeContractLazyVO> lazyQueryContractWbsTree(String id, String contractId, String contractIdRelation, String tableOwner) {
|
|
public List<WbsTreeContractLazyVO> lazyQueryContractWbsTree(String id, String contractId, String contractIdRelation, String tableOwner) {
|
|
if (ObjectUtil.isNotEmpty(contractId)) {
|
|
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);
|
|
|
|
|
|
+ ContractInfo contractInfo = contractInfoMapper.selectOne(Wrappers.<ContractInfo>lambdaQuery().select(ContractInfo::getContractName, ContractInfo::getContractType).eq(ContractInfo::getId, contractId));
|
|
if (contractInfo != null) {
|
|
if (contractInfo != null) {
|
|
//TODO ************ 施工合同段 ************
|
|
//TODO ************ 施工合同段 ************
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
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 {*/
|
|
|
|
-
|
|
|
|
- //long startTime1 = System.currentTimeMillis();
|
|
|
|
-
|
|
|
|
- /*开启mybatis-plus二级缓存*/
|
|
|
|
- List<WbsTreeContract> wbsTreeContracts = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .select(WbsTreeContract::getId, WbsTreeContract::getPKeyId, WbsTreeContract::getParentId)
|
|
|
|
- .eq(WbsTreeContract::getType, 1)
|
|
|
|
- .eq(WbsTreeContract::getStatus, 1)
|
|
|
|
- .eq(WbsTreeContract::getContractId, contractId)
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- /*long endTime1 = System.currentTimeMillis();
|
|
|
|
- long executionTime1 = endTime1 - startTime1;
|
|
|
|
- System.out.println("1111111111111:" + executionTime1);*/
|
|
|
|
-
|
|
|
|
- nodesAll = BeanUtil.copyProperties(wbsTreeContracts, WbsTreeContractLazyVO.class);
|
|
|
|
-
|
|
|
|
- //nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
- if (nodesAll.size() > 0) {
|
|
|
|
- //判断是否有子级,赋值
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
- for (WbsTreeContractLazyVO vo : nodesAll) {
|
|
|
|
- if (vo.getParentId() == 0) {
|
|
|
|
- vo.setHasChildren(1);
|
|
|
|
- }
|
|
|
|
- List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
|
|
|
|
- if (childNodes != null && childNodes.size() > 0) {
|
|
|
|
- vo.setHasChildren(1);
|
|
|
|
- } else {
|
|
|
|
- vo.setHasChildren(0);
|
|
|
|
|
|
+ /*获取本地缓存*/
|
|
|
|
+ List<WbsTreeContractLazyVO> nodesAll = localCacheNodes.get(contractId);
|
|
|
|
+
|
|
|
|
+ if (nodesAll == null || nodesAll.size() == 0) {
|
|
|
|
+
|
|
|
|
+ //获取当前合同段所有缓存节点信息
|
|
|
|
+ Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + contractId);
|
|
|
|
+ if (data != null) {
|
|
|
|
+ //从Redis获取数据
|
|
|
|
+ nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
|
+ /*更新本地缓存*/
|
|
|
|
+ localCacheNodes.put(contractId, nodesAll);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ long startTime1 = System.currentTimeMillis();
|
|
|
|
+
|
|
|
|
+ nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+
|
|
|
|
+ long endTime1 = System.currentTimeMillis();
|
|
|
|
+ long executionTime1 = endTime1 - startTime1;
|
|
|
|
+ logger.info("查询合同段" + contractId + "所有树执行时间:" + executionTime1 + " ms");
|
|
|
|
+
|
|
|
|
+ if (nodesAll.size() > 0) {
|
|
|
|
+ //判断是否有子级,赋值
|
|
|
|
+ Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
+ for (WbsTreeContractLazyVO vo : nodesAll) {
|
|
|
|
+ if (vo.getParentId() == 0) {
|
|
|
|
+ vo.setHasChildren(1);
|
|
|
|
+ }
|
|
|
|
+ List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
|
|
|
|
+ if (childNodes != null && childNodes.size() > 0) {
|
|
|
|
+ vo.setHasChildren(1);
|
|
|
|
+ } else {
|
|
|
|
+ vo.setHasChildren(0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /*更新本地缓存*/
|
|
|
|
+ localCacheNodes.put(contractId, nodesAll);
|
|
|
|
+
|
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
|
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + contractId, JSON.toJSON(array).toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- /*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 p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id) AS drawingsId,id,parent_id,node_type,type,wbs_type,is_concrete,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));
|
|
List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id) AS drawingsId,id,parent_id,node_type,type,wbs_type,is_concrete,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));
|
|
@@ -746,7 +752,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
));
|
|
));
|
|
|
|
|
|
//获取当前合同段所有填报资料缓存信息
|
|
//获取当前合同段所有填报资料缓存信息
|
|
- List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
|
|
|
|
|
|
+ List<WbsTreeContractLazyQueryInfoVO> queryInfoList = this.getQueryInfoList(contractId, tableOwner);
|
|
|
|
+ /*List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
|
|
Object dataInformationQuery;
|
|
Object dataInformationQuery;
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1");
|
|
dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1");
|
|
@@ -769,25 +776,24 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
|
|
|
|
-
|
|
|
|
//TODO 处理数量
|
|
//TODO 处理数量
|
|
//填报过的所有最底层节点
|
|
//填报过的所有最底层节点
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
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 = new ArrayList<>();
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
|
|
|
|
|
|
- //long startTime2 = System.currentTimeMillis();
|
|
|
|
|
|
+ long startTime2 = System.currentTimeMillis();
|
|
|
|
|
|
this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
|
|
- /*long endTime2 = System.currentTimeMillis();
|
|
|
|
|
|
+ long endTime2 = System.currentTimeMillis();
|
|
long executionTime2 = endTime2 - startTime2;
|
|
long executionTime2 = endTime2 - startTime2;
|
|
- System.out.println("2222222222222:" + executionTime2);*/
|
|
|
|
|
|
+ logger.info("recursiveGetParentNodes 处理数量 执行时间:" + executionTime2 + " ms");
|
|
|
|
|
|
//最底层节点颜色构造后Map
|
|
//最底层节点颜色构造后Map
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
@@ -803,7 +809,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
|
|
|
|
- //long startTime3 = System.currentTimeMillis();
|
|
|
|
|
|
+ long startTime3 = System.currentTimeMillis();
|
|
|
|
+
|
|
//TODO 处理颜色
|
|
//TODO 处理颜色
|
|
//先将WbsTreeContractLazyVO转为NodeVO
|
|
//先将WbsTreeContractLazyVO转为NodeVO
|
|
List<NodeVO> nodeVOList = distinctNodesAll.stream().map(this::convertToNodeVO).collect(Collectors.toList());
|
|
List<NodeVO> nodeVOList = distinctNodesAll.stream().map(this::convertToNodeVO).collect(Collectors.toList());
|
|
@@ -818,9 +825,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
//获取所有节点颜色Map
|
|
//获取所有节点颜色Map
|
|
Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
|
|
Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
|
|
|
|
|
|
- /*long endTime3 = System.currentTimeMillis();
|
|
|
|
- long executionTime3 = endTime3- startTime3;
|
|
|
|
- System.out.println("3333333333333:" + executionTime3);*/
|
|
|
|
|
|
+ long endTime3 = System.currentTimeMillis();
|
|
|
|
+ long executionTime3 = endTime3 - startTime3;
|
|
|
|
+ logger.info("处理颜色执行时间:" + executionTime3 + " ms");
|
|
|
|
|
|
//TODO 处理最终结果集
|
|
//TODO 处理最终结果集
|
|
if (lazyNodes.size() > 0) {
|
|
if (lazyNodes.size() > 0) {
|
|
@@ -881,41 +888,43 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
for (String sgContractId : contractIds) {
|
|
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);
|
|
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) {
|
|
if (sgContractInfo != null) {
|
|
- //获取当前合同段所有缓存节点信息
|
|
|
|
- List<WbsTreeContractLazyVO> nodesAll;
|
|
|
|
- /*Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
|
|
|
|
- if (data != null) {
|
|
|
|
- nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
|
- } else {*/
|
|
|
|
|
|
+ /*获取本地缓存*/
|
|
|
|
+ List<WbsTreeContractLazyVO> nodesAll = localCacheNodes.get(sgContractId);
|
|
|
|
|
|
- List<WbsTreeContract> wbsTreeContracts = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .select(WbsTreeContract::getId, WbsTreeContract::getPKeyId, WbsTreeContract::getParentId)
|
|
|
|
- .eq(WbsTreeContract::getType, 1)
|
|
|
|
- .eq(WbsTreeContract::getStatus, 1)
|
|
|
|
- .eq(WbsTreeContract::getContractId, sgContractId)
|
|
|
|
- );
|
|
|
|
- nodesAll = BeanUtil.copyProperties(wbsTreeContracts, WbsTreeContractLazyVO.class);
|
|
|
|
|
|
+ if (nodesAll == null || nodesAll.size() == 0) {
|
|
|
|
|
|
- //nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
- if (nodesAll.size() > 0) {
|
|
|
|
- //判断是否有子级,赋值
|
|
|
|
- Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
- for (WbsTreeContractLazyVO vo : nodesAll) {
|
|
|
|
- if (vo.getParentId() == 0) {
|
|
|
|
- vo.setHasChildren(1);
|
|
|
|
- }
|
|
|
|
- List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
|
|
|
|
- if (childNodes != null && childNodes.size() > 0) {
|
|
|
|
- vo.setHasChildren(1);
|
|
|
|
- } else {
|
|
|
|
- vo.setHasChildren(0);
|
|
|
|
|
|
+ //获取当前合同段所有缓存节点信息
|
|
|
|
+ Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
|
|
|
|
+ if (data != null) {
|
|
|
|
+ //从Redis获取数据
|
|
|
|
+ nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
|
+ /*更新本地缓存*/
|
|
|
|
+ localCacheNodes.put(sgContractId, nodesAll);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+ if (nodesAll.size() > 0) {
|
|
|
|
+ //判断是否有子级,赋值
|
|
|
|
+ Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
|
|
+ for (WbsTreeContractLazyVO vo : nodesAll) {
|
|
|
|
+ if (vo.getParentId() == 0) {
|
|
|
|
+ vo.setHasChildren(1);
|
|
|
|
+ }
|
|
|
|
+ List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
|
|
|
|
+ if (childNodes != null && childNodes.size() > 0) {
|
|
|
|
+ vo.setHasChildren(1);
|
|
|
|
+ } else {
|
|
|
|
+ vo.setHasChildren(0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /*更新本地缓存*/
|
|
|
|
+ localCacheNodes.put(sgContractId, nodesAll);
|
|
|
|
+
|
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
|
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + sgContractId, JSON.toJSON(array).toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- /*JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
|
|
|
|
- redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + sgContractId, JSON.toJSON(array).toString());*/
|
|
|
|
}
|
|
}
|
|
- //}
|
|
|
|
|
|
|
|
//获取当前层懒加载节点
|
|
//获取当前层懒加载节点
|
|
List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id) AS drawingsId,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));
|
|
List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id) AS drawingsId,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));
|
|
@@ -934,7 +943,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
));
|
|
));
|
|
|
|
|
|
//获取当前合同段所有填报资料缓存信息
|
|
//获取当前合同段所有填报资料缓存信息
|
|
- List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
|
|
|
|
|
|
+ List<WbsTreeContractLazyQueryInfoVO> queryInfoList = this.getQueryInfoList(sgContractId, tableOwner);
|
|
|
|
+ /*List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
|
|
Object dataInformationQuery;
|
|
Object dataInformationQuery;
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_1");
|
|
dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_1");
|
|
@@ -945,7 +955,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
|
|
queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
|
|
} else {
|
|
} else {
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
if (ObjectUtil.isEmpty(tableOwner)) {
|
|
- queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
|
|
|
|
+ queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + sgContractId + " and classify = 1", new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
if (queryInfoList.size() > 0) {
|
|
if (queryInfoList.size() > 0) {
|
|
JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
|
|
JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_1", JSON.toJSON(array).toString());
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_1", JSON.toJSON(array).toString());
|
|
@@ -957,7 +967,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_" + tableOwner, JSON.toJSON(array).toString());
|
|
redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + sgContractId + "_" + tableOwner, JSON.toJSON(array).toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
.collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
|
|
@@ -1048,8 +1058,63 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //构建资料查询缓存的key
|
|
|
|
+ private String buildCacheKey(String contractId, String tableOwner) {
|
|
|
|
+ if (StringUtils.isNotEmpty(tableOwner)) {
|
|
|
|
+ return contractId + "_" + tableOwner;
|
|
|
|
+ } else {
|
|
|
|
+ return contractId + "_1";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取当前合同段所有填报资料缓存信息
|
|
|
|
+ public List<WbsTreeContractLazyQueryInfoVO> getQueryInfoList(String contractId, String tableOwner) {
|
|
|
|
+ //从本地缓存获取
|
|
|
|
+ String cacheKey = buildCacheKey(contractId, tableOwner);
|
|
|
|
+ List<WbsTreeContractLazyQueryInfoVO> cachedQueryInfoList = localCacheQueryInfos.get(cacheKey);
|
|
|
|
+
|
|
|
|
+ if (cachedQueryInfoList != null && !cachedQueryInfoList.isEmpty()) {
|
|
|
|
+ return cachedQueryInfoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据需要更新localCacheQueryInfos
|
|
|
|
+ Object dataInformationQuery;
|
|
|
|
+ if (ObjectUtil.isEmpty(tableOwner)) {
|
|
|
|
+ dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1");
|
|
|
|
+ } else {
|
|
|
|
+ dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner);
|
|
|
|
+ }
|
|
|
|
+ List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
|
|
|
|
+ if (dataInformationQuery != null) {
|
|
|
|
+ //返回redis数据
|
|
|
|
+ queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
|
|
|
|
+ localCacheQueryInfos.put(cacheKey, queryInfoList); //更新本地缓存
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //返回数据库数据
|
|
|
|
+ String querySql = ObjectUtil.isEmpty(tableOwner) ?
|
|
|
|
+ "select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId + " and classify =1" :
|
|
|
|
+ "select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId + " and classify = " + tableOwner;
|
|
|
|
+
|
|
|
|
+ queryInfoList = jdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
|
|
|
|
+
|
|
|
|
+ if (!queryInfoList.isEmpty()) {
|
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
|
|
|
|
+ if (ObjectUtil.isEmpty(tableOwner)) {
|
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1", JSON.toJSON(array).toString());
|
|
|
|
+ } else {
|
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
|
|
|
|
+ }
|
|
|
|
+ localCacheQueryInfos.put(cacheKey, queryInfoList); //更新本地缓存
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return queryInfoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public List<WbsTreeContractLazyVO> imageLazyQueryContractWbsTree(String id, String contractId, String contractIdRelation, String classId) {
|
|
|
|
|
|
+ public List<WbsTreeContractLazyVO> imageLazyQueryContractWbsTree(String id, String contractId, String
|
|
|
|
+ contractIdRelation, String classId) {
|
|
if (ObjectUtil.isNotEmpty(contractId)) {
|
|
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);
|
|
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) {
|
|
if (contractInfo != null) {
|
|
@@ -1298,7 +1363,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<AppWbsTreeContractVO> searchNodeAllTableAndFile(String primaryKeyId, String type, String contractId, String projectId) {
|
|
|
|
|
|
+ public List<AppWbsTreeContractVO> searchNodeAllTableAndFile(String primaryKeyId, String type, String
|
|
|
|
+ contractId, String projectId) {
|
|
List<AppWbsTreeContractVO> vos = this.searchNodeAllTable(primaryKeyId, type, contractId, projectId);
|
|
List<AppWbsTreeContractVO> vos = this.searchNodeAllTable(primaryKeyId, type, contractId, projectId);
|
|
if (vos != null && vos.size() > 0) {
|
|
if (vos != null && vos.size() > 0) {
|
|
List<Long> list = vos.stream().map(AppWbsTreeContractVO::getPKeyId).collect(Collectors.toList());
|
|
List<Long> list = vos.stream().map(AppWbsTreeContractVO::getPKeyId).collect(Collectors.toList());
|
|
@@ -1383,7 +1449,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
* @param initNode 初始化节点入参
|
|
* @param initNode 初始化节点入参
|
|
* @param contractId 合同段id
|
|
* @param contractId 合同段id
|
|
*/
|
|
*/
|
|
- private void getConcealedWorkParentNode(Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
|
|
|
|
+ private void getConcealedWorkParentNode
|
|
|
|
+ (Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
Set<Long> parentIds = initNode.stream().map(WbsTreeContract::getParentId).collect(Collectors.toSet());
|
|
Set<Long> parentIds = initNode.stream().map(WbsTreeContract::getParentId).collect(Collectors.toSet());
|
|
if (parentIds.size() > 0) {
|
|
if (parentIds.size() > 0) {
|
|
List<WbsTreeContract> parentNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getId, parentIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
List<WbsTreeContract> parentNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getId, parentIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
@@ -1401,7 +1468,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
* @param initNode 初始化节点入参
|
|
* @param initNode 初始化节点入参
|
|
* @param contractId 合同段id
|
|
* @param contractId 合同段id
|
|
*/
|
|
*/
|
|
- private void getConcealedWorkChildNode(Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
|
|
|
|
+ private void getConcealedWorkChildNode
|
|
|
|
+ (Set<WbsTreeContract> resultAllNodes, List<WbsTreeContract> initNode, String contractId) {
|
|
Set<Long> childIds = initNode.stream().map(WbsTreeContract::getId).collect(Collectors.toSet());
|
|
Set<Long> childIds = initNode.stream().map(WbsTreeContract::getId).collect(Collectors.toSet());
|
|
if (childIds.size() > 0) {
|
|
if (childIds.size() > 0) {
|
|
List<WbsTreeContract> childNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getParentId, childIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
List<WbsTreeContract> childNodes = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getParentId, childIds).eq(WbsTreeContract::getContractId, contractId).eq(WbsTreeContract::getType, 1));
|
|
@@ -1439,43 +1507,31 @@ 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()
|
|
|
|
- .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());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ Map<Long, Long> parentIdGroup = lowestNodeParentIds.parallelStream()
|
|
|
|
+ .collect(Collectors.groupingByConcurrent(Function.identity(), Collectors.counting()));
|
|
|
|
|
|
//批量查询单次节点
|
|
//批量查询单次节点
|
|
- List<WbsTreeContractLazyVO> parentNodes = new ArrayList<>();
|
|
|
|
- if (keysWithValueOne.size() > 0) {
|
|
|
|
- parentNodes = nodesAll.stream().filter(f -> keysWithValueOne.contains(f.getId().toString())).collect(Collectors.toList());
|
|
|
|
- }
|
|
|
|
|
|
+ List<WbsTreeContractLazyVO> parentNodes = parentIdGroup.entrySet().parallelStream()
|
|
|
|
+ .filter(entry -> entry.getValue() == 1L)
|
|
|
|
+ .flatMap(entry -> nodesAll.parallelStream()
|
|
|
|
+ .filter(f -> entry.getKey().equals(f.getId())))
|
|
|
|
+ .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<WbsTreeContractLazyVO> multipleParentNodes = parentIdGroup.entrySet().parallelStream()
|
|
|
|
+ .filter(entry -> entry.getValue() > 1L)
|
|
|
|
+ .flatMap(entry -> nodesAll.parallelStream()
|
|
|
|
+ .filter(f -> entry.getKey().equals(f.getId()))
|
|
|
|
+ .limit(1)
|
|
|
|
+ .flatMap(node -> Collections.nCopies(entry.getValue().intValue(), node).stream()))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
//结果集
|
|
//结果集
|
|
List<Long> collect = Stream.concat(parentNodes.stream(), multipleParentNodes.stream())
|
|
List<Long> collect = Stream.concat(parentNodes.stream(), multipleParentNodes.stream())
|
|
@@ -1487,8 +1543,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;
|
|
}
|
|
}
|
|
@@ -1538,7 +1595,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
result.addAll(multipleParentNodes);
|
|
result.addAll(multipleParentNodes);
|
|
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 {
|
|
@@ -2525,13 +2582,15 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
* @param distinctNodesAll 去重后所有节点数据
|
|
* @param distinctNodesAll 去重后所有节点数据
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<NodeVO> buildNodeTreeByStream(List<WbsTreeContractLazyVO> distinctNodesAll, Map<Long, WbsTreeContractLazyVO> lowestNodesMap) {
|
|
|
|
|
|
+ public List<NodeVO> buildNodeTreeByStream
|
|
|
|
+ (List<WbsTreeContractLazyVO> distinctNodesAll, Map<Long, WbsTreeContractLazyVO> lowestNodesMap) {
|
|
List<WbsTreeContractLazyVO> list = distinctNodesAll.stream().filter(f -> f.getParentId().equals(0L)).collect(Collectors.toList());
|
|
List<WbsTreeContractLazyVO> list = distinctNodesAll.stream().filter(f -> f.getParentId().equals(0L)).collect(Collectors.toList());
|
|
Map<Long, List<WbsTreeContractLazyVO>> map = distinctNodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
Map<Long, List<WbsTreeContractLazyVO>> map = distinctNodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
|
|
return recursionFnNodeTree(list, map, lowestNodesMap);
|
|
return recursionFnNodeTree(list, map, lowestNodesMap);
|
|
}
|
|
}
|
|
|
|
|
|
- public List<NodeVO> recursionFnNodeTree(List<WbsTreeContractLazyVO> list, Map<Long, List<WbsTreeContractLazyVO>> map, Map<Long, WbsTreeContractLazyVO> lowestNodesMap) {
|
|
|
|
|
|
+ public List<NodeVO> recursionFnNodeTree
|
|
|
|
+ (List<WbsTreeContractLazyVO> list, Map<Long, List<WbsTreeContractLazyVO>> map, Map<Long, WbsTreeContractLazyVO> lowestNodesMap) {
|
|
List<NodeVO> result = new ArrayList<>();
|
|
List<NodeVO> result = new ArrayList<>();
|
|
for (WbsTreeContractLazyVO vo : list) {
|
|
for (WbsTreeContractLazyVO vo : list) {
|
|
if (vo.getHasChildren().equals(0)) {
|
|
if (vo.getHasChildren().equals(0)) {
|
|
@@ -2675,5 +2734,20 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*删除合同段本地缓存*/
|
|
|
|
+ public void deleteContractLocalCache(String contractId) {
|
|
|
|
+ /*删除节点缓存*/
|
|
|
|
+ localCacheNodes.remove(contractId);
|
|
|
|
+
|
|
|
|
+ /*删除资料缓存*/
|
|
|
|
+ Iterator<Map.Entry<String, List<WbsTreeContractLazyQueryInfoVO>>> iterator = localCacheQueryInfos.entrySet().iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Map.Entry<String, List<WbsTreeContractLazyQueryInfoVO>> entry = iterator.next();
|
|
|
|
+ String cacheKey = entry.getKey();
|
|
|
|
+ if (cacheKey.startsWith(contractId + "_")) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|