Bläddra i källkod

修改客户端归档树同步bug

lvy 4 månader sedan
förälder
incheckning
4da5baca99

+ 8 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArTreeContractInitServiceImpl.java

@@ -355,13 +355,15 @@ public class ArTreeContractInitServiceImpl {
                     addNodes.addAll(tmpList);
                 }else {
                     Long contractId = ar.getContractId();
-                    List<ContractRelationJlyz> list = contractInfoService.searchContractRelationInfo(contractId.toString());
-                    for (ContractRelationJlyz contractRelationJlyz: list) {
-                        ar.setContractId(contractRelationJlyz.getId());
-                        List<ArchiveTreeContract> tmpList = getTreeContractFromWbs(tenantId, projectId, wbsId, ar,classify);
-                        addNodes.addAll(tmpList);
+                    if (contractId != null) {
+                        List<ContractRelationJlyz> list = contractInfoService.searchContractRelationInfo(contractId.toString());
+                        for (ContractRelationJlyz contractRelationJlyz: list) {
+                            ar.setContractId(contractRelationJlyz.getId());
+                            List<ArchiveTreeContract> tmpList = getTreeContractFromWbs(tenantId, projectId, wbsId, ar,classify);
+                            addNodes.addAll(tmpList);
+                        }
+                        ar.setContractId(contractId);
                     }
-                    ar.setContractId(contractId);
                 }
             }
         }

+ 14 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java

@@ -1002,18 +1002,23 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 
 		for (ArchiveTreeVO2 src : srcChilds) {
 			if (dstMap.get(src.getId()) == null ) {
-				List<ArchiveTreeContract> tmpSaveList = new ArrayList<>();
+				boolean flag = false;
 				if (contractInfos != null && !contractInfos.isEmpty()) {
-					addNewContract1(contractInfos,src,dstTree,tmpSaveList);
-				} else {
-					tmpSaveList = archiveTreeContractSync.getNormalSaveListEx(src.getId(),src,dstNode.getId(),dstTree);
+					List<ArchiveTreeContract> tmpSaveList = new ArrayList<>();
+					flag = addNewContract1(contractInfos,src,dstTree,tmpSaveList);
+					saveList.addAll(tmpSaveList);
+				}
+				if (!flag) {
+					List<ArchiveTreeContract> tmpSaveList = archiveTreeContractSync.getNormalSaveListEx(src.getId(),src,dstNode.getId(),dstTree);
+					if (tmpSaveList != null) {
+						saveList.addAll(tmpSaveList);
+					}
 				}
-				saveList.addAll(tmpSaveList);
 			}
 		}
 
 	}
-	void addNewContract1(List<ContractInfo> contractInfos,ArchiveTreeVO2 srcTree,ArchiveTreeContractVO2 dstTree,List<ArchiveTreeContract> saveList){
+	boolean addNewContract1(List<ContractInfo> contractInfos,ArchiveTreeVO2 srcTree,ArchiveTreeContractVO2 dstTree,List<ArchiveTreeContract> saveList){
 
 		dstTree.setValue(1L);
 		ArchiveTreeContract contractNode = null;
@@ -1026,6 +1031,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 					contractNode = new ArchiveTreeContract(srcTree);
 					contractNode.setId(SnowFlakeUtil.getId());
 					contractNode.setParentId(dstTree.getId());
+					contractNode.setContractId(contractInfo.getId());
 					saveList.add(contractNode);
 					contractNode.setTreeCode("C");
 				}
@@ -1040,6 +1046,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 					contractNode = new ArchiveTreeContract(srcTree);
 					contractNode.setId(SnowFlakeUtil.getId());
 					contractNode.setParentId(dstTree.getId());
+					contractNode.setContractId(contractInfo.getId());
 					saveList.add(contractNode);
 					contractNode.setTreeCode("S");
 				}
@@ -1051,6 +1058,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 			}
 			saveList.addAll(tmpSaveList);
 		}
+		return contractNode != null;
 	}
 
 	/**