|
@@ -27,8 +27,10 @@ import org.springblade.business.socket.WebSocket;
|
|
|
import org.springblade.business.utils.FileUtils;
|
|
|
import org.springblade.business.vo.*;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
+import org.springblade.common.constant.LauncherConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.cache.utils.CacheUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
@@ -50,8 +52,14 @@ import org.springblade.system.cache.ParamCache;
|
|
|
import org.springblade.system.entity.DictBiz;
|
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
+import org.springframework.cache.annotation.CachePut;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
+import org.springframework.cache.annotation.Caching;
|
|
|
+import org.springframework.data.redis.core.RedisConnectionUtils;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
@@ -60,6 +68,8 @@ import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
|
|
|
+
|
|
|
/**
|
|
|
* 资料填报及查询控制器
|
|
|
*
|
|
@@ -110,6 +120,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final ITreeContractFirstService treeContractFirstService;
|
|
|
|
|
|
+ private static final String CONTRACT_CACHE_WBSTREE = "contract:wbstree:";
|
|
|
+
|
|
|
/**
|
|
|
* 获取文件题名
|
|
|
*/
|
|
@@ -1857,9 +1869,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
if (queryProcess != null && queryProcess.size() > 0) {
|
|
|
//检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
|
|
|
- List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
|
|
|
+ List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
|
|
|
//
|
|
|
- List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
|
|
|
+ List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
|
|
|
if (approvalList.size() > 0 || runTaskList.size() > 0) {
|
|
|
//说明存在已经审批或已经上报的节点,不允许删除
|
|
|
return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
|
|
@@ -2389,7 +2401,25 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
parentId = primaryKeyId;
|
|
|
}
|
|
|
- return R.data(this.queryContractTree(parentId, contractId, contractIdRelation, classifyType));
|
|
|
+ String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
|
|
|
+ queryContractWbsTreeByContractIdAndType2(primaryKeyId,parentId,contractId,contractIdRelation,classifyType);
|
|
|
+ List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = CacheUtil.get(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, List.class);
|
|
|
+ if (wbsTreeContractTreeVOS == null) {
|
|
|
+ wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
|
|
|
+ CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
|
|
|
+ }
|
|
|
+ return R.data(wbsTreeContractTreeVOS);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Async
|
|
|
+ public void queryContractWbsTreeByContractIdAndType2(String primaryKeyId,
|
|
|
+ String parentId,
|
|
|
+ String contractId,
|
|
|
+ String contractIdRelation,
|
|
|
+ String classifyType) {
|
|
|
+ String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
|
|
|
+ List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
|
|
|
+ CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2441,6 +2471,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(rootTreeNode);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 查询合同段划分树公共代码
|
|
|
*/
|
|
@@ -2454,17 +2485,64 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//监理/业主合同段,需要获取关联的施工方合同段根节点数据
|
|
|
List<String> contractIds = new ArrayList<>();
|
|
|
if (StringUtils.isEmpty(parentId)) {
|
|
|
+ // 获取 有几个合同段主键Id
|
|
|
contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
|
|
|
} else {
|
|
|
contractIds.add(contractIdRelation);
|
|
|
}
|
|
|
if (contractIds.size() > 0) {
|
|
|
-
|
|
|
//监理复制加载树问题
|
|
|
if (StringUtils.isEmpty(classifyType)) {
|
|
|
classifyType = "2";
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(parentId)) {
|
|
|
+ //子节点
|
|
|
+ rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
|
|
|
+ } else {
|
|
|
+ //根节点
|
|
|
+ rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, "0", Integer.parseInt(classifyType));
|
|
|
+ //设置根节点数量统计
|
|
|
+ for (WbsTreeContractTreeVOS root : rootTreeNode) {
|
|
|
+ List<WbsTreeContractTreeVOS> rootZi = this.informationQueryService.queryContractTreeSupervision(Func.toStrList(root.getContractIdRelation()), root.getId().toString(), Integer.parseInt(classifyType));
|
|
|
+ List<Long> collect = rootZi.stream().map(WbsTreeContractTreeVOS::getSubmitCounts).collect(Collectors.toList());
|
|
|
+ Long reduce = collect.stream().reduce(0L, Long::sum);
|
|
|
+ root.setSubmitCounts(reduce);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rootTreeNode = new ArrayList<>();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //施工合同段
|
|
|
+ rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
|
|
|
+ }
|
|
|
+ return rootTreeNode;
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ *//**
|
|
|
+ * 查询合同段划分树公共代码
|
|
|
+ *//*
|
|
|
+ private List<WbsTreeContractTreeVOS> queryContractTree(String parentId, String contractId, String contractIdRelation, String classifyType) {
|
|
|
+ List<WbsTreeContractTreeVOS> rootTreeNode;
|
|
|
|
|
|
+ //获取合同段,检查是否是监理合同段
|
|
|
+ ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
+
|
|
|
+ if (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) {
|
|
|
+ //监理/业主合同段,需要获取关联的施工方合同段根节点数据
|
|
|
+ List<String> contractIds = new ArrayList<>();
|
|
|
+ if (StringUtils.isEmpty(parentId)) {
|
|
|
+ // 获取 有几个合同段主键Id
|
|
|
+ contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
|
|
|
+ } else {
|
|
|
+ contractIds.add(contractIdRelation);
|
|
|
+ }
|
|
|
+ if (contractIds.size() > 0) {
|
|
|
+
|
|
|
+ //监理复制加载树问题
|
|
|
+ if (StringUtils.isEmpty(classifyType)) {
|
|
|
+ classifyType = "2";
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
|
//子节点
|
|
|
rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
|
|
@@ -2480,7 +2558,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
root.setSubmitCounts(reduce);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
rootTreeNode = new ArrayList<>();
|
|
|
}
|
|
@@ -2488,14 +2565,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else {
|
|
|
//施工合同段
|
|
|
rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
|
|
|
- rootTreeNode.stream().forEach(rtn->{
|
|
|
+ *//*rootTreeNode.stream().forEach(rtn->{
|
|
|
if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
|
|
|
rtn.setColorStatus(2);
|
|
|
}
|
|
|
- });
|
|
|
+ });*//*
|
|
|
}
|
|
|
|
|
|
return rootTreeNode;
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
}
|