|
@@ -58,6 +58,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -1403,7 +1404,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
|
|
|
// 组织复制值Sql
|
|
|
- if (nodeTabColsMap != null && node.getType() == 2) {
|
|
|
+ if (nodeTabColsMap != null && node.getType() == 2 && StringUtils.isNotEmpty(newData.getInitTableName())) {
|
|
|
String tableName = newData.getInitTableName();
|
|
|
String col = nodeTabColsMap.get(tableName);
|
|
|
String colVal = nodeTabColsMap.get(tableName);
|
|
@@ -1437,6 +1438,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
* 2.2 如果点击选择的是当前复制节点本身的同等级节点,那么复制对应表数据,如果没有对应表,那么跳过。
|
|
|
*/
|
|
|
} else if (("2").equals(vo.getCopyType())) {
|
|
|
+
|
|
|
//获取需要复制到的位置节点信息的集合
|
|
|
List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
|
|
|
if (copyBatches.size() > 0) {
|
|
@@ -1454,8 +1456,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
|
|
|
//结果集
|
|
|
- List<WbsTreeContract> addChildNodesAll = new ArrayList<>();
|
|
|
- List<WbsTreeContract> addChildNodesTablesAll = new ArrayList<>();
|
|
|
+ List<WbsTreeContract> addNodeList = new ArrayList<>();
|
|
|
+ List<WbsTreeContract> addTabList = new ArrayList<>();
|
|
|
+ List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>();
|
|
|
Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>();
|
|
|
List<String> resultTablesData = new ArrayList<>();
|
|
|
|
|
@@ -1467,6 +1470,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
tabOwner = "1,2,3";
|
|
|
} else if (("2").equals(vo.getClassifyType())) {
|
|
|
tabOwner = "4,5,6";
|
|
|
+ } else if (vo.getIsCopyData() == 0 && StringUtils.isEmpty(tabOwner)) {
|
|
|
+ //如果选择的是否复制数据=0(否),默认所属方123456
|
|
|
+ tabOwner = "1,2,3,4,5,6";
|
|
|
}
|
|
|
|
|
|
//解析位置信息,进行复制数据构造
|
|
@@ -1475,6 +1481,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//首先查询需要复制的节点的信息
|
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
WbsTreeContract toCopyNode = toCopyNodes.get(i);
|
|
|
+ asyncWbsTreeNodes.add(toCopyNode);
|
|
|
CopyContractTreeNodeVO.CopyBatch toCopyVO = copyBatches.get(i);
|
|
|
|
|
|
if (toCopyNode != null && toCopyVO != null && needCopyNode != null) {
|
|
@@ -1502,16 +1509,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
addChildNodesTablesOldAll.addAll(oldTab);
|
|
|
|
|
|
//构造新的节点、表、数据
|
|
|
- this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData());
|
|
|
-
|
|
|
- //返回结果集
|
|
|
- addChildNodesAll.addAll(addChildNodes);
|
|
|
- addChildNodesTablesAll.addAll(addChildNodesTables);
|
|
|
+ this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData());
|
|
|
|
|
|
//1.2 选择同父级的同级节点,只复制数据
|
|
|
} else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
|
//构造数据
|
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addChildNodesTablesAll, vo.getIsCopyData());
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addTabList, vo.getIsCopyData());
|
|
|
}
|
|
|
|
|
|
//TODO 跨节点复制
|
|
@@ -1541,16 +1544,12 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
addChildNodesTablesOldAll.addAll(oldTab);
|
|
|
|
|
|
//构造新的节点、表、数据
|
|
|
- this.addCopyNodesAndTabsBuildData(addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
|
|
|
-
|
|
|
- //返回结果集
|
|
|
- addChildNodesAll.addAll(addChildNodes);
|
|
|
- addChildNodesTablesAll.addAll(addChildNodesTables);
|
|
|
+ this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, addChildNodes, addChildNodesTables, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData());
|
|
|
|
|
|
//2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据)
|
|
|
} else if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
|
//构造数据
|
|
|
- this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addChildNodesTablesAll, vo.getIsCopyData());
|
|
|
+ this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addChildNodesTablesOldAll, addTabList, vo.getIsCopyData());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1558,21 +1557,22 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
|
|
|
//节点
|
|
|
- if (addChildNodesAll.size() > 0) {
|
|
|
- wbsTreeContractClient.saveBatch(addChildNodesAll);
|
|
|
+ if (addNodeList.size() > 0) {
|
|
|
+ wbsTreeContractClient.saveBatch(addNodeList);
|
|
|
//更新redis缓存
|
|
|
- Map<Long, List<WbsTreeContract>> collect = addChildNodesAll.stream().filter(f -> new Integer(1).equals(f.getType()) && ObjectUtil.isNotEmpty(f.getParentId())).collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
- for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
|
|
|
- informationQueryService.AsyncWbsTree("", longListEntry.getKey().toString(), contractId, "", "1");
|
|
|
+ if (asyncWbsTreeNodes.size() > 0) {
|
|
|
+ for (WbsTreeContract asyncWbsTreeNode : asyncWbsTreeNodes) {
|
|
|
+ informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getParentId() + "", contractId, "", "1");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//元素表
|
|
|
- if (addChildNodesTablesAll.size() > 0) {
|
|
|
- wbsTreeContractClient.saveBatch(addChildNodesTablesAll);
|
|
|
+ if (addTabList.size() > 0) {
|
|
|
+ wbsTreeContractClient.saveBatch(addTabList);
|
|
|
|
|
|
//表单文件附件
|
|
|
if (addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
- this.addCopyTabFile(addChildNodesTablesAll, addChildNodesTablesOldAll);
|
|
|
+ this.addCopyTabFile(addTabList, addChildNodesTablesOldAll);
|
|
|
}
|
|
|
}
|
|
|
//实体表数据
|
|
@@ -1674,7 +1674,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
/**
|
|
|
* 新增复制的节点、表的数据构造
|
|
|
*/
|
|
|
- private void addCopyNodesAndTabsBuildData(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;
|
|
|
if (needNodes.size() == 1) {
|
|
|
//判断是否为最下级节点
|
|
@@ -1689,54 +1689,66 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//构造节点
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
for (WbsTreeContract needNode : needNodes) {
|
|
|
- if (isSameNode == 0) {
|
|
|
- //跨节点复制,更改父级id
|
|
|
- needNode.setParentId(toCopyNode.getId());
|
|
|
+ WbsTreeContract obj = BeanUtil.copyProperties(needNode, WbsTreeContract.class);
|
|
|
+ if (obj != null) {
|
|
|
+ if (isSameNode == 0) {
|
|
|
+ //跨节点复制,更改父级id
|
|
|
+ obj.setParentId(toCopyNode.getId());
|
|
|
+ //设置祖级id
|
|
|
+ String[] split = obj.getAncestors().split(",");
|
|
|
+ String lastId = split[split.length - 1];
|
|
|
+ obj.setAncestors(obj.getAncestors().replace(lastId, toCopyNode.getId().toString()));
|
|
|
+ }
|
|
|
+ obj.setOldId(needNode.getId() + "");
|
|
|
+ obj.setPKeyId(SnowFlakeUtil.getId());
|
|
|
+ obj.setId(id);
|
|
|
+ obj.setNodeName(toCopyNode.getNodeName());
|
|
|
+ obj.setFullName(toCopyNode.getNodeName());
|
|
|
+ obj.setPartitionCode(toCopyNode.getPartitionCode());
|
|
|
+ obj.setCreateTime(new Date());
|
|
|
+ addNodeList.add(obj);
|
|
|
+ break;
|
|
|
}
|
|
|
- needNode.setOldId(needNode.getId() + "");
|
|
|
- needNode.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- needNode.setId(id);
|
|
|
- needNode.setNodeName(toCopyNode.getNodeName());
|
|
|
- needNode.setFullName(toCopyNode.getNodeName());
|
|
|
- needNode.setPartitionCode(toCopyNode.getPartitionCode());
|
|
|
- break;
|
|
|
}
|
|
|
//构造当前节点下所有元素表
|
|
|
for (WbsTreeContract needTab : needTabs) {
|
|
|
if (StringUtils.isEmpty(needTab.getInitTableName())) {
|
|
|
continue;
|
|
|
}
|
|
|
- Long oldPKeyId = needTab.getPKeyId();
|
|
|
-
|
|
|
- Long tabId = SnowFlakeUtil.getId();
|
|
|
- needTab.setAncestors(needTab.getAncestors().replace(needTab.getParentId().toString(), id.toString()));
|
|
|
- needTab.setId(tabId);
|
|
|
- needTab.setParentId(id);
|
|
|
- needTab.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- //初始化是否显示表格,默认显示
|
|
|
- needTab.setIsBussShow(1);
|
|
|
- //初始化表格是否上传附件,默认未上传
|
|
|
- needTab.setTabFileType(1);
|
|
|
- //初始化单表是否可以预览,默认不能
|
|
|
- needTab.setIsTabPdf(1);
|
|
|
- //初始化PDF路径
|
|
|
- needTab.setPdfUrl(null);
|
|
|
-
|
|
|
- //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
- if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
|
|
|
- //获取实体表列对象
|
|
|
- List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.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 = needTab.getInitTableName();
|
|
|
- String col = nodeTabColsMap.get(tableName);
|
|
|
- String colVal = nodeTabColsMap.get(tableName);
|
|
|
- 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("' ;");
|
|
|
- resultTablesData.add(copyDataSql.toString());
|
|
|
+ WbsTreeContract obj = BeanUtil.copyProperties(needTab, WbsTreeContract.class);
|
|
|
+ if (obj != null) {
|
|
|
+ Long oldPKeyId = needTab.getPKeyId();
|
|
|
+ obj.setAncestors(needTab.getAncestors().replace(needTab.getParentId().toString(), id.toString()));
|
|
|
+ obj.setId(SnowFlakeUtil.getId());
|
|
|
+ obj.setParentId(id);
|
|
|
+ obj.setPKeyId(SnowFlakeUtil.getId());
|
|
|
+ //初始化是否显示表格,默认显示
|
|
|
+ obj.setIsBussShow(1);
|
|
|
+ //初始化表格是否上传附件,默认未上传
|
|
|
+ obj.setTabFileType(1);
|
|
|
+ //初始化单表是否可以预览,默认不能
|
|
|
+ obj.setIsTabPdf(1);
|
|
|
+ //初始化PDF路径
|
|
|
+ obj.setPdfUrl(null);
|
|
|
+ obj.setCreateTime(new Date());
|
|
|
+ addTabList.add(obj);
|
|
|
+
|
|
|
+ //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
+ if (tabOwner.contains(obj.getTableOwner()) && isCopyData == 1) {
|
|
|
+ //获取实体表列对象
|
|
|
+ List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(obj.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 = obj.getInitTableName();
|
|
|
+ String col = 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,");
|
|
|
+ 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("' ;");
|
|
|
+ resultTablesData.add(copyDataSql.toString());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1749,70 +1761,81 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Map<Long, Long> parentIdToId = new HashMap<>();
|
|
|
Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
|
|
|
+ //获取节点下所有表的key
|
|
|
+ List<String> initTabNames = needTabs.stream().map(WbsTreeContract::getInitTableName).distinct().filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
|
|
+ String joined = StringUtils.join(initTabNames, ",");
|
|
|
+ joined = "'" + joined.replaceAll(",", "','") + "'";
|
|
|
+ Map<String, QueryProcessDataVO> tabColsAllByTabNameMaps = jdbcTemplate.query("SELECT table_name as queryType, GROUP_CONCAT(COLUMN_name) as ancestors from information_schema.COLUMNS where table_name in (" + joined + ") GROUP BY table_name", new BeanPropertyRowMapper<>(QueryProcessDataVO.class)).stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, Function.identity()));
|
|
|
for (WbsTreeContract node : needNodes) {
|
|
|
Long oldId = node.getId();
|
|
|
- //构造节点
|
|
|
- Long newParentId;
|
|
|
- if (parentIdToId.size() > 0) {
|
|
|
- //去数据源节点获取父级id对应的新id,设置成重设后的新的父级id
|
|
|
- newParentId = parentIdToId.get(node.getParentId());
|
|
|
- } else {
|
|
|
- //根节点
|
|
|
- newParentId = toCopyNode.getId();
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(newParentId)) {
|
|
|
- newParentId = toCopyNode.getId();
|
|
|
- }
|
|
|
- node.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- node.setOldId(node.getId().toString());
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
- //数据源节点的老id与新的id的Map,作为下一级的节点的父级id的替换
|
|
|
- parentIdToId.put(node.getId(), id);
|
|
|
- //重设祖级id
|
|
|
- node.setAncestors(node.getAncestors().replace(node.getParentId().toString(), id.toString()));
|
|
|
- //重设Id
|
|
|
- node.setId(id);
|
|
|
- node.setParentId(newParentId);
|
|
|
-
|
|
|
- //构造当前节点下所有元素表
|
|
|
- List<WbsTreeContract> tabs = tabMap.get(oldId);
|
|
|
- //构造节点下的表
|
|
|
- if (tabs != null && tabs.size() > 0) {
|
|
|
- for (WbsTreeContract needTab : tabs) {
|
|
|
- if (StringUtils.isEmpty(needTab.getInitTableName())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- Long oldPKeyId = needTab.getPKeyId();
|
|
|
-
|
|
|
- Long tabId = SnowFlakeUtil.getId();
|
|
|
- needTab.setAncestors(needTab.getAncestors().replace(needTab.getParentId().toString(), id.toString()));
|
|
|
- needTab.setId(tabId);
|
|
|
- needTab.setParentId(id);
|
|
|
- needTab.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- //初始化是否显示表格,默认显示
|
|
|
- needTab.setIsBussShow(1);
|
|
|
- //初始化表格是否上传附件,默认未上传
|
|
|
- needTab.setTabFileType(1);
|
|
|
- //初始化单表是否可以预览,默认不能
|
|
|
- needTab.setIsTabPdf(1);
|
|
|
- //初始化PDF路径
|
|
|
- needTab.setPdfUrl(null);
|
|
|
-
|
|
|
- //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
- if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1) {
|
|
|
- //获取实体表列对象
|
|
|
- List<QueryProcessDataVO> nodeTabColOneTab = informationQueryService.getNodeChildTabColsAllByTabName(needTab.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();
|
|
|
+ WbsTreeContract obj = BeanUtil.copyProperties(node, WbsTreeContract.class);
|
|
|
+ if (obj != null) {
|
|
|
+ //构造节点
|
|
|
+ Long newParentId;
|
|
|
+ if (parentIdToId.size() > 0) {
|
|
|
+ //去数据源节点获取父级id对应的新id,设置成重设后的新的父级id
|
|
|
+ newParentId = parentIdToId.get(node.getParentId());
|
|
|
+ } else {
|
|
|
+ //根节点
|
|
|
+ newParentId = toCopyNode.getId();
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isEmpty(newParentId)) {
|
|
|
+ newParentId = toCopyNode.getId();
|
|
|
+ }
|
|
|
+ obj.setPKeyId(SnowFlakeUtil.getId());
|
|
|
+ obj.setOldId(node.getId().toString());
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ //数据源节点的老id与新的id的Map,作为下一级的节点的父级id的替换
|
|
|
+ parentIdToId.put(node.getId(), id);
|
|
|
+ //重设祖级id
|
|
|
+ this.restoreParent(obj, parentIdToId);
|
|
|
+ //重设Id
|
|
|
+ obj.setId(id);
|
|
|
+ obj.setParentId(newParentId);
|
|
|
+ obj.setCreateTime(new Date());
|
|
|
+ addNodeList.add(obj);
|
|
|
+
|
|
|
+ //构造当前节点下所有元素表
|
|
|
+ List<WbsTreeContract> tabs = tabMap.get(oldId);
|
|
|
+ //构造节点下的表
|
|
|
+ if (tabs != null && tabs.size() > 0) {
|
|
|
+ for (WbsTreeContract needTab : tabs) {
|
|
|
+ if (StringUtils.isEmpty(needTab.getInitTableName())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ WbsTreeContract objTab = BeanUtil.copyProperties(needTab, WbsTreeContract.class);
|
|
|
+ if (objTab != null) {
|
|
|
+ Long oldPKeyId = needTab.getPKeyId();
|
|
|
String tableName = needTab.getInitTableName();
|
|
|
- String col = nodeTabColsMap.get(tableName);
|
|
|
- String colVal = nodeTabColsMap.get(tableName);
|
|
|
- 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("' ;");
|
|
|
- resultTablesData.add(copyDataSql.toString());
|
|
|
+ Long tabId = SnowFlakeUtil.getId();
|
|
|
+ objTab.setAncestors(needTab.getAncestors().replace(needTab.getParentId().toString(), id.toString()));
|
|
|
+ objTab.setId(tabId);
|
|
|
+ objTab.setParentId(id);
|
|
|
+ objTab.setPKeyId(SnowFlakeUtil.getId());
|
|
|
+ //初始化是否显示表格,默认显示
|
|
|
+ objTab.setIsBussShow(1);
|
|
|
+ //初始化表格是否上传附件,默认未上传
|
|
|
+ objTab.setTabFileType(1);
|
|
|
+ //初始化单表是否可以预览,默认不能
|
|
|
+ objTab.setIsTabPdf(1);
|
|
|
+ //初始化PDF路径
|
|
|
+ objTab.setPdfUrl(null);
|
|
|
+ objTab.setCreateTime(new Date());
|
|
|
+ addTabList.add(objTab);
|
|
|
+
|
|
|
+ //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
+ if (tabOwner.contains(needTab.getTableOwner()) && isCopyData == 1 && tabColsAllByTabNameMaps.size() > 0) {
|
|
|
+ QueryProcessDataVO queryProcessDataVO = tabColsAllByTabNameMaps.get(tableName);
|
|
|
+ //组织复制表的数据的sql
|
|
|
+ if (queryProcessDataVO != null) {
|
|
|
+ StringBuilder copyDataSql = new StringBuilder();
|
|
|
+ String col = queryProcessDataVO.getAncestors();
|
|
|
+ String colVal = queryProcessDataVO.getAncestors();
|
|
|
+ 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("' ;");
|
|
|
+ resultTablesData.add(copyDataSql.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1827,12 +1850,15 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else {
|
|
|
//跨节点
|
|
|
toCopyNode.setParentId(toCopyNodeOldId);
|
|
|
+ //重设祖级id
|
|
|
+ toCopyNode.setAncestors(needCopyNode.getAncestors().replace(needCopyNode.getParentId().toString(), toCopyNode.getId().toString()));
|
|
|
}
|
|
|
toCopyNode.setPKeyId(SnowFlakeUtil.getId());
|
|
|
toCopyNode.setNodeName(toCopyNode.getNodeName());
|
|
|
toCopyNode.setFullName(toCopyNode.getNodeName());
|
|
|
toCopyNode.setPartitionCode(toCopyNode.getPartitionCode());
|
|
|
needNodes.add(toCopyNode);
|
|
|
+ addNodeList.add(toCopyNode);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2069,7 +2095,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
this.createLedger(newData, saveLedger, nodeMap, null);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -2941,9 +2966,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(wbsTreeContractTreeVOS);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // set的处理
|
|
|
-
|
|
|
/**
|
|
|
* 修改
|
|
|
*/
|