|
@@ -2165,17 +2165,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
//TODO 20250414-lhb-新增 添加祖级字段 ancestorsPId
|
|
|
//因为复制选中节点,所以要查询出选中节点的父节点信息 来组装祖级节点
|
|
|
if(needCopyNode != null){
|
|
|
- Long parentPKeyId = null;
|
|
|
- String ancestorsPId = null;
|
|
|
- if(needCopyNode.getPId() == 0L){
|
|
|
- ancestorsPId = "0";
|
|
|
- parentPKeyId = 0L;
|
|
|
- }else{
|
|
|
- WbsTreeContract parentNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(String.valueOf(needCopyNode.getPId()));
|
|
|
- ancestorsPId = parentNode.getAncestorsPId();
|
|
|
- parentPKeyId = parentNode.getPKeyId();
|
|
|
- }
|
|
|
- attachNodesToTarget(saveList,parentPKeyId,ancestorsPId);
|
|
|
+ attachNodesToTarget(saveList);
|
|
|
}
|
|
|
}
|
|
|
needCopyNode.setNodeName(vo.getNeedCopyNodeName());
|
|
@@ -2352,17 +2342,7 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
resultAll.addAll(addTabList);
|
|
|
//因为复制选中节点,所以要查询出选中节点的父节点信息 来组装祖级节点
|
|
|
if(needCopyNode != null && CollectionUtil.isNotEmpty(resultAll)){
|
|
|
- Long parentPKeyId = null;
|
|
|
- String ancestorsPId = null;
|
|
|
- if(needCopyNode.getPId() == 0L){
|
|
|
- ancestorsPId = "0";
|
|
|
- parentPKeyId = 0L;
|
|
|
- }else{
|
|
|
- WbsTreeContract parentNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(String.valueOf(toCopyVO.getPrimaryKeyId()));
|
|
|
- ancestorsPId = parentNode.getAncestorsPId();
|
|
|
- parentPKeyId = parentNode.getPKeyId();
|
|
|
- }
|
|
|
- attachNodesToTarget(resultAll,parentPKeyId,ancestorsPId);
|
|
|
+ attachNodesToTarget(resultAll);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4214,7 +4194,7 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
|
|
|
}
|
|
|
}
|
|
|
//TODO 20250414-lhb-新增 添加ancestorsPId字段
|
|
|
- attachNodesToTarget(saveList,treeContract.getPKeyId(),treeContract.getAncestorsPId());
|
|
|
+ attachNodesToTarget(saveList);
|
|
|
|
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
|
|
|
@@ -5130,15 +5110,18 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void attachNodesToTarget(List<WbsTreeContract> newNodes, Long targetId, String targetAncestors) {
|
|
|
+ public void attachNodesToTarget(List<WbsTreeContract> newNodes) {
|
|
|
// 1. 找到新数据中的顶层节点(新树的根节点)
|
|
|
List<WbsTreeContract> newRoot = findRootNode(newNodes);
|
|
|
|
|
|
// 2. 将新树的根节点绑定到目标节点
|
|
|
newRoot.forEach(f -> {
|
|
|
- f.setPId(targetId);
|
|
|
- f.setAncestorsPId(calculateAncestors(targetAncestors, targetId));
|
|
|
-
|
|
|
+ WbsTreeContract parentNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(String.valueOf(f.getPId()));
|
|
|
+ if(parentNode == null){
|
|
|
+ f.setAncestorsPId("0");
|
|
|
+ }else{
|
|
|
+ f.setAncestorsPId(calculateAncestors(parentNode.getAncestorsPId(), f.getPId()));
|
|
|
+ }
|
|
|
|
|
|
// 3. 构建映射关系
|
|
|
Map<Long, WbsTreeContract> nodeMap = new HashMap<>();
|