|
@@ -1,7 +1,5 @@
|
|
package org.springblade.system.user.service.impl;
|
|
package org.springblade.system.user.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.date.StopWatch;
|
|
|
|
-import cn.hutool.log.StaticLog;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.nacos.common.utils.StringUtils;
|
|
import com.alibaba.nacos.common.utils.StringUtils;
|
|
@@ -39,11 +37,11 @@ import org.springblade.core.tool.support.Kv;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
|
+import org.springblade.manager.entity.ContractRelationJlyz;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.feign.ContractClient;
|
|
import org.springblade.manager.feign.ContractClient;
|
|
import org.springblade.manager.vo.WbsTreeContractLazyQueryInfoVO;
|
|
import org.springblade.manager.vo.WbsTreeContractLazyQueryInfoVO;
|
|
import org.springblade.manager.vo.WbsTreeContractLazyVO;
|
|
import org.springblade.manager.vo.WbsTreeContractLazyVO;
|
|
-import org.springblade.manager.vo.WbsTreeContractVO8;
|
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.system.cache.DictCache;
|
|
import org.springblade.system.cache.DictCache;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springblade.system.cache.ParamCache;
|
|
@@ -818,7 +816,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
contractIds.add(contractIdRelation);
|
|
contractIds.add(contractIdRelation);
|
|
} else {
|
|
} else {
|
|
//根节点时默认加载所有施工合同段的树
|
|
//根节点时默认加载所有施工合同段的树
|
|
- contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
|
|
|
|
|
|
+ List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ contractIds = query.stream().map(ContractRelationJlyz::getContractIdSg).map(String::valueOf).collect(Collectors.toList());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (cn.hutool.core.util.ObjectUtil.isEmpty(contractIds) || contractIds.size() <= 0) {
|
|
if (cn.hutool.core.util.ObjectUtil.isEmpty(contractIds) || contractIds.size() <= 0) {
|
|
return null;
|
|
return null;
|
|
@@ -974,6 +975,98 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<WbsTreeContractLazyVO> queryContractWbsTreeByFirstInfo(String parentId, String contractId, String contractIdRelation) {
|
|
|
|
+ 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 (new Integer(1).equals(contractInfo.getContractType())) {
|
|
|
|
+ if (ObjectUtil.isEmpty(parentId)) {
|
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) 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 = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where parent_id = 0 AND contract_id = " + contractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+ for (WbsTreeContractLazyVO lazyNode : lazyNodes) {
|
|
|
|
+ lazyNode.setTitle(contractInfo.getContractName());
|
|
|
|
+ lazyNode.setType(lazyNode.getNodeType());
|
|
|
|
+ lazyNode.setNotExsitChild(!lazyNode.getHasChildren().equals(1));
|
|
|
|
+ lazyNode.setPrimaryKeyId(lazyNode.getPKeyId());
|
|
|
|
+ }
|
|
|
|
+ return lazyNodes;
|
|
|
|
+ }
|
|
|
|
+ List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 AND contract_id = " + contractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ List<WbsTreeContractLazyVO> nodeAll = this.getNodeAll(contractId);
|
|
|
|
+ List<Long> nodeIds = query.stream().map(TreeContractFirst::getWbsNodeId).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> firstNodes = nodeAll.stream().filter(f -> nodeIds.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> collect = firstNodes.stream().filter(f -> f.getParentId().equals(Long.parseLong(parentId))).collect(Collectors.toList());
|
|
|
|
+ List<Long> pKeyIds = collect.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toList());
|
|
|
|
+ if (pKeyIds.size() > 0) {
|
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) 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 = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+ if (lazyNodes.size() > 0) {
|
|
|
|
+ for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
|
|
|
|
+ lazyNodeVO.setType(lazyNodeVO.getNodeType());
|
|
|
|
+ lazyNodeVO.setNotExsitChild(!lazyNodeVO.getHasChildren().equals(1));
|
|
|
|
+ lazyNodeVO.setPrimaryKeyId(lazyNodeVO.getPKeyId());
|
|
|
|
+ }
|
|
|
|
+ return lazyNodes;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } 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(parentId)) {
|
|
|
|
+ contractIds.add(contractIdRelation);
|
|
|
|
+ } else {
|
|
|
|
+ List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ contractIds = query.stream().map(ContractRelationJlyz::getContractIdSg).map(String::valueOf).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isEmpty(contractIds) || contractIds.size() <= 0) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ 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) {
|
|
|
|
+ if (ObjectUtil.isNotEmpty(parentId)) {
|
|
|
|
+ List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 AND contract_id = " + sgContractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ List<WbsTreeContractLazyVO> nodeAll = this.getNodeAll(sgContractId);
|
|
|
|
+ List<Long> nodeIds = query.stream().map(TreeContractFirst::getWbsNodeId).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> firstNodes = nodeAll.stream().filter(f -> nodeIds.contains(f.getPKeyId())).collect(Collectors.toList());
|
|
|
|
+ List<WbsTreeContractLazyVO> collect = firstNodes.stream().filter(f -> f.getParentId().equals(Long.parseLong(parentId))).collect(Collectors.toList());
|
|
|
|
+ List<Long> pKeyIds = collect.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toList());
|
|
|
|
+ if (pKeyIds.size() > 0) {
|
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) 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 p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+ if (lazyNodes.size() > 0) {
|
|
|
|
+ for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
|
|
|
|
+ lazyNodeVO.setType(lazyNodeVO.getNodeType());
|
|
|
|
+ lazyNodeVO.setNotExsitChild(!lazyNodeVO.getHasChildren().equals(1));
|
|
|
|
+ lazyNodeVO.setPrimaryKeyId(lazyNodeVO.getPKeyId());
|
|
|
|
+ lazyNodeVO.setContractIdRelation(sgContractId);
|
|
|
|
+ }
|
|
|
|
+ lazyNodesAll.addAll(lazyNodes);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) 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 parent_id = 0 AND contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
|
+ for (WbsTreeContractLazyVO lazyNode : lazyNodes) {
|
|
|
|
+ lazyNode.setTitle(sgContractInfo.getContractName());
|
|
|
|
+ lazyNode.setType(lazyNode.getNodeType());
|
|
|
|
+ lazyNode.setNotExsitChild(!lazyNode.getHasChildren().equals(1));
|
|
|
|
+ lazyNode.setPrimaryKeyId(lazyNode.getPKeyId());
|
|
|
|
+ lazyNode.setContractIdRelation(sgContractId);
|
|
|
|
+ }
|
|
|
|
+ lazyNodesAll.addAll(lazyNodes);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return lazyNodesAll;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取当前合同段所有节点缓存
|
|
* 获取当前合同段所有节点缓存
|
|
*
|
|
*
|
|
@@ -1099,7 +1192,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
* @param nodesAll
|
|
* @param nodesAll
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<WbsTreeContractLazyVO> getCachedParentCountNodes(String contractId, List<Long> lowestNodeParentIdsTB, List<WbsTreeContractLazyVO> nodesAll, String tableOwner) {
|
|
|
|
|
|
+ public List<WbsTreeContractLazyVO> getCachedParentCountNodes(String
|
|
|
|
+ contractId, List<Long> lowestNodeParentIdsTB, List<WbsTreeContractLazyVO> nodesAll, String tableOwner) {
|
|
//从本地缓存获取数据
|
|
//从本地缓存获取数据
|
|
String cacheKey = contractId + "_" + tableOwner;
|
|
String cacheKey = contractId + "_" + tableOwner;
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = localCacheParentCountNodes.get(cacheKey);
|
|
List<WbsTreeContractLazyVO> resultParentNodesTB = localCacheParentCountNodes.get(cacheKey);
|
|
@@ -1131,7 +1225,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
* @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;
|
|
}
|
|
}
|
|
@@ -1193,8 +1288,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
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)) {
|
|
@@ -1291,7 +1387,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
return this.selectInformationQueryPage(Condition.getPage(query), vo, node, childNodesPkeyIds);
|
|
return this.selectInformationQueryPage(Condition.getPage(query), vo, node, childNodesPkeyIds);
|
|
}
|
|
}
|
|
|
|
|
|
- private IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo, WbsTreeContract node, List<Long> childNodesPkeyIds) {
|
|
|
|
|
|
+ private IPage<InformationQueryVO> selectInformationQueryPage
|
|
|
|
+ (IPage<InformationQueryVO> page, InformationQueryVO vo, WbsTreeContract
|
|
|
|
+ node, List<Long> childNodesPkeyIds) {
|
|
if (StringUtils.isNotEmpty(vo.getBetweenTime())) {
|
|
if (StringUtils.isNotEmpty(vo.getBetweenTime())) {
|
|
String[] betweenTime;
|
|
String[] betweenTime;
|
|
if (vo.getBetweenTime().contains("~")) {
|
|
if (vo.getBetweenTime().contains("~")) {
|
|
@@ -1581,7 +1679,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
}
|
|
}
|
|
|
|
|
|
- private void recursionGetChildNodesPkeyIds(List<WbsTreeContractLazyVO> nodeAll, List<Long> ids, List<Long> resultPKeyId, List<Long> lowestNodesPkeyIds) {
|
|
|
|
|
|
+ private void recursionGetChildNodesPkeyIds
|
|
|
|
+ (List<WbsTreeContractLazyVO> nodeAll, List<Long> ids, List<Long> resultPKeyId, List<Long> lowestNodesPkeyIds) {
|
|
if (ids.size() > 0) {
|
|
if (ids.size() > 0) {
|
|
List<WbsTreeContractLazyVO> sortedFilteredNodes = nodeAll.stream()
|
|
List<WbsTreeContractLazyVO> sortedFilteredNodes = nodeAll.stream()
|
|
.filter(f -> ids.contains(f.getParentId()))
|
|
.filter(f -> ids.contains(f.getParentId()))
|