Bläddra i källkod

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-middleware.git into develop

zhangqiankun 3 år sedan
förälder
incheckning
497217e4a5

+ 34 - 3
src/main/java/com/persagy/proxy/adm/controller/AdmSpaceController.java

@@ -2,10 +2,13 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmBuilding;
+import com.persagy.proxy.adm.model.AdmFloor;
 import com.persagy.proxy.adm.model.AdmSpace;
 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.adm.service.IAdmBuildingService;
 import com.persagy.proxy.adm.service.IAdmSpaceService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -29,6 +33,8 @@ import java.util.List;
 public class AdmSpaceController {
     @Autowired
     private IAdmSpaceService service;
+    @Autowired
+    private IAdmBuildingService buildingService;
     @Value("${middleware.group.code}")
     private String groupCode;
 
@@ -116,12 +122,37 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/building-floor")
-    public AdmResponse queryFloor(@QueryParam("projectId") String projectId,
+    public AdmResponse queryBuildingFloor(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        request.setName("space");
-        return service.doQuery(context, request, AdmSpace.class);
+        request.setName("building");
+        AdmQueryCriteria criteriaFloor = new AdmQueryCriteria();
+        criteriaFloor.setName("floor");
+
+        AdmQueryCriteria criteriaSpace = new AdmQueryCriteria();
+        criteriaSpace.setName("spaceList");
+        criteriaSpace.setFilters("state = 1");
+
+        criteriaFloor.setCascade(CollUtil.newArrayList(criteriaSpace));
+        request.setCascade(CollUtil.newArrayList(criteriaFloor));
+        AdmResponse response = buildingService.doQueryBuildingFloor(context, request);
+        List<AdmBuilding> buildings = (List<AdmBuilding>) response.getContent();
+        buildings.stream().forEach(building -> {
+            if(CollUtil.isNotEmpty(building.getFloor())){
+                List<AdmFloor> floors = building.getFloor();
+                floors.stream().forEach(floor -> {
+                    if(CollUtil.isNotEmpty(floor.getSpaceList())){
+                        floor.setCount(String.valueOf(floor.getSpaceList().size()));
+                        floor.setSpaceList(null);
+                    }else{
+                        floor.setCount("0");
+                    }
+                });
+            }
+        });
+
+        return response;
     }
 
     /**

+ 11 - 4
src/main/java/com/persagy/proxy/adm/model/AdmComponent.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
 
 import java.util.Date;
@@ -94,26 +95,32 @@ public class AdmComponent {
         private Map<String, Object> infos;
         /** 统计信息 */
         private Map<String, Object> statistics;
-        /** 资产信息实体类 */
+
+        /** 资产信息实体类   资产对应部件设施关系 资产→部件设施*/
+        @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)
         private AdmProperty property;
         /** 建筑信息实体类 */
+        @CascadeColumn(graphCode = "MechForArch", relCode = "Eq2Bd")
         private AdmBuilding building;
         /** 楼层信息实体类 */
+        @CascadeColumn(graphCode = "MechForArch", relCode = "Eq2Fl")
         private AdmFloor floor;
         /** 项目信息实体类 */
+        @CascadeColumn(graphCode = "MechSubset", relCode = "Pj2Eq", selectToObj = false)
         private AdmProject project;
-
         /**BIM模型中坐标json,坐标x,y,z */
         private AdmBIMLocation locationJson;
         /** 级联-部件服务所在的空 */
+        @CascadeColumn(graphCode = "MechForArch", relCode = "Eq2Sp")
         private List<AdmSpace> zoneSpaceForBase;
         /** 级联-部件服务所在的空 */
+        @CascadeColumn(graphCode = "MechInArch", relCode = "Eq2Sp")
         private List<AdmSpace> zoneSpaceInBase;
         /** 级联-部件所在的竖井 */
+        @CascadeColumn(graphCode = "MechInArch", relCode = "Eq2Sh")
         private List<AdmShaft> shaftList;
         /** 资产列表 */
+        @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)
         private List<AdmProperty> propertyList;
-        /** 级联-部件 */
-        private List<AdmEquipment> component;
         
 }

+ 6 - 0
src/main/java/com/persagy/proxy/adm/model/AdmFloor.java

@@ -81,4 +81,10 @@ public class AdmFloor {
     private String objectType = "floor";
     /** 楼层类型code */
     private String classCode = "floor";
+
+
+    /** 空间列表 非中台信息*/
+    @CascadeColumn(graphCode = "ArchSubset", relCode = "Fl2Sp")
+    private List<AdmSpace> spaceList;
+
 }

+ 25 - 74
src/main/java/com/persagy/proxy/adm/model/AdmISpace.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
 
 import java.util.ArrayList;
@@ -30,21 +31,16 @@ public class AdmISpace {
     private String buildingId;
     /** 楼层ID */
     private String floorId;
-    /** 平台二维码 */
-    private String defaultQRCode;
+    /** 二维码图片 */
+    private String qrCode;
     /** BIM模型中编码 */
     private String bimId;
-
-    /** 楼层选定区域轮廓线 */
-    private ArrayList<ArrayList<ArrayList<AdmPointPosition>>> outline;
-    /** 轮廓线2 */
-    private ArrayList<ArrayList<ArrayList<AdmPointPosition>>> outline2;
-    /** 图片 */
-    private ArrayList<AdmTaskPic> pic;
-    /** 空间是否受影响 */
-    private String state;
-    /** 空间常驻人数 */
-    private Integer permanentPeopleNum;
+    /** BIM模型中坐标 */
+    private String bimLocation;
+    /** 模型文件id */
+    private String modelId;
+    /** 空间功能区类型 */
+    private String funcType;
 
     /** 井深 */
     private Float depth;
@@ -56,75 +52,30 @@ public class AdmISpace {
     private Float netArea;
     /** 高 */
     private Float height;
-    /** 备注文字 */
-    private String intro;
-    /** 设计供冷功率 */
-    private Float ratedCoolingp;
-    /** 设计供热功率 */
-    private Float ratedHeatingp;
-    /** 空调形式 */
-    private String acType;
-    /** 空间朝向 */
-    private String zoneOrientation;
-    /** 空间功能区类型 */
-    private String roomFuncType;
 
-    /** 空间序号 */
-    private Float roomSerial;
-    /** 项目空间功能区类型 */
-    private String projRoomFuncType;
-    /** 设计照明功率 */
-    private Float ratedLightp;
-    /** 内外区分类 */
-    private String zoneType;
-    /** 租赁业态类型 */
-    private Integer tenantType;
-    /** 所属租户 */
-    private String tenant;
+    /** 图片 */
+    private ArrayList<AdmTaskPic> pic;
+    /** 空间是否受影响 */
+    private String state;
+    /** 空间常驻人数 */
+    private Integer permanentPeopleNum;
+
     /** 配电容量 */
     private Float elecCap;
     /** 污染等级 */
     private String pollutionDegree;
 
-    /** 对象类型code */
-    private String classCode = "ispace";
-
-    /** 二维码图片 */
-    private String qrcodePic;
-    /** 创建时间 */
-    private Date createTime;
-    /** 最后更新日期 */
-    private Date lastUpdate;
-
+    /** 备注文字 */
+    private String intro;
     /** 信息点 */
     private Map<String, Object> infos;
-    /** 统计信息 */
-    private Map<String, Object> statistics;
+    /** 对象类型 */
+    private String objectType = "ispace";
 
-    /** 级联-设备 */
-    private List<AdmEquipment> equipment;
-    /** 级联-元空间 */
-    //@SCascade(table="relationship.r_sp2si", idColumn="sp_id", childIdColumn="si_id")
-    //private List<AdmSpace> zoneIspace;
-    /** 级联-系统 */
-    private List<AdmSystem> generalSystem;
-    /** 级联-服务于空间的设备 */
-    private List<AdmEquipment> equipmentFor;
-    /** 建筑信息实体类 */
-    private AdmBuilding building;
-    /** 楼层信息实体类 */
-    private AdmFloor floor;
-    /** 级联-建筑 */
-    private List<AdmBuilding> buildingList;
-    /** 级联-楼层 */
-    private List<AdmFloor> floorList;
-    /** 资产列表 */
-    private List<AdmProperty> propertyList;
-    /** 级联-部件 */
-    private List<AdmEquipment> component;
+    /** 轮廓线 */
+    private ArrayList<ArrayList<AdmPointPosition>> outline;
+
+    /** 对象类型code */
+    private String classCode = "ispace";
 
-    /** 空间轮廓线 */
-    //private T spaceOutline;
-    /** 对象类型 */
-    private String objectType = "space";
 }

+ 2 - 6
src/main/java/com/persagy/proxy/adm/model/AdmSpace.java

@@ -38,7 +38,7 @@ public class AdmSpace {
 
     /** 楼层选定区域轮廓线 */
     private ArrayList<ArrayList<ArrayList<AdmPointPosition>>> outline;
-    /** 轮廓线2 */
+    /** 轮廓线2 未使用*/
     private ArrayList<ArrayList<ArrayList<AdmPointPosition>>> outline2;
     /** 图片 */
     private ArrayList<AdmTaskPic> pic;
@@ -129,11 +129,7 @@ public class AdmSpace {
     /** 资产列表 */
     @CascadeColumn
     private List<AdmProperty> propertyList;
-    /** 级联-部件 */
-    @CascadeColumn
-    private List<AdmEquipment> component;
-
-    /** 空间轮廓线 */
+    /** 空间轮廓线 未使用 */
     //private T spaceOutline;
     /** 对象类型 */
     private String objectType = "space";

+ 9 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmBuildingService.java

@@ -1,6 +1,9 @@
 package com.persagy.proxy.adm.service;
 
 import com.persagy.proxy.adm.model.AdmBuilding;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 
 /**
  * ADM 建筑 接口类
@@ -8,4 +11,10 @@ import com.persagy.proxy.adm.model.AdmBuilding;
  * @date 2021-08-16
  */
 public interface IAdmBuildingService extends IAdmBaseService<AdmBuilding> {
+    /**
+     * 查询业务空间的建筑楼层数量
+     *
+     * @return
+     */
+    AdmResponse doQueryBuildingFloor(InstanceUrlParam context, AdmQueryCriteria request);
 }

+ 5 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmSpaceService.java

@@ -1,6 +1,11 @@
 package com.persagy.proxy.adm.service;
 
+import com.persagy.proxy.adm.model.AdmBuilding;
 import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.apache.poi.ss.formula.functions.T;
 
 /**
  * ADM 空间 接口

+ 7 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmBuildingServiceImpl.java

@@ -1,7 +1,10 @@
 package com.persagy.proxy.adm.service.impl;
 
 import com.persagy.proxy.adm.model.AdmBuilding;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBuildingService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.stereotype.Service;
 
 /**
@@ -12,4 +15,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class AdmBuildingServiceImpl extends AbstractAdmBaseServiceImpl<AdmBuilding> implements IAdmBuildingService {
 
+    @Override
+    public AdmResponse doQueryBuildingFloor(InstanceUrlParam context, AdmQueryCriteria request) {
+        return doQuery(context, request, AdmBuilding.class);
+    }
 }

+ 10 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

@@ -1,7 +1,17 @@
 package com.persagy.proxy.adm.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.model.AdmBuilding;
 import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmSpaceService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.stereotype.Service;
 
 /**

+ 1 - 1
src/main/java/com/persagy/proxy/adm/utils/AdmEntityTransferUtil.java

@@ -131,7 +131,7 @@ public class AdmEntityTransferUtil {
             }
         } else {
             // 返回全部时,去掉不需要属性
-            List<String> removeList = CollUtil.newArrayList("creator", "groupCode", "valid", "createApp", "virtualCodes", "updateApp");
+            List<String> removeList = CollUtil.newArrayList("creator", "groupCode", "valid", "createApp", "virtualCodes", "updateApp", "grouping", "modifier");
             for(String removeField:removeList) {
                 dmpData.remove(removeField);
             }