|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -1345,15 +1346,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
//首先查询需要复制的节点及其下级所有子节点的信息
|
|
//首先查询需要复制的节点及其下级所有子节点的信息
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
// 获取当前节点的所有子节点
|
|
// 获取当前节点的所有子节点
|
|
- String vocational = SnowFlakeUtil.getId() + "";
|
|
|
|
|
|
+ /*String vocational = SnowFlakeUtil.getId() + "";*/
|
|
|
|
+
|
|
//新增施工台账
|
|
//新增施工台账
|
|
List<WbsTreeContract> saveList = new ArrayList<>();
|
|
List<WbsTreeContract> saveList = new ArrayList<>();
|
|
List<ConstructionLedger> saveLedger = new ArrayList<>();
|
|
List<ConstructionLedger> saveLedger = new ArrayList<>();
|
|
- // 获取附件
|
|
|
|
|
|
+
|
|
|
|
+ //获取子级节点、表信息
|
|
List<WbsTreeContract> nodeChildAll = informationQueryService.getNodeChildAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId(), vo.getNeedCopyPrimaryKeyId());
|
|
List<WbsTreeContract> nodeChildAll = informationQueryService.getNodeChildAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId(), vo.getNeedCopyPrimaryKeyId());
|
|
- // 获取实体表列对象
|
|
|
|
|
|
+ //获取数据源表(附件复制使用)
|
|
|
|
+ Set<WbsTreeContract> oldTabs = nodeChildAll.stream().filter(f -> (new Integer(2).equals(f.getType()))).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ //获取实体表列对象
|
|
List<QueryProcessDataVO> nodeTabCols = informationQueryService.getNodeChildTabColsAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId());
|
|
List<QueryProcessDataVO> nodeTabCols = informationQueryService.getNodeChildTabColsAllByNodeId(needCopyNode.getId() + "", needCopyNode.getContractId());
|
|
- // 转化为map
|
|
|
|
|
|
+ //转化为map
|
|
Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
|
|
Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
|
|
StringBuilder copeSql = new StringBuilder();
|
|
StringBuilder copeSql = new StringBuilder();
|
|
|
|
|
|
@@ -1432,14 +1438,24 @@ public class InformationWriteQueryController extends BladeController {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- //保存节点信息
|
|
|
|
|
|
+
|
|
|
|
+ //复制保存节点、表信息
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
- //复制数据逻辑
|
|
|
|
|
|
+
|
|
|
|
+ //复制元素表附件信息
|
|
|
|
+ List<WbsTreeContract> newTabs = saveList.stream().filter(f -> (new Integer(2).equals(f.getType()))).collect(Collectors.toList());
|
|
|
|
+ if (newTabs.size() > 0 && oldTabs.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
|
+ this.addCopyTabFile(newTabs, oldTabs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //复制表单数据
|
|
if (copeSql.length() >= 10) {
|
|
if (copeSql.length() >= 10) {
|
|
jdbcTemplate.execute(copeSql.toString());
|
|
jdbcTemplate.execute(copeSql.toString());
|
|
}
|
|
}
|
|
- //获取父节点信息
|
|
|
|
|
|
+
|
|
|
|
+ //更新redis缓存
|
|
informationQueryService.AsyncWbsTree(needCopyNode.getParentId() + "", needCopyNode.getParentId() + "", needCopyNode.getContractId(), "", "1");
|
|
informationQueryService.AsyncWbsTree(needCopyNode.getParentId() + "", needCopyNode.getParentId() + "", needCopyNode.getContractId(), "", "1");
|
|
|
|
+
|
|
return booleanR;
|
|
return booleanR;
|
|
|
|
|
|
} else if (("2").equals(vo.getCopyType())) {
|
|
} else if (("2").equals(vo.getCopyType())) {
|
|
@@ -1473,7 +1489,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
if (needCopyNodeRoot != null) {
|
|
if (needCopyNodeRoot != null) {
|
|
- //缓存需要复制的节点信息、表信息
|
|
|
|
|
|
+ //缓存需要复制的节点、表信息
|
|
Map<String, List<WbsTreeContract>> needCopyNodeAndTabMap = new HashMap<>();
|
|
Map<String, List<WbsTreeContract>> needCopyNodeAndTabMap = new HashMap<>();
|
|
List<WbsTreeContract> needCopyChildNodes = this.getChildNodes(needCopyNodeRoot);
|
|
List<WbsTreeContract> needCopyChildNodes = this.getChildNodes(needCopyNodeRoot);
|
|
if (ObjectUtil.isEmpty(needCopyChildNodes) || needCopyChildNodes.size() == 0) {
|
|
if (ObjectUtil.isEmpty(needCopyChildNodes) || needCopyChildNodes.size() == 0) {
|
|
@@ -1486,10 +1502,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
needCopyNodeAndTabMap.put("tab:" + needCopyNodeRoot.getPKeyId(), addChildNodesTables);
|
|
needCopyNodeAndTabMap.put("tab:" + needCopyNodeRoot.getPKeyId(), addChildNodesTables);
|
|
|
|
|
|
//结果集
|
|
//结果集
|
|
- List<WbsTreeContract> addNodeList = new ArrayList<>();//节点
|
|
|
|
- List<WbsTreeContract> addTabList = new ArrayList<>(); //表单
|
|
|
|
- List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>(); //redis同步信息
|
|
|
|
- Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>(addChildNodesTables);//表单附件数据源
|
|
|
|
|
|
+ List<WbsTreeContract> addNodeList = new ArrayList<>();//新增节点
|
|
|
|
+ List<WbsTreeContract> addTabList = new ArrayList<>(); //新增表单
|
|
|
|
+ List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>(); //redis同步节点
|
|
|
|
+ Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>(addChildNodesTables);//数据源表附件
|
|
|
|
+ Set<WbsTreeContract> addNewFileTabs = new HashSet<>(addChildNodesTables);//新增到目标表附件
|
|
List<String> resultTablesData = new ArrayList<>();//表单数据
|
|
List<String> resultTablesData = new ArrayList<>();//表单数据
|
|
|
|
|
|
//创建线程池,默认设置4个线程
|
|
//创建线程池,默认设置4个线程
|
|
@@ -1523,7 +1540,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
//1.2 选择同父级的同级节点,只复制数据
|
|
//1.2 选择同父级的同级节点,只复制数据
|
|
} else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
} else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
//构造数据
|
|
//构造数据
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData());
|
|
|
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
}
|
|
}
|
|
|
|
|
|
//TODO 跨节点复制
|
|
//TODO 跨节点复制
|
|
@@ -1565,7 +1582,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
//2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据),且var=false,表示没有进行到跨节点新增的逻辑,只是跨节点复制数据
|
|
//2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据),且var=false,表示没有进行到跨节点新增的逻辑,只是跨节点复制数据
|
|
if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId()) && !var) {
|
|
if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId()) && !var) {
|
|
//构造数据
|
|
//构造数据
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData());
|
|
|
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, finalTabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1593,18 +1610,29 @@ public class InformationWriteQueryController extends BladeController {
|
|
//入库
|
|
//入库
|
|
Boolean row = false;
|
|
Boolean row = false;
|
|
if (nodes.size() > 0) {
|
|
if (nodes.size() > 0) {
|
|
|
|
+ //复制新增节点
|
|
row = wbsTreeContractClient.saveBatch(nodes);
|
|
row = wbsTreeContractClient.saveBatch(nodes);
|
|
}
|
|
}
|
|
|
|
+
|
|
if (tabs.size() > 0) {
|
|
if (tabs.size() > 0) {
|
|
|
|
+ //复制新增表
|
|
row = wbsTreeContractClient.saveBatch(tabs);
|
|
row = wbsTreeContractClient.saveBatch(tabs);
|
|
- if (addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
|
- this.addCopyTabFile(tabs, addChildNodesTablesOldAll);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- if (resultTablesData.size() > 0) {
|
|
|
|
- jdbcTemplate.execute(StringUtils.join(resultTablesData, ""));
|
|
|
|
|
|
+
|
|
|
|
+ if (addNewFileTabs.size() > 0 && addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
|
+ //复制新增表附件
|
|
|
|
+ this.addCopyTabFile(tabs, addChildNodesTablesOldAll);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (resultTablesData.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
|
+ //复制新增表数据
|
|
|
|
+ List<List<String>> partition = Lists.partition(resultTablesData, 20);
|
|
|
|
+ for (List<String> strings : partition) {
|
|
|
|
+ jdbcTemplate.execute(StringUtils.join(strings, ""));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (row && asyncWbsTreeNodes.size() > 0) {
|
|
if (row && asyncWbsTreeNodes.size() > 0) {
|
|
|
|
+ //更新redis缓存
|
|
List<WbsTreeContract> collect = asyncWbsTreeNodes.stream().distinct().collect(Collectors.toList());
|
|
List<WbsTreeContract> collect = asyncWbsTreeNodes.stream().distinct().collect(Collectors.toList());
|
|
for (WbsTreeContract asyncWbsTreeNode : collect) {
|
|
for (WbsTreeContract asyncWbsTreeNode : collect) {
|
|
informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getId() + "", contractId, "", "1");
|
|
informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getId() + "", contractId, "", "1");
|
|
@@ -1658,6 +1686,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(StringUtils.join(tabFileIds, ",")).stream().collect(Collectors.groupingBy(TableFile::getTabId));
|
|
Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(StringUtils.join(tabFileIds, ",")).stream().collect(Collectors.groupingBy(TableFile::getTabId));
|
|
if (tableFileOldMap != null && tableFileOldMap.size() > 0) {
|
|
if (tableFileOldMap != null && tableFileOldMap.size() > 0) {
|
|
List<TableFile> resultFileData = new ArrayList<>();
|
|
List<TableFile> resultFileData = new ArrayList<>();
|
|
|
|
+ List<Long> updatePKeyIds = new ArrayList<>();
|
|
for (WbsTreeContract tabOld : addChildNodesTablesOld) {
|
|
for (WbsTreeContract tabOld : addChildNodesTablesOld) {
|
|
for (WbsTreeContract tabNew : addChildNodesTables) {
|
|
for (WbsTreeContract tabNew : addChildNodesTables) {
|
|
//获取对应表
|
|
//获取对应表
|
|
@@ -1670,12 +1699,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
file.setId(SnowFlakeUtil.getId());
|
|
file.setId(SnowFlakeUtil.getId());
|
|
});
|
|
});
|
|
resultFileData.addAll(tab);
|
|
resultFileData.addAll(tab);
|
|
|
|
+ if (ObjectUtil.isNotEmpty(tabOld) && tabOld.getTabFileType() == 2) {
|
|
|
|
+ updatePKeyIds.add(tabNew.getPKeyId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (resultFileData.size() > 0) {
|
|
if (resultFileData.size() > 0) {
|
|
|
|
+ //入库
|
|
tableFileClient.saveBatch(resultFileData);
|
|
tableFileClient.saveBatch(resultFileData);
|
|
|
|
+ if (updatePKeyIds.size() > 0) {
|
|
|
|
+ //修改表的文件按钮状态
|
|
|
|
+ wbsTreeContractClient.updateTabFileTypeByPkeyIds(updatePKeyIds);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1683,32 +1720,25 @@ public class InformationWriteQueryController extends BladeController {
|
|
/**
|
|
/**
|
|
* 新增复制的数据
|
|
* 新增复制的数据
|
|
*/
|
|
*/
|
|
- private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String tabOwner, List<String> resultTablesData, List<WbsTreeContract> addChildNodesTablesAll, Integer isCopyData) {
|
|
|
|
|
|
+ private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String tabOwner, List<String> resultTablesData, List<WbsTreeContract> addChildNodesTablesAll, Integer isCopyData, Set<WbsTreeContract> addNewFileTabs) {
|
|
List<WbsTreeContract> wbsTreeContractsNeed = Collections.singletonList(needCopyNode);
|
|
List<WbsTreeContract> wbsTreeContractsNeed = Collections.singletonList(needCopyNode);
|
|
List<WbsTreeContract> wbsTreeContractsTo = Collections.singletonList(toCopyNode);
|
|
List<WbsTreeContract> wbsTreeContractsTo = Collections.singletonList(toCopyNode);
|
|
List<WbsTreeContract> needCopyNodeTabs = this.getChildNodesTables(wbsTreeContractsNeed, needCopyNode.getContractId());
|
|
List<WbsTreeContract> needCopyNodeTabs = this.getChildNodesTables(wbsTreeContractsNeed, needCopyNode.getContractId());
|
|
List<WbsTreeContract> toCopyNodeTabs = this.getChildNodesTables(wbsTreeContractsTo, needCopyNode.getContractId());
|
|
List<WbsTreeContract> toCopyNodeTabs = this.getChildNodesTables(wbsTreeContractsTo, needCopyNode.getContractId());
|
|
|
|
+ Map<String, WbsTreeContract> toCopyNodeTabsMaps = toCopyNodeTabs.stream().collect(Collectors.toMap(obj -> obj.getNodeName() + "-" + obj.getHtmlUrl(), Function.identity()));
|
|
if (needCopyNodeTabs.size() > 0) {
|
|
if (needCopyNodeTabs.size() > 0) {
|
|
for (WbsTreeContract needTab : needCopyNodeTabs) {
|
|
for (WbsTreeContract needTab : needCopyNodeTabs) {
|
|
- for (WbsTreeContract toCopyNodeTab : toCopyNodeTabs) {
|
|
|
|
- //获取相同表单 nodeName 、HtmlUrl相同
|
|
|
|
- if (needTab.getNodeName().equals(toCopyNodeTab.getNodeName()) && (ObjectUtil.isNotEmpty(needTab.getHtmlUrl()) && ObjectUtil.isNotEmpty(toCopyNodeTab.getHtmlUrl()) && needTab.getHtmlUrl().equals(toCopyNodeTab.getHtmlUrl()))) {
|
|
|
|
- if (StringUtils.isEmpty(needTab.getInitTableName())) {
|
|
|
|
- //没有对应实体表,跳过
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(needTab.getHtmlUrl())) {
|
|
|
|
+ String pKey = needTab.getNodeName() + "-" + needTab.getHtmlUrl();
|
|
|
|
+ //获取目标表对象
|
|
|
|
+ WbsTreeContract toCopyNodeTab = toCopyNodeTabsMaps.get(pKey);
|
|
|
|
+ //如果存在,只复制数据
|
|
|
|
+ if (toCopyNodeTab != null) {
|
|
Long oldPKeyId = needTab.getPKeyId();
|
|
Long oldPKeyId = needTab.getPKeyId();
|
|
-
|
|
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
|
|
if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
|
|
-
|
|
|
|
- //源表obj对象,文件附件使用
|
|
|
|
- if (!needTab.getTabFileType().equals(toCopyNodeTab.getTabFileType())) {
|
|
|
|
- toCopyNodeTab.setTabFileType(needTab.getTabFileType()); //已上传
|
|
|
|
- }
|
|
|
|
//目标表obj对象,文件附件使用
|
|
//目标表obj对象,文件附件使用
|
|
- addChildNodesTablesAll.add(toCopyNodeTab);
|
|
|
|
-
|
|
|
|
|
|
+ addNewFileTabs.add(toCopyNodeTab);
|
|
//获取实体表列对象
|
|
//获取实体表列对象
|
|
List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
|
|
List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.getInitTableName());
|
|
//转化为map
|
|
//转化为map
|
|
@@ -1727,6 +1757,52 @@ public class InformationWriteQueryController extends BladeController {
|
|
resultTablesData.add(copyDataSql.toString());
|
|
resultTablesData.add(copyDataSql.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ } else if (ObjectUtil.isNotEmpty(needTab.getIsCopeTab()) && (new Integer(2).equals(needTab.getIsCopeTab()) || new Integer(3).equals(needTab.getIsCopeTab()))) {
|
|
|
|
+ //如果不存在,则获新增复制的表,toCopyNodeTab == null && getIsCopeTab != null && =2为复制表、=3为频率表
|
|
|
|
+ WbsTreeContract objTab = BeanUtil.copyProperties(needTab, WbsTreeContract.class);
|
|
|
|
+ if (objTab != null) {
|
|
|
|
+ Long oldPKeyId = needTab.getPKeyId();
|
|
|
|
+ Long tabId = SnowFlakeUtil.getId();
|
|
|
|
+ objTab.setId(tabId);
|
|
|
|
+ objTab.setParentId(toCopyNode.getId());
|
|
|
|
+ objTab.setPKeyId(SnowFlakeUtil.getId());
|
|
|
|
+ //初始化是否显示表格,默认显示
|
|
|
|
+ objTab.setIsBussShow(1);
|
|
|
|
+ //初始化表格是否上传附件,默认未上传
|
|
|
|
+ objTab.setTabFileType(1);
|
|
|
|
+ //初始化单表是否可以预览,默认不能
|
|
|
|
+ objTab.setIsTabPdf(1);
|
|
|
|
+ //初始化PDF路径
|
|
|
|
+ objTab.setPdfUrl(null);
|
|
|
|
+ objTab.setCreateTime(new Date());
|
|
|
|
+ //获取当前复制的表的sort
|
|
|
|
+ objTab.setSort(ObjectUtils.isNotEmpty(needTab.getSort()) ? needTab.getSort() : 0);
|
|
|
|
+
|
|
|
|
+ //复制表
|
|
|
|
+ addChildNodesTablesAll.add(objTab);
|
|
|
|
+
|
|
|
|
+ //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
|
+ if (tabOwner.contains(objTab.getTableOwner()) && isCopyData == 1) {
|
|
|
|
+ //获取实体表列对象
|
|
|
|
+ List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(objTab.getInitTableName());
|
|
|
|
+ //转化为map
|
|
|
|
+ Map<String, String> nodeTabColsMap = nodeTabColOneTab.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
|
|
|
|
+ //组织复制表的数据的sql
|
|
|
|
+ if (nodeTabColsMap.size() > 0) {
|
|
|
|
+ StringBuilder copyDataSql = new StringBuilder();
|
|
|
|
+ String tableName = objTab.getInitTableName();
|
|
|
|
+ String col = nodeTabColsMap.get(tableName);
|
|
|
|
+ String colVal = nodeTabColsMap.get(tableName);
|
|
|
|
+ colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + objTab.getPKeyId() + "' as p_key_id,");
|
|
|
|
+ //delete SQL (先删除旧数据,再新增)
|
|
|
|
+ String delSql = "delete from " + tableName + " where p_key_id = " + objTab.getPKeyId() + " ; ";
|
|
|
|
+ //insert into SQL
|
|
|
|
+ copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
|
|
|
|
+ resultTablesData.add(copyDataSql.toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1736,9 +1812,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
/**
|
|
/**
|
|
* 新增复制的节点、表的数据构造
|
|
* 新增复制的节点、表的数据构造
|
|
*/
|
|
*/
|
|
- private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, List<WbsTreeContract> addTabList, List<WbsTreeContract> needNodes, List<WbsTreeContract> needTabs, WbsTreeContract
|
|
|
|
- needCopyNode, WbsTreeContract toCopyNode, List<String> resultTablesData, Integer isSameNode, String
|
|
|
|
- tabOwner, Integer isCopyData) {
|
|
|
|
|
|
+ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, List<WbsTreeContract> addTabList, List<WbsTreeContract> needNodes, List<WbsTreeContract> needTabs, WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, List<String> resultTablesData, Integer isSameNode, String tabOwner, Integer isCopyData) {
|
|
int var = 0;
|
|
int var = 0;
|
|
if (needNodes.size() == 1) {
|
|
if (needNodes.size() == 1) {
|
|
//判断是否为最下级节点
|
|
//判断是否为最下级节点
|
|
@@ -1766,6 +1840,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
obj.setFullName(toCopyNode.getNodeName());
|
|
obj.setFullName(toCopyNode.getNodeName());
|
|
obj.setPartitionCode(toCopyNode.getPartitionCode());
|
|
obj.setPartitionCode(toCopyNode.getPartitionCode());
|
|
obj.setCreateTime(new Date());
|
|
obj.setCreateTime(new Date());
|
|
|
|
+ //获取当前复制的节点的sort
|
|
|
|
+ obj.setSort(ObjectUtils.isNotEmpty(needNode.getSort()) ? needNode.getSort() : 0);
|
|
|
|
+
|
|
addNodeList.add(obj);
|
|
addNodeList.add(obj);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1790,6 +1867,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
//初始化PDF路径
|
|
//初始化PDF路径
|
|
obj.setPdfUrl(null);
|
|
obj.setPdfUrl(null);
|
|
obj.setCreateTime(new Date());
|
|
obj.setCreateTime(new Date());
|
|
|
|
+ //获取当前复制的表的sort
|
|
|
|
+ obj.setSort(ObjectUtils.isNotEmpty(needTab.getSort()) ? needTab.getSort() : 0);
|
|
|
|
+
|
|
addTabList.add(obj);
|
|
addTabList.add(obj);
|
|
|
|
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
@@ -1805,7 +1885,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
String col = nodeTabColsMap.get(tableName);
|
|
String col = nodeTabColsMap.get(tableName);
|
|
String colVal = nodeTabColsMap.get(tableName);
|
|
String colVal = nodeTabColsMap.get(tableName);
|
|
colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + obj.getPKeyId() + "' as p_key_id,");
|
|
colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + obj.getPKeyId() + "' as p_key_id,");
|
|
- copyDataSql.append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
|
|
|
|
|
|
+ //delete SQL (先删除旧数据,再新增)
|
|
|
|
+ String delSql = "delete from " + tableName + " where p_key_id = " + obj.getPKeyId() + " ; ";
|
|
|
|
+ //insert into SQL
|
|
|
|
+ copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
|
|
resultTablesData.add(copyDataSql.toString());
|
|
resultTablesData.add(copyDataSql.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1850,6 +1933,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
obj.setId(id);
|
|
obj.setId(id);
|
|
obj.setParentId(newParentId);
|
|
obj.setParentId(newParentId);
|
|
obj.setCreateTime(new Date());
|
|
obj.setCreateTime(new Date());
|
|
|
|
+ //获取当前复制的节点的sort
|
|
|
|
+ obj.setSort(ObjectUtils.isNotEmpty(node.getSort()) ? node.getSort() : 0);
|
|
|
|
+
|
|
addNodeList.add(obj);
|
|
addNodeList.add(obj);
|
|
|
|
|
|
//构造当前节点下所有元素表
|
|
//构造当前节点下所有元素表
|
|
@@ -1877,6 +1963,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
//初始化PDF路径
|
|
//初始化PDF路径
|
|
objTab.setPdfUrl(null);
|
|
objTab.setPdfUrl(null);
|
|
objTab.setCreateTime(new Date());
|
|
objTab.setCreateTime(new Date());
|
|
|
|
+ //获取当前复制的表的sort
|
|
|
|
+ objTab.setSort(ObjectUtils.isNotEmpty(needTab.getSort()) ? needTab.getSort() : 0);
|
|
|
|
+
|
|
addTabList.add(objTab);
|
|
addTabList.add(objTab);
|
|
|
|
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
//表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
@@ -1888,7 +1977,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
String col = queryProcessDataVO.getAncestors();
|
|
String col = queryProcessDataVO.getAncestors();
|
|
String colVal = queryProcessDataVO.getAncestors();
|
|
String colVal = queryProcessDataVO.getAncestors();
|
|
colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
|
|
colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + needTab.getPKeyId() + "' as p_key_id,");
|
|
- copyDataSql.append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
|
|
|
|
|
|
+ //delete SQL (先删除旧数据,再新增)
|
|
|
|
+ String delSql = "delete from " + tableName + " where p_key_id = " + needTab.getPKeyId() + " ; ";
|
|
|
|
+ //insert into SQL
|
|
|
|
+ copyDataSql.append(delSql).append("insert into ").append(tableName).append(" (").append(col).append(") select ").append(colVal).append(" from ").append(tableName).append(" where p_key_id='").append(oldPKeyId).append("' ;");
|
|
resultTablesData.add(copyDataSql.toString());
|
|
resultTablesData.add(copyDataSql.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1911,6 +2003,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
needCopyNode.setNodeName(toCopyNode.getNodeName());
|
|
needCopyNode.setNodeName(toCopyNode.getNodeName());
|
|
needCopyNode.setFullName(toCopyNode.getNodeName());
|
|
needCopyNode.setFullName(toCopyNode.getNodeName());
|
|
needCopyNode.setPartitionCode(toCopyNode.getPartitionCode());
|
|
needCopyNode.setPartitionCode(toCopyNode.getPartitionCode());
|
|
|
|
+ needCopyNode.setCreateTime(new Date());
|
|
|
|
+
|
|
addNodeList.add(needCopyNode);
|
|
addNodeList.add(needCopyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2181,7 +2275,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
* 生成施工日志记录
|
|
* 生成施工日志记录
|
|
*/
|
|
*/
|
|
private void createLedger(WbsTreeContract
|
|
private void createLedger(WbsTreeContract
|
|
- newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreePrivate> projectNodeMap) {
|
|
|
|
|
|
+ newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreeContract> projectNodeMap) {
|
|
//工序,需要新增施工台账
|
|
//工序,需要新增施工台账
|
|
ConstructionLedger ledger = new ConstructionLedger();
|
|
ConstructionLedger ledger = new ConstructionLedger();
|
|
//获取这个节点的原始信息
|
|
//获取这个节点的原始信息
|
|
@@ -2203,13 +2297,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
}
|
|
}
|
|
} else if (projectNodeMap != null) {
|
|
} else if (projectNodeMap != null) {
|
|
if (projectNodeMap.containsKey(newData.getOldId())) {
|
|
if (projectNodeMap.containsKey(newData.getOldId())) {
|
|
- WbsTreePrivate contractNode = projectNodeMap.get(newData.getOldId());
|
|
|
|
|
|
+ WbsTreeContract contractNode = projectNodeMap.get(newData.getOldId());
|
|
if (contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())) {
|
|
if (contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())) {
|
|
- WbsTreePrivate parentNode;
|
|
|
|
|
|
+ WbsTreeContract parentNode;
|
|
if (projectNodeMap.containsKey(contractNode.getParentId().toString())) {
|
|
if (projectNodeMap.containsKey(contractNode.getParentId().toString())) {
|
|
parentNode = projectNodeMap.get(contractNode.getParentId().toString());
|
|
parentNode = projectNodeMap.get(contractNode.getParentId().toString());
|
|
} else {
|
|
} else {
|
|
- parentNode = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(contractNode.getProjectId(), contractNode.getParentId());
|
|
|
|
|
|
+ parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(contractNode.getContractId()), contractNode.getParentId());
|
|
}
|
|
}
|
|
if (parentNode != null) {
|
|
if (parentNode != null) {
|
|
ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
|
|
ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
|
|
@@ -2381,7 +2475,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
private void currentNodeAllParent(StringBuilder nodeName, WbsTreeContract currentNode) {
|
|
private void currentNodeAllParent(StringBuilder nodeName, WbsTreeContract currentNode) {
|
|
if (!"0".equals(String.valueOf(currentNode.getParentId()))) {
|
|
if (!"0".equals(String.valueOf(currentNode.getParentId()))) {
|
|
//如果父节点不是0说明没到顶层
|
|
//如果父节点不是0说明没到顶层
|
|
- WbsTreeContract parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(currentNode.getContractId()), currentNode.getParentId());
|
|
|
|
|
|
+ WbsTreeContract parentNode = jdbcTemplate.query("select full_name,node_name from m_wbs_tree_contract where is_deleted = 0 and contract_id = " + currentNode.getContractId() + " and id = " + currentNode.getParentId(), new BeanPropertyRowMapper<>(WbsTreeContract.class)).stream().findAny().orElse(null);
|
|
if (parentNode != null) {
|
|
if (parentNode != null) {
|
|
nodeName.append("-").append(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
|
|
nodeName.append("-").append(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getNodeName());
|
|
this.currentNodeAllParent(nodeName, parentNode);
|
|
this.currentNodeAllParent(nodeName, parentNode);
|
|
@@ -2407,7 +2501,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
this.currentNodeAllParent(parentNodeName, removeNode);
|
|
this.currentNodeAllParent(parentNodeName, removeNode);
|
|
|
|
|
|
//查询所有子节点
|
|
//查询所有子节点
|
|
- List<WbsTreeContract> removeNodeList = this.wbsTreeContractClient.queryCurrentNodeAllChild(Long.parseLong(removeNode.getContractId()), removeNode.getId());
|
|
|
|
|
|
+ List<WbsTreeContract> removeNodeList = jdbcTemplate.query("select p_key_id,type from m_wbs_tree_contract where is_deleted = 0 and contract_id = " + removeNode.getContractId() + " and ancestors like '%" + removeNode.getId() + "%'", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
//获取pKeyId
|
|
//获取pKeyId
|
|
List<Long> removeList = removeNodeList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList());
|
|
List<Long> removeList = removeNodeList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList());
|
|
//拼接
|
|
//拼接
|
|
@@ -2415,7 +2509,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
//删除掉表格
|
|
//删除掉表格
|
|
removeNodeList.removeIf(tree -> tree.getType() != null && new Integer("2").equals(tree.getType()));
|
|
removeNodeList.removeIf(tree -> tree.getType() != null && new Integer("2").equals(tree.getType()));
|
|
//获取被删除节点名称
|
|
//获取被删除节点名称
|
|
- String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());
|
|
|
|
|
|
+ //String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());
|
|
|
|
|
|
//获取当前节点下所有填报节点
|
|
//获取当前节点下所有填报节点
|
|
List<QueryProcessDataVO> queryProcess = new ArrayList<>();
|
|
List<QueryProcessDataVO> queryProcess = new ArrayList<>();
|
|
@@ -2430,7 +2524,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
if (queryProcess != null && queryProcess.size() > 0) {
|
|
if (queryProcess != null && queryProcess.size() > 0) {
|
|
//检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
|
|
//检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
|
|
List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId() != null).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()) && vo.getInformationQueryId() != null).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) {
|
|
if (approvalList.size() > 0 || runTaskList.size() > 0) {
|
|
//说明存在已经审批或已经上报的节点,不允许删除
|
|
//说明存在已经审批或已经上报的节点,不允许删除
|
|
@@ -2457,7 +2550,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
//保存进回收站
|
|
//保存进回收站
|
|
this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
|
|
this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
|
|
Boolean aBoolean = this.wbsTreeContractClient.removeContractTreeNode(idArray);
|
|
Boolean aBoolean = this.wbsTreeContractClient.removeContractTreeNode(idArray);
|
|
- // 更新redis
|
|
|
|
|
|
+ //更新redis
|
|
this.informationQueryService.AsyncWbsTree(removeNode.getParentId() + "", removeNode.getParentId() + "", removeNode.getContractId(), "", "1");
|
|
this.informationQueryService.AsyncWbsTree(removeNode.getParentId() + "", removeNode.getParentId() + "", removeNode.getContractId(), "", "1");
|
|
return R.data(aBoolean);
|
|
return R.data(aBoolean);
|
|
}
|
|
}
|
|
@@ -2484,7 +2577,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
selectList.addAll(allSelectedNodeList);
|
|
selectList.addAll(allSelectedNodeList);
|
|
|
|
|
|
//所有相关节点集合
|
|
//所有相关节点集合
|
|
- List<WbsTreePrivate> selectedNodeList = new ArrayList<>();
|
|
|
|
|
|
+ List<WbsTreeContract> selectedNodeList = new ArrayList<>();
|
|
|
|
|
|
//检查新增类型
|
|
//检查新增类型
|
|
if ("1".equals(vo.getSaveType())) {
|
|
if ("1".equals(vo.getSaveType())) {
|
|
@@ -2492,12 +2585,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
//当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
|
|
//当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
|
|
if (allSelectedNodeList.size() > 0) {
|
|
if (allSelectedNodeList.size() > 0) {
|
|
//查询数据
|
|
//查询数据
|
|
- selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
|
|
|
|
|
|
+ selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract, "1");
|
|
|
|
|
|
//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
|
|
//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
|
|
- List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<WbsTreeContract> submitNodeList = selectedNodeList.stream().filter(treeContract1 -> Arrays.asList("1,2,3,4".split(",")).contains(treeContract1.getMajorDataType().toString())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- List<WbsTreePrivate> childList = new ArrayList<>();
|
|
|
|
|
|
+ List<WbsTreeContract> childList = new ArrayList<>();
|
|
if (submitNodeList.size() > 0) {
|
|
if (submitNodeList.size() > 0) {
|
|
this.foreachQueryChild(submitNodeList, childList);
|
|
this.foreachQueryChild(submitNodeList, childList);
|
|
//将表格数据设置
|
|
//将表格数据设置
|
|
@@ -2506,11 +2599,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
if (childList.size() > 0) {
|
|
if (childList.size() > 0) {
|
|
//处理重复的数据
|
|
//处理重复的数据
|
|
- Iterator<WbsTreePrivate> iterator = childList.iterator();
|
|
|
|
|
|
+ Iterator<WbsTreeContract> iterator = childList.iterator();
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
- WbsTreePrivate next = iterator.next();
|
|
|
|
- for (WbsTreePrivate treePrivate : selectedNodeList) {
|
|
|
|
- if (treePrivate.getPKeyId().equals(next.getPKeyId())) {
|
|
|
|
|
|
+ WbsTreeContract next = iterator.next();
|
|
|
|
+ for (WbsTreeContract wbsTreeContract : selectedNodeList) {
|
|
|
|
+ if (wbsTreeContract.getPKeyId().equals(next.getPKeyId())) {
|
|
//删掉重复数据
|
|
//删掉重复数据
|
|
iterator.remove();
|
|
iterator.remove();
|
|
break;
|
|
break;
|
|
@@ -2528,20 +2621,18 @@ public class InformationWriteQueryController extends BladeController {
|
|
//todo 仅当前节点操作
|
|
//todo 仅当前节点操作
|
|
if (allSelectedNodeList.size() > 0) {
|
|
if (allSelectedNodeList.size() > 0) {
|
|
//查询数据
|
|
//查询数据
|
|
- selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
|
|
|
|
|
|
+ selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract, "0");
|
|
|
|
|
|
//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
|
|
//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
|
|
- List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<WbsTreeContract> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- List<WbsTreePrivate> childList = new ArrayList<>();
|
|
|
|
|
|
+ List<WbsTreeContract> childList = new ArrayList<>();
|
|
if (submitNodeList.size() > 0) {
|
|
if (submitNodeList.size() > 0) {
|
|
this.foreachQueryChild(submitNodeList, childList);
|
|
this.foreachQueryChild(submitNodeList, childList);
|
|
//将表格数据设置
|
|
//将表格数据设置
|
|
selectedNodeList.addAll(childList);
|
|
selectedNodeList.addAll(childList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //处理半选
|
|
|
|
- this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//保存集合
|
|
//保存集合
|
|
@@ -2550,7 +2641,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
if (selectedNodeList.size() > 0) {
|
|
if (selectedNodeList.size() > 0) {
|
|
//重塑关键信息
|
|
//重塑关键信息
|
|
Map<Long, Long> OldIdToNewIdMap = new HashMap<>();
|
|
Map<Long, Long> OldIdToNewIdMap = new HashMap<>();
|
|
- Map<String, WbsTreePrivate> nodeMap = new HashMap<>();
|
|
|
|
|
|
+ Map<String, WbsTreeContract> nodeMap = new HashMap<>();
|
|
selectedNodeList.forEach(half -> {
|
|
selectedNodeList.forEach(half -> {
|
|
OldIdToNewIdMap.put(half.getId(), SnowFlakeUtil.getId());
|
|
OldIdToNewIdMap.put(half.getId(), SnowFlakeUtil.getId());
|
|
nodeMap.put(half.getId().toString(), half);
|
|
nodeMap.put(half.getId().toString(), half);
|
|
@@ -2567,7 +2658,22 @@ public class InformationWriteQueryController extends BladeController {
|
|
if (new Integer("1").equals(half.getType())) {
|
|
if (new Integer("1").equals(half.getType())) {
|
|
newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
|
|
newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
|
|
}
|
|
}
|
|
- newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
|
|
|
+
|
|
|
|
+ //设置父级id
|
|
|
|
+ if (("1").equals(vo.getSaveType())) {
|
|
|
|
+ //当前节点及其子节点操作
|
|
|
|
+ newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
|
+ } else {
|
|
|
|
+ //仅当前节点新增操作时,父级id=选择新增的节点父级id
|
|
|
|
+ if (new Integer("1").equals(half.getType())) {
|
|
|
|
+ //节点
|
|
|
|
+ newData.setParentId(half.getParentId());
|
|
|
|
+ } else if (new Integer("2").equals(half.getType())) {
|
|
|
|
+ //表
|
|
|
|
+ newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//记录旧ID
|
|
//记录旧ID
|
|
newData.setOldId(half.getId().toString());
|
|
newData.setOldId(half.getId().toString());
|
|
//设置合同段等信息
|
|
//设置合同段等信息
|
|
@@ -2635,21 +2741,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
|
|
|
|
//更新redis
|
|
//更新redis
|
|
- List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.informationQueryService.queryContractTree(treeContract.getId() + "", treeContract.getContractId(), "", "1");
|
|
|
|
-
|
|
|
|
informationQueryService.AsyncWbsTree(treeContract.getId() + "", treeContract.getId() + "", treeContract.getContractId(), "", "1");
|
|
informationQueryService.AsyncWbsTree(treeContract.getId() + "", treeContract.getId() + "", treeContract.getContractId(), "", "1");
|
|
|
|
+ informationQueryService.AsyncWbsTree(treeContract.getParentId() + "", treeContract.getParentId() + "", treeContract.getContractId(), "", "1");
|
|
return booleanR;
|
|
return booleanR;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<WbsTreePrivate> unifiedCode
|
|
|
|
- (List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract) {
|
|
|
|
|
|
+ private List<WbsTreeContract> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract, String saveType) {
|
|
//获取主键
|
|
//获取主键
|
|
- List<String> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).map(Long::parseLong).distinct().collect(Collectors.toList());
|
|
//查询数据
|
|
//查询数据
|
|
- List<WbsTreePrivate> selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
|
|
|
|
- //剔除与当前操作节点相同的ID
|
|
|
|
- selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
|
|
-
|
|
|
|
|
|
+ List<WbsTreeContract> selectedNodeList = this.wbsTreeContractClient.queryContractTreeNodeByPKIds(halfSelectedList);
|
|
|
|
+ //剔除与当前操作节点相同的ID,(如果saveType=1,表示当前及子级节点,那么就要剔除自己本身,否则视为仅当前节点操作,会存在自己本身)
|
|
|
|
+ if (("1").equals(saveType)) {
|
|
|
|
+ selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
|
|
+ }
|
|
return selectedNodeList;
|
|
return selectedNodeList;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2710,13 +2815,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
/**
|
|
/**
|
|
* 处理半选集合
|
|
* 处理半选集合
|
|
*/
|
|
*/
|
|
- private void disposeHalfSelectList(@RequestBody WbsTreeContract
|
|
|
|
- treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreePrivate> selectedNodeList) {
|
|
|
|
|
|
+ private void disposeHalfSelectList(@RequestBody WbsTreeContract treeContract, List<AddContractTreeNodeVO.Node> allSelectedNodeList, List<WbsTreeContract> selectedNodeList) {
|
|
if (allSelectedNodeList != null && allSelectedNodeList.size() > 0) {
|
|
if (allSelectedNodeList != null && allSelectedNodeList.size() > 0) {
|
|
//获取主键
|
|
//获取主键
|
|
- List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).map(Long::parseLong).distinct().collect(Collectors.toList());
|
|
//查询对应数据
|
|
//查询对应数据
|
|
- List<WbsTreePrivate> allSelectedNodeLists = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
|
|
|
|
|
|
+ List<WbsTreeContract> allSelectedNodeLists = this.wbsTreeContractClient.queryContractTreeNodeByPKIds(allSelectedList);
|
|
//剔除与当前操作节点相同的ID
|
|
//剔除与当前操作节点相同的ID
|
|
allSelectedNodeLists.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
allSelectedNodeLists.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
//设置到集合中
|
|
//设置到集合中
|
|
@@ -2730,9 +2834,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
* @param parentList 父节点集合
|
|
* @param parentList 父节点集合
|
|
* @param childList 保存集合
|
|
* @param childList 保存集合
|
|
*/
|
|
*/
|
|
- private void foreachQueryChild(List<WbsTreePrivate> parentList, List<WbsTreePrivate> childList) {
|
|
|
|
|
|
+ private void foreachQueryChild(List<WbsTreeContract> parentList, List<WbsTreeContract> childList) {
|
|
parentList.forEach(parent -> {
|
|
parentList.forEach(parent -> {
|
|
- List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
|
|
|
|
|
|
+ List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "", "");
|
|
|
|
|
|
if (childs != null && childs.size() > 0) {
|
|
if (childs != null && childs.size() > 0) {
|
|
//添加入结果集
|
|
//添加入结果集
|