|
@@ -1681,7 +1681,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
if (new Integer("1").equals(nodeOld.getType())) {
|
|
if (new Integer("1").equals(nodeOld.getType())) {
|
|
//新节点的id设置为随机id
|
|
//新节点的id设置为随机id
|
|
newData.setId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
newData.setId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
- //20250414-lhb-新增
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增
|
|
newData.setTreePId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
newData.setTreePId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
//新节点设置规划编号
|
|
//新节点设置规划编号
|
|
newData.setPartitionCode(StringUtils.isNotEmpty(vo.getPartitionCode()) ? vo.getPartitionCode() : null);
|
|
newData.setPartitionCode(StringUtils.isNotEmpty(vo.getPartitionCode()) ? vo.getPartitionCode() : null);
|
|
@@ -1774,7 +1774,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- //20250414-lhb-新增 添加祖级字段 ancestorsPId
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增 添加祖级字段 ancestorsPId
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(needCopyNode.getContractId()));
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(needCopyNode.getContractId()));
|
|
contractWbsTreeByContractId.addAll(saveList);
|
|
contractWbsTreeByContractId.addAll(saveList);
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
@@ -1958,7 +1958,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
resultAll.addAll(addNodeList);
|
|
resultAll.addAll(addNodeList);
|
|
resultAll.addAll(addTabList);
|
|
resultAll.addAll(addTabList);
|
|
|
|
|
|
- //20250414-lhb-新增
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(contractId));
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(contractId));
|
|
contractWbsTreeByContractId.addAll(resultAll);
|
|
contractWbsTreeByContractId.addAll(resultAll);
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
@@ -2542,7 +2542,7 @@ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, Lis
|
|
|
|
|
|
//id字段和随机id
|
|
//id字段和随机id
|
|
Map<Long, Long> parentIdToId = new HashMap<>();
|
|
Map<Long, Long> parentIdToId = new HashMap<>();
|
|
- //20250414-lhb-新增 老对象唯一ID 和新对象唯一id
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增 老对象唯一ID 和新对象唯一id
|
|
Map<Long, Long> oldPKeyIdToNewPkeyId = new HashMap<>();
|
|
Map<Long, Long> oldPKeyIdToNewPkeyId = new HashMap<>();
|
|
|
|
|
|
Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
@@ -2574,11 +2574,11 @@ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, Lis
|
|
newParentId = needCopyNode.getId();
|
|
newParentId = needCopyNode.getId();
|
|
newPId = needCopyNode.getPKeyId();
|
|
newPId = needCopyNode.getPKeyId();
|
|
}
|
|
}
|
|
- //20250414-lhb-调整
|
|
|
|
|
|
+ //TODO 20250414-lhb-调整
|
|
Long pKeyId = SnowFlakeUtil.getId();
|
|
Long pKeyId = SnowFlakeUtil.getId();
|
|
obj.setPKeyId(pKeyId);
|
|
obj.setPKeyId(pKeyId);
|
|
|
|
|
|
- //20250414-lhb-新增 保存新老id和新id的映射关系
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增 保存新老id和新id的映射关系
|
|
oldPKeyIdToNewPkeyId.put(node.getPKeyId(),obj.getPKeyId());
|
|
oldPKeyIdToNewPkeyId.put(node.getPKeyId(),obj.getPKeyId());
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(node.getOldId())) {
|
|
if (ObjectUtil.isNotEmpty(node.getOldId())) {
|
|
@@ -3372,7 +3372,7 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
WbsTreeContract wbsTreeContract = BeanUtil.copyProperties(half, WbsTreeContract.class);
|
|
WbsTreeContract wbsTreeContract = BeanUtil.copyProperties(half, WbsTreeContract.class);
|
|
nodeMapContract.put(half.getId().toString(), wbsTreeContract);
|
|
nodeMapContract.put(half.getId().toString(), wbsTreeContract);
|
|
|
|
|
|
- //20250414-lhb-新增 绑定旧keyId和新keyId
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增 绑定旧keyId和新keyId
|
|
OldPKeyIdToNewPKeyIdMap.put(half.getPKeyId(),SnowFlakeUtil.getId());
|
|
OldPKeyIdToNewPKeyIdMap.put(half.getPKeyId(),SnowFlakeUtil.getId());
|
|
|
|
|
|
});
|
|
});
|
|
@@ -3398,12 +3398,14 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
WbsTreePrivate wbsTreePrivate = nodeMap.get(half.getParentId() + "");
|
|
WbsTreePrivate wbsTreePrivate = nodeMap.get(half.getParentId() + "");
|
|
if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && treeContract.getNodeName().equals(wbsTreePrivate.getNodeName())) {
|
|
if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && treeContract.getNodeName().equals(wbsTreePrivate.getNodeName())) {
|
|
newData.setParentId(treeContract.getId());
|
|
newData.setParentId(treeContract.getId());
|
|
|
|
+ //TODO
|
|
newData.setPId(treeContract.getPKeyId());
|
|
newData.setPId(treeContract.getPKeyId());
|
|
var = false;
|
|
var = false;
|
|
|
|
|
|
//从复制or新增节点开始操作-》选择新增节点,根节点会走到这里
|
|
//从复制or新增节点开始操作-》选择新增节点,根节点会走到这里
|
|
} else if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && ObjectUtil.isNotEmpty(treeContract.getOldId()) && treeContract.getOldId().equals(wbsTreePrivate.getId().toString())) {
|
|
} else if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && ObjectUtil.isNotEmpty(treeContract.getOldId()) && treeContract.getOldId().equals(wbsTreePrivate.getId().toString())) {
|
|
newData.setParentId(treeContract.getId());
|
|
newData.setParentId(treeContract.getId());
|
|
|
|
+ //TODO
|
|
newData.setPId(treeContract.getPKeyId());
|
|
newData.setPId(treeContract.getPKeyId());
|
|
var = false;
|
|
var = false;
|
|
}
|
|
}
|
|
@@ -3434,6 +3436,15 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
||
|
|
||
|
|
half.getParentId().toString().equals(treeContract.getOldId())
|
|
half.getParentId().toString().equals(treeContract.getOldId())
|
|
? treeContract.getId() : SnowFlakeUtil.getId());
|
|
? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
|
+
|
|
|
|
+ // TODO 现阶段 odlId为被复制节点的Id字段的值 不能不能拿来做PId的匹配 后面考虑优化
|
|
|
|
+ newData.setPId(OldPKeyIdToNewPKeyIdMap.containsKey(half.getPId())
|
|
|
|
+ ? OldPKeyIdToNewPKeyIdMap.get(half.getPId()) : treeContract.getPKeyId().equals(half.getPId())
|
|
|
|
+ ||
|
|
|
|
+ half.getParentId().toString().equals(treeContract.getOldId())
|
|
|
|
+ ? treeContract.getPKeyId() : SnowFlakeUtil.getId());
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3535,6 +3546,10 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
if (wbsTreeContract.getPKeyId().equals(root.getPKeyId())) { //根节点
|
|
if (wbsTreeContract.getPKeyId().equals(root.getPKeyId())) { //根节点
|
|
wbsTreeContract.setParentId(treeContract.getId());
|
|
wbsTreeContract.setParentId(treeContract.getId());
|
|
wbsTreeContract.setAncestors(treeContract.getAncestors() + "," + wbsTreeContract.getParentId());
|
|
wbsTreeContract.setAncestors(treeContract.getAncestors() + "," + wbsTreeContract.getParentId());
|
|
|
|
+ //TODO
|
|
|
|
+ wbsTreeContract.setPId(treeContract.getPKeyId());
|
|
|
|
+ //TODO
|
|
|
|
+ wbsTreeContract.setAncestorsPId(treeContract.getAncestorsPId() + "," + wbsTreeContract.getPId());
|
|
ancestorsMap.put(wbsTreeContract.getId(), wbsTreeContract.getAncestors());
|
|
ancestorsMap.put(wbsTreeContract.getId(), wbsTreeContract.getAncestors());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3561,12 +3576,12 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
for (WbsTreeContract wbsTreeContract : saveList) {
|
|
for (WbsTreeContract wbsTreeContract : saveList) {
|
|
if (topLevelNode.getPKeyId().equals(wbsTreeContract.getPKeyId())) {
|
|
if (topLevelNode.getPKeyId().equals(wbsTreeContract.getPKeyId())) {
|
|
wbsTreeContract.setParentId(treeContract.getId());
|
|
wbsTreeContract.setParentId(treeContract.getId());
|
|
- //20250414-lhb-新增
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增
|
|
wbsTreeContract.setPId(treeContract.getPKeyId());
|
|
wbsTreeContract.setPId(treeContract.getPKeyId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //20250414-lhb-新增 添加ancestorsPId字段
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增 添加ancestorsPId字段
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(treeContract.getContractId()));
|
|
List<WbsTreeContract> contractWbsTreeByContractId = wbsTreeContractClient.getContractWbsTreeByContractId(Long.valueOf(treeContract.getContractId()));
|
|
contractWbsTreeByContractId.addAll(saveList);
|
|
contractWbsTreeByContractId.addAll(saveList);
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
Map<Long, WbsTreeContract> collect = contractWbsTreeByContractId.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
@@ -4402,7 +4417,7 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
|
|
obj.setPartitionCode(dto.getPartitionCode());
|
|
obj.setPartitionCode(dto.getPartitionCode());
|
|
}
|
|
}
|
|
obj.setParentId(parentNode.getId());
|
|
obj.setParentId(parentNode.getId());
|
|
- //20250414-lhb-新增
|
|
|
|
|
|
+ //TODO 20250414-lhb-新增
|
|
obj.setPId(parentNode.getPKeyId());
|
|
obj.setPId(parentNode.getPKeyId());
|
|
obj.setAncestors(parentNode.getAncestors() + "," + parentNode.getId());
|
|
obj.setAncestors(parentNode.getAncestors() + "," + parentNode.getId());
|
|
obj.setAncestorsPId(parentNode.getAncestorsPId() + "," + parentNode.getPKeyId());
|
|
obj.setAncestorsPId(parentNode.getAncestorsPId() + "," + parentNode.getPKeyId());
|