Browse Source

fix : 统一处理更新的时候

lvxianyun 3 years ago
parent
commit
b289acf2d6

+ 8 - 10
src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java

@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -20,15 +19,15 @@ import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmBuildingService;
 import com.persagy.proxy.adm.service.IAdmRelationService;
-import com.persagy.proxy.object.service.IAdmShaftService;
-import com.persagy.proxy.object.service.IAdmSpaceService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.RelationDTO;
 import com.persagy.proxy.object.model.*;
+import com.persagy.proxy.object.service.IAdmBuildingService;
+import com.persagy.proxy.object.service.IAdmShaftService;
+import com.persagy.proxy.object.service.IAdmSpaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -53,8 +52,6 @@ public class AdmShaftController {
     private IAdmBuildingService buildingService;
     @Autowired
     private IAdmSpaceService spaceService;
-    @Autowired
-    private ObjectMapper objectMapper;
 
     /**
      * 统计
@@ -353,10 +350,11 @@ public class AdmShaftController {
 
             List<AdmSpace> vos = JSONUtil.toList(spaceList.toString(), AdmSpace.class);
             Map<String, AdmSpace> admSpaceMap = CollUtil.fieldValueMap(vos, "buildingId");
-            StringBuilder filter = new StringBuilder(" id in ['");
-            admSpaceMap.keySet().stream().forEach(spaceId -> filter.append(spaceId).append("','"));
-            String filters = StrUtil.sub(filter.toString(), 0,-2)+"]";
-            queryCriteriaBd.setFilters(filters);
+            ObjectNode relationFrom = JsonNodeFactory.instance.objectNode();
+            relationFrom.put("relCode", "Bd2Sp");
+            relationFrom.put("graphCode","ArchSubset");
+            ArrayNode arrayNode = relationFrom.putObject("objTo").putArray("$in");
+            admSpaceMap.keySet().stream().forEach(spaceId -> arrayNode.add(spaceId));
             AdmResponse response =  buildingService.doQuery(AdmContextUtil.toDmpContext(), queryCriteriaBd, AdmBuilding.class);
             return response;
         }else{

+ 0 - 2
src/main/java/com/persagy/proxy/object/controller/AdmSystemController.java

@@ -99,7 +99,6 @@ public class AdmSystemController {
         List<AdmSystem> vos = CollUtil.newArrayList(createRequest.getContent());
 
         Map<String, AdmSystem> admSystemMap = CollUtil.fieldValueMap(vos, "classCode");
-
         QueryCriteria defineCriteria = new QueryCriteria();
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         ArrayNode array = criteria.putObject("code").putArray("$in");
@@ -124,7 +123,6 @@ public class AdmSystemController {
                 List<AdmSystem> admSystems = service.doInsert(AdmContextUtil.toDmpContext(), AdmSystem.class, CollUtil.newArrayList(admSystem));
                 //添加关系
                 String systemId = admSystems.get(0).getId();
-
                 admSystem.getBuildingFloorInfoList().forEach(info -> {
                     String floorId = info.get("FloorID") == null ? null : info.get("FloorID").textValue();
                     String buildID = info.get("BuildID") == null ? null : info.get("BuildID").textValue();