Browse Source

fix: (龙华项目提出人:王国虎)竖井台账---关联业务空间台账--楼层显示顺序错乱

lvxianyun 3 years ago
parent
commit
d01be0510f

+ 56 - 1
src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java

@@ -313,6 +313,61 @@ public class AdmShaftController {
      */
     @GetMapping("/shaft-zoneSpaceBaseTable-building")
     public AdmResponse queryZoneSpBd(@QueryParam("shaftId") String shaftId,
+                                     @QueryParam("objectType") String objectType) throws Exception {
+        if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
+            return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
+        }
+        // 组装条件 查询竖井下的空间
+        AdmQueryCriteria admQueryCriteriaSpace = new AdmQueryCriteria();
+        admQueryCriteriaSpace.setName(AdmSpace.OBJ_TYPE);
+        if(StrUtil.isNotEmpty(objectType)){
+            admQueryCriteriaSpace.setFilters(" classCode = '"+objectType+"'");
+        }
+        ObjectNode relationTO = JsonNodeFactory.instance.objectNode();
+        relationTO.put("relCode", "Sh2Sp");
+        relationTO.put("graphCode","ArchSubset");
+        relationTO.put("objFrom", shaftId);
+        relationTO.put("relValue", objectType);
+        admQueryCriteriaSpace.setRelationTo(relationTO);
+
+        //1 空间级联建筑
+        List<AdmQueryCriteria> cascadeSp2BdFl = new ArrayList<>(1);
+        //1.1 空间级联楼层
+        AdmQueryCriteria cascadeSpFl = new AdmQueryCriteria();
+        cascadeSpFl.setName("floorList");
+        cascadeSpFl.setProjection(Arrays.asList("id","name","localName"));
+        cascadeSpFl.setOrders("floorSequenceId desc");
+        cascadeSp2BdFl.add(cascadeSpFl);
+
+        //1.2 空间级联建
+        AdmQueryCriteria queryCriteriaBd = new AdmQueryCriteria();
+        queryCriteriaBd.setName("building");
+        queryCriteriaBd.setProjection(Arrays.asList("id","name","localName","floor"));
+
+        cascadeSp2BdFl.add(queryCriteriaBd);
+        admQueryCriteriaSpace.setCascade(cascadeSp2BdFl);
+
+        AdmResponse admResponseSp = spaceService.query(admQueryCriteriaSpace);
+        if(CollUtil.isNotEmpty(admResponseSp.getContent())){
+            //处理建筑下的楼层不是和空间关联的信息
+            List<AdmSpace> spaces = (List<AdmSpace>) admResponseSp.getContent();
+            List<AdmBuilding> admBuildingList = new ArrayList<>();
+            for(AdmSpace space : spaces){
+                AdmBuilding building = space.getBuilding();
+                List<AdmFloor> floorList = space.getFloorList();
+                if(building != null && CollUtil.isNotEmpty(floorList)){
+                    building.setFloor(floorList);
+                    admBuildingList.add(building);
+                }
+            }
+            return AdmResponse.success(admBuildingList);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /*@GetMapping("/shaft-zoneSpaceBaseTable-building")
+    public AdmResponse queryZoneSpBd(@QueryParam("shaftId") String shaftId,
              @QueryParam("objectType") String objectType) throws Exception {
         if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
             return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
@@ -362,7 +417,7 @@ public class AdmShaftController {
             return AdmResponse.success();
         }
     }
-
+*/
     /**
      * 查询和当前竖井没有关联的业务空间
      * shaftId 为竖井id