Browse Source

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

zhangqiankun 3 years ago
parent
commit
399c4f7232
23 changed files with 1232 additions and 103 deletions
  1. 14 1
      pom.xml
  2. 3 0
      src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java
  3. 115 0
      src/main/java/com/persagy/proxy/adm/constant/AdmObjectInfoConstant.java
  4. 38 0
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java
  5. 43 0
      src/main/java/com/persagy/proxy/adm/constant/BusinessErrorRwdCode.java
  6. 86 0
      src/main/java/com/persagy/proxy/adm/controller/AdmManualRelCalController.java
  7. 0 48
      src/main/java/com/persagy/proxy/adm/controller/AdmManualRelationCalcController.java
  8. 5 4
      src/main/java/com/persagy/proxy/adm/controller/AdmModelRelController.java
  9. 4 4
      src/main/java/com/persagy/proxy/adm/controller/REqForSpConreoller.java
  10. 189 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyEqController.java
  11. 3 0
      src/main/java/com/persagy/proxy/adm/model/AdmFloor.java
  12. 27 0
      src/main/java/com/persagy/proxy/adm/model/AdmManualRelCalRequest.java
  13. 26 0
      src/main/java/com/persagy/proxy/adm/model/AdmManualRelationCalcDel.java
  14. 2 1
      src/main/java/com/persagy/proxy/adm/model/AdmModelRel.java
  15. 2 1
      src/main/java/com/persagy/proxy/adm/model/AdmRelationAddRequest.java
  16. 4 0
      src/main/java/com/persagy/proxy/adm/request/AdmCreateResponse.java
  17. 41 0
      src/main/java/com/persagy/proxy/adm/request/AdmManualRelCalResponse.java
  18. 48 0
      src/main/java/com/persagy/proxy/adm/service/AdmManualRelCalService.java
  19. 0 21
      src/main/java/com/persagy/proxy/adm/service/AdmManualRelationCalcService.java
  20. 14 1
      src/main/java/com/persagy/proxy/adm/service/IAdmModelRelService.java
  21. 132 18
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmManualRelationCalcServiceImpl.java
  22. 347 4
      src/main/java/com/persagy/proxy/adm/service/impl/AdmModelRelServiceImpl.java
  23. 89 0
      src/main/java/com/persagy/proxy/adm/utils/GeoToolsUtil.java

+ 14 - 1
pom.xml

@@ -38,6 +38,13 @@
 				<enabled>true</enabled>
 			</releases>
 		</repository>
+
+		<repository>
+			<id>osgeo</id>
+			<name>Open Source Geospatial Foundation Repository</name>
+			<url>https://repo.osgeo.org/repository/release/</url>
+		</repository>
+
 	</repositories>
 	<properties>
 		<java.version>1.8</java.version>
@@ -75,5 +82,11 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-    </dependencies>
+		<dependency>
+			<groupId>org.geotools</groupId>
+			<artifactId>gt-main</artifactId>
+			<version>23.0</version>
+		</dependency>
+
+	</dependencies>
 </project>

+ 3 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java

@@ -48,4 +48,7 @@ public interface AdmCommonConstant {
     /** 有效标示*/
     String VALID = "valid";
 
+    /** 楼层标高 */
+    String FLOOR_ELEVATION = "floorElevation";
+
 }

+ 115 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmObjectInfoConstant.java

@@ -28,4 +28,119 @@ public interface AdmObjectInfoConstant {
     Set<String> CHECK_SENSOR_CODES= CollUtil.newHashSet("SPVSCM","FFEALS","FFFPSE","FFFASE","SPIASE",
             "WEGMCM","WEOFCM","WEGMPD","FFGASE","OTSESP","OTSESD","OTSETP","OTSEVD","OTSEPS","OTSEPF","OTSERH",
             "OTSEIP","OTSEIL","OTSEHT","OTSECB","OTSECT","OTSEEE","OTSEDP","OTSEFL");
+    /**重复检查主对象的type与从对象的type是否重复*/
+    Set<String> CHECK_SPECIAL_TYPES= CollUtil.newHashSet("sp2sp_RadiationNetwork_2","sp2sp_RadiationNetwork_1",
+            "sp2sp_ConvectionNetwork_2","sp2sp_ConvectionNetwork_3","sp2sp_ConvectionNetwork_1",
+            "sp2sp_TrafficNetwork_3","sp2sp_TrafficNetwork_2","sp2sp_TrafficNetwork_1");
+
+    Set<String> SOURCE_FLAG_FALSE=CollUtil.newHashSet("eq2eq_GasNetwork_2", "eq2fl",
+            "sp2sp_SpaceNeighborhood_3", "eq2sp_in", "sh2bd", "sp2sp_SpaceNeighborhood_2", "sp2sp_SpaceNeighborhood_5",
+            "eq2sp_in", "sy2sh_for", "eq2sp_for", "eq2sp_in", "eq2sy", "eq2eq_ChillWaterLoop_4", "eq2bd_for",
+            "sp2sp_SpaceNeighborhood_1", "eq2eq_ValveRelationship_vv2eq", "eq2eq_SensorNetwork_1", "eq2sp_in",
+            "eq2eq_CoolingWaterLoop_3", "eq2fl_for", "eq2eq_EquipPower_3", "eq2sp_for", "eq2eq_ACAirNetwork_3",
+            "eq2sp_for", "eq2eq_SupplyWaterNetwork_2", "eq2sy_ControlRelation_2", "eq2sp_in", "eq2sp_in",
+            "eq2eq_HeatWaterLoop_4", "bd2sp", "sp2sp_TrafficNetwork_2", "fl2sp", "Sh2Sp_ArchSubset", "eq2sp_for",
+            "sp2sp_ConvectionNetwork_2", "sy2sh", "sy2bd_MechInArch", "eq2eq_DHWNetwork_2", "eq2sp_for",
+            "sp2sp_ConvectionNetwork_3", "eq2eq_ControlEquipNetwork", "sy2fl_for", "eq2eq_RecycleWaterNetwork_2",
+            "eq2sy_SensorRelationship_ss2sy", "sp2sp_SpaceNeighborhood_4", "eq2sp_in", "eq2sp_in", "pe2fl",
+            "eq2sp_in", "eq2sp_for", "sh2sh", "eq2eq_LUDistribution_1", "eq2eq_HUDistribution_2",
+            "eq2eq_DrainingWaterNetwork_2", "fl2fl", "eq2eq_LUDistribution_2", "eq2sp_for",
+            "eq2eq_DrinkingWaterNetwork_2", "eq2sp_SensorRelationship_ss2sp", "eq2sp_in", "tn2sp",
+            "eq2eq_ChillWaterLoop_3", "eq2eq_GasNetwork_1", "sy2bd_for", "eq2eq_EquipPower_4", "eq2sp_for",
+            "eq2eq_CoolingWaterLoop_4", "eq2sp_in", "eq2sh", "pe2bd", "eq2sh_for", "eq2eq_EquipPower_2",
+            "eq2sy_ValveRelationship_vv2sy", "sp2sp_TrafficNetwork_1", "eq2sp_in", "eq2sp_in", "eq2sp_in",
+            "eq2sp_in", "sp2sp_RadiationNetwork_2", "eq2eq_FireWaterNetwork_2", "sp2sp_ConvectionNetwork_1",
+            "sp2sp_TrafficNetwork_3", "eq2eq_EquipPower_1", "sy2fl", "eq2sp_for", "eq2eq_SensorRelationship_ss2eq",
+            "eq2sp_for", "pe2sh", "eq2eq_ControlRelation_1", "sp2sp_RadiationNetwork_1", "sh2sp",
+            "eq2eq_HeatWaterLoop_3", "bd2bd_ArchForArch", "sh2fl_ArchForArch", "sh2sh_ArchForArch",
+            "sh2sp_ArchForArch", "sp2bd_ArchForArch", "sp2fl_ArchForArch", "sp2sh_ArchForArch", "sp2sp_ArchForArch",
+            "bd2fl_ArchForArch", "bd2sh_ArchForArch", "bd2sh_ArchSubset", "bd2sp_ArchForArch", "fl2bd_ArchForArch",
+            "fl2fl_ArchForArch", "fl2sh_ArchForArch", "fl2sp_ArchForArch", "sh2bd_ArchForArch", "sy2sp",
+            "syeq2bd", "sy2sp_for", "eq2sp_for", "eq2sp_for", "eq2sp_for", "eq2sp_for", "eq2sp_for",
+            "eq2eq_VentNetwork_3", "eq2eq_HUDistribution_1");
+
+    Set<String> SOURCE_FLAG_TRUE=CollUtil.newHashSet("eq2eq_DrainingWaterNetwork_1",
+            "eq2eq_ACAirNetwork_2", "eq2eq_CondWaterNetwork_1", "eq2eq_HeatWaterLoop_1", "eq2eq_DHWNetwork_1",
+            "eq2eq_RecycleWaterNetwork_1", "eq2eq_FireVentNetwork_1", "eq2eq_FireWaterNetwork_1", "eq2eq_VRFNetwork_1",
+            "eq2eq_ChillWaterLoop_2", "eq2eqFreshAirNetwork_1", "eq2eq_ChillWaterLoop_1",
+            "eq2eq_DrinkingWaterNetwork_2", "eq2eq_CoolingWaterLoop_2", "eq2eq_VentNetwork_1", "eq2eq_HeatWaterLoop_2",
+            "eq2eq_CoolingWaterLoop_1", "eq2eq_ACAirNetwork_1", "eq2eq_SupplyWaterNetwork_1");
+
+    Set<String> AUTOMATIC_FLAG_FALSE=CollUtil.newHashSet("eq2eq_GasNetwork_2", "sp2sp_SpaceNeighborhood_3", "sp2sp_SpaceNeighborhood_2",
+            "sy2sh_for", "eq2sp_for", "eq2sy", "eq2eq_ChillWaterLoop_4", "eq2bd_for", "sp2sp_SpaceNeighborhood_1",
+            "eq2eq_ValveRelationship_vv2eq", "eq2eq_SensorNetwork_1", "eq2eq_CoolingWaterLoop_3", "eq2fl_for",
+            "eq2eq_EquipPower_3", "eq2sp_for", "eq2eq_SupplyWaterNetwork_2", "eq2sy_ControlRelation_2",
+            "sp2sp_TrafficNetwork_2", "Sh2Sp_ArchSubset", "eq2sp_for", "sp2sp_ConvectionNetwork_2",
+            "sy2bd_MechInArch", "eq2eq_DHWNetwork_2", "eq2sp_for", "sp2sp_ConvectionNetwork_3",
+            "eq2eq_ControlEquipNetwork", "sy2fl_for", "eq2eq_RecycleWaterNetwork_2", "eq2sy_SensorRelationship_ss2sy",
+            "sp2sp_SpaceNeighborhood_4", "eq2sp_for", "eq2eq_LUDistribution_1", "eq2eq_HUDistribution_2",
+            "eq2eq_DrainingWaterNetwork_2", "eq2eq_LUDistribution_2", "eq2sp_for", "eq2eq_DrinkingWaterNetwork_2",
+            "tn2sp", "eq2eq_ChillWaterLoop_3", "eq2eq_GasNetwork_1", "sy2bd_for", "eq2eq_EquipPower_4", "eq2sp_for",
+            "eq2eq_CoolingWaterLoop_4", "eq2sh_for", "eq2eq_EquipPower_2", "eq2sy_ValveRelationship_vv2sy",
+            "sp2sp_RadiationNetwork_2", "eq2eq_FireWaterNetwork_2", "sp2sp_TrafficNetwork_3", "eq2eq_EquipPower_1",
+            "eq2eq_SensorRelationship_ss2eq", "eq2sp_for", "eq2eq_ControlRelation_1", "sh2sp", "eq2eq_HeatWaterLoop_3",
+            "bd2bd_ArchForArch", "sh2fl_ArchForArch", "sh2sh_ArchForArch", "sh2sp_ArchForArch", "sp2bd_ArchForArch",
+            "sp2fl_ArchForArch", "sp2sh_ArchForArch", "sp2sp_ArchForArch", "bd2fl_ArchForArch", "bd2sh_ArchForArch",
+            "bd2sh_ArchSubset", "bd2sp_ArchForArch", "fl2bd_ArchForArch", "fl2fl_ArchForArch", "fl2sh_ArchForArch",
+            "fl2sp_ArchForArch", "sh2bd_ArchForArch", "sy2sp_for", "eq2sp_for", "eq2sp_for", "eq2sp_for",
+            "eq2sp_for", "eq2sp_for", "eq2eq_VentNetwork_3", "eq2eq_HUDistribution_1");
+
+    Set<String> AUTOMATIC_FLAG_TRUE=CollUtil.newHashSet("eq2fl", "eq2sp_in", "sh2bd", "sp2sp_SpaceNeighborhood_5",
+            "eq2sp_in", "eq2eq_DrainingWaterNetwork_1", "eq2sp_in", "eq2eq_ACAirNetwork_2",
+            "eq2eq_CondWaterNetwork_1", "pe2sp", "eq2eq_VentNetwork_2", "eq2sp_in", "eq2sp_for",
+            "eq2eq_ACAirNetwork_3", "eq2sp_in", "eq2sp_in", "eq2eq_HeatWaterLoop_4", "bd2sp", "fl2sp",
+            "sy2sh", "eq2eq_HeatWaterLoop_1", "eq2eq_DHWNetwork_1", "eq2sp_in", "eq2sp_in", "pe2fl",
+            "eq2eq_RecycleWaterNetwork_1", "eq2sp_in", "sh2sh", "eq2eq_FireVentNetwork_1", "eq2eq_FireWaterNetwork_1",
+            "fl2fl", "eq2eq_VRFNetwork_1", "eq2sp_SensorRelationship_ss2sp", "eq2sp_in", "eq2eq_ChillWaterLoop_2",
+            "eq2eqFreshAirNetwork_1", "eq2sp_in", "eq2sh", "eq2eq_ChillWaterLoop_1", "eq2eq_DrinkingWaterNetwork_2",
+            "pe2bd", "eq2eq_CoolingWaterLoop_2", "sp2sp_TrafficNetwork_1", "eq2sp_in", "eq2sp_in", "eq2sp_in",
+            "eq2sp_in", "sp2sp_ConvectionNetwork_1", "eq2eq_VentNetwork_1", "sy2fl", "eq2sp_for", "pe2sh",
+            "eq2eq_HeatWaterLoop_2", "sp2sp_RadiationNetwork_1", "eq2eq_CoolingWaterLoop_1", "sy2sp",
+            "syeq2bd", "eq2eq_ACAirNetwork_1", "eq2eq_SupplyWaterNetwork_1");
+
+    Set<String> MANUAL_FLAG_TWO = CollUtil.newHashSet("eq2fl", "eq2sp_in", "sh2bd", "eq2sp_in", "eq2sp_for",
+            "eq2sp_in", "eq2sy", "eq2sp_in", "eq2sp_for", "eq2sp_for", "eq2sp_in", "eq2sp_in", "bd2sp", "fl2sp",
+            "Sh2Sp_ArchSubset", "eq2sp_for", "sy2sh", "sy2bd_MechInArch", "eq2sp_for", "eq2sp_in", "eq2sp_in",
+            "pe2fl", "eq2sp_in", "eq2sp_for", "sh2sh", "fl2fl", "eq2sp_for", "eq2sp_in", "tn2sp", "eq2sp_for",
+            "eq2sp_in", "eq2sh", "pe2bd", "eq2sp_in", "eq2sp_in", "eq2sp_in", "eq2sp_in", "sy2fl", "eq2sp_for",
+            "eq2sp_for", "sh2sp", "bd2sh_ArchSubset", "sy2sp", "syeq2bd", "eq2sp_for", "eq2sp_for", "eq2sp_for",
+            "eq2sp_for", "eq2sp_for");
+
+    Set<String> MANUAL_FLAG_THREE = CollUtil.newHashSet("eq2eq_GasNetwork_2", "sp2sp_SpaceNeighborhood_3",
+            "sp2sp_SpaceNeighborhood_2", "sp2sp_SpaceNeighborhood_5", "sy2sh_for", "eq2eq_DrainingWaterNetwork_1",
+            "eq2eq_ACAirNetwork_2", "eq2eq_ChillWaterLoop_4", "eq2bd_for", "eq2eq_CondWaterNetwork_1",
+            "sp2sp_SpaceNeighborhood_1", "eq2eq_ValveRelationship_vv2eq", "pe2sp", "eq2eq_VentNetwork_2",
+            "eq2eq_SensorNetwork_1", "eq2eq_CoolingWaterLoop_3", "eq2fl_for", "eq2eq_EquipPower_3",
+            "eq2eq_ACAirNetwork_3", "eq2eq_SupplyWaterNetwork_2", "eq2sy_ControlRelation_2", "eq2eq_HeatWaterLoop_4",
+            "sp2sp_TrafficNetwork_2", "sp2sp_ConvectionNetwork_2", "eq2eq_DHWNetwork_2", "eq2eq_HeatWaterLoop_1",
+            "sp2sp_ConvectionNetwork_3", "eq2eq_ControlEquipNetwork", "sy2fl_for", "eq2eq_DHWNetwork_1",
+            "eq2eq_RecycleWaterNetwork_2", "eq2sy_SensorRelationship_ss2sy", "sp2sp_SpaceNeighborhood_4",
+            "eq2eq_RecycleWaterNetwork_1", "eq2eq_LUDistribution_1", "eq2eq_FireVentNetwork_1",
+            "eq2eq_FireWaterNetwork_1", "eq2eq_HUDistribution_2", "eq2eq_DrainingWaterNetwork_2",
+            "eq2eq_VRFNetwork_1", "eq2eq_LUDistribution_2", "eq2eq_DrinkingWaterNetwork_2",
+            "eq2sp_SensorRelationship_ss2sp", "eq2eq_ChillWaterLoop_3", "eq2eq_ChillWaterLoop_2",
+            "eq2eq_GasNetwork_1", "sy2bd_for", "eq2eqFreshAirNetwork_1", "eq2eq_EquipPower_4",
+            "eq2eq_CoolingWaterLoop_4", "eq2eq_ChillWaterLoop_1", "eq2eq_DrinkingWaterNetwork_2", "eq2sh_for",
+            "eq2eq_EquipPower_2", "eq2eq_CoolingWaterLoop_2", "eq2sy_ValveRelationship_vv2sy", "sp2sp_TrafficNetwork_1",
+            "sp2sp_RadiationNetwork_2", "eq2eq_FireWaterNetwork_2", "sp2sp_ConvectionNetwork_1", "eq2eq_VentNetwork_1",
+            "sp2sp_TrafficNetwork_3", "eq2eq_EquipPower_1", "eq2eq_SensorRelationship_ss2eq", "pe2sh",
+            "eq2eq_HeatWaterLoop_2", "eq2eq_ControlRelation_1", "sp2sp_RadiationNetwork_1", "eq2eq_HeatWaterLoop_3",
+            "eq2eq_CoolingWaterLoop_1", "bd2bd_ArchForArch", "sh2fl_ArchForArch", "sh2sh_ArchForArch",
+            "sh2sp_ArchForArch", "sp2bd_ArchForArch", "sp2fl_ArchForArch", "sp2sh_ArchForArch", "sp2sp_ArchForArch",
+            "bd2fl_ArchForArch", "bd2sh_ArchForArch", "bd2sp_ArchForArch", "fl2bd_ArchForArch", "fl2fl_ArchForArch",
+            "fl2sh_ArchForArch", "fl2sp_ArchForArch", "sh2bd_ArchForArch", "sy2sp_for", "eq2eq_ACAirNetwork_1",
+            "eq2eq_SupplyWaterNetwork_1", "eq2eq_VentNetwork_3", "eq2eq_HUDistribution_1");
+    /**系统类型,风系统1,水系统0*/
+    Set<String> SYSTEM_TYPE_FALSE = CollUtil.newHashSet("eq2eq_GasNetwork_2", "eq2eq_DrainingWaterNetwork_1",
+            "eq2eq_CondWaterNetwork_1", "eq2eq_CoolingWaterLoop_3", "eq2eq_SupplyWaterNetwork_2",
+            "eq2eq_HeatWaterLoop_4", "eq2eq_DHWNetwork_2", "eq2eq_HeatWaterLoop_1", "eq2eq_DHWNetwork_1",
+            "eq2eq_RecycleWaterNetwork_2", "eq2eq_RecycleWaterNetwork_1", "eq2eq_FireWaterNetwork_1",
+            "eq2eq_DrainingWaterNetwork_2", "eq2eq_VRFNetwork_1", "eq2eq_DrinkingWaterNetwork_2",
+            "eq2eq_ChillWaterLoop_3", "eq2eq_ChillWaterLoop_2", "eq2eq_GasNetwork_1", "eq2eq_CoolingWaterLoop_4",
+            "eq2eq_ChillWaterLoop_1", "eq2eq_DrinkingWaterNetwork_2", "eq2eq_CoolingWaterLoop_2",
+            "eq2eq_FireWaterNetwork_2", "eq2eq_HeatWaterLoop_2", "eq2eq_HeatWaterLoop_3",
+            "eq2eq_CoolingWaterLoop_1", "eq2eq_SupplyWaterNetwork_1");
+    /**系统类型,风系统1,水系统0*/
+    Set<String> SYSTEM_TYPE_TRUE = CollUtil.newHashSet("eq2eq_VentNetwork_2", "eq2eq_ACAirNetwork_3",
+            "eq2eq_FireVentNetwork_1", "eq2eq_VentNetwork_1", "eq2eq_ACAirNetwork_1", "eq2eq_VentNetwork_3");
 }

+ 38 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java

@@ -270,6 +270,16 @@ public enum AdmRelationTypeEnum {
     private Set<String> checkClassCodes;
     /**是否检查传感器使用的传感器类型*/
     private Set<String> checkSensorCodes;
+    /**是否需要配置源末端,0-不需要,1-需要*/
+    private Integer sourceFlag;
+    /**是否自动计算类型,0-不自动计算,1-自动计算*/
+    private Integer automaticFlag;
+    /**手动计算类型 1 禁用  2提示引导 3手动维护*/
+    private Integer manualFlag;
+    /**风系统1,水系统0*/
+    private Integer systemType;
+    ///**业务分区类型*/
+//    private String zoneType;
 
     /***
      * Description: 构造函数
@@ -300,6 +310,34 @@ public enum AdmRelationTypeEnum {
         this.hasCheckClassCode = hasCheckClassCode;
         this.checkClassCodes = CollUtil.newHashSet(AdmObjectInfoConstant.CHECK_CLASS_CODES);
         this.checkSensorCodes = CollUtil.newHashSet(AdmObjectInfoConstant.CHECK_SENSOR_CODES);
+        this.sourceFlag=null;
+        if (AdmObjectInfoConstant.SOURCE_FLAG_FALSE.contains(relationType)){
+            this.sourceFlag=0;
+        }
+        if (AdmObjectInfoConstant.SOURCE_FLAG_TRUE.contains(relationType)){
+            this.sourceFlag=1;
+        }
+        this.automaticFlag=null;
+        if (AdmObjectInfoConstant.AUTOMATIC_FLAG_FALSE.contains(relationType)){
+            this.automaticFlag=0;
+        }
+        if (AdmObjectInfoConstant.AUTOMATIC_FLAG_TRUE.contains(relationType)){
+            this.automaticFlag=1;
+        }
+        this.manualFlag=null;
+        if (AdmObjectInfoConstant.MANUAL_FLAG_TWO.contains(relationType)){
+            this.manualFlag=2;
+        }
+        if (AdmObjectInfoConstant.MANUAL_FLAG_THREE.contains(relationType)){
+            this.manualFlag=3;
+        }
+        this.systemType=null;
+        if (AdmObjectInfoConstant.SYSTEM_TYPE_FALSE.contains(relationType)){
+            this.systemType=0;
+        }
+        if (AdmObjectInfoConstant.SYSTEM_TYPE_TRUE.contains(relationType)){
+            this.systemType=1;
+        }
     }
     /***
      * Description: 构造函数

+ 43 - 0
src/main/java/com/persagy/proxy/adm/constant/BusinessErrorRwdCode.java

@@ -0,0 +1,43 @@
+package com.persagy.proxy.adm.constant;
+
+/***
+ * Description: rwd定制的错误返回码
+ * @author : lijie
+ * @date :2021/9/3 14:25
+ * Update By lijie 2021/9/3 14:25
+ */
+public enum BusinessErrorRwdCode {
+    /**
+     * A73XX:代表关系计算的错误码
+     *
+     * */
+	A7301("A7301", ":不存在"),
+    A7302("A7302", ":存在多个实例"),
+    A7303("A7303", ":不存在"),
+    A7304("A7304", ":存在多个实例"),
+    A7305("A7305", ":错误的类型参考:这里的传感器包含车库摄像头,车位检测器,办公摄像头,火灾探测器,燃气探测器,漏电探测器,消防设备电源传感器,监控摄像头,入侵报警探测器,以及传感器系统下所有设备类型"),
+    A7306("A7306", ":不符合主对象条件限制");
+
+    private String code;
+
+    private String desc;
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    private BusinessErrorRwdCode(String code, String desc) {
+        this.desc = desc;
+        this.code = code;
+    }
+
+    @Override
+    public String toString() {
+        return this.code + "_" + this.desc;
+    }
+
+}

+ 86 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmManualRelCalController.java

@@ -0,0 +1,86 @@
+package com.persagy.proxy.adm.controller;
+
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmManualRelCalRequest;
+import com.persagy.proxy.adm.model.AdmManualRelationCalcDel;
+import com.persagy.proxy.adm.model.AdmRelationAddRequest;
+import com.persagy.proxy.adm.request.AdmCreateResponse;
+import com.persagy.proxy.adm.request.AdmManualRelCalResponse;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.AdmManualRelCalService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.ws.rs.QueryParam;
+
+/***
+ * Description:手动计算输入类
+ * @author : lijie
+ * @date :2021/8/31 11:37
+ * Update By lijie 2021/8/31 11:37
+ */
+@RestController
+@RequestMapping("/rel-manual-calc/")
+@RequiredArgsConstructor
+public class AdmManualRelCalController {
+
+    private final AdmManualRelCalService admManualRelationCalcService;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    
+    /***
+     * Description: 添加关系
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse  
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    @PostMapping(value = "add")
+    public AdmCreateResponse addRels(@QueryParam("projectId") String projectId,
+                                     @RequestBody AdmRelationAddRequest request) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return admManualRelationCalcService.addRels(context,request);
+    }
+    /***
+     * Description: 删除关系
+     * @param admManualRelationCalcDel : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    @PostMapping(value = "del")
+    public AdmCreateResponse delRels(@QueryParam("projectId") String projectId,
+                                     @Validated @RequestBody AdmManualRelationCalcDel admManualRelationCalcDel) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return admManualRelationCalcService.delRels(context,admManualRelationCalcDel);
+    }
+    /***
+     * Description: 查询关系数据
+     * @param admManualRelCalRequest : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    @PostMapping(value = "query")
+    public AdmResponse query(@QueryParam("projectId") String projectId,
+                             @Validated @RequestBody AdmManualRelCalRequest admManualRelCalRequest) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return admManualRelationCalcService.query(context,admManualRelCalRequest);
+    }
+
+
+
+
+}

+ 0 - 48
src/main/java/com/persagy/proxy/adm/controller/AdmManualRelationCalcController.java

@@ -1,48 +0,0 @@
-package com.persagy.proxy.adm.controller;
-
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.model.AdmRelationAddRequest;
-import com.persagy.proxy.adm.model.AdmTenant;
-import com.persagy.proxy.adm.request.AdmCreateResponse;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.adm.service.AdmManualRelationCalcService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.ws.rs.QueryParam;
-
-/***
- * Description:手动计算输入类
- * @author : lijie
- * @date :2021/8/31 11:37
- * Update By lijie 2021/8/31 11:37
- */
-@RestController
-@RequestMapping("/rel-manual-calc/")
-@RequiredArgsConstructor
-public class AdmManualRelationCalcController {
-
-    private final AdmManualRelationCalcService admManualRelationCalcService;
-    
-    /***
-     * Description: 添加关系
-     * @param request : 请求参数
-     * @return : com.persagy.proxy.adm.request.AdmCreateResponse  
-     * @author : lijie
-     * @date :2021/8/31 12:10
-     * Update By lijie 2021/8/31 12:10
-     */
-    @PostMapping(value = "add")
-    public AdmCreateResponse addRels(@RequestBody AdmRelationAddRequest request) throws Exception {
-        return admManualRelationCalcService.addRels(request);
-    }
-
-
-
-
-}

+ 5 - 4
src/main/java/com/persagy/proxy/adm/controller/AdmModelRelController.java

@@ -17,6 +17,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;
 
 /**
@@ -40,16 +41,16 @@ public class AdmModelRelController {
 
     /**
      * 模型修改设备元空间的建筑楼层信息
-     * @param createRequest
+     * @param admModelRel
      * @return
      * @throws Exception
      */
     @PostMapping("/equip-ispace")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmModelRel> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmModelRel admModelRel, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        List<AdmModelRel> vos = CollUtil.newArrayList(createRequest.getContent());
-       // vos = service.doUpdate(context, AdmModelRel.class, vos);
+        List<AdmModelRel> vos = new ArrayList<>();
+        vos = service.doUpdateModelInfo(context, AdmModelRel.class,admModelRel);
         return AdmResponse.success(vos);
     }
 

+ 4 - 4
src/main/java/com/persagy/proxy/adm/controller/REqForSpConreoller.java

@@ -27,7 +27,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/rel/eq-for-sp-base")
-public class REqForSpConreoller {
+public class RelationEqForSpConreoller {
 
     @Autowired
     private IAdmRelationService service;
@@ -62,7 +62,7 @@ public class REqForSpConreoller {
                 return AdmResponse.failure("必填项:EquipId(设备id)、SpaceId(业务空间id)");
             }
             // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
-            voList.add(new RelationDTO(null, "EquipforSpace", "Eq2Sp", type, equipId, spaceId));
+            voList.add(new RelationDTO(null, "MechForArch", "Eq2Sp", type, equipId, spaceId));
         }
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
@@ -96,7 +96,7 @@ public class REqForSpConreoller {
                 continue;
             }
             // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
-            voList.add(new RelationDTO(null, "EquipforSpace", "Eq2Sp", type, equipId, spaceId));
+            voList.add(new RelationDTO(null, "MechForArch", "Eq2Sp", type, equipId, spaceId));
         }
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
@@ -131,7 +131,7 @@ public class REqForSpConreoller {
                 return AdmResponse.failure("必填项:EquipId(设备id)、SpaceId(业务空间id)");
             }
             ObjectNode node = JsonNodeFactory.instance.objectNode();
-            node.put("graphCode", "EquipforSpace");
+            node.put("graphCode", "MechForArch");
             node.put("relCode", "Eq2Sp");
             node.put("relValue", type);
             node.put("objFrom", equipId);

+ 189 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyEqController.java

@@ -0,0 +1,189 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:系统下的设备设施
+ * @author:lgy
+ * @data:2021/9/3 15:25
+ */
+@RestController
+@RequestMapping("/rel/sy-in-eq")
+public class RelationSyEqController {
+
+    @Autowired
+    private IAdmRelationService service;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+
+    /**
+     * 创建系统下的设备关系,数据叠加,不会覆盖以前的数据
+     * 必填项:EquipID(设备id)、SysID(系统id)
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link-sy-eq","/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String equipId = param.getString("equipId");
+        String sysID = param.getString("sysId");
+        if(!StrUtil.isAllNotEmpty(equipId,sysID)) {
+            return AdmResponse.failure("必填项:EquipID(设备id)、SysID(系统id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, sysID , equipId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除系统和设备的关系,只针对一个对象
+     *必填项:EquipID(设备id)、SysID(系统id)
+     * @param   param      对象
+     * @return             删除的结果信息
+     */
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String equipId = param.getString("equipId");
+        String sysID = param.getString("sysId");
+        if(!StrUtil.isAllNotEmpty(equipId,sysID)) {
+            return AdmResponse.failure("必填项:EquipID(设备id)、SysID(系统id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "MechSubset");
+        node.put("relCode", "Sy2Eq");
+        node.put("objFrom", sysID);
+        node.put("objTo", equipId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建系统下的设备关系
+     *
+     * @param   syEqList           系统和设备的关系对象
+     * @return                  创建结果信息
+     */
+    @PostMapping("/link-eq")
+    public AdmResponse createBatchWithDeleteOldsysIdRelation(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject syEqList) throws Exception {
+        JSONArray equipIdList = syEqList.getJSONArray("equipIdList");
+        String sysId = syEqList.getString("sysId");
+        if(StrUtil.isBlank(sysId) || CollUtil.isEmpty(equipIdList)) {
+            return AdmResponse.failure("必填项:EquipIdList(设备id列表)、SysID(系统id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequest = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "MechSubset");
+        node.put("relCode", "Sy2Eq");
+        node.put("objFrom", sysId);
+        queryRequest.setCriteria(node);
+        service.doDelete(context,queryRequest);
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        for (int i = 0; i < equipIdList.size(); i++) {
+            voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, sysId , equipIdList.getString(i)));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建系统下的设备关系
+     *
+     * @param   param           系统和设备的关系对象
+     * @return                  创建结果信息
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createDistinctEq(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String equipId = param.getString("equipId");
+        String sysID = param.getString("sysId");
+        if(!StrUtil.isAllNotEmpty(equipId,sysID)) {
+            return AdmResponse.failure("必填项:EquipId(设备id)、sysIdList(系统id列表)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequest = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "MechSubset");
+        node.put("relCode", "Sy2Eq");
+        node.put("objTo", equipId);
+        queryRequest.setCriteria(node);
+        service.doDelete(context,queryRequest);
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, sysID , equipId));
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 根据对象删除系统和设备的关系
+     *
+     * @param   entytyList           根据对象删除系统和设备的关系
+     * @return                  创建结果信息
+     */
+    public AdmResponse deleteBatch(@RequestParam String projectId,
+                              @RequestBody JSONArray entytyList) throws Exception {
+        if(CollUtil.isEmpty(entytyList)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (int i = 0; i < entytyList.size(); i++) {
+            JSONObject entity = entytyList.getJSONObject(i);
+            // 组装条件
+            QueryCriteria criteria = new QueryCriteria();
+            String equipId = entity.getString("equipId");
+            String sysID = entity.getString("sysId");
+            if(!StrUtil.isAllNotEmpty(equipId,sysID)) {
+                continue;
+            }
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "MechSubset");
+            node.put("relCode", "Sy2Eq");
+            node.put("objFrom", sysID);
+            node.put("objTo", equipId);
+            criteria.setCriteria(node);
+            service.doDelete(context, criteria);
+        }
+        return AdmResponse.success();
+    }
+
+}

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

@@ -87,4 +87,7 @@ public class AdmFloor {
     @CascadeColumn(graphCode = "ArchSubset", relCode = "Fl2Sp")
     private List<AdmSpace> spaceList;
 
+    /** 楼层平面图地址 */
+    private String floorMap;
+
 }

+ 27 - 0
src/main/java/com/persagy/proxy/adm/model/AdmManualRelCalRequest.java

@@ -0,0 +1,27 @@
+package com.persagy.proxy.adm.model;
+
+import lombok.Data;
+
+@Data
+public class AdmManualRelCalRequest {
+
+    /**主从对象类型,主1、从2*/
+    private String objectType;
+    /**关系类型*/
+    private String relType;
+    /**分类类型*/
+    private String category;
+    /**楼层id,未明确楼层传(isNull)*/
+    private String floorId;
+    /**建筑id,未明确建筑传(isNull)*/
+    private String buildingId;
+    /**模糊查询 关键词*/
+    private String vague;
+    /**模糊查询 关键词*/
+    private String vagueTo;
+    /** 第几页(从1开始) */
+    private Integer pageNumber;
+    /** 每页记录数(0 < 记录数 < 1000) */
+    private Integer pageSize;
+
+}

+ 26 - 0
src/main/java/com/persagy/proxy/adm/model/AdmManualRelationCalcDel.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.adm.model;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+public class AdmManualRelationCalcDel {
+
+    /**主对象Id*/
+    @NotNull(message = "主对象 id 不可以为空")
+    private String fromId;
+
+    /**从对象 Id*/
+    @NotNull(message = "从对象 id 不可以为空")
+    private String toId;
+
+    /**关系类型*/
+    @NotNull(message = "关系类型不可以为空")
+    String relType;
+
+    /**图类型*/
+    @NotNull(message = "图类型不可以为空")
+    String graphicType;
+
+}

+ 2 - 1
src/main/java/com/persagy/proxy/adm/model/AdmModelRel.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import lombok.Data;
 
 /**
@@ -28,5 +29,5 @@ public class AdmModelRel {
     private String modelId;
 
     /** 自定义属性 */
-    private String attributeMap;
+    private ObjectNode attributeMap;
 }

+ 2 - 1
src/main/java/com/persagy/proxy/adm/model/AdmRelationAddRequest.java

@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 @Data
 @Builder
@@ -27,7 +28,7 @@ public class AdmRelationAddRequest implements Serializable {
     private String mainContent;
 
     /**从对象内容*/
-    private List<String> fromContent;
+    private Set<String> fromContent;
 
     /**图类型编码*/
     @JsonAlias({"graphicType","graphic_type"})

+ 4 - 0
src/main/java/com/persagy/proxy/adm/request/AdmCreateResponse.java

@@ -34,6 +34,10 @@ public class AdmCreateResponse {
         return new AdmCreateResponse(SUCCESS, null, null, null);
     }
 
+    public static AdmCreateResponse success(String message) {
+        return new AdmCreateResponse(SUCCESS, message, null, null);
+    }
+
     public static AdmCreateResponse failure(String message) {
         return new AdmCreateResponse(FAILURE, message, null, new ArrayList<>());
     }

+ 41 - 0
src/main/java/com/persagy/proxy/adm/request/AdmManualRelCalResponse.java

@@ -0,0 +1,41 @@
+package com.persagy.proxy.adm.request;
+
+import lombok.*;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@AllArgsConstructor
+@NoArgsConstructor
+public class AdmManualRelCalResponse extends AdmResponse {
+
+    private final static String SUCCESS = "success";
+    private final static String FAILURE = "failure";
+
+    /** 方向 Left、right */
+    private String direction;
+
+    public AdmManualRelCalResponse(String result, String message, Long total, Integer pageNumber, Integer pageSize, List<?> content, String direction) {
+        this.setResult(result);
+        this.setMessage(message);
+        this.setTotal(total);
+        this.setPageNumber(pageNumber);
+        this.setPageSize(pageSize);
+        this.setContent(content);
+        this.setDirection(direction);
+    }
+
+    public static AdmResponse success() {
+        return new AdmManualRelCalResponse(SUCCESS, null, null, null, null, null,null);
+    }
+
+    public static AdmResponse failure(String message, String direction) {
+        return new AdmManualRelCalResponse(FAILURE, message, null, null, null, null,direction);
+    }
+
+    public static AdmResponse success(List<?> content, String direction) {
+        return new AdmManualRelCalResponse(SUCCESS, null, null, null, null, content,direction);
+    }
+}

+ 48 - 0
src/main/java/com/persagy/proxy/adm/service/AdmManualRelCalService.java

@@ -0,0 +1,48 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.model.AdmManualRelCalRequest;
+import com.persagy.proxy.adm.model.AdmManualRelationCalcDel;
+import com.persagy.proxy.adm.model.AdmRelationAddRequest;
+import com.persagy.proxy.adm.request.AdmCreateResponse;
+import com.persagy.proxy.adm.request.AdmManualRelCalResponse;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+/***
+ * Description: 手动关系计算逻辑处理接口
+ * @author : lijie
+ * @date :2021/8/31 12:14
+ * Update By lijie 2021/8/31 12:14
+ */
+public interface AdmManualRelCalService {
+    /***
+     * Description: 添加关系
+     *
+     * @param context: 存储集团编码及项目id的上下文
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:14
+     * Update By lijie 2021/8/31 12:14
+     */
+    AdmCreateResponse addRels(InstanceUrlParam context, AdmRelationAddRequest request);
+    /***
+     * Description: 删除关系
+     * @param admManualRelationCalcDel : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    AdmCreateResponse delRels(InstanceUrlParam context, AdmManualRelationCalcDel admManualRelationCalcDel);
+    /***
+     * Description: 查询关系数据
+     * @param admManualRelCalRequest : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    AdmResponse query(InstanceUrlParam context, AdmManualRelCalRequest admManualRelCalRequest);
+
+}

+ 0 - 21
src/main/java/com/persagy/proxy/adm/service/AdmManualRelationCalcService.java

@@ -1,21 +0,0 @@
-package com.persagy.proxy.adm.service;
-
-import com.persagy.proxy.adm.model.AdmRelationAddRequest;
-import com.persagy.proxy.adm.request.AdmCreateResponse;
-/***
- * Description: 手动关系计算逻辑处理接口
- * @author : lijie
- * @date :2021/8/31 12:14
- * Update By lijie 2021/8/31 12:14
- */
-public interface AdmManualRelationCalcService {
-    /***
-     * Description: 添加关系
-     * @param request : 请求参数
-     * @return : com.persagy.proxy.adm.request.AdmCreateResponse  
-     * @author : lijie
-     * @date :2021/8/31 12:14
-     * Update By lijie 2021/8/31 12:14
-     */
-    AdmCreateResponse addRels(AdmRelationAddRequest request);
-}

+ 14 - 1
src/main/java/com/persagy/proxy/adm/service/IAdmModelRelService.java

@@ -1,6 +1,10 @@
 package com.persagy.proxy.adm.service;
 
 import com.persagy.proxy.adm.model.AdmLocationPoint;
+import com.persagy.proxy.adm.model.AdmModelRel;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+import java.util.List;
 
 /**
  * @ClassName IAdmModelRelService
@@ -9,5 +13,14 @@ import com.persagy.proxy.adm.model.AdmLocationPoint;
  * @Date 2021/8/31 14:30
  * @Version V1.0
  **/
-public interface IAdmModelRelService extends IAdmBaseService<AdmLocationPoint>{
+public interface IAdmModelRelService extends IAdmBaseService<AdmModelRel>{
+
+    /**
+     * 修改
+     * @param context
+     * @param clazz
+     * @param vo
+     * @return
+     */
+    List<AdmModelRel> doUpdateModelInfo(InstanceUrlParam context, Class<AdmModelRel> clazz, AdmModelRel vo)  throws Exception;
 }

+ 132 - 18
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmManualRelationCalcServiceImpl.java

@@ -1,17 +1,34 @@
 package com.persagy.proxy.adm.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
+import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.digital.client.DigitalObjectClient;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
+import com.persagy.dmp.digital.client.DigitalRelationCaclClient;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmObjectInfoConstant;
+import com.persagy.proxy.adm.constant.BusinessErrorRwdCode;
+import com.persagy.proxy.adm.model.AdmManualRelCalRequest;
+import com.persagy.proxy.adm.model.AdmManualRelationCalcDel;
 import com.persagy.proxy.adm.model.AdmRelationAddRequest;
 import com.persagy.proxy.adm.request.AdmCreateResponse;
-import com.persagy.proxy.adm.service.AdmManualRelationCalcService;
+import com.persagy.proxy.adm.request.AdmManualRelCalResponse;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.AdmManualRelCalService;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /***
  * Description: 手动计算逻辑处理类
@@ -21,10 +38,18 @@ import java.util.Map;
  */
 @Service
 @Slf4j
-public class AbstractAdmManualRelationCalcServiceImpl implements AdmManualRelationCalcService {
+@RequiredArgsConstructor
+public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
+
+    private final DigitalRelationCaclClient digitalRelationCaclClient;
+    private final DigitalObjectClient digitalObjectClient;
+
+
 
     /***
      * Description: 添加关系
+     *
+     * @param context
      * @param request : 请求参数
      * @return : com.persagy.proxy.adm.request.AdmCreateResponse
      * @author : lijie
@@ -32,7 +57,7 @@ public class AbstractAdmManualRelationCalcServiceImpl implements AdmManualRelati
      * Update By lijie 2021/8/31 12:14
      */
     @Override
-    public AdmCreateResponse addRels(AdmRelationAddRequest request) {
+    public AdmCreateResponse addRels(InstanceUrlParam context, AdmRelationAddRequest request) {
         // 获取项目id
         String projectId = AppContext.getContext().getProjectId();
         if (StrUtil.isBlank(request.getRelType())){
@@ -66,14 +91,45 @@ public class AbstractAdmManualRelationCalcServiceImpl implements AdmManualRelati
         if (AdmObjectInfoConstant.CADID.equals(request.getType()) && relationTypeEnum.getHasCheckCadId()){
             return AdmCreateResponse.failure("从对象不存在CADID编码","2");
         }
-
-
-
-
-        // 1.根据项目id和关系类型更新计算时间为当前时间
-        // 2.根据不同关系类型进行处理
-
-
+        // relType为下面几种的从对象不能重复,主对象和从对象不能重复
+        if (AdmObjectInfoConstant.CHECK_SPECIAL_TYPES.contains(request.getRelType())){
+            Set<String> fromContent = request.getFromContent();
+            if (fromContent.contains(request.getMainContent())){
+                return AdmCreateResponse.failure(request.getMainContent()+":从对象不能重复","2");
+            }
+        }
+        RequestData requestData = RequestData.builder()
+                .graphCode(relationTypeEnum.getGraphCode())
+                .relCode(relationTypeEnum.getRelCode())
+                .masterObjType(relationTypeEnum.getMasterObjType())
+                .slaveObjType(relationTypeEnum.getSlaveObjType())
+                .type(request.getType())
+                .hasRelValue(relationTypeEnum.getHasRelValue())
+                .hasFilterMasterId(relationTypeEnum.getHasFilterMasterId())
+                .hasFilterClassCode(relationTypeEnum.getHasFilterClassCode())
+                .hasCheckSensor(relationTypeEnum.getHasCheckSensor())
+                .hasCheckClassCode(relationTypeEnum.getHasCheckClassCode())
+                .checkClassCodes(relationTypeEnum.getCheckClassCodes())
+                .checkSensorCodes(relationTypeEnum.getCheckSensorCodes())
+                .sign("1")
+                .mainContent(request.getMainContent())
+                .fromContent(request.getFromContent())
+                .build();
+        CommonResult<List<ObjectRelation>> commonResult = digitalRelationCaclClient
+                .createObjRelationsByKeywordAndObjType(context.getGroupCode(), context.getProjectId(),
+                        context.getAppId(), "0", requestData);
+        if (BusinessErrorRwdCode.A7301.getCode().equals(commonResult.getResult())
+                || BusinessErrorRwdCode.A7302.getCode().equals(commonResult.getResult())
+                || BusinessErrorRwdCode.A7305.getCode().equals(commonResult.getResult())
+                || BusinessErrorRwdCode.A7306.getCode().equals(commonResult.getResult())){
+            return AdmCreateResponse.failure(commonResult.getMessage(),"1");
+        }
+        if (BusinessErrorRwdCode.A7303.getCode().equals(commonResult.getResult())
+                || BusinessErrorRwdCode.A7304.getCode().equals(commonResult.getResult())){
+            return AdmCreateResponse.failure(commonResult.getMessage(),"2");
+        }
+        return AdmCreateResponse.success("添加成功");
+        // 原数据中心逻辑
         // 2.2 特殊类型的判断
         // *******
         // sp2sp_RadiationNetwork_2,sp2sp_RadiationNetwork_1 && classCode!=LightingZone errorType=1,不是照明分区类型
@@ -219,17 +275,75 @@ public class AbstractAdmManualRelationCalcServiceImpl implements AdmManualRelati
         // 传感器类型检查
         // eq2sp_SensorRelationship_ss2sp:图类型为SensorRelationship,边类型为Ss2Sp
         // *****
-        // eq2sp_x
+        // eq2sp_x,已经不存在的类型
         // bd2bd_ArchForArch,bd2fl_ArchForArch,bd2sh_ArchForArch,bd2sp_ArchForArch,fl2bd_ArchForArch,fl2fl_ArchForArch
         // fl2sh_ArchForArch,fl2sp_ArchForArch,sh2bd_ArchForArch,sh2fl_ArchForArch,sh2sh_ArchForArch,sh2sp_ArchForArch
         // sp2bd_ArchForArch,sp2fl_ArchForArch,sp2sh_ArchForArch,sp2sp_ArchForArch
 
+    }
+    /***
+     * Description: 删除关系
+     * @param admManualRelationCalcDel : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    @Override
+    public AdmCreateResponse delRels(InstanceUrlParam context, AdmManualRelationCalcDel admManualRelationCalcDel) {
+        ObjectRelation objectRelation = new ObjectRelation();
+        Map<String, AdmRelationTypeEnum> relationTypeMap = AdmRelationTypeEnum.getRelationTypeMap();
+        if (relationTypeMap.containsKey(admManualRelationCalcDel.getRelType())){
+            return AdmCreateResponse.failure("不存在的关系类型");
+        }
+        AdmRelationTypeEnum relationTypeEnum = relationTypeMap.get(admManualRelationCalcDel.getRelType());
+        objectRelation.setGraphCode(relationTypeEnum.getGraphCode());
+        objectRelation.setRelCode(relationTypeEnum.getRelCode());
+        objectRelation.setObjFrom(admManualRelationCalcDel.getFromId());
+        objectRelation.setObjTo(admManualRelationCalcDel.getToId());
+        CommonResult<List<ObjectRelation>> commonResult = digitalRelationCaclClient.deleteObjRelationsByRelId(context.getGroupCode(),
+                context.getProjectId(), context.getAppId(), "0", objectRelation);
+        if (!"success".equals(commonResult.getResult())){
+            return AdmCreateResponse.failure(commonResult.getMessage());
+        }
+        return AdmCreateResponse.success("删除关系成功");
+    }
 
-
-
-
-
-
-        return null;
+    /***
+     * Description: 查询关系数据
+     * @param admManualRelCalRequest : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmCreateResponse
+     * @author : lijie
+     * @date :2021/8/31 12:10
+     * Update By lijie 2021/8/31 12:10
+     */
+    @Override
+    public AdmResponse query(InstanceUrlParam context, AdmManualRelCalRequest admManualRelCalRequest) {
+        Map<String, AdmRelationTypeEnum> relationTypeMap = AdmRelationTypeEnum.getRelationTypeMap();
+        if (relationTypeMap.containsKey(admManualRelCalRequest.getRelType())){
+            return AdmManualRelCalResponse.failure("不存在的关系类型");
+        }
+        AdmRelationTypeEnum relationTypeEnum = relationTypeMap.get(admManualRelCalRequest.getRelType());
+        RequestData requestData = RequestData.builder()
+                .graphCode(relationTypeEnum.getGraphCode())
+                .relCode(relationTypeEnum.getRelCode())
+                .relValue(admManualRelCalRequest.getCategory())
+                .mainContent(admManualRelCalRequest.getVague())
+                .build();
+        if (null!=admManualRelCalRequest.getPageNumber()){
+            requestData.setPage(Long.valueOf(admManualRelCalRequest.getPageNumber()));
+        }
+        if (null!=admManualRelCalRequest.getPageSize()){
+            requestData.setSize(Long.valueOf(admManualRelCalRequest.getPageSize()));
+        }
+        if (StrUtil.isNotBlank(admManualRelCalRequest.getVagueTo())){
+            requestData.setFromContent(CollUtil.newHashSet(admManualRelCalRequest.getVagueTo()));
+        }
+        CommonResult<List<ObjectDigital>> commonResult = digitalObjectClient
+                .queryObjectListByGraphCodeAndRelCode(context.getGroupCode(), context.getProjectId(),
+                        context.getAppId(), "0", requestData);
+        return new AdmManualRelCalResponse(commonResult.getResult(),commonResult.getMessage(),commonResult.getCount(),
+                admManualRelCalRequest.getPageNumber(),admManualRelCalRequest.getPageSize(),
+                commonResult.getData(),"Left");
     }
 }

+ 347 - 4
src/main/java/com/persagy/proxy/adm/service/impl/AdmModelRelServiceImpl.java

@@ -1,10 +1,27 @@
 package com.persagy.proxy.adm.service.impl;
 
-import com.persagy.proxy.adm.model.AdmLocationPoint;
-import com.persagy.proxy.adm.service.IAdmLocationPointService;
-import com.persagy.proxy.adm.service.IAdmModelRelService;
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.adm.utils.GeoToolsUtil;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @ClassName AdmModelRelServiceImpl
  * @Description: 模型修改设备元空间的建筑楼层信息
@@ -13,6 +30,332 @@ import org.springframework.stereotype.Service;
  * @Version V1.0
  **/
 @Service
-public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmLocationPoint> implements IAdmModelRelService {
+@Slf4j
+public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelRel> implements IAdmModelRelService {
+
+
+    @Autowired
+    private IAdmFloorService floorService;
+
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+
+    @Autowired
+    private IAdmISpaceService iSpaceService;
+
+    /**
+     * 模型修改设备元空间的建筑楼层信息
+     * @param context
+     * @param clazz
+     * @param vo
+     * @return
+     */
+    @Override
+    public List<AdmModelRel> doUpdateModelInfo(InstanceUrlParam context, Class<AdmModelRel> clazz, AdmModelRel vo) throws Exception{
+
+        //1.查询模型文件是否有楼层在使用
+        AdmModelRel floorCriteria = new AdmModelRel();
+        floorCriteria.setModelId(vo.getModelId());
+        List<AdmFloor> floorList = queryFloorEntity(context,floorCriteria);
+        if(CollUtil.isNotEmpty(floorList)){
+            List<String> floorQueryTypes = getFloorQueryTypes(floorList);
+            //根据类型查询relation_type_project
+            //更新边类型计算状态:computationalState为2
+
+        }
+        //2.修改设备和元空间的建筑楼层信息
+        String oldBimId = vo.getOldBimId();
+        String bimId = vo.getBimId();
+
+        if(StringUtils.isNotEmpty(oldBimId)  && !oldBimId.equals(bimId)){
+            //根据模型id重置设备元空间的建筑楼层信息
+            resetEquipIspaceInfo(context,vo);
+        }
+
+        //查询楼层实体
+        floorCriteria = new AdmModelRel();
+        floorCriteria.setFloorId(vo.getFloorId());
+        List<AdmFloor> admFloors = queryFloorEntity(context, floorCriteria);
+        if(CollUtil.isEmpty(admFloors)){
+            throw new Exception("楼层不存在");
+        }
+        AdmFloor floorEntity = admFloors.get(0);
+        //2.1 模型修改设备的建筑楼层信息
+        if(CollUtil.isEmpty(floorEntity.getOutline())){
+            //如果楼层的轮廓线为空的话,直接修改
+            updateEquipModelInfo(context, vo,floorEntity);
+        }else{
+            //判断该设备的坐标是否在层楼的轮廓中,若在,修改;不在,不修改
+            List<AdmEquipment> admEquipments = queryModelEquip(context, vo);
+            Boolean pointInPolygon = isPointInPolygon(admEquipments, floorEntity);
+            if(pointInPolygon){
+                updateEquipModelInfo(context, vo,floorEntity);
+            }
+        }
+        //2.2 模型修改元空间的建筑楼层信息
+        updateIspaceModelInfo(context, vo,floorEntity);
+
+        //3. 修改楼层平面图地址
+        if(StringUtils.isNotEmpty(vo.getFloorMap())){
+            floorEntity.setFloorMap(vo.getFloorMap());
+        }
+        floorEntity.setModelId(vo.getModelId());
+        floorEntity.setBimIdPre(vo.getBimId());
+
+        //4.处理楼层自定义属性:楼层标高
+        ObjectNode attributeMap = vo.getAttributeMap();
+        if(attributeMap!=null){
+            updateFloorElevation(vo.getAttributeMap().toString(),floorEntity);
+        }
+
+        //5.修改楼层信息
+        ArrayList<AdmFloor> floors = new ArrayList<>();
+        floors.add(floorEntity);
+        List<AdmFloor> floorUpresult = floorService.doUpdate(context, AdmFloor.class, floors);
+        if(CollUtil.isEmpty(floorUpresult)) {
+            //6.发送消息,BDTP已发送,不再重复发送修改对象消息
+        }
+        return null;
+    }
+
+    /**
+     * 模型修改设备的建筑楼层信息
+     */
+    private void updateEquipModelInfo(InstanceUrlParam context, AdmModelRel modelRel,AdmFloor floorEntity){
+
+        //查询模型下的设备信息
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters("bimId = "+modelRel.getBimId());
+        criteria.setFilters("floorId = "+modelRel.getFloorId());
+        AdmResponse admResponse = equipmentService.doQuery(context, criteria, AdmEquipment.class);
+        List<AdmEquipment> content = (List<AdmEquipment>) admResponse.getContent();
+        if(CollUtil.isEmpty(content)){
+            return;
+        }
+        for (AdmEquipment admEquipment : content) {
+            //修改设备的建筑楼层信息
+            admEquipment.setBuildingId(floorEntity.getBuildingId());
+            admEquipment.setFloorId(floorEntity.getId());
+        }
+        List<AdmEquipment> admEquipments = equipmentService.doUpdate(context, AdmEquipment.class, content);
+        log.info("模型修改设备建筑楼层信息结果"+admEquipments);
+    }
+
+
+    /**
+     * 模型修改元空间的建筑楼层信息
+     */
+    private void updateIspaceModelInfo(InstanceUrlParam context, AdmModelRel modelRel,AdmFloor floorEntity){
+
+        //查询模型下的元空间信息
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters("bimId = "+modelRel.getBimId());
+        criteria.setFilters("floorId = "+modelRel.getFloorId());
+        AdmResponse admResponse = iSpaceService.doQuery(context, criteria, AdmISpace.class);
+        List<AdmISpace> content = (List<AdmISpace>) admResponse.getContent();
+        if(CollUtil.isEmpty(content)){
+            return;
+        }
+        for (AdmISpace admIspace : content) {
+            //修改设备的建筑楼层信息
+            admIspace.setBuildingId(floorEntity.getBuildingId());
+            admIspace.setFloorId(floorEntity.getId());
+        }
+        List<AdmISpace> admEquipments = iSpaceService.doUpdate(context, AdmISpace.class, content);
+        log.info("模型修改元空间的建筑楼层信息结果"+admEquipments);
+    }
+
+
+    /**
+     * 判断点是否在面中
+     * @return
+     */
+    private Boolean isPointInPolygon(List<AdmEquipment> equipments,AdmFloor floor){
+        if(CollUtil.isEmpty(equipments)){
+            return false;
+        }
+        Boolean flag = true;
+        //楼层轮廓线
+        List<ObjectNode> outline = floor.getOutline();
+        for (AdmEquipment equipment : equipments) {
+            //设备BIM坐标
+            String bimLocation = equipment.getBimLocation();
+            //判断点是否在面中:即设备位置是否在该楼层轮廓线中
+            if(StringUtils.isEmpty(bimLocation)){
+                continue;
+            }
+            String[] split = bimLocation.split(",");
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("X",split[0]);
+            node.put("Y",split[1]);
+            node.put("Z",split[2]);
+            flag = GeoToolsUtil.isPointInPoly(node,outline);
+            if(!flag){
+                return flag;
+            }
+        }
+        return flag;
+    }
+
+
+    /**
+     * 楼层属性修改
+     * @param floorMapStr
+     * @param floorEntity
+     */
+    private void updateFloorMap(String floorMapStr,AdmFloor floorEntity){
+        if(StringUtils.isEmpty(floorMapStr)){
+            return;
+        }
+        Map<String, Object> floorMap = JSONObject.toJavaObject(JSON.parseObject(floorMapStr), Map.class);
+        Map<String, Object> infos = floorEntity.getInfos();
+        for(Map.Entry<String,Object> map : floorMap.entrySet()){
+            infos.put(map.getKey(),map.getValue());
+        }
+        floorEntity.setInfos(infos);
+    }
+
+    /**
+     * 处理楼层标高
+     * @param floorMapStr
+     * @param floorEntity
+     */
+    private void updateFloorElevation(String floorMapStr,AdmFloor floorEntity){
+        if(StringUtils.isEmpty(floorMapStr)){
+            return;
+        }
+        Map<String, Object> floorMap = JSONObject.toJavaObject(JSON.parseObject(floorMapStr), Map.class);
+
+        Map<String, Object> infos = floorEntity.getInfos();
+        if(floorMap.containsKey(AdmCommonConstant.FLOOR_ELEVATION)){
+            Object object = floorMap.get(AdmCommonConstant.FLOOR_ELEVATION);
+            if(object != null){
+                double floorElevation = (Double) object / 1000;
+                infos.put(AdmCommonConstant.FLOOR_ELEVATION,floorElevation);
+            }
+        }
+    }
+
+
+    /**
+     * 根据模型id重置设备元空间的建筑楼层信息
+     * @param context
+     * @param vo
+     */
+    private void resetEquipIspaceInfo(InstanceUrlParam context, AdmModelRel vo){
+        //重置历史设备的建筑楼层信息
+        List<AdmEquipment> admEquipments = queryEquipmentByBimId(context, vo);
+        if(CollUtil.isNotEmpty(admEquipments)){
+            admEquipments.forEach(item->{
+                item.setFloorId(null);
+                item.setBuildingId(null);
+            });
+        }
+        equipmentService.doUpdate(context,AdmEquipment.class,admEquipments);
+
+        //重置历史元空间的建筑楼层信息
+        List<AdmISpace> admISpaces = queryIspaceByBimId(context, vo);
+        if(CollUtil.isNotEmpty(admISpaces)){
+            admISpaces.forEach(item->{
+                item.setFloorId(null);
+                item.setBuildingId(null);
+            });
+        }
+       iSpaceService.doUpdate(context,AdmISpace.class,admISpaces);
+    }
+
+
+    /**
+     * 查询设备信息
+     * @param context
+     * @param modelRel
+     */
+    private List<AdmEquipment> queryModelEquip(InstanceUrlParam context, AdmModelRel modelRel){
+        //查询模型下的设备信息
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
+        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
+        AdmResponse admResponse = equipmentService.doQuery(context, criteria, AdmEquipment.class);
+        if(CollUtil.isEmpty(admResponse.getContent())){
+            return new ArrayList<>();
+        }
+        return (List<AdmEquipment>) admResponse.getContent();
+    }
+
+    /**
+     * 根据BIMID查询历史设备信息
+     */
+    private List<AdmEquipment> queryEquipmentByBimId(InstanceUrlParam context, AdmModelRel vo){
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters("bimId = '"+vo.getOldBimId()+"'");
+        AdmResponse admResponse = equipmentService.doQuery(context, criteria, AdmEquipment.class);
+        return (List<AdmEquipment>)admResponse.getContent();
+    }
+
+
+    /**
+     * 根据BIMID查询历史元空间信息
+     */
+    private List<AdmISpace> queryIspaceByBimId(InstanceUrlParam context, AdmModelRel vo){
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters("bimId = '"+vo.getOldBimId()+"'");
+        AdmResponse admResponse = iSpaceService.doQuery(context, criteria, AdmISpace.class);
+        return (List<AdmISpace>)admResponse.getContent();
+    }
+
+
+    /**
+     * 查询模型文件是否有楼层在使用
+     */
+    private List<AdmFloor> queryFloorEntity(InstanceUrlParam context, AdmModelRel vo){
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        if(StringUtils.isNotEmpty(vo.getModelId())){
+            criteria.setFilters("modelId = '"+vo.getModelId()+"'");
+        }
+        if(StringUtils.isNotEmpty(vo.getFloorId())){
+            criteria.setFilters("id = '"+vo.getFloorId()+"'");
+        }
+        AdmResponse admResponse = floorService.doQuery(context, criteria, AdmFloor.class);
+        return (List<AdmFloor>)admResponse.getContent();
+    }
+
 
+    /**
+     * 获取楼层查询类型
+     * @param floorList
+     */
+    private List<String> getFloorQueryTypes(List<AdmFloor> floorList){
+        List<String> types = new ArrayList<>();
+        for (AdmFloor admFloor : floorList) {
+            if(CollUtil.isNotEmpty(admFloor.getOutline())){
+                types.add("eq2fl");
+                types.add("fl2sp");
+                types.add("bd2sp");
+            }
+            types.add(AdmRelationTypeEnum.EQ2SP_IN.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_2.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_CONDWATERNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_2.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_3.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_4.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_DHWNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_RECYCLEWATERNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_FIREVENTNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_FIREWATERNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_VRFNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_2.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQFRESHAIRNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_CHILLWATERLOOP_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_DRINKINGWATERNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_2.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_VENTNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_HEATWATERLOOP_2.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_COOLINGWATERLOOP_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_ACAIRNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_SUPPLYWATERNETWORK_1.getRelCode());
+            types.add(AdmRelationTypeEnum.EQ2EQ_DRAININGWATERNETWORK_1.getRelCode());
+        }
+        return types;
+    }
 }

+ 89 - 0
src/main/java/com/persagy/proxy/adm/utils/GeoToolsUtil.java

@@ -0,0 +1,89 @@
+package com.persagy.proxy.adm.utils;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.geotools.geometry.jts.JTSFactoryFinder;
+import org.locationtech.jts.geom.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @ClassName GeoToolsUtil
+ * @Description: 点面包含关系分析
+ * @Author linhuili
+ * @Date 2021/9/3 20:31
+ * @Version V1.0
+ **/
+public class GeoToolsUtil {
+    /**
+     * 创建点
+     * @param pointLocal
+     */
+    private static Point createPoint(ObjectNode pointLocal){
+        Long x = 0L;
+        Long y = 0L;
+        Long z = 0L;
+        if(pointLocal.get("X") != null){
+            x = Long.valueOf(pointLocal.get("X").textValue());
+        }
+        if(pointLocal.get("Y") != null){
+            y = Long.valueOf(pointLocal.get("Y").textValue());
+        }
+        if(pointLocal.get("Z") !=null){
+            z = Long.valueOf(pointLocal.get("Z").textValue());
+        }
+        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
+        Coordinate coord = new Coordinate(x, y,z);
+        Point point = geometryFactory.createPoint(coord);
+        return point;
+    }
+
+    /**
+     * 创建面
+     * @param outLines
+     */
+    private static Polygon createPolygon(List<ObjectNode> outLines){
+        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
+        List<Coordinate> objects = new ArrayList<>();
+        for (ObjectNode outLine : outLines) {
+            Long x = 0L;
+            Long y = 0L;
+            Long z = 0L;
+            if(outLine.get("X") != null){
+                x = Long.valueOf(outLine.get("X").textValue());
+            }
+            if(outLine.get("Y") != null){
+                y = Long.valueOf(outLine.get("Y").textValue());
+            }
+            if(outLine.get("Z") !=null){
+                z = Long.valueOf(outLine.get("Z").textValue());
+            }
+            Coordinate coordinate = new Coordinate(x, y, z);
+            objects.add(coordinate);
+        }
+        Coordinate[] coordinates = objects.toArray(new Coordinate[0]);
+        LinearRing ring = geometryFactory.createLinearRing(objects.toArray(new Coordinate[0]));
+        LinearRing holes[] = null; // use LinearRing[] to represent holes
+        Polygon polygon = geometryFactory.createPolygon(ring, holes);
+        return polygon;
+   }
+
+    /**
+     * 点面包含关系判断
+     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
+     * @param pointLocal 坐标点
+     * @param outLines 轮廓线
+     * @return
+     */
+   public static Boolean isPointInPoly(ObjectNode pointLocal, List<ObjectNode> outLines){
+       //创建点
+       Point point = createPoint(pointLocal);
+       //创建面
+       Polygon polygon = createPolygon(outLines);
+       //判断点面包含关系
+       boolean flag = polygon.contains(point);
+       return flag;
+   }
+
+}