瀏覽代碼

fix: adm 业务空间更新 当建筑/楼层id均为空时 删除对应的信息点

lvxianyun 3 年之前
父節點
當前提交
6a51af7181
共有 1 個文件被更改,包括 16 次插入11 次删除
  1. 16 11
      src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

+ 16 - 11
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -127,7 +127,7 @@ public class AdmSpaceController {
             ObjectNode node = JsonNodeFactory.instance.objectNode();
 
             List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
-            vos.stream().forEach(admSpace -> {
+            vos.forEach(admSpace -> {
                 //处理建筑 楼层信息点
                 int removeflBd = 0 ;//关系处理 0 不删除 1 删除bd 2 删除fl 3 都删除
                 if(StrUtil.isNotEmpty(admSpace.getFlowBuild())){
@@ -275,6 +275,12 @@ public class AdmSpaceController {
             String id = requestData.getId();
             String type = requestData.getType();//classCode
 
+            //更新实体
+            AdmSpace space = new AdmSpace();
+            space.setId(spaceId);
+            space.setObjectType(AdmSpace.OBJ_TYPE);
+            space.setClassCode(type);
+
             /** 清除空间和建筑楼层的的数据 */
             dealRelation(spaceId, queryCriteria,"Bd2Sp", false);
             dealRelation(spaceId, queryCriteria,"Fl2Sp", false);
@@ -285,6 +291,7 @@ public class AdmSpaceController {
                     admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
                     admQueryCriteria.setFilters("id = '"+id+"'");
                     AdmResponse admResponseFl = floorService.query(admQueryCriteria);
+
                     if(CollUtil.isNotEmpty(admResponseFl.getContent())){
                         AdmFloor floor = (AdmFloor) admResponseFl.getContent().get(0);
                         if (floor!=null){
@@ -303,11 +310,7 @@ public class AdmSpaceController {
                             rFl_up.setObjFrom(floor.getId());
                             RSpInFl_up.add(rFl_up);
 
-                            //更新实体
-                            AdmSpace space = new AdmSpace();
-                            space.setId(spaceId);
-                            space.setObjectType(AdmSpace.OBJ_TYPE);
-                            space.setClassCode(type);
+                            //楼层 建筑信息点维护
                             space.setBuildingId(floor.getBuildingId());
                             space.setFloorId(floor.getId());
                             space_up.add(space);
@@ -331,17 +334,19 @@ public class AdmSpaceController {
                     rBd_up.setObjFrom(id);
                     RSpInBd_up.add(rBd_up);
 
-                    //更新实体
-                    AdmSpace space = new AdmSpace();
-                    space.setId(spaceId);
-                    space.setObjectType(AdmSpace.OBJ_TYPE);
-                    space.setClassCode(type);
+                    //楼层 建筑信息点维护
                     space.setBuildingId(id);
                     Map<String, Object> info = new HashMap<>(1);
                     info.put("$remove",Arrays.asList("floorId"));
                     space.setInfos(info);
                     space_up.add(space);
                 }
+            }else{
+                //楼层 建筑信息点维护 清除
+                Map<String, Object> info = new HashMap<>(1);
+                info.put("$remove",Arrays.asList("floorId","buildingId"));
+                space.setInfos(info);
+                space_up.add(space);
             }
         });
         service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, space_up);