|
@@ -285,8 +285,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
String names = StringUtils.join(nodeNames, " , ");
|
|
String names = StringUtils.join(nodeNames, " , ");
|
|
throw new ServiceException(StringUtil.format("节点下的 {} 中存在填报数据,删除失败!", names));
|
|
throw new ServiceException(StringUtil.format("节点下的 {} 中存在填报数据,删除失败!", names));
|
|
}
|
|
}
|
|
- baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId(), pawDTO.getContractId());
|
|
|
|
}
|
|
}
|
|
|
|
+ baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId(), pawDTO.getContractId());
|
|
}
|
|
}
|
|
|
|
|
|
//TODO ---------新增---------
|
|
//TODO ---------新增---------
|
|
@@ -688,29 +688,46 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
//获取当前合同段所有缓存节点信息
|
|
//获取当前合同段所有缓存节点信息
|
|
List<WbsTreeContractLazyVO> nodesAll;
|
|
List<WbsTreeContractLazyVO> nodesAll;
|
|
- Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + contractId);
|
|
|
|
|
|
+ /*Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + contractId);
|
|
if (data != null) {
|
|
if (data != null) {
|
|
nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
- } 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 = " + 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);
|
|
|
|
- }
|
|
|
|
|
|
+ } 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);
|
|
}
|
|
}
|
|
- 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));
|
|
@@ -757,13 +774,21 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
.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();
|
|
|
|
+
|
|
this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
this.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAll);
|
|
|
|
|
|
|
|
+ /*long endTime2 = System.currentTimeMillis();
|
|
|
|
+ long executionTime2 = endTime2 - startTime2;
|
|
|
|
+ System.out.println("2222222222222:" + executionTime2);*/
|
|
|
|
+
|
|
//最底层节点颜色构造后Map
|
|
//最底层节点颜色构造后Map
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
|
|
.peek(vo -> {
|
|
.peek(vo -> {
|
|
@@ -778,6 +803,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
}
|
|
}
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
}).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
|
|
|
|
|
|
|
|
+ //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());
|
|
@@ -792,6 +818,10 @@ 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);*/
|
|
|
|
+
|
|
//TODO 处理最终结果集
|
|
//TODO 处理最终结果集
|
|
if (lazyNodes.size() > 0) {
|
|
if (lazyNodes.size() > 0) {
|
|
//处理填报数量
|
|
//处理填报数量
|
|
@@ -853,29 +883,39 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
if (sgContractInfo != null) {
|
|
if (sgContractInfo != null) {
|
|
//获取当前合同段所有缓存节点信息
|
|
//获取当前合同段所有缓存节点信息
|
|
List<WbsTreeContractLazyVO> nodesAll;
|
|
List<WbsTreeContractLazyVO> nodesAll;
|
|
- Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
|
|
|
|
|
|
+ /*Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
|
|
if (data != null) {
|
|
if (data != null) {
|
|
nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
- } 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);
|
|
|
|
- }
|
|
|
|
|
|
+ } else {*/
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ //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);
|
|
}
|
|
}
|
|
- 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));
|