Przeglądaj źródła

fix 数据迁移 关系同步,先删除再增加

lvxianyun 2 lat temu
rodzic
commit
72769be49b

+ 9 - 9
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java

@@ -320,15 +320,6 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
         List<ObjectNode> objectNodeListAdm = JsonNodeUtils.toListNode(admRelations, null, null);
         Map<String,Object> admDefineMap = toEntityMap(objectNodeListAdm, ObjectRelation.class);
 
-        //差集 新增
-        Map<String,Object> doSubtractFromInsert = doSubtractAdd(admDefineMap, projectDefineMap);
-        if(!CollUtil.isEmpty(doSubtractFromInsert)){
-            List<ObjectRelation> insertData = toList(doSubtractFromInsert, admRelations);
-            DataMigrationResponse dataMigrationResponse = insertBatch(insertData, ObjectRelation.class, insertUrl);
-            //处理并保存日志
-            syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.CREATE.getCode()));
-        }
-
         //差集 删除
         Map<String,Object> doSubtractFromDelete = doSubtractDel(admDefineMap, projectDefineMap);
         if(!CollUtil.isEmpty(doSubtractFromDelete)){
@@ -340,6 +331,15 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
             syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.DELETE.getCode()));
         }
 
+        //差集 新增
+        Map<String,Object> doSubtractFromInsert = doSubtractAdd(admDefineMap, projectDefineMap);
+        if(!CollUtil.isEmpty(doSubtractFromInsert)){
+            List<ObjectRelation> insertData = toList(doSubtractFromInsert, admRelations);
+            DataMigrationResponse dataMigrationResponse = insertBatch(insertData, ObjectRelation.class, insertUrl);
+            //处理并保存日志
+            syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.CREATE.getCode()));
+        }
+
         //交集更新
         Map<String,Object> intersectionUpdateFrom = doIntersectionGetFrom(admDefineMap, projectDefineMap);
         Map<String,Object> intersectionUpdateTo = doIntersectionGetTo(admDefineMap, projectDefineMap);