|
@@ -15,6 +15,8 @@ import io.swagger.annotations.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springblade.business.dto.CustomAddContractNodeDTO;
|
|
|
import org.springblade.business.entity.*;
|
|
|
import org.springblade.business.feign.MessageWarningClient;
|
|
@@ -57,11 +59,12 @@ import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.jdbc.core.PreparedStatementSetter;
|
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
|
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -86,6 +89,8 @@ import java.util.stream.Collectors;
|
|
|
@Api(tags = "资料查询接口")
|
|
|
public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(InformationWriteQueryController.class);
|
|
|
+
|
|
|
private final ContractClient contractClient;
|
|
|
|
|
|
private final WbsTreeContractClient wbsTreeContractClient;
|
|
@@ -1392,7 +1397,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperation(value = "复制节点(新)")
|
|
|
@TreeCodeUpdate(type = ArgType.PKD, value = "#vo.needCopyPrimaryKeyId")
|
|
|
public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
- //表单所属方
|
|
|
String tabOwner = "";
|
|
|
if (("1,2").equals(vo.getClassifyType()) || ("2,1").equals(vo.getClassifyType())) {
|
|
|
tabOwner = "1,2,3,4,5,6";
|
|
@@ -1401,23 +1405,27 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else if (("2").equals(vo.getClassifyType())) {
|
|
|
tabOwner = "4,5,6";
|
|
|
} else if (vo.getIsCopyData() == 0) {
|
|
|
- tabOwner = "1,2,3,4,5,6"; //如果选择的是否复制数据=0(否),默认所属方123456
|
|
|
+ tabOwner = "1,2,3,4,5,6";
|
|
|
}
|
|
|
+
|
|
|
/*用来标识新旧工序结对*/
|
|
|
Map<Long, Long> peerMap = new HashMap<>();
|
|
|
- //TODO 单份复制
|
|
|
+
|
|
|
+ /*==========================================单份复制==========================================*/
|
|
|
if (("1").equals(vo.getCopyType())) {
|
|
|
- //首先查询需要复制的节点及其下级所有子节点的信息
|
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
|
|
|
- //新增施工台账
|
|
|
+ /*结果集-节点表*/
|
|
|
List<WbsTreeContract> saveList = new ArrayList<>();
|
|
|
+ /*结果集-复制表数据SQL*/
|
|
|
+ StringBuilder copySql = new StringBuilder();
|
|
|
+ /*结果集-施工台账*/
|
|
|
List<ConstructionLedger> saveLedger = new ArrayList<>();
|
|
|
|
|
|
- //获取子级节点、表信息
|
|
|
+ /*获取子级节点、表信息*/
|
|
|
List<WbsTreeContract> needCopyChildNodes = this.getChildNodes(needCopyNode);
|
|
|
if (ObjectUtil.isEmpty(needCopyChildNodes) || needCopyChildNodes.size() == 0) {
|
|
|
- //最下层级节点复制
|
|
|
+ /*最下层级节点复制*/
|
|
|
needCopyChildNodes = new ArrayList<>();
|
|
|
}
|
|
|
needCopyChildNodes.add(needCopyNode);
|
|
@@ -1427,53 +1435,88 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
nodeChildAll.addAll(addChildNodesTables);
|
|
|
}
|
|
|
|
|
|
- //获取数据源表(附件复制使用)
|
|
|
+ /*获取数据源表(附件复制使用)*/
|
|
|
Set<WbsTreeContract> oldTabs = nodeChildAll.stream().filter(f -> (new Integer(2).equals(f.getType()))).collect(Collectors.toSet());
|
|
|
|
|
|
- StringBuilder copySql = new StringBuilder();
|
|
|
/*重置内容*/
|
|
|
Map<String, Map<String, String>> ekvMap = new HashMap<>();
|
|
|
|
|
|
if (StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())) {
|
|
|
WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
|
|
|
-
|
|
|
- //重塑关键信息
|
|
|
Map<Long, Long> oldToNewIdMap = new HashMap<>();
|
|
|
- //节点信息
|
|
|
Map<String, WbsTreeContract> nodeMap = new HashMap<>();
|
|
|
nodeChildAll.forEach(node -> {
|
|
|
oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
|
|
|
nodeMap.put(node.getId().toString(), node);
|
|
|
});
|
|
|
|
|
|
+ /*获取元素表数据*/
|
|
|
+ Map<Long, Map<String, Object>> colMaps = new HashMap<>();
|
|
|
+ if (vo.getIsCopyData() == 1) {
|
|
|
+ List<String> tabNames = nodeChildAll.stream()
|
|
|
+ .map(WbsTreeContract::getInitTableName)
|
|
|
+ .filter(ObjectUtil::isNotEmpty)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ String inClausePlaceholders = String.join(",", Collections.nCopies(tabNames.size(), "?"));
|
|
|
+ String sql = "SELECT table_name AS queryType, GROUP_CONCAT(COLUMN_name) AS ancestors " +
|
|
|
+ "FROM information_schema.COLUMNS WHERE table_name IN (" + inClausePlaceholders + ") " +
|
|
|
+ "GROUP BY table_name";
|
|
|
+ Object[] params = tabNames.toArray();
|
|
|
+ List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, params);
|
|
|
+
|
|
|
+ Map<String, List<WbsTreeContract>> tabsGroup = nodeChildAll.stream()
|
|
|
+ .filter(f -> f.getType() == 2 && ObjectUtil.isNotEmpty(f.getInitTableName()))
|
|
|
+ .collect(Collectors.groupingBy(WbsTreeContract::getInitTableName));
|
|
|
+
|
|
|
+ Set<Long> continuePkeyIds = new HashSet<>();
|
|
|
+ for (Map<String, Object> result : results) {
|
|
|
+ String tabName = (String) result.get("queryType");
|
|
|
+ String col = (String) result.get("ancestors");
|
|
|
+ if (ObjectUtil.isEmpty(col) || ObjectUtil.isEmpty(tabName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> filteredList = Arrays.stream(col.split(","))
|
|
|
+ .filter(value -> !value.equals("id") && !value.equals("p_key_id") && !value.equals("group_id"))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ String keys = StringUtils.join(filteredList, ",");
|
|
|
+ List<WbsTreeContract> tabs = tabsGroup.get(tabName);
|
|
|
+ for (WbsTreeContract tab : tabs) {
|
|
|
+ String dataSql = "SELECT " + keys + " FROM " + tabName + " WHERE p_key_id = " + tab.getPKeyId() + " LIMIT 1;";
|
|
|
+ try {
|
|
|
+ Map<String, Object> resultMap = jdbcTemplate.queryForMap(dataSql);
|
|
|
+ resultMap.values().removeIf(value -> value == null || (value instanceof String && ObjectUtil.isEmpty(value)));
|
|
|
+ colMaps.put(tab.getPKeyId(), resultMap);
|
|
|
+ } catch (EmptyResultDataAccessException e) {
|
|
|
+ continuePkeyIds.add(tab.getPKeyId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("以下元素表没有获取到对应实体表数据,已跳过 ===> 表pKeyId:[{}]", StringUtils.join(continuePkeyIds, ","));
|
|
|
+ }
|
|
|
+
|
|
|
for (WbsTreeContract nodeOld : nodeChildAll) {
|
|
|
WbsTreeContract newData = new WbsTreeContract();
|
|
|
BeanUtils.copyProperties(nodeOld, newData);
|
|
|
- //重塑关键信息
|
|
|
- //重塑primaryKeyId
|
|
|
+
|
|
|
newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
if (nodeOld.getNodeType() != null && nodeOld.getNodeType() == 6) {
|
|
|
peerMap.put(newData.getPKeyId(), nodeOld.getPKeyId());
|
|
|
}
|
|
|
- //设置旧ID
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(nodeOld.getOldId())) {
|
|
|
newData.setOldId(nodeOld.getOldId());
|
|
|
} else {
|
|
|
newData.setOldId(nodeOld.getId().toString());
|
|
|
}
|
|
|
|
|
|
- //设置新ID
|
|
|
if (new Integer("1").equals(nodeOld.getType())) {
|
|
|
- //如果是节点类型才重塑ID
|
|
|
newData.setId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
|
- //划分编号
|
|
|
newData.setPartitionCode(StringUtils.isNotEmpty(vo.getPartitionCode()) ? vo.getPartitionCode() : null);
|
|
|
}
|
|
|
- //设置父节点ID
|
|
|
if (vo.getNeedCopyPrimaryKeyId().equals(nodeOld.getPKeyId().toString())) {
|
|
|
- //找到复制的节点,将parentId更改为 parent.getId()
|
|
|
newData.setParentId(parent.getId());
|
|
|
- //设置新名称
|
|
|
newData.setNodeName(vo.getNeedCopyNodeName());
|
|
|
newData.setFullName(vo.getNeedCopyNodeName());
|
|
|
} else {
|
|
@@ -1481,109 +1524,64 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
newData.setCreateTime(new Date());
|
|
|
newData.setUpdateTime(new Date());
|
|
|
- //初始化是否显示表格,默认显示(2023年7月19日10:48:55需求更改:跟随原状态,原表单隐藏的,那么复制过来就是隐藏的)
|
|
|
- //newData.setIsBussShow(1);
|
|
|
- //初始化表格是否上传附件,默认未上传
|
|
|
newData.setTabFileType(1);
|
|
|
- //初始化单表是否可以预览,默认
|
|
|
newData.setIsTabPdf(1);
|
|
|
- //初始化PDF路径
|
|
|
newData.setPdfUrl(null);
|
|
|
newData.setCreateUser(AuthUtil.getUserId());
|
|
|
newData.setSort(ObjectUtil.isNotEmpty(nodeOld.getSort()) ? nodeOld.getSort() : 0);
|
|
|
- //重塑父节点关联关系
|
|
|
+
|
|
|
this.restoreParent(newData, oldToNewIdMap);
|
|
|
- //保存到集合中
|
|
|
+
|
|
|
saveList.add(newData);
|
|
|
+
|
|
|
+ /*生成工序节点施工日志*/
|
|
|
if (new Integer("6").equals(nodeOld.getNodeType())) {
|
|
|
- //生成施工日志
|
|
|
this.createLedger(newData, saveLedger, nodeMap, null);
|
|
|
}
|
|
|
- //表单所属方,只有勾选了对应的所属方权限才复制数据;勾选了复制数据才能复制,否则只是创建节点、表
|
|
|
- if (nodeOld.getType() == 2 && StringUtils.isNotEmpty(newData.getInitTableName()) && tabOwner.contains(nodeOld.getTableOwner()) && vo.getIsCopyData() == 1) {
|
|
|
- String tableName = newData.getInitTableName();
|
|
|
- if (StringUtils.isEmpty(tableName)) { //没有实体表名,跳过
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- //获取实体表对应字段
|
|
|
- List<QueryProcessDataVO> nodeTabCols = informationQueryService.getNodeChildTabColsAllByTabName(tableName);
|
|
|
|
|
|
- //转化为map
|
|
|
- Map<String, String> nodeTabColsMap = nodeTabCols.stream().collect(Collectors.toMap(QueryProcessDataVO::getQueryType, QueryProcessDataVO::getAncestors, (key1, key2) -> key2));
|
|
|
+ /*处理复制表数据*/
|
|
|
+ if (nodeOld.getType() == 2 && vo.getIsCopyData() == 1
|
|
|
+ && StringUtils.isNotEmpty(newData.getInitTableName())
|
|
|
+ && tabOwner.contains(nodeOld.getTableOwner())) {
|
|
|
|
|
|
- String col = nodeTabColsMap.get(tableName);
|
|
|
- if (ObjectUtil.isEmpty(col)) { //如果没获取到字段,那么跳过
|
|
|
+ /*获取表对应的实体数据*/
|
|
|
+ Map<String, Object> resultMap = colMaps.getOrDefault(nodeOld.getPKeyId(), null);
|
|
|
+ if (resultMap == null) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- List<String> filteredList = Arrays.stream(col.split(","))
|
|
|
- .filter(value -> !value.equals("id") && !value.equals("p_key_id") && !value.equals("group_id"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- String keys = StringUtils.join(filteredList, ",");
|
|
|
-
|
|
|
/*重置*/
|
|
|
Map<String, String> eMap = reviseValue(nodeOld, null, ekvMap);
|
|
|
|
|
|
- //构造入参(获取列名、列值)
|
|
|
- String dataSql = "SELECT " + keys + " FROM " + tableName + " WHERE p_key_id= " + nodeOld.getPKeyId() + " LIMIT 1;";
|
|
|
- List<LinkedHashMap<String, Object>> resultList = jdbcTemplate.query(dataSql, new RowMapper<LinkedHashMap<String, Object>>() {
|
|
|
- @Override
|
|
|
- public LinkedHashMap<String, Object> mapRow(@NotNull ResultSet rs, int rowNum) throws SQLException {
|
|
|
- ResultSetMetaData metaData = rs.getMetaData();
|
|
|
- int columnCount = metaData.getColumnCount();
|
|
|
- LinkedHashMap<String, Object> resultMap = new LinkedHashMap<>();
|
|
|
- for (int i = 1; i <= columnCount; i++) {
|
|
|
- String columnName = metaData.getColumnName(i);
|
|
|
- Object columnValue = rs.getObject(i);
|
|
|
- //判断列值不为null或者不为空串
|
|
|
- if (columnValue != null && !columnValue.toString().isEmpty()) {
|
|
|
- resultMap.put(columnName, columnValue);
|
|
|
- }
|
|
|
- }
|
|
|
- return resultMap;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ /*构造复制表数据*/
|
|
|
StringBuilder newString = new StringBuilder();
|
|
|
List<String> keySet = new LinkedList<>();
|
|
|
- if (!resultList.isEmpty()) {
|
|
|
- LinkedHashMap<String, Object> resultMap = resultList.get(0);
|
|
|
- for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
|
|
|
- keySet.add(entry.getKey());
|
|
|
- Object value = reviseValue(eMap, entry.getKey(), entry.getValue());
|
|
|
- //Object value = entry.getValue();
|
|
|
- if (value != null) {
|
|
|
- if (value.toString().contains("\n")) {
|
|
|
- //如果值中包含换行符,则将换行符替换
|
|
|
- value = value.toString().replace("\n", "\\n");
|
|
|
- }
|
|
|
- newString.append("'").append(value).append("',");
|
|
|
+ for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
|
|
|
+ keySet.add(entry.getKey());
|
|
|
+ Object value = reviseValue(eMap, entry.getKey(), entry.getValue());
|
|
|
+ if (value != null) {
|
|
|
+ if (value.toString().contains("\n")) {
|
|
|
+ value = value.toString().replace("\n", "\\n");
|
|
|
}
|
|
|
+ newString.append("'").append(value).append("',");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (newString.length() > 0) {
|
|
|
- //首位添加逗号分隔符
|
|
|
newString.insert(0, ',');
|
|
|
- //移除最后逗号分隔符
|
|
|
if (newString.charAt(newString.length() - 1) == ',') {
|
|
|
newString.deleteCharAt(newString.length() - 1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //所有有值的key
|
|
|
String keysHaveValue = StringUtils.join(keySet, ",");
|
|
|
if (keysHaveValue.length() > 0) {
|
|
|
- //首位添加逗号分隔符
|
|
|
keysHaveValue = "," + keysHaveValue;
|
|
|
}
|
|
|
-
|
|
|
//delete SQL (先删除旧数据,再新增)
|
|
|
- String delSql = "DELETE FROM " + tableName + " WHERE p_key_id = " + newData.getPKeyId() + " ; ";
|
|
|
-
|
|
|
- //insert into SQL
|
|
|
- copySql.append(delSql).append("INSERT INTO ").append(tableName)
|
|
|
+ String delSql = "DELETE FROM " + newData.getInitTableName() + " WHERE p_key_id = " + newData.getPKeyId() + " ; ";
|
|
|
+ //insert SQL
|
|
|
+ copySql.append(delSql)
|
|
|
+ .append("INSERT INTO ")
|
|
|
+ .append(newData.getInitTableName())
|
|
|
.append(" (id,p_key_id,group_id")
|
|
|
.append(keysHaveValue)
|
|
|
.append(") VALUES (")
|
|
@@ -1596,16 +1594,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
needCopyNode.setNodeName(vo.getNeedCopyNodeName());
|
|
|
|
|
|
- //复制保存节点、表信息
|
|
|
+ /*保存复制节点、表信息*/
|
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
|
|
|
|
try {
|
|
|
- //复制表单数据
|
|
|
+ /*保存复制表单数据*/
|
|
|
if (copySql.length() >= 10 && booleanR.getData()) {
|
|
|
jdbcTemplate.execute(copySql.toString());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- //手动回滚,删除节点、表
|
|
|
+ /*手动回滚*/
|
|
|
List<String> collect = saveList.stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
|
|
|
if (collect.size() > 0) {
|
|
|
jdbcTemplate.execute("delete from m_wbs_tree_contract where p_key_id in(" + StringUtils.join(collect, ",") + ")");
|
|
@@ -1614,21 +1612,23 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
throw new ServiceException("保存数据异常,请联系管理员");
|
|
|
}
|
|
|
|
|
|
- //复制元素表附件信息
|
|
|
+ /*保存复制元素表附件信息*/
|
|
|
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(new HashSet<>(newTabs), oldTabs);
|
|
|
}
|
|
|
+
|
|
|
/*复制formulaOption*/
|
|
|
this.copyFormulaOptions(saveList, peerMap);
|
|
|
- //更新redis缓存
|
|
|
+
|
|
|
+ /*更新缓存*/
|
|
|
informationQueryService.delAsyncWbsTree(needCopyNode.getContractId());
|
|
|
|
|
|
return booleanR;
|
|
|
|
|
|
} else if (("2").equals(vo.getCopyType())) {
|
|
|
- /** TODO 多份复制
|
|
|
- * 解析复制节点位置信息:
|
|
|
+ /*==========================================多份复制==========================================*/
|
|
|
+ /**
|
|
|
* 1:同节点复制(同一个父级下)
|
|
|
* 1.1 如果点击选择的是当前复制节点的父级,那么就新增一个当前需要复制的节点-新的子级-新的表-新的表数据(根据所属方查询对应数据)。
|
|
|
* 1.2 如果点击选择的是当前复制节点的同级节点(自己本身节点是无法点击进行复制的),那么复制对应表数据,如果没有对应表,那么跳过。
|
|
@@ -1636,14 +1636,13 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
* 2.1 如果点击选择的是其他父级节点的父级,那么新增一个新的当前选择的复制的节点-新的表-新的表数据(根据所属方查询对应数据)。
|
|
|
* 2.2 如果点击选择的是当前复制节点本身的同等级节点,那么复制对应表数据,如果没有对应表,那么跳过。
|
|
|
*/
|
|
|
- //获取需要复制到的位置节点信息的集合
|
|
|
List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
|
|
|
if (copyBatches.size() > 0) {
|
|
|
- //获取当前需要复制到的位置节点信息,判断同节点复制或跨节点复制
|
|
|
+ /*获取当前需要复制到的位置节点信息,判断同节点复制或跨节点复制*/
|
|
|
List<Long> toCopyNodePKeyIds = copyBatches.stream().map(CopyContractTreeNodeVO.CopyBatch::getPrimaryKeyId).map(Long::valueOf).collect(Collectors.toList());
|
|
|
List<WbsTreeContract> toCopyNodes = new ArrayList<>();
|
|
|
String contractId = "";
|
|
|
- //选择的复制节点PKeyId可能一样(选择相同节点复制),所以循环分开查询
|
|
|
+ /*选择的复制节点PKeyId可能一样(选择相同节点复制),所以循环分开查询*/
|
|
|
for (Long toCopyNodePKeyId : toCopyNodePKeyIds) {
|
|
|
WbsTreeContract toCopyNode = wbsTreeContractClient.queryContractTreeNodeByPKeyId(toCopyNodePKeyId);
|
|
|
toCopyNodes.add(toCopyNode);
|
|
@@ -1654,7 +1653,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
if (needCopyNodeRoot != null) {
|
|
|
- //缓存需要复制的节点、表信息
|
|
|
+ /*缓存需要复制的节点、表信息*/
|
|
|
Map<String, List<WbsTreeContract>> needCopyNodeAndTabMap = new HashMap<>();
|
|
|
List<WbsTreeContract> needCopyChildNodes = this.getChildNodes(needCopyNodeRoot);
|
|
|
if (ObjectUtil.isEmpty(needCopyChildNodes) || needCopyChildNodes.size() == 0) {
|
|
@@ -1666,48 +1665,44 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
List<WbsTreeContract> addChildNodesTables = this.getChildNodesTables(needCopyChildNodes, needCopyNodeRoot.getContractId());
|
|
|
needCopyNodeAndTabMap.put("tab:" + needCopyNodeRoot.getPKeyId(), addChildNodesTables);
|
|
|
|
|
|
- //结果集
|
|
|
+ /*结果集*/
|
|
|
List<WbsTreeContract> addNodeList = new ArrayList<>();//新增节点
|
|
|
List<WbsTreeContract> addTabList = new ArrayList<>(); //新增表单
|
|
|
Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>(addChildNodesTables);//数据源表附件
|
|
|
Set<WbsTreeContract> addNewFileTabs = new HashSet<>();//新增到目标表附件
|
|
|
List<String> resultTablesData = new ArrayList<>();//表单数据
|
|
|
|
|
|
- //解析位置信息,进行复制数据构造
|
|
|
+ /*解析位置信息,进行复制数据构造*/
|
|
|
if (toCopyNodes.size() == copyBatches.size()) {
|
|
|
for (int i = 0; i < toCopyNodes.size(); i++) {
|
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
- //首先查询需要复制的节点的信息
|
|
|
+ /*获取需要复制的节点的信息*/
|
|
|
WbsTreeContract toCopyNode = toCopyNodes.get(i);
|
|
|
CopyContractTreeNodeVO.CopyBatch toCopyVO = copyBatches.get(i);
|
|
|
|
|
|
if (toCopyNode != null && toCopyVO != null && needCopyNodeAndTabMap.size() > 0) {
|
|
|
- //TODO 同节点复制
|
|
|
+ /*=============================同节点复制=============================*/
|
|
|
if (new Integer(1).equals(toCopyVO.getIsSameNode())) {
|
|
|
//1.1 选择当前节点的父级节点,新增
|
|
|
if (needCopyNode.getParentId().equals(toCopyNode.getId())) {
|
|
|
toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
|
|
|
- //获取缓存节点、表信息
|
|
|
List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
|
|
|
- //构造新的节点、表、数据
|
|
|
this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 1, tabOwner, vo.getIsCopyData(), peerMap);
|
|
|
|
|
|
- //附件
|
|
|
addNewFileTabs.addAll(addTabList);
|
|
|
|
|
|
//1.2 选择同父级的同级节点,只复制数据
|
|
|
} else if (needCopyNode.getParentId().equals(toCopyNode.getParentId())) {
|
|
|
- //构造数据
|
|
|
this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
}
|
|
|
|
|
|
- //TODO 跨节点复制
|
|
|
+ /*=============================跨节点复制=============================*/
|
|
|
} else if (new Integer(0).equals(toCopyVO.getIsSameNode())) {
|
|
|
- //获取需要复制节点的上级
|
|
|
+ /*获取需要复制节点的上级*/
|
|
|
WbsTreeContract parentNodeNeed = wbsTreeContractClient.getContractWbsTreeByContractIdAndId(needCopyNode.getParentId(), Long.parseLong(needCopyNode.getContractId()));
|
|
|
|
|
|
boolean var = false;
|
|
@@ -1718,14 +1713,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
|
|
|
- //获取缓存节点、表信息
|
|
|
List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
|
|
|
- //构造新的节点、表、数据
|
|
|
this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData(), peerMap);
|
|
|
|
|
|
- //附件
|
|
|
addNewFileTabs.addAll(addTabList);
|
|
|
|
|
|
var = true;
|
|
@@ -1735,23 +1727,18 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
toCopyNode.setNodeName(toCopyVO.getNodeName());
|
|
|
toCopyNode.setPartitionCode(toCopyVO.getPartitionCode());
|
|
|
|
|
|
- //获取缓存节点、表信息
|
|
|
List<WbsTreeContract> needCopyNodes = needCopyNodeAndTabMap.get("node:" + needCopyNodeRoot.getPKeyId());
|
|
|
List<WbsTreeContract> needCopyTab = needCopyNodeAndTabMap.get("tab:" + needCopyNodeRoot.getPKeyId());
|
|
|
|
|
|
- //构造新的节点、表、数据
|
|
|
this.addCopyNodesAndTabsBuildData(addNodeList, addTabList, needCopyNodes, needCopyTab, needCopyNode, toCopyNode, resultTablesData, 0, tabOwner, vo.getIsCopyData(), peerMap);
|
|
|
|
|
|
- //附件
|
|
|
addNewFileTabs.addAll(addTabList);
|
|
|
-
|
|
|
var = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//2.2 如果点击选择的是当前复制节点本身的同等级节点,那么就只复制数据。(如果是跨节点,类型相同的情况下,只复制数据),且var=false,表示没有进行到跨节点新增的逻辑,只是跨节点复制数据
|
|
|
if (needCopyNode.getNodeType().equals(toCopyNode.getNodeType()) && !needCopyNode.getParentId().equals(toCopyNode.getParentId()) && !var) {
|
|
|
- //构造数据
|
|
|
this.addCopyTabData(needCopyNode, toCopyNode, tabOwner, resultTablesData, addTabList, vo.getIsCopyData(), addNewFileTabs);
|
|
|
}
|
|
|
}
|
|
@@ -1759,7 +1746,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //重构祖级id
|
|
|
+ /*重构祖级id*/
|
|
|
List<WbsTreeContract> resultAll = new ArrayList<>();
|
|
|
resultAll.addAll(addNodeList);
|
|
|
resultAll.addAll(addTabList);
|
|
@@ -1767,32 +1754,31 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
List<WbsTreeContract> nodes = allData.stream().filter(f -> f.getType().equals(1)).collect(Collectors.toList());
|
|
|
List<WbsTreeContract> tabs = allData.stream().filter(f -> f.getType().equals(2)).collect(Collectors.toList());
|
|
|
|
|
|
- //入库
|
|
|
Boolean row = false;
|
|
|
if (nodes.size() > 0) {
|
|
|
- //复制新增节点
|
|
|
+ /*保存复制新增节点*/
|
|
|
row = wbsTreeContractClient.saveBatch(nodes);
|
|
|
}
|
|
|
|
|
|
if (tabs.size() > 0) {
|
|
|
- //复制新增表
|
|
|
+ /*保存复制新增表*/
|
|
|
row = wbsTreeContractClient.saveBatch(tabs);
|
|
|
}
|
|
|
|
|
|
if (addNewFileTabs.size() > 0 && addChildNodesTablesOldAll.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
- //复制新增表附件
|
|
|
+ /*保存复制新增表附件*/
|
|
|
this.addCopyTabFile(addNewFileTabs, addChildNodesTablesOldAll);
|
|
|
}
|
|
|
|
|
|
if (resultTablesData.size() > 0 && vo.getIsCopyData() == 1) {
|
|
|
- //复制新增表数据
|
|
|
+ /*保存复制新增表数据*/
|
|
|
try {
|
|
|
List<List<String>> partition = Lists.partition(resultTablesData, 20);
|
|
|
for (List<String> strings : partition) {
|
|
|
jdbcTemplate.execute(StringUtils.join(strings, ""));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- //手动回滚,删除节点、表
|
|
|
+ /*手动回滚*/
|
|
|
List<String> collect1 = nodes.stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
|
|
|
List<String> collect2 = tabs.stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
|
|
|
collect1.addAll(collect2);
|
|
@@ -1804,7 +1790,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
if (nodes.size() > 0) {
|
|
|
- /*复制formulaOpion*/
|
|
|
+ /*复制formulaOption*/
|
|
|
this.copyFormulaOptions(nodes, peerMap);
|
|
|
}
|
|
|
if (row) {
|
|
@@ -1838,6 +1824,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
@@ -2036,8 +2023,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
* 新增复制的表单文件
|
|
|
*/
|
|
|
@Async
|
|
|
- public void addCopyTabFile
|
|
|
- (Set<WbsTreeContract> addChildNodesTables, Set<WbsTreeContract> addChildNodesTablesOld) {
|
|
|
+ public void addCopyTabFile(Set<WbsTreeContract> addChildNodesTables,
|
|
|
+ Set<WbsTreeContract> addChildNodesTablesOld) {
|
|
|
//获取所有数据源附件文件
|
|
|
List<Long> tabFileIds = addChildNodesTablesOld.stream().distinct().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
Map<String, List<TableFile>> tableFileOldMap = tableFileClient.getTabFilesByTabIds(StringUtils.join(tabFileIds, ",")).stream().collect(Collectors.groupingBy(TableFile::getTabId));
|
|
@@ -2092,9 +2079,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
/**
|
|
|
* 新增复制的数据
|
|
|
*/
|
|
|
- private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopyNode, String
|
|
|
- tabOwner, List<String> resultTablesData, List<WbsTreeContract> addChildNodesTablesAll, Integer
|
|
|
- isCopyData, Set<WbsTreeContract> addNewFileTabs) {
|
|
|
+ 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> wbsTreeContractsTo = Collections.singletonList(toCopyNode);
|
|
|
List<WbsTreeContract> needCopyNodeTabs = this.getChildNodesTables(wbsTreeContractsNeed, needCopyNode.getContractId());
|
|
@@ -2200,10 +2187,10 @@ 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, Map<Long, Long> peerMap) {
|
|
|
+ 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,
|
|
|
+ Map<Long, Long> peerMap) {
|
|
|
int var = 0;
|
|
|
if (needNodes.size() == 1) {
|
|
|
//判断是否为最下级节点
|
|
@@ -2468,206 +2455,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 复制节点
|
|
|
- */
|
|
|
- @PostMapping("/copyContractTreeNode12313212")
|
|
|
- @ApiOperationSupport(order = 15)
|
|
|
- @ApiOperation(value = "复制节点")
|
|
|
- @Deprecated
|
|
|
- public R<Boolean> copyContractTreeNode123131231(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
- //首先查询需要复制的节点及其下级所有子节点的信息
|
|
|
- WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
- //获取当前合同段所有节点
|
|
|
- List<WbsTreeContract> allContractNodeList = this.wbsTreeContractClient.searchContractTree(needCopyNode.getContractId());
|
|
|
-
|
|
|
- //设置父子节点关系
|
|
|
- Map<String, List<WbsTreeContract>> contractAllNodeMap = new HashMap<>();
|
|
|
- if (allContractNodeList != null && allContractNodeList.size() > 0) {
|
|
|
- allContractNodeList.forEach(contractTree -> {
|
|
|
- List<WbsTreeContract> parentList;
|
|
|
- if (contractAllNodeMap.containsKey(contractTree.getParentId().toString())) {
|
|
|
- parentList = contractAllNodeMap.get(contractTree.getParentId().toString());
|
|
|
- } else {
|
|
|
- parentList = new ArrayList<>();
|
|
|
- }
|
|
|
- parentList.add(contractTree);
|
|
|
- contractAllNodeMap.put(contractTree.getParentId().toString(), parentList);
|
|
|
-
|
|
|
- if (!contractAllNodeMap.containsKey(contractTree.getId().toString())) {
|
|
|
- contractAllNodeMap.put(contractTree.getId().toString(), new ArrayList<>());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- //复制结构信息
|
|
|
- // R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
|
- // 复制表数据
|
|
|
-
|
|
|
- System.out.println("1=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- List<WbsTreeContract> parentList = new ArrayList<>(), childList = new ArrayList<>(), allList = new ArrayList<>(), saveList = new ArrayList<>();
|
|
|
- //新增施工台账
|
|
|
- List<ConstructionLedger> saveLedger = new ArrayList<>();
|
|
|
-
|
|
|
- parentList.add(needCopyNode);
|
|
|
- System.out.println("2=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- //查询所有有效子节点(慢 10分钟)
|
|
|
- this.foreachQueryChildContract(parentList, childList, contractAllNodeMap);
|
|
|
-
|
|
|
- System.out.println("3=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- allList.addAll(parentList);
|
|
|
- allList.addAll(childList);
|
|
|
- System.out.println("4=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- if ("1".equals(vo.getCopyType())) {
|
|
|
- if (StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())) {
|
|
|
- WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
|
|
|
-
|
|
|
- //重塑关键信息
|
|
|
- Map<Long, Long> oldToNewIdMap = new HashMap<>();
|
|
|
- //节点信息
|
|
|
- Map<String, WbsTreeContract> nodeMap = new HashMap<>();
|
|
|
- allList.forEach(node -> {
|
|
|
- oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
|
|
|
- nodeMap.put(node.getId().toString(), node);
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- System.out.println("5=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- //todo 单份复制
|
|
|
- allList.forEach(node -> {
|
|
|
- WbsTreeContract newData = new WbsTreeContract();
|
|
|
- BeanUtils.copyProperties(node, newData);
|
|
|
-
|
|
|
- //重塑关键信息
|
|
|
- //重塑primaryKeyId
|
|
|
- newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- //设置旧ID
|
|
|
- if (StringUtils.isNotEmpty(node.getOldId())) {
|
|
|
- newData.setOldId(node.getOldId());
|
|
|
- } else {
|
|
|
- newData.setOldId(node.getId().toString());
|
|
|
- }
|
|
|
-
|
|
|
- //设置新ID
|
|
|
- if (new Integer("1").equals(node.getType())) {
|
|
|
- //如果是节点类型才重塑ID
|
|
|
- newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
|
|
|
-
|
|
|
- //划分编号
|
|
|
- newData.setPartitionCode(StringUtils.isNotEmpty(vo.getPartitionCode()) ? vo.getPartitionCode() : null);
|
|
|
- }
|
|
|
- //设置父节点ID
|
|
|
- if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
|
|
|
- //找到复制的节点,将parentId更改为 parent.getId()
|
|
|
- newData.setParentId(parent.getId());
|
|
|
- //设置新名称
|
|
|
- newData.setNodeName(vo.getNeedCopyNodeName());
|
|
|
- newData.setFullName(vo.getNeedCopyNodeName());
|
|
|
- } else {
|
|
|
- newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
|
|
|
- }
|
|
|
- newData.setCreateTime(new Date());
|
|
|
- newData.setUpdateTime(new Date());
|
|
|
- //初始化是否显示表格,默认显示
|
|
|
- newData.setIsBussShow(1);
|
|
|
- //初始化表格是否上传附件,默认未上传
|
|
|
- newData.setTabFileType(1);
|
|
|
- //初始化单表是否可以预览,默认不能
|
|
|
- newData.setIsTabPdf(1);
|
|
|
- //初始化PDF路径
|
|
|
- newData.setPdfUrl(null);
|
|
|
- newData.setCreateUser(AuthUtil.getUserId());
|
|
|
-
|
|
|
- newData.setSort(ObjectUtils.isNotEmpty(node.getSort()) ? node.getSort() : 0);
|
|
|
-
|
|
|
- //重塑父节点关联关系
|
|
|
- this.restoreParent(newData, oldToNewIdMap);
|
|
|
-
|
|
|
- //保存到集合中
|
|
|
- saveList.add(newData);
|
|
|
-
|
|
|
- if (new Integer("6").equals(node.getNodeType())) {
|
|
|
- //生成施工日志
|
|
|
- this.createLedger(newData, saveLedger, nodeMap, null);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- System.out.println("6=" + DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- } else {
|
|
|
- //todo 多份复制
|
|
|
- //获取需要复制到的位置集合
|
|
|
- List<CopyContractTreeNodeVO.CopyBatch> copyBatches = vo.getCopyBatchToPaths();
|
|
|
- if (copyBatches.size() > 0) {
|
|
|
- copyBatches.forEach(copyBatch -> {
|
|
|
- //查询复制到的位置信息
|
|
|
- WbsTreeContract copyPath = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
|
|
|
-
|
|
|
- //重塑关键信息
|
|
|
- Map<Long, Long> oldToNewIdMap = new HashMap<>();
|
|
|
- Map<String, WbsTreeContract> nodeMap = new HashMap<>();
|
|
|
- allList.forEach(node -> {
|
|
|
- oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
|
|
|
- nodeMap.put(node.getId().toString(), node);
|
|
|
- });
|
|
|
-
|
|
|
- allList.forEach(node -> {
|
|
|
- WbsTreeContract newData = new WbsTreeContract();
|
|
|
- BeanUtils.copyProperties(node, newData);
|
|
|
-
|
|
|
- //重塑关键信息
|
|
|
- //设置旧ID
|
|
|
- newData.setOldId(StringUtils.isNotEmpty(node.getOldId()) ? node.getOldId() : node.getId().toString());
|
|
|
- //重塑primaryKeyId
|
|
|
- newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- //设置新ID
|
|
|
- if (new Integer("1").equals(node.getType())) {
|
|
|
- newData.setId(oldToNewIdMap.containsKey(node.getId()) ? oldToNewIdMap.get(node.getId()) : SnowFlakeUtil.getId());
|
|
|
-
|
|
|
- //划分编号
|
|
|
- newData.setPartitionCode(StringUtils.isNotEmpty(copyBatch.getPartitionCode()) ? copyBatch.getPartitionCode() : null);
|
|
|
- }
|
|
|
- //设置父节点ID
|
|
|
- if (vo.getNeedCopyPrimaryKeyId().equals(node.getPKeyId().toString())) {
|
|
|
- //找到复制的节点,将parentId更改为 parent.getId()
|
|
|
- newData.setParentId(copyPath.getId());
|
|
|
- //设置新名称
|
|
|
- newData.setNodeName(copyBatch.getNodeName());
|
|
|
- newData.setFullName(copyBatch.getNodeName());
|
|
|
- } else {
|
|
|
- newData.setParentId(oldToNewIdMap.containsKey(node.getParentId()) ? oldToNewIdMap.get(node.getParentId()) : SnowFlakeUtil.getId());
|
|
|
- }
|
|
|
- newData.setCreateTime(new Date());
|
|
|
- newData.setUpdateTime(new Date());
|
|
|
- newData.setCreateUser(AuthUtil.getUserId());
|
|
|
- //初始化是否显示表格,默认显示
|
|
|
- newData.setIsBussShow(1);
|
|
|
- //初始化表格是否上传附件,默认未上传
|
|
|
- newData.setTabFileType(1);
|
|
|
- //初始化单表是否可以预览,默认不能
|
|
|
- newData.setIsTabPdf(1);
|
|
|
- //初始化PDF路径
|
|
|
- newData.setPdfUrl(null);
|
|
|
-
|
|
|
- //获取当前所有复制的节点的最大sort
|
|
|
- newData.setSort(ObjectUtils.isNotEmpty(node.getSort()) ? node.getSort() : 0);
|
|
|
-
|
|
|
- //重塑父节点关联关系
|
|
|
- this.restoreParent(newData, oldToNewIdMap);
|
|
|
-
|
|
|
- //保存到集合中
|
|
|
- saveList.add(newData);
|
|
|
-
|
|
|
- if (new Integer("6").equals(node.getNodeType())) {
|
|
|
- //生成施工日志
|
|
|
- this.createLedger(newData, saveLedger, nodeMap, null);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- return this.saveOrCopyNodeTree(saveList, saveLedger, 32, needCopyNode);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 重塑父节点链
|
|
|
*/
|
|
@@ -2694,8 +2481,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
/**
|
|
|
* 生成施工日志记录
|
|
|
*/
|
|
|
- private void createLedger(WbsTreeContract
|
|
|
- newData, List<ConstructionLedger> saveLedger, Map<String, WbsTreeContract> contractNodeMap, Map<String, WbsTreeContract> projectNodeMap) {
|
|
|
+ private void createLedger(WbsTreeContract newData, List<ConstructionLedger> saveLedger,
|
|
|
+ Map<String, WbsTreeContract> contractNodeMap,
|
|
|
+ Map<String, WbsTreeContract> projectNodeMap) {
|
|
|
//工序,需要新增施工台账
|
|
|
ConstructionLedger ledger = new ConstructionLedger();
|
|
|
//获取这个节点的原始信息
|
|
@@ -2747,41 +2535,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
saveLedger.add(ledger);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 循环查询子节点
|
|
|
- *
|
|
|
- * @param parentList 父节点集合
|
|
|
- * @param childList 保存集合
|
|
|
- */
|
|
|
- private void foreachQueryChildContract
|
|
|
- (List<WbsTreeContract> parentList, List<WbsTreeContract> childList, Map<String, List<WbsTreeContract>> contractAllNodeMap) {
|
|
|
- parentList.forEach(parent -> {
|
|
|
- List<WbsTreeContract> childs;
|
|
|
- if (contractAllNodeMap.containsKey(parent.getId().toString())) {
|
|
|
- childs = contractAllNodeMap.get(parent.getId().toString());
|
|
|
- } else {
|
|
|
- childs = new ArrayList<>();
|
|
|
- }
|
|
|
- if (childs.size() <= 0) {
|
|
|
- if (!Arrays.asList("1,2,3,4".split(",")).contains(parent.getMajorDataType().toString())) {
|
|
|
- childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable", "");
|
|
|
- } else {
|
|
|
- childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable", "");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (childs != null && childs.size() > 0) {
|
|
|
- //添加入结果集
|
|
|
- childList.addAll(childs);
|
|
|
-
|
|
|
- //还有子级,继续向下
|
|
|
- this.foreachQueryChildContract(childs, childList, contractAllNodeMap);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 导图结构树节点查询
|
|
|
*
|
|
@@ -2795,8 +2548,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
})
|
|
|
- public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String
|
|
|
- parentId, @RequestParam String contractId, @RequestParam String contractIdRelation) {
|
|
|
+ public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId,
|
|
|
+ @RequestParam String contractId,
|
|
|
+ @RequestParam String contractIdRelation) {
|
|
|
List<WbsTreeContractTreeVOS> result = this.informationQueryService.queryContractTree(parentId, contractId, contractIdRelation, null);
|
|
|
if (result.size() == 1) {
|
|
|
//只有一个子节点,继续向下
|