Browse Source

Merge remote-tracking branch 'origin/master'

caiaf 4 năm trước cách đây
mục cha
commit
140deb5df7
19 tập tin đã thay đổi với 703 bổ sung72 xóa
  1. 1 1
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dictnew/DefFuncId.kt
  2. 0 2
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/ZoneSpace.kt
  3. 1 1
      datacenter/src/main/kotlin/com/persagy/server/services/objects/ZoneSpaceBaseService.kt
  4. 3 0
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt
  5. 1 1
      datacenter/src/main/resources/application-dev.yml
  6. 7 7
      datacenter/src/main/resources/application-prod.yml
  7. 220 5
      datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt
  8. 252 9
      datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelFromToControllers.kt
  9. 23 31
      datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelToFromController.kt
  10. 90 3
      datasyn/src/main/kotlin/com/persagy/server/syn/jms/DataCenterSync.kt
  11. 2 0
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt
  12. 81 0
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/rel/AutomaticCalculationSync.kt
  13. 13 3
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/rel/EquipinSpaceSync.kt
  14. 2 2
      datasyn/src/main/kotlin/com/persagy/server/syn/task/SchedulerTaskRel.kt
  15. 1 1
      datasyn/src/main/resources/application-dev.yml
  16. 1 1
      equip-component/src/main/kotlin/com/persagy/server/controllers/SpaceController.kt
  17. 1 1
      equip-component/src/main/kotlin/com/persagy/server/service/objects/EquipmentService.kt
  18. 2 2
      equip-component/src/main/resources/application-dev.yml
  19. 2 2
      equip-component/src/main/resources/application-prod.yml

+ 1 - 1
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dictnew/DefFuncId.kt

@@ -225,7 +225,7 @@ open class DefFuncId: Serializable {
         get() {
             return if (firstName == "基本信息"|| firstName.isNullOrEmpty()||firstName == "基本参数"){
                 code
-            } else if (code == "roomLocalFuncTypeID"||code == "RoomLocalFuncTypeName"){
+            } else if (code == "roomLocalFuncTypeID"||code == "roomLocalFuncTypeName"){
                 "infos.$code"
             } else {
                 "infos.$code"

+ 0 - 2
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/ZoneSpace.kt

@@ -46,7 +46,6 @@ import javax.persistence.Table
 @Table(name = "zone_space_base")
 open class ZoneSpace: Serializable, SBaseEntity() {
 
-
     /** 空间ID */
     @Schema(description = "空间ID")
     @Id
@@ -91,7 +90,6 @@ open class ZoneSpace: Serializable, SBaseEntity() {
     /** 平台二维码 */
     @Schema(description = "平台二维码")
     @Column(name = "default_qr_code")
-    @JSONField(name = "DefaultQRCode")
     var defaultQRCode: String? = null
 
     /** BIM模型中编码 */

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/services/objects/ZoneSpaceBaseService.kt

@@ -650,10 +650,10 @@ object ZoneSpaceBaseService : ServiceSpace<ZoneSpace>(SMybatisDao(ZoneSpace::cla
                 DataCenterLogsService.addLogs(
                     Opt.projectId!!,"update",zoneSpace.classCode!!,
                     zoneSpace.id!!,zoneSpace, Opt.account, Opt.coming)
+                ObjInfoService.createInfo(zoneSpace,false,"Sp",zoneSpace.classCode!!)
             } catch (e: Exception) {
                 e.printStackTrace()
             }
-            ObjInfoService.createInfo(zoneSpace,false,"Sp",zoneSpace.classCode!!)
         }
 
         try {

+ 3 - 0
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt

@@ -350,6 +350,7 @@ open class RelationCalcService {
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType",tables!!)).entity()
                 if (entity!=null){
                     entity.computationalState = 3
+                    entity.computingTime = IdUtils.time()
                     relationTypeProjectservice.update(entity)
                 }
             } catch (e: Exception) {
@@ -365,6 +366,7 @@ open class RelationCalcService {
                     val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType",tables!!)).entity()
                     if (entity!=null){
                         entity.computationalState = 1
+                        entity.computingTime = IdUtils.time()
                         relationTypeProjectservice.update(entity)
                     }
                 } catch (e: Exception) {
@@ -377,6 +379,7 @@ open class RelationCalcService {
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_in"), SFilter.eq("zoneType",tables!!)).entity()
                 if (entity!=null){
                     entity.computationalState = 5
+                    entity.computingTime = IdUtils.time()
                     relationTypeProjectservice.update(entity)
                 }
             }

+ 1 - 1
datacenter/src/main/resources/application-dev.yml

@@ -34,7 +34,7 @@ spring:
     type:                               com.alibaba.druid.pool.DruidDataSource
     driver-class-name:                  org.postgresql.Driver
 #    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
-    url:                                jdbc:postgresql://39.102.40.239:5432/datacenterlabsl
+    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj

+ 7 - 7
datacenter/src/main/resources/application-prod.yml

@@ -38,13 +38,13 @@ spring:
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-  rabbitmq:
-    host: 39.102.43.179
-    port: 9936
-    username: admin
-    password: brzj123456
-    #虚拟host 可以不设置,使用server默认host
-    virtual-host: /test
+#  rabbitmq:
+#    host: 39.102.43.179
+#    port: 9936
+#    username: admin
+#    password: brzj123456
+#    #虚拟host 可以不设置,使用server默认host
+#    virtual-host: /test
 
   servlet:
     multipart:

+ 220 - 5
datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt

@@ -28,6 +28,8 @@ package com.persagy.server.syn
 
 import com.alibaba.fastjson.JSONArray
 import com.alibaba.fastjson.JSONObject
+import com.persagy.base.extensions.toJson
+import org.slf4j.LoggerFactory
 
 /**
  * 配置文件
@@ -36,8 +38,11 @@ import com.alibaba.fastjson.JSONObject
  * @date  2020/11/1 21:45
  */
 object Configure {
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(Configure::class.java)
 
-
+    /** 标记 */
+    var flag: Boolean = true
     var messageTypeDataCerten = 1
     /** 数据中台消息之创建 */
     const val RWDCREATE = "instanceObjectCreate"
@@ -81,7 +86,7 @@ object Configure {
      * @param objFrom       主对象 id
      * @param objTo         从对象 id
      */
-    fun toJsonObjArray(graphCode: String, relCode: String, objFrom: String, objTo: String): JSONArray {
+    fun toJsonObjArray(graphCode: String, relCode: String, objFrom: String, objTo: String,relValue: String? = null): JSONArray {
         /** 列表 */
         val jsonArray = JSONArray()
         /** 对象 */
@@ -94,8 +99,12 @@ object Configure {
         jsonObject["objFrom"] = objFrom
         /** 从对象 id */
         jsonObject["objTo"] = objTo
+        if (!relValue.isNullOrEmpty()) {
+            /** 边类型属性, */
+            jsonObject["relValue"] = objTo
+        }
         /** 添加到列表 */
-        jsonArray.plus(jsonObject)
+        jsonArray.add(jsonObject)
         return jsonArray
     }
 
@@ -122,7 +131,7 @@ object Configure {
             /** 从对象 id */
             jsonObject["objTo"] = id
             /** 添加到列表 */
-            jsonArray.plus(jsonObject)
+            jsonArray.add(jsonObject)
         }
         return jsonArray
     }
@@ -136,6 +145,7 @@ object Configure {
      * @param objTo         从对象 id
      */
     fun toJsonObjFromList(graphCode: String, relCode: String, objFroms: ArrayList<String>, objTo: String): JSONArray {
+
         /** 列表 */
         val jsonArray = JSONArray()
         for (id in objFroms){
@@ -150,7 +160,7 @@ object Configure {
             /** 从对象 id */
             jsonObject["objTo"] = objTo
             /** 添加到列表 */
-            jsonArray.plus(jsonObject)
+            jsonArray.add(jsonObject)
         }
         return jsonArray
     }
@@ -183,6 +193,211 @@ object Configure {
         return jsonObject1
     }
 
+    /**
+     * 关系对照
+     */
+    fun relContrast(graphCode: String,type: String): String {
+        if (graphCode == "SpaceNeighborhood"&&type == "None") {
+                return "sp2sp_SpaceNeighborhood_1"
+        } else if (graphCode == "SpaceNeighborhood"&&type == "Door") {
+            return "sp2sp_SpaceNeighborhood_2"
+        } else if (graphCode == "SpaceNeighborhood"&&type == "Window") {
+                return "sp2sp_SpaceNeighborhood_3"
+        } else if (graphCode == "SpaceNeighborhood"&&type == "DoorWindow") {
+            return "sp2sp_SpaceNeighborhood_4"
+        } else if (graphCode == "SpaceNeighborhood"&&type == "Connect") {
+            return "sp2sp_SpaceNeighborhood_5"
+        } else if (graphCode == "TrafficNetwork"&&type == "Normal"){
+            return "sp2sp_TrafficNetwork_1"
+        }else if (graphCode == "TrafficNetwork"&&type == "FFOpen"){
+            return "sp2sp_TrafficNetwork_2"
+        } else if (graphCode == "TrafficNetwork"&&type == "FFClose"){
+            return "sp2sp_TrafficNetwork_3"
+         } else if (graphCode == "ConvectionNetwork"&&type == "Natural"){
+            return "sp2sp_ConvectionNetwork_1"
+        } else if (graphCode == "ConvectionNetwork"&&type == "OnewayMech"){
+            return "sp2sp_ConvectionNetwork_2"
+        } else if (graphCode == "ConvectionNetwork"&&type == "MixMech"){
+            return "sp2sp_ConvectionNetwork_3"
+        } else if (graphCode == "RadiationNetwork"&&type == "Connect"){
+            return "sp2sp_RadiationNetwork_1"
+        } else if (graphCode == "RadiationNetwork"&&type == "Transparent"){
+            return "sp2sp_RadiationNetwork_2"
+         }else {
+            return ""
+        }
+    }
+
+    /**
+     * 设备和设备的关系
+     */
+    fun relContrastEq(graphCode: String,type: String): String{
+        if (graphCode == "LUDistribution"&&type == "Normal") {
+            /** 低压配电普通连接 */
+            return "eq2eq_LUDistribution_1"
+        } else if (graphCode == "LUDistribution"&&type == "Backup") {
+            /** 低压配电互备连接 */
+            return "eq2eq_LUDistribution_2"
+        } else if (graphCode == "HUDistribution"&&type == "Normal") {
+            /** 高压变配电普通连接 */
+            return  "eq2eq_HUDistribution_1"
+        } else if (graphCode == "HUDistribution"&&type == "Backup") {
+            /** 高压变配电互备连接 */
+            return "eq2eq_HUDistribution_2"
+        } else if (graphCode == "ChillWaterLoop"&&type == "Supply") {
+            /** 空调冷冻水供水 */
+            return "eq2eq_ChillWaterLoop_1"
+        } else if (graphCode == "ChillWaterLoop"&&type == "Return") {
+            /** 空调冷冻水回水 */
+            return "eq2eq_ChillWaterLoop_2"
+        } else if (graphCode == "ChillWaterLoop"&&type == "Bypass") {
+            /** 空调冷冻水旁通 */
+            return "eq2eq_ChillWaterLoop_3"
+        } else if (graphCode == "ChillWaterLoop"&&type == "Fill") {
+            /** 空调冷冻水补水 */
+            return "eq2eq_ChillWaterLoop_4"
+        } else if (graphCode == "CoolingWaterLoop"&&type == "Supply") {
+            /** 空调冷却水供水 */
+            return "eq2eq_CoolingWaterLoop_1"
+        } else if (graphCode == "CoolingWaterLoop"&&type == "Return") {
+            /** 空调冷却水回水 */
+            return "eq2eq_CoolingWaterLoop_2"
+        } else if (graphCode == "CoolingWaterLoop"&&type == "Bypass") {
+            /** 空调冷却水旁通 */
+            return "eq2eq_CoolingWaterLoop_3"
+        } else if (graphCode == "CoolingWaterLoop"&&type == "Fill") {
+            /** 空调冷冻水补水 */
+            return "eq2eq_ChillWaterLoop_4"
+        } else if (graphCode == "HeatWaterLoop"&&type == "Supply") {
+            /** 采暖水供水 */
+            return "eq2eq_HeatWaterLoop_1"
+        } else if (graphCode == "HeatWaterLoop"&&type == "Return") {
+            /** 采暖水回水 */
+            return "eq2eq_HeatWaterLoop_2"
+        } else if (graphCode == "HeatWaterLoop"&&type == "Bypass") {
+            /** 采暖水旁通 */
+            return "eq2eq_HeatWaterLoop_3"
+        } else if (graphCode == "HeatWaterLoop"&&type == "Fill") {
+            /** 采暖水补水 */
+            return "eq2eq_HeatWaterLoop_4"
+        } else if (graphCode == "CondWaterNetwork"&&type == "Discharge") {
+            /** 空调冷凝水排水 */
+            return "eq2eq_CondWaterNetwork_1"
+        } else if (graphCode == "ACAirNetwork"&&type == "Supply") {
+            /** 空调送风 */
+            return "eq2eq_ACAirNetwork_1"
+        } else if (graphCode == "ACAirNetwork"&&type == "Return") {
+            /** 空调回风 */
+            return "eq2eq_ACAirNetwork_2"
+        } else if (graphCode == "ACAirNetwork"&&type == "Discharge") {
+            /** 空调排风 */
+            return "eq2eq_ACAirNetwork_3"
+        } else if (graphCode == "FreshAirNetwork"&&type == "Fresh") {
+            /** 新风送风 */
+            return "eq2eqFreshAirNetwork_1"
+        } else if (graphCode == "VentNetwork"&&type == "Supply") {
+            /** 通风送风 */
+            return "eq2eq_VentNetwork_1"
+        } else if (graphCode == "VentNetwork"&&type == "Discharge") {
+            /** 通风排风 */
+            return "eq2eq_VentNetwork_2"
+        } else if (graphCode == "VentNetwork"&&type == "Uncertain") {
+            /** 通风不确定 */
+            return "eq2eq_VentNetwork_3"
+        } else if (graphCode == "VRFNetwork"&&type == "SupplyReturn") {
+            /** 多联机供回制冷剂 */
+            return "eq2eq_VRFNetwork_1"
+        } else if (graphCode == "DomesticWaterNetwork"&&type == "Supply") {
+            /** 生活给水供水 */
+            return "eq2eq_SupplyWaterNetwork_1"
+        } else if (graphCode == "DomesticWaterNetwork"&&type == "Bypass") {
+            /** 生活给水旁通 */
+            return "eq2eq_SupplyWaterNetwork_2"
+        } else if (graphCode == "DrainingWaterNetwork"&&type == "Discharge") {
+            /** 污水排水 */
+            return "eq2eq_DrainingWaterNetwork_1"
+        } else if (graphCode == "DrainingWaterNetwork"&&type == "Bypass") {
+            /** 污水旁通 */
+            return "eq2eq_DrainingWaterNetwork_2"
+        } else if (graphCode == "RecycleWaterNetwork"&&type == "Supply") {
+            /** 中水供水 */
+            return "eq2eq_RecycleWaterNetwork_1"
+        } else if (graphCode == "RecycleWaterNetwork"&&type == "Bypass") {
+            /** 中水旁通 */
+            return "eq2eq_RecycleWaterNetwork_2"
+        } else if (graphCode == "DrinkingWaterNetwork"&&type == "Supply") {
+            /** 直饮水供水 */
+            return "eq2eq_DrinkingWaterNetwork_1"
+        } else if (graphCode == "DrinkingWaterNetwork"&&type == "Bypass") {
+            /** 直饮水旁通 */
+            return "eq2eq_DrinkingWaterNetwork_2"
+        } else if (graphCode == "DHWNetwork"&&type == "Supply") {
+            /** 生活热水供水 */
+            return "eq2eq_DHWNetwork_1"
+        } else if (graphCode == "DHWNetwork"&&type == "Bypass") {
+            /** 生活热水旁通 */
+            return "eq2eq_DHWNetwork_2"
+        } else if (graphCode == "GasNetwork"&&type == "Supply") {
+            /** 燃气供气 */
+            return "eq2eq_GasNetwork_1"
+        } else if (graphCode == "GasNetwork"&&type == "Bypass") {
+            /** 燃气旁通 */
+            return "eq2eq_GasNetwork_2"
+        } else if (graphCode == "FireWaterNetwork"&&type == "Supply") {
+            /** 消防给水供水 */
+            return "eq2eq_FireWaterNetwork_1"
+        } else if (graphCode == "FireWaterNetwork"&&type == "Bypass") {
+            /** 消防给水旁通 */
+            return "eq2eq_FireWaterNetwork_2"
+        } else if (graphCode == "FireVentNetwork"&&type == "Discharge") {
+            /** 消防排烟 */
+            return "eq2eq_FireVentNetwork_1"
+        } else if (graphCode == "WENetwork"&&type == "Normal") {
+            /** 通信连接 */
+            return "eq2eq_SensorNetwork_1"
+        } else if (graphCode == "MechCtrl"&&type == "SyCtrl") {
+            /** 系统控制关系 */
+            return "eq2eq_ControlRelation_1"
+        } else if (graphCode == "MechCtrl"&&type == "EqCtrl") {
+            /** 设备控制关系 */
+            return "eq2eq_ControlRelation_1"
+        } else if (graphCode == "MechPower"&&type == "SyNormal") {
+            /** 系统常规电源 */
+            return "eq2eq_EquipPower_3"
+        } else if (graphCode == "MechPower"&&type == "SyBackup") {
+            /** 系统备用电源 */
+            return "eq2eq_EquipPower_4"
+        } else if (graphCode == "MechPower"&&type == "EqNormal") {
+            /** 设备常规电源 */
+            return "eq2eq_EquipPower_1"
+        } else if (graphCode == "MechPower"&&type == "EqBackup") {
+            /** 设备备用电源 */
+            return "eq2eq_EquipPower_2"
+        } else if (graphCode == "SensorRelationship"&&type == "Ss2Eq") {
+            /** 传感器测量设备关系 */
+            return "eq2eq_SensorRelationship_ss2eq"
+        } else if (graphCode == "SensorRelationship"&&type == "Ss2Sy") {
+            /** 传感器测量系统关系 */
+            return "eq2sy_SensorRelationship_ss2sy"
+        } else if (graphCode == "SensorRelationship"&&type == "Ss2Sp") {
+            /** 传感器测量空间关系 */
+            return "eq2sp_SensorRelationship_ss2sp"
+        } else if (graphCode == "ValveRelationship"&&type == "Vv2Eq") {
+            /** 阀门限制设备关系 */
+            return "eq2eq_ValveRelationship_vv2eq"
+        } else if (graphCode == "ValveRelationship"&&type == "Vv2Sy") {
+            /** 阀门限制系统关系 */
+            return "eq2sy_ValveRelationship_vv2sy"
+        } else {
+            return ""
+        }
+    }
+
+
+
+
+
+
 
 
 }

+ 252 - 9
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelFromToControllers.kt

@@ -3,10 +3,18 @@ package com.persagy.server.syn.controllers.obj
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DictProject
-import com.persagy.server.datacenter.models.entities.rel.REq2Sp
+import com.persagy.server.datacenter.models.entities.objects.Equipment
+import com.persagy.server.datacenter.models.entities.objects.Floor
+import com.persagy.server.datacenter.models.entities.objects.ZoneSpace
+import com.persagy.server.datacenter.models.entities.rel.*
 import com.persagy.server.syn.models.api.obj.EquipApi
 import com.persagy.service.SBaseService
+import com.persagy.service.SObjectService
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.responses.SBaseResponse
+import io.swagger.v3.oas.annotations.Operation
 import io.swagger.v3.oas.annotations.tags.Tag
+import org.springframework.web.bind.annotation.PostMapping
 import org.springframework.web.bind.annotation.RequestMapping
 import org.springframework.web.bind.annotation.RestController
 
@@ -20,23 +28,258 @@ class RelFromToControllers {
 
     /** 字典项目服务 */
     private val dictProjectService = SBaseService(SMybatisDao(DictProject::class.java))
+    /** 设备和空间关系 */
     private val rEq2SpService = SBaseService(SMybatisDao(REq2Sp::class.java))
+    /** 空间对象服务 */
+    private val zoneSpaceService = SBaseService(SMybatisDao(ZoneSpace::class.java))
+    /** 系统下的设备设施 */
+    val rSyEqService = SBaseService(SMybatisDao(RSyEq::class.java))
+    /** 设备和设备关系 */
+    val rEq2EqService = SBaseService(SMybatisDao(REq2Eq::class.java))
+    /** 设备服务楼层 */
+    private val rEqForFlService = SBaseService(SMybatisDao(REqForFl::class.java))
+    /** 设备服务建筑 */
+    private val rEqForBdService = SBaseService(SMybatisDao(REqForBd::class.java))
+    /** 设备服务于竖井 */
+    private val rEqForShService = SBaseService(SMybatisDao(REqForSh::class.java))
+    /** 设备所在竖井 */
+    private val rEqInShService = SBaseService(SMybatisDao(REqInSh::class.java))
+    /** 数据中心系统所在竖井关系 */
+    private val syInShService = SObjectService(SMybatisDao(RSyInSh::class.java))
+    /** 数据中心系统服务于竖井关系 */
+    private val rSyForShService = SObjectService(SMybatisDao(RSyForSh::class.java))
+    /** 数据中心竖井下的业务空间关系 */
+    private val rSh2SpService = SObjectService(SMybatisDao(RSh2Sp::class.java))
+    /** 数据中心建筑下的竖井关系 */
+    private val rShInBdService = SObjectService(SMybatisDao(RShInBd::class.java))
+    /** 数据中心系统所在楼层关系 */
+    private val rSyInFlService = SObjectService(SMybatisDao(RSyInFl::class.java))
+    /** 数据中心系统服务于楼层关系 */
+    private val rSyForFlService = SObjectService(SMybatisDao(RSyForFl::class.java))
+    /** 数据中心系统所在的建筑体关系 */
+    private val rSyInBdService = SObjectService(SMybatisDao(RSyInBd::class.java))
+    /** 数据中心系统服务于楼层关系 */
+    private val rSyForBdService = SObjectService(SMybatisDao(RSyForBd::class.java))
+    /** 数据中心楼层下的业务空间关系 */
+    private val rSpinFlService = SObjectService(SMybatisDao(RSpinFl::class.java))
+    /** 数据中心建筑体下的业务空间关系 */
+    private val rSpinBdService = SObjectService(SMybatisDao(RSpinBd::class.java))
+    /** 数据中心系统和空间关系 */
+    private val rSy2SpService = SObjectService(SMybatisDao(RSy2Sp::class.java))
+    /** 数据中心竖井贯通关系 */
+    private val rShaftThroughShaftService = SObjectService(SMybatisDao(RShaftThroughShaft::class.java))
+    /** 数据中心楼层贯通关系 */
+    private val rFlThroughFlService = SObjectService(SMybatisDao(RFlThroughFl::class.java))
+    /** 空间和空间的关系 */
+    private val rSp2SpService = SObjectService(SMybatisDao(RSp2Sp::class.java))
+    /** 数据中心设备服务 */
+    private val equipmentService = SObjectService(SMybatisDao(Equipment::class.java))
+    /** 数据中心楼层服务 */
+    private val floorService = SObjectService(SMybatisDao(Floor::class.java))
+
     /**
      * 设备所在的业务空间
      */
-    fun eq2SpIn(projectId: String){
-        val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
-        if (dictProject!=null) {
-            val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "", "")
-            if (!relList.isNullOrEmpty()){
-                for ( rel in relList){
-                    val fromId = rel["objFrom"].toString()
-                    val toId = rel["objTo"].toString()
+    @Operation(summary= "设备所在的业务空间-同步到数据中心", description = "")
+    @PostMapping("/eq2spIn")
+    fun eq2SpIn(projectId: String): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (dictProject!=null) {
+                val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "MechInArch", "Eq2Sp")
+                if (!relList.isNullOrEmpty()){
+                    for ( rel in relList) {
+                        try {
+                            val fromId = rel["objFrom"].toString()
+                            val toId = rel["objTo"].toString()
+                            val rEq2Sp = REq2Sp()
+                            rEq2Sp.id1 = fromId
+                            rEq2Sp.id2 = toId
+                            rEq2Sp.projectId = projectId
+                            rEq2Sp.type = "eq2sp_in"
+                            val containsKey = rel.containsKey("relValue")
+                            if (containsKey) {
+                                rEq2Sp.zoneType = rel["relValue"].toString()
+                            } else {
+                                val zoneSpace = zoneSpaceService.select(
+                                    SFilter.eq("projectId", projectId),
+                                    SFilter.eq("id", rEq2Sp.id2!!)
+                                ).entity()
+                                if (zoneSpace!=null) {
+                                    rEq2Sp.zoneType = zoneSpace.classCode
+                                }
+                            }
+                            rEq2SpService.replace(rEq2Sp)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
+                        }
+                    }
                 }
             }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure)
         }
+    }
 
+    /**
+     * 系统下的设备设施
+     */
+    @Operation(summary= "系统下的设备设施-同步到数据中心", description = "")
+    @PostMapping("/sy2EqIn")
+    fun sy2EqIn(projectId: String): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (dictProject!=null) {
+                val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "MechSubset", "Sy2Eq")
+                if (!relList.isNullOrEmpty()){
+                    for ( rel in relList) {
+                        try {
+                            val fromId = rel["objFrom"].toString()
+                            val toId = rel["objTo"].toString()
+                            val rSyEq = RSyEq()
+                            rSyEq.sysId = fromId
+                            rSyEq.sysId = toId
+                            rSyEq.projectId = projectId
+                            rSyEq.graphCode = "MechSubset"
+                            rSyEqService.replace(rSyEq)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure)
+        }
+    }
 
+    /**
+     * 设备设施服务业务空间
+     */
+    @Operation(summary= "设备设施服务业务空间-同步到数据中心", description = "")
+    @PostMapping("/eq2SpFor")
+    fun eq2SpFor(projectId: String): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (dictProject!=null) {
+                val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "MechForArch", "Eq2Sp")
+                if (!relList.isNullOrEmpty()){
+                    for ( rel in relList) {
+                        try {
+                            val fromId = rel["objFrom"].toString()
+                            val toId = rel["objTo"].toString()
+                            val rEq2Sp = REq2Sp()
+                            rEq2Sp.id1 = fromId
+                            rEq2Sp.id2 = toId
+                            rEq2Sp.projectId = projectId
+                            rEq2Sp.type = "eq2sp_for"
+                            val containsKey = rel.containsKey("relValue")
+                            if (containsKey) {
+                                rEq2Sp.zoneType = rel["relValue"].toString()
+                            } else {
+                                val zoneSpace = zoneSpaceService.select(
+                                    SFilter.eq("projectId", projectId),
+                                    SFilter.eq("id", rEq2Sp.id2!!)
+                                ).entity()
+                                if (zoneSpace!=null) {
+                                    rEq2Sp.zoneType = zoneSpace.classCode
+                                }
+                            }
+                            rEq2SpService.replace(rEq2Sp)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure)
+        }
+    }
+
+    /**
+     * 建筑下的竖井
+     */
+    @Operation(summary= "建筑下的竖井-同步到数据中心", description = "")
+    @PostMapping("/bd2ShIn")
+    fun bd2ShIn(projectId: String): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (dictProject!=null) {
+                val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "ArchSubset", "Bd2Sh")
+                if (!relList.isNullOrEmpty()){
+                    for ( rel in relList) {
+                        try {
+                            val fromId = rel["objFrom"].toString()
+                            val toId = rel["objTo"].toString()
+                            val rShInBd = RShInBd()
+                            rShInBd.buildingId = fromId
+                            rShInBd.shaftId = toId
+                            rShInBd.projectId = projectId
+                            rShInBd.graphCode = "ArchSubset"
+                            rShInBdService.replace(rShInBd)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure)
+        }
+    }
+
+    /**
+     * 建筑下的业务空间
+     */
+    @Operation(summary= "建筑下的业务空间-同步到数据中心", description = "")
+    @PostMapping("/bd2SpIn")
+    fun bd2SpIn(projectId: String): SBaseResponse {
+        try {
+            val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            if (dictProject!=null) {
+                val relList = EquipApi.getRel(dictProject.groupCode!!, projectId, "ArchSubset", "Bd2Sp")
+                if (!relList.isNullOrEmpty()){
+                    for ( rel in relList) {
+                        try {
+                            val fromId = rel["objFrom"].toString()
+                            val toId = rel["objTo"].toString()
+                            val rSpinBd = RSpinBd()
+                            rSpinBd.buildingId = fromId
+                            rSpinBd.spaceId = toId
+                            rSpinBd.projectId = projectId
+                            val containsKey = rel.containsKey("relValue")
+                            if (containsKey) {
+                                rSpinBd.objectType = rel["relValue"].toString()
+                            } else {
+                                val zoneSpace = zoneSpaceService.select(
+                                    SFilter.eq("projectId", projectId),
+                                    SFilter.eq("id", rSpinBd.spaceId!!)
+                                ).entity()
+                                if (zoneSpace!=null) {
+                                    rSpinBd.objectType = zoneSpace.classCode
+                                }
+                            }
+                            rSpinBdService.replace(rSpinBd)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
+                        }
+                    }
+                }
+            }
+            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure)
+        }
     }
 
 

+ 23 - 31
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelToFromController.kt

@@ -131,7 +131,7 @@ class RelToFromController {
                 if (equipmentList.size>0) {
                     for (equipment in equipmentList) {
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.floorId!!)
+                                Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.floorId!!,null)
                         if (isDel) {
                             val toJsonObj = Configure.toJsonObj(graphCode, type, equipment.id!!, null)
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
@@ -151,7 +151,7 @@ class RelToFromController {
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                         }
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.floorId!!)
+                                Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.floorId!!,null)
                         val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                         if (!createRel){
                             logger.debug("设备服务楼层的关系失败:${toJsonObjArray.toJson()}")
@@ -185,7 +185,7 @@ class RelToFromController {
                 if (equipmentList.size>0) {
                     for (equipment in equipmentList) {
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.buildingId!!)
+                                Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.buildingId!!,null)
                         if (isDel) {
                             val toJsonObj = Configure.toJsonObj(graphCode, type, equipment.id!!, null)
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
@@ -205,7 +205,7 @@ class RelToFromController {
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                         }
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.buildingId!!)
+                                Configure.toJsonObjArray(graphCode, type, rEqForFl.equipId!!, rEqForFl.buildingId!!,null)
                         val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                         if (!createRel){
                             logger.debug("设备服务建筑的关系失败:${toJsonObjArray.toJson()}")
@@ -230,9 +230,7 @@ class RelToFromController {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
             val rSyEqList = rSyEqService.select(
-                    SFilter.eq("projectId", projectId),
-                    SFilter.eq("graphCode", graphCode),
-                    SFilter.eq("type", type)
+                    SFilter.eq("projectId", projectId)
             ).exec()
             if (rSyEqList.size>0){
                 for (rSyEq in rSyEqList){
@@ -241,7 +239,7 @@ class RelToFromController {
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =
-                            Configure.toJsonObjArray(graphCode, type, rSyEq.sysId!!, rSyEq.equipId!!)
+                            Configure.toJsonObjArray(graphCode, type, rSyEq.sysId!!, rSyEq.equipId!!,null)
                     val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("系统下的设备关系失败:${toJsonObjArray.toJson()}")
@@ -273,7 +271,7 @@ class RelToFromController {
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                         }
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, rEqInSh.equipId!!, rEqInSh.shaftId!!)
+                                Configure.toJsonObjArray(graphCode, type, rEqInSh.equipId!!, rEqInSh.shaftId!!,null)
                         val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                         if (!createRel){
                             logger.debug("设备所在竖井关系失败:${toJsonObjArray.toJson()}")
@@ -313,9 +311,7 @@ class RelToFromController {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
             val rEq2SpList = rEq2SpService.select(
-                    SFilter.eq("projectId", projectId),
-                    SFilter.eq("graphCode", graphCode),
-                    SFilter.eq("type", type)
+                    SFilter.eq("projectId", projectId)
             ).exec()
             if (rEq2SpList.size>0) {
                 for (rEq2Sp in rEq2SpList) {
@@ -324,7 +320,7 @@ class RelToFromController {
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =
-                            Configure.toJsonObjArray(graphCode, type, rEq2Sp.id1!!, rEq2Sp.id2!!)
+                            Configure.toJsonObjArray(graphCode, type, rEq2Sp.id1!!, rEq2Sp.id2!!,rEq2Sp.zoneType)
                     val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("设备和空间关系失败:${toJsonObjArray.toJson()}")
@@ -439,7 +435,7 @@ class RelToFromController {
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =
-                            Configure.toJsonObjArray(graphCode, type, rSh2Sp.id1!!, rSh2Sp.id2!!)
+                            Configure.toJsonObjArray(graphCode, type, rSh2Sp.id1!!, rSh2Sp.id2!!,rSh2Sp.zoneType)
                     val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("竖井下的业务空间:${toJsonObjArray.toJson()}")
@@ -757,7 +753,7 @@ class RelToFromController {
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                         }
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!)
+                                Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!,rSy2Sp.zoneType)
                         val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                         if (!createRel){
                             logger.debug("系统所在业务空间:${toJsonObjArray.toJson()}")
@@ -776,7 +772,7 @@ class RelToFromController {
                             EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                         }
                         val toJsonObjArray =
-                                Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!)
+                                Configure.toJsonObjArray(graphCode, type, rSy2Sp.id1!!, rSy2Sp.id2!!,rSy2Sp.zoneType)
                         val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                         if (!createRel){
                             logger.debug("系统服务于业务空间:${toJsonObjArray.toJson()}")
@@ -799,9 +795,12 @@ class RelToFromController {
     fun sp2sp(projectId: String,graphCode: String,type: String,isDel: Boolean = false): SBaseResponse {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
-            val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", projectId),
-                    SFilter.eq("graphCode", graphCode),
-                    SFilter.eq("type", type)).exec()
+            val relContrast = Configure.relContrast(graphCode, type)
+            if (relContrast.isNullOrEmpty()){
+                return SBaseResponse(SResponseType.failure)
+            }
+
+            val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", projectId), SFilter.eq("type",relContrast)).exec()
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     if (isDel) {
@@ -831,9 +830,12 @@ class RelToFromController {
     fun eq2eq(projectId: String,graphCode: String,type: String,isDel: Boolean = false) : SBaseResponse {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
+            val relContrastEq = Configure.relContrastEq(graphCode, type)
+            if (relContrastEq.isNullOrEmpty()){
+                return SBaseResponse(SResponseType.failure)
+            }
             val rEq2EqList = rEq2EqService.select(SFilter.eq("projectId", projectId),
-                    SFilter.eq("graphCode", graphCode),
-                    SFilter.eq("type", type)).exec()
+                    SFilter.eq("type", relContrastEq)).exec()
             if (rEq2EqList.size>0) {
                 for (rEq2Eq in rEq2EqList) {
                     if (isDel) {
@@ -855,14 +857,4 @@ class RelToFromController {
         }
     }
 
-    /**
-     * 所有关系同步到数据中台
-     */
-    @Operation(summary= "所有关系-同步到中台", description = "")
-    @PostMapping("/all/rel")
-    fun allRel(projectId: String,graphCode: String,type: String,isDel: Boolean = false) {
-
-
-    }
-
 }

+ 90 - 3
datasyn/src/main/kotlin/com/persagy/server/syn/jms/DataCenterSync.kt

@@ -2,12 +2,14 @@ package com.persagy.server.syn.jms
 
 import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
+import com.persagy.base.extensions.toJson
 import com.persagy.server.datacenter.models.jms.SynchronousMessage
 import com.persagy.server.datacenter.models.jms.SynchronousMessageRel
 import com.persagy.server.syn.Configure
 import com.persagy.server.syn.services.jms.*
 import com.persagy.server.syn.services.jms.rel.AutomaticCalculationSync
 import com.persagy.server.syn.services.jms.rel.EquipinSpaceSync
+import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 
@@ -19,6 +21,11 @@ import org.springframework.stereotype.Service
  */
 @Service
 class DataCenterSync {
+
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(DataCenterSync::class.java)
+    } // Companion object
     /** 建筑 */
     @Autowired
     lateinit var dataCenterBuilding: DataCenterBuilding
@@ -104,8 +111,10 @@ class DataCenterSync {
         val type = object : TypeToken<ArrayList<String>>() {
         }.type
         for (message in messageList){
+            logger.debug("消息类型 = ${message.type}")
             when(message.type){
                 "EquipinSpace" -> {
+                    logger.debug("消息01 = ${message.toJson()}")
                     /** 设备所在的空间  */
                     when(message.ops){
 
@@ -116,20 +125,20 @@ class DataCenterSync {
                             equipInSpaceSync.delRel(message,"MechInArch","Eq2Sp")
                         }
                         "13" -> { // 清除之前的关系,替换
-
                             if (message.fromId!!.startsWith("Eq")){
                                 var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
                                 equipInSpaceSync.addRelSuperposition(message,ids,"MechInArch","Eq2Sp")
 
-                            } else if (message.fromId!!.startsWith("Sq")) {
+                            } else if (message.fromId!!.startsWith("Sp")) {
                                 var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
 
                                 equipInSpaceSync.addRelSuperpositionFan(message,ids,"MechInArch","Eq2Sp")
                             }
                         }
                         "14" -> {  // 添加不替换
-                            if (message.fromId!!.startsWith("Sq")) {
+                            if (message.fromId!!.startsWith("Sp")) {
                                 var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                logger.debug("id= ${ids.toJson()}**************************")
                                 equipInSpaceSync.equipInSpaceCreate(message,"MechInArch","Eq2Sp",ids)
                             }
                         }
@@ -145,6 +154,28 @@ class DataCenterSync {
                         "12" -> { // 删除关系
                             equipInSpaceSync.delRel(message, "MechSubset", "Sy2Eq")
                         }
+                        "13" ->{
+                            if (message.fromId!!.startsWith("Eq")){
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.addRelSuperposition(message,ids,"MechSubset","Sy2Eq")
+
+                            } else if (message.fromId!!.startsWith("Sy")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+
+                                equipInSpaceSync.addRelSuperpositionFan(message,ids,"MechSubset","Sy2Eq")
+                            }
+
+                        }
+                        "14" ->{
+                            if (message.fromId!!.startsWith("Sy")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                logger.debug("id= ${ids.toJson()}**************************")
+                                equipInSpaceSync.equipInSpaceCreate(message,"MechSubset","Sy2Eq",ids)
+                            }
+                        }
+
+
+
                     }
                 }
                 "Sy2Sh" -> {
@@ -157,6 +188,25 @@ class DataCenterSync {
                         "12" -> { // 删除关系
                             equipInSpaceSync.delRel(message, "MechInArch", "Sy2Sh")
                         }
+                        "13" ->{
+                            if (message.fromId!!.startsWith("Sy")){
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.addRelSuperposition(message,ids,"MechInArch","Sy2Sh")
+
+                            } else if (message.fromId!!.startsWith("Sh")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+
+                                equipInSpaceSync.addRelSuperpositionFan(message,ids,"MechInArch","Sy2Sh")
+                            }
+
+                        }
+                        "14" ->{
+                            if (message.fromId!!.startsWith("Sy")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.equipInSpaceCreate(message,"MechInArch","Sy2Sh",ids)
+                            }
+                        }
+
                     }
                 }
                 "Sy2Sp" -> {
@@ -169,6 +219,24 @@ class DataCenterSync {
                         "12" -> { // 删除关系
                             equipInSpaceSync.delRel(message, "MechInArch", "Sy2Sp")
                         }
+                        "13" ->{
+                            if (message.fromId!!.startsWith("Sy")){
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.addRelSuperposition(message,ids,"MechInArch","Sy2Sp")
+
+                            } else if (message.fromId!!.startsWith("Sp")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+
+                                equipInSpaceSync.addRelSuperpositionFan(message,ids,"MechInArch","Sy2Sp")
+                            }
+
+                        }
+                        "14" ->{
+                            if (message.fromId!!.startsWith("Sy")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.equipInSpaceCreate(message,"MechInArch","Sy2Sp",ids)
+                            }
+                        }
                     }
                 }
                 "Eq2Bd" -> {
@@ -217,6 +285,25 @@ class DataCenterSync {
                         "12" -> { // 删除关系
                             equipInSpaceSync.delRel(message, "MechForArch", "Eq2Sp")
                         }
+                        "13" -> { // 清除之前的关系,替换
+                            if (message.fromId!!.startsWith("Eq")){
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                equipInSpaceSync.addRelSuperposition(message,ids,"MechForArch","Eq2Sp")
+
+                            } else if (message.fromId!!.startsWith("Sp")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+
+                                equipInSpaceSync.addRelSuperpositionFan(message,ids,"MechForArch","Eq2Sp")
+                            }
+                        }
+                        "14" -> {  // 添加不替换
+                            if (message.fromId!!.startsWith("Sp")) {
+                                var ids=  Gson().fromJson<ArrayList<String>>(message.toId,type)
+                                logger.debug("id= ${ids.toJson()}**************************")
+                                equipInSpaceSync.equipInSpaceCreate(message,"MechForArch","Eq2Sp",ids)
+                            }
+                        }
+
                     }
                 }
                 "EquipinShaft" -> {

+ 2 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt

@@ -202,6 +202,8 @@ object EquipApi {
      */
     fun createRel(groupCode: String, projectId: String, jsonArray:JSONArray): Boolean {
         val url = "${opts.dataPlatform}/rwd/instance/relation/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
+        logger.debug("url = ${url}")
+        logger.debug("boby= ${jsonArray.toJson()}")
         val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonArray)
         if (postObject.result == "success") {
             return true

+ 81 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/rel/AutomaticCalculationSync.kt

@@ -376,11 +376,20 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("MechInArch", "Sy2Sh", rSyInSh.sysId!!, rSyInSh.shaftId!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
+
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -391,6 +400,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSy2SpList = rSy2SpService.select(SFilter.eq("projectId", message.projectId!!)).exec()
+            message.sign = 0
             if (rSy2SpList.size>0) {
                 for (rSy2Sp in rSy2SpList) {
                     try {
@@ -401,11 +411,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("MechInArch", "Sy2Sp", rSy2Sp.id1!!, rSy2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -417,6 +435,7 @@ class AutomaticCalculationSync {
         if (dictProject!=null) {
             val rEq2SpList = rEq2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "eq2sp_for"),SFilter.inList("zoneType",
                 arrayListOf("GeneralZone","AirConditioningZone"))).exec()
+            message.sign = 0
             if (rEq2SpList.size>0) {
                 for (rEq2Sp in rEq2SpList) {
                     try {
@@ -427,11 +446,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("MechForArch", "Eq2Sp", rEq2Sp.id1!!, rEq2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -442,6 +469,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sp_ConvectionNetwork_1")).exec()
+            message.sign = 0
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     try {
@@ -452,11 +480,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("ConvectionNetwork", "Natural", rSp2Sp.id1!!, rSp2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -467,6 +503,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sp_SpaceNeighborhood_5")).exec()
+            message.sign = 0
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     try {
@@ -477,11 +514,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("ThroughRelationship", "Connect", rSp2Sp.id1!!, rSp2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -492,6 +537,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sp_RadiationNetwork_1")).exec()
+            message.sign = 0
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     try {
@@ -502,11 +548,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("RadiationNetwork", "Connect", rSp2Sp.id1!!, rSp2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -517,6 +571,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSp2SpList = rSp2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "sp2sp_TrafficNetwork_1")).exec()
+            message.sign = 0
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     try {
@@ -527,11 +582,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("TrafficNetwork", "Normal", rSp2Sp.id1!!, rSp2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 
@@ -542,6 +605,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rSp2SpList = rEq2EqService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "eq2eq_SensorRelationship_ss2eq")).exec()
+            message.sign = 0
             if (rSp2SpList.size>0) {
                 for (rSp2Sp in rSp2SpList) {
                     try {
@@ -552,11 +616,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("TrafficNetwork", "Normal", rSp2Sp.id1!!, rSp2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
     /**
@@ -566,6 +638,7 @@ class AutomaticCalculationSync {
         val dictProject = dictProjectService.select(SFilter.eq("id", message.projectId!!)).entity()
         if (dictProject!=null) {
             val rEq2SpList = rEq2SpService.select(SFilter.eq("projectId", message.projectId!!),SFilter.eq("type", "eq2sp_SensorRelationship_ss2sp")).exec()
+            message.sign = 0
             if (rEq2SpList.size>0) {
                 for (rEq2Sp in rEq2SpList) {
                     try {
@@ -576,11 +649,19 @@ class AutomaticCalculationSync {
                         val toJsonObjArray =
                             Configure.toJsonObjArray("SensorRelationship", "Ss2Sp", rEq2Sp.id1!!, rEq2Sp.id2!!)
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
+                        if (!createRel){
+                            message.sign = 2
+                            message.count +1
+                        }
                     } catch (e: Exception) {
                         e.printStackTrace()
+                        message.sign = 2
+                        message.count +1
                     }
                 }
             }
+            /** 更改标记 */
+            synchronousMessageRelService.update(message, arrayListOf("sign","count"))
         }
     }
 

+ 13 - 3
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/rel/EquipinSpaceSync.kt

@@ -1,5 +1,6 @@
 package com.persagy.server.syn.services.jms.rel
 
+import com.alibaba.fastjson.JSONArray
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DictProject
@@ -7,6 +8,7 @@ import com.persagy.server.datacenter.models.jms.SynchronousMessageRel
 import com.persagy.server.syn.Configure
 import com.persagy.server.syn.models.api.obj.EquipApi
 import com.persagy.service.SObjectService
+import org.slf4j.LoggerFactory
 import org.springframework.stereotype.Service
 
 /**
@@ -15,6 +17,11 @@ import org.springframework.stereotype.Service
 @Service
 class EquipinSpaceSync {
 
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(EquipinSpaceSync::class.java)
+    } // Companion object
+
     /** 缓存对象数据服务 - 数据中心到数据中台  */
     var synchronousMessageRelService = SObjectService(SMybatisDao(SynchronousMessageRel::class.java))
     /** 项目所属的集团 */
@@ -29,16 +36,19 @@ class EquipinSpaceSync {
      */
     fun equipInSpaceCreate(synchronousMessageRel: SynchronousMessageRel,graphCode: String,relCode: String,fromIds:ArrayList<String>?){
         try {
+
             val dictProject = dictProjectService.select(SFilter.eq("id", synchronousMessageRel.projectId!!)).entity()
             if (dictProject!=null) {
                 synchronousMessageRel.sign = 0
-                val toJsonObjArray = if (!fromIds.isNullOrEmpty()){
+                val toJsonObjArray :JSONArray
+                    if (!fromIds.isNullOrEmpty()){
                     /** 关系列表 */
-                    Configure.toJsonObjFromList(graphCode, relCode, fromIds, synchronousMessageRel.toId!!)
+                        toJsonObjArray= Configure.toJsonObjFromList(graphCode, relCode, fromIds, synchronousMessageRel.fromId!!)
                 } else {
                     /** 关系列表 */
-                    Configure.toJsonObjArray(graphCode, relCode, synchronousMessageRel.fromId!!, synchronousMessageRel.toId!!)
+                        toJsonObjArray = Configure.toJsonObjArray(graphCode, relCode, synchronousMessageRel.fromId!!, synchronousMessageRel.toId!!)
                 }
+
                 val createRel = EquipApi.createRel(dictProject.groupCode!!, synchronousMessageRel.projectId!!, toJsonObjArray)
                 if (!createRel ){
                     synchronousMessageRel.sign = 2

+ 2 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/task/SchedulerTaskRel.kt

@@ -52,8 +52,8 @@ class SchedulerTaskRel {
 
     //cron表达式:每隔5秒执行一次
 //    @Scheduled(cron = "0 */3 * * * ?")
-//    @Scheduled(cron="0/5 * *  * * ? ")   //每5秒执行一次
-    @Scheduled(cron = "0 */1 * * * ?")
+    @Scheduled(cron="0/5 * *  * * ? ")   //每5秒执行一次
+//    @Scheduled(cron = "0 */1 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始至数据中台-关系数据")
         messageProcessing.syncDataCenterRel()

+ 1 - 1
datasyn/src/main/resources/application-dev.yml

@@ -3,7 +3,7 @@ server:
 
 spring:
   datasource:
-#    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl?serverTimezone=UTC
+#    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
 #    username:                           postgres
 #    password:                           123qwe!@#
     url:                                jdbc:postgresql://39.102.40.239:5432/datacenter

+ 1 - 1
equip-component/src/main/kotlin/com/persagy/server/controllers/SpaceController.kt

@@ -97,7 +97,7 @@ class SpaceController {
      */
    @Operation(summary=" 空间内没有和空间关联的设备 根据坐标计算", description ="")
     @PostMapping(value = ["/unspace-fIn-eq-point"])
-    fun unSpaceInEqPoint(@RequestParam type: String, spaceId: String,@RequestBody request: SQueryRequest): SQueryResponse<Equipment> {
+    fun unSpaceInEqPoint(@RequestParam type: String, @RequestParam spaceId: String,@RequestBody request: SQueryRequest): SQueryResponse<Equipment> {
         return  EquipmentService.unSpaceInEqPoint(type,spaceId,request)
     } // Function unSpaceForEqPoint()
 

+ 1 - 1
equip-component/src/main/kotlin/com/persagy/server/service/objects/EquipmentService.kt

@@ -529,7 +529,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
             if (!buildingId.isNullOrEmpty()&&!floorId.isNullOrEmpty()){
                 val entity = rSpInFlService.select(SFilter.eq("buildingId", buildingId!!), SFilter.eq("floorId", floorId!!), SFilter.eq("spaceId", spaceId!!)).entity()
                 if (entity!=null){
-                    val space = zoneSpaceBaseTable.select(SFilter.eq("RoomID", spaceId)).entity()
+                    val space = zoneSpaceBaseTable.select(SFilter.eq("id", spaceId)).entity()
                     queryBuilder.tableName = "f_uneq_in_space_point('$projectId','$type','$spaceId','${buildingId}','${floorId}')"
 
                     val exec = queryBuilder.exec()

+ 2 - 2
equip-component/src/main/resources/application-dev.yml

@@ -14,8 +14,8 @@ server:
 
 spring:
   datasource:
-#    url:                                jdbc:postgresql://39.102.40.239:5432/datacenterlabsl
-    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
+    url:                                jdbc:postgresql://39.102.40.239:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj

+ 2 - 2
equip-component/src/main/resources/application-prod.yml

@@ -19,9 +19,9 @@ spring:
 #    url:                                jdbc:postgresql://data-center:5432/datacenter
 #    username:                           postgres
 #    password:                           123qwe!@#
-    url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
+#    url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
 #    url:                                jdbc:postgresql://172.17.11.228:5432/datacenterlabsl
-#    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
+    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj