|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
+import com.alibaba.excel.util.DateUtils;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -26,6 +27,7 @@ import org.springblade.business.service.*;
|
|
|
import org.springblade.business.socket.WebSocket;
|
|
|
import org.springblade.business.utils.FileUtils;
|
|
|
import org.springblade.business.vo.*;
|
|
|
+import org.springblade.common.constant.BusinessConstant;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.constant.LauncherConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
@@ -52,11 +54,13 @@ 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.beans.factory.annotation.Autowired;
|
|
|
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.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
@@ -120,7 +124,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final ITreeContractFirstService treeContractFirstService;
|
|
|
|
|
|
- private static final String CONTRACT_CACHE_WBSTREE = "contract:wbstree:";
|
|
|
+ @Autowired
|
|
|
+ StringRedisTemplate RedisTemplate;
|
|
|
|
|
|
/**
|
|
|
* 获取文件题名
|
|
@@ -1271,7 +1276,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperation(value = "自定义排序")
|
|
|
public R<Boolean> diySort(@RequestBody DiySortVO vo) {
|
|
|
List<String> sortLists = vo.getSortList();
|
|
|
- return R.status(wbsTreeContractClient.diySort(sortLists));
|
|
|
+ boolean b = wbsTreeContractClient.diySort(sortLists);
|
|
|
+ if(sortLists!=null){
|
|
|
+ WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(sortLists.get(0));
|
|
|
+ //获取父节点信息
|
|
|
+ informationQueryService.AsyncWbsTree(needCopyNode.getParentId()+ "",needCopyNode.getParentId()+ "",needCopyNode.getContractId(),"","1");
|
|
|
+ }
|
|
|
+ return R.status(b);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1372,12 +1383,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
|
|
|
|
//复制数据逻辑
|
|
|
- jdbcTemplate.execute(copeSql.toString());
|
|
|
+ if(nodeTabColsMap!=null &&copeSql.length()>=10){
|
|
|
+ jdbcTemplate.execute(copeSql.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取父节点信息
|
|
|
+ informationQueryService.AsyncWbsTree(needCopyNode.getParentId()+ "",needCopyNode.getParentId()+ "",needCopyNode.getContractId(),"","1");
|
|
|
return booleanR;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 复制节点
|
|
|
*/
|
|
@@ -1722,15 +1737,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
})
|
|
|
public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
|
|
|
- List<WbsTreeContractTreeVOS> result = this.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
+ List<WbsTreeContractTreeVOS> result = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
if (result.size() == 1) {
|
|
|
//只有一个子节点,继续向下
|
|
|
int size;
|
|
|
WbsTreeContractTreeVOS vos = result.get(0);
|
|
|
do {
|
|
|
try {
|
|
|
- List<WbsTreeContractTreeVOS> childResult = this.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation(), null);
|
|
|
-
|
|
|
+ List<WbsTreeContractTreeVOS> childResult = this.informationQueryService.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation(), null);
|
|
|
vos.setChildren(childResult);
|
|
|
size = childResult.size();
|
|
|
if (size != 1) {
|
|
@@ -1797,8 +1811,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ Boolean aBoolean = this.wbsTreeContractClient.updateContractNodeParameter(node);
|
|
|
|
|
|
- return R.data(this.wbsTreeContractClient.updateContractNodeParameter(node));
|
|
|
+ //获取父节点信息
|
|
|
+ informationQueryService.AsyncWbsTree(queries.getParentId()+ "",queries.getParentId()+ "",queries.getContractId(),"","1");
|
|
|
+ return R.data(aBoolean);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1896,8 +1913,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
//保存进回收站
|
|
|
this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
|
|
|
-
|
|
|
- return R.data(this.wbsTreeContractClient.removeContractTreeNode(idArray));
|
|
|
+ Boolean aBoolean = this.wbsTreeContractClient.removeContractTreeNode(idArray);
|
|
|
+ // 更新redis
|
|
|
+ this.informationQueryService.AsyncWbsTree(removeNode.getParentId()+ "",removeNode.getParentId()+ "",removeNode.getContractId(),"","1");
|
|
|
+ return R.data(aBoolean);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2081,7 +2100,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- return this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
|
+ R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
|
+
|
|
|
+ //更新redis
|
|
|
+ List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(treeContract.getId()+ "", treeContract.getContractId(), "", "1");
|
|
|
+
|
|
|
+ informationQueryService.AsyncWbsTree(treeContract.getId()+ "",treeContract.getId()+ "",treeContract.getContractId(),"","1");
|
|
|
+ return booleanR;
|
|
|
}
|
|
|
|
|
|
private List<WbsTreePrivate> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract) {
|
|
@@ -2374,7 +2399,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
parentId = primaryKeyId;
|
|
|
}
|
|
|
- List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
+ List<WbsTreeContractTreeVOS> rootTreeNode = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
rootTreeNode.removeIf(vos -> (vos.getNodeType() != null && vos.getNodeType() == 111));
|
|
|
|
|
|
return R.data(rootTreeNode);
|
|
@@ -2397,30 +2422,28 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@RequestParam String parentId,
|
|
|
@RequestParam String contractId,
|
|
|
@RequestParam String contractIdRelation,
|
|
|
- String classifyType) {
|
|
|
+ @RequestParam String classifyType){
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
parentId = primaryKeyId;
|
|
|
}
|
|
|
+
|
|
|
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);
|
|
|
+ Object data = RedisTemplate.opsForValue().get("blade-manager::contract:wbstree:"+dataInfoId);
|
|
|
+ List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = null;
|
|
|
+ if(data!=null){
|
|
|
+ wbsTreeContractTreeVOS = JSON.parseArray(data.toString(), WbsTreeContractTreeVOS.class);
|
|
|
+ }
|
|
|
+
|
|
|
if (wbsTreeContractTreeVOS == null) {
|
|
|
- wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
|
|
|
- CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
|
|
|
+ wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
|
|
|
+ JSONArray array= JSONArray.parseArray(JSON.toJSONString(wbsTreeContractTreeVOS));
|
|
|
+ RedisTemplate.opsForValue().set("blade-manager::contract:wbstree:"+dataInfoId,JSON.toJSON(array).toString());
|
|
|
}
|
|
|
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);
|
|
|
- }
|
|
|
+
|
|
|
+ // set的处理
|
|
|
|
|
|
/**
|
|
|
* 修改
|
|
@@ -2464,115 +2487,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
})
|
|
|
public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByFirstInfo(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
|
|
|
- List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
+ List<WbsTreeContractTreeVOS> rootTreeNode = informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
//查询被标记为首件的数据
|
|
|
rootTreeNode = rootTreeNode.stream().filter(WbsTreeContractTreeVOS::getIsFirst).collect(Collectors.toList());
|
|
|
-
|
|
|
return R.data(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));
|
|
|
- } 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));
|
|
|
- } 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);
|
|
|
- *//*rootTreeNode.stream().forEach(rtn->{
|
|
|
- if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
|
|
|
- rtn.setColorStatus(2);
|
|
|
- }
|
|
|
- });*//*
|
|
|
- }
|
|
|
-
|
|
|
- return rootTreeNode;
|
|
|
- }
|
|
|
-*/
|
|
|
}
|