Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

zhangweixin 4 gadi atpakaļ
vecāks
revīzija
9597545600
19 mainītis faili ar 1322 papildinājumiem un 7 dzēšanām
  1. 6 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/MLocation.kt
  2. 8 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/MPoint.kt
  3. 71 0
      datacenter/src/main/kotlin/com/persagy/server/controllers/TestController.kt
  4. 97 0
      datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/CalcSpecialController.kt
  5. 353 0
      datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/RelationCalcController.kt
  6. 19 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/ICalcSpecialMapper.kt
  7. 62 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/CalcSpecialService.kt
  8. 149 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt
  9. 37 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/BaseComponent.kt
  10. 105 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Connector.kt
  11. 102 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Door.kt
  12. 119 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Equipment.kt
  13. 22 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Parameter.kt
  14. 23 0
      datacenter/src/main/kotlin/com/persagy/server/models/entities/WindowDoorBase.kt
  15. 27 0
      datacenter/src/main/kotlin/com/persagy/server/models/object/TwicePoint.kt
  16. 11 0
      datacenter/src/main/kotlin/com/persagy/server/models/service/BaseDataService.kt
  17. 93 0
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CommonService.kt
  18. 10 7
      datacenter/src/main/resources/application-dev.yml
  19. 8 0
      datacenter/src/main/resources/logback-spring.xml

+ 6 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/MLocation.kt

@@ -26,6 +26,8 @@
 
 package com.persagy.server.datacenter.models.entities.graphtype
 
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonProperty
 import java.io.Serializable
 
 /**
@@ -34,8 +36,12 @@ import java.io.Serializable
 class MLocation : Serializable {
 
 
+    @JSONField(name = "Type")
+    @JsonProperty("Type")
     val type : String? = null
 
+    @JSONField(name = "Points")
+    @JsonProperty("Points")
     var points : ArrayList<MPoint>? = null
 
 }

+ 8 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/MPoint.kt

@@ -26,7 +26,9 @@
 
 package com.persagy.server.datacenter.models.entities.graphtype
 
+import com.alibaba.fastjson.annotation.JSONField
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
 
 /**
  *
@@ -34,10 +36,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
 @JsonIgnoreProperties(ignoreUnknown = true)
 class MPoint (x : Double, y : Double, z : Double){
 
+    @JSONField(name = "X")
+    @JsonProperty("X")
     var x : Double = x
 
+    @JSONField(name = "Y")
+    @JsonProperty("Y")
     var y : Double = y
 
+    @JSONField(name = "Z")
+    @JsonProperty("Z")
     var z : Double = z
 
     constructor() : this(0.0, 0.0 , 0.0)

+ 71 - 0
datacenter/src/main/kotlin/com/persagy/server/controllers/TestController.kt

@@ -0,0 +1,71 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.controllers
+
+import com.persagy.server.Opt
+import com.persagy.server.jms.TopicSender
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.tags.Tag
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+
+/**
+ * 测试消息
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2020/10/27 19:35
+ */
+@Tag(name = "0000、测试消息")
+@RestController
+@RequestMapping("/tests")
+class TestController {
+    companion object {
+        // 日志
+        private val logger = LoggerFactory.getLogger(TestController::class.java)
+    } // Companion object
+
+    @Autowired
+    lateinit var topicSender: TopicSender
+
+    /**
+     * 创建设备
+     *
+     * @param   request         设备对象
+     * @return                  创建结果信息
+     */
+    @Operation(summary = "测试消息", description = "")
+    @PostMapping(value = ["/test"])
+    fun create() {
+        logger.debug("projectId =${Opt.projectId}")
+        topicSender.sendMessage()
+    } // Function create()
+
+}

+ 97 - 0
datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/CalcSpecialController.kt

@@ -0,0 +1,97 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.controllers.relation_calc
+
+import com.persagy.server.services.relation_calc.CalcSpecialService
+import com.persagy.service.SPageContext
+import com.persagy.service.models.responses.SBaseResponse
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.tags.Tag
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 关系计算-管网
+ *
+ * @author 邓婷婷
+ */
+@Tag(name = "016、关系计算-管网接口")
+@RestController
+@RequestMapping("/calc_special")
+open class CalcSpecialController {
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(CalcSpecialController::class.java)
+    } // Companion object
+
+    @Autowired
+    lateinit var service: CalcSpecialService
+
+    /**
+     * 管网系统设备分块  +  计算流向
+     *
+     * @param   SystemName  需要计算的系统名称
+     * @param   Domain      需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac
+     */
+    @Operation(summary = "管网系统设备分块", description = "Domain 需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac;需要计算的building_id,如果没有提供时直接为空")
+    @PostMapping(value = ["/sys-block"])
+    fun sysBolck(@RequestParam relationType: String,@RequestParam buildingId: String): SBaseResponse{
+        return service.sysBolck(relationType,buildingId)
+    } // Function sysBolck()
+
+
+//    /**
+//     * 管网系统确定流向
+//     * @param   BlockId     需要计算的块id
+//     * @param   SystemName  需要计算的系统名称
+//     * @param   Domain      需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac
+//     * @param   isSource    跟据源或端计算:bool。true表示源,false表示端
+//     */
+//    @Operation(summary = "管网系统确定流向", description = "Domain 需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac;需要计算的building_id,如果没有提供时直接为空;isSource 跟据源或端计算 true表示源,false表示端")
+//    @PostMapping(value = ["/sys-direction"])
+//    fun sysDirection(BuildingId: String?, BlockId: String, SystemName: String,Domain: String, isSource: Boolean): SBaseResponse{
+//        return service.sysDirection(BuildingId, BlockId, SystemName, Domain, isSource)
+//    } // Function sysDirection()
+
+
+    /**
+     * @Description: 管网计算
+     * @Param:
+     * @Return:
+     */
+    @Operation(summary = "管网计算", description = "管网计算")
+    @PostMapping(value = ["/calcNetworks"])
+    fun calcNetworks(@RequestParam buildingId: String): SBaseResponse{
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcNetworks(projectId,buildingId)
+    } // Function sysBolck()
+
+} // Class CalcSpecialController

+ 353 - 0
datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/RelationCalcController.kt

@@ -0,0 +1,353 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.controllers.relation_calc
+
+import com.persagy.server.services.relation_calc.RelationCalcService
+import com.persagy.service.SPageContext
+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.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 关系计算
+ *
+ * @author  庞利祥 <sybotan@126.com>
+ */
+@Tag(name = "015、关系计算")
+@RestController
+@RequestMapping("/relation-calc")
+class RelationCalcController {
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(RelationCalcController::class.java)
+    } // Companion object
+    @Autowired
+    lateinit var service: RelationCalcService
+
+    /**
+     * 建筑下的业务空间
+     *
+     * @param  objectTypes  参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开
+     */
+    @Operation(summary = "建筑下的业务空间", description = "objectTypes 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone,FunctionZone,FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone")
+    @PostMapping(value = ["/bd2sp"])
+    fun calcBd2Sp(@RequestParam objectTypes: String?): SBaseResponse {
+        logger.debug("calcBd2Sp --------------")
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcBd2Sp(objectTypes,projectId)
+    } // Function calcBd2Sp()
+
+    /**
+     * 设备所在建筑
+     */
+    @Operation(summary = "设备所在建筑", description = "")
+    @PostMapping(value = ["/eq2bd"])
+    fun calcEq2Bd(@RequestParam relationType: String?): SBaseResponse {
+        logger.debug("calcEq2Bd --------------")
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcEq2Bd(projectId)
+    } // Function calcEq2Bd()
+
+    /**
+     * 设备所在楼层
+     */
+    @Operation(summary = "设备所在楼层", description = "")
+    @PostMapping(value = ["/eq2fl"])
+    fun calcEq2Fl(): SBaseResponse{
+        logger.debug("calcEq2Fl --------------")
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcEq2Fl(projectId)
+    } // Function calcEq2Fl()
+
+
+    /**
+     * 设备所在竖井
+     */
+    @Operation(summary = "设备所在竖井", description = "")
+    @PostMapping(value = ["/eq2sh"])
+    fun calcEq2Sh(): SBaseResponse {
+        logger.debug("calcEq2Sh --------------")
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcEq2Sh(projectId)
+    } // Function calcEq2Sh()
+
+    /**
+     * 设备所在业务空间
+     * @param   objectTypes tables 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone FunctionZone,FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone
+     * @param   sign        是否要删除手动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除自动计算的的关系)
+     */
+    @Operation(summary = "设备所在业务空间", description = "objectTypes 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone,  " +
+            "FunctionZone,FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone\n " +
+            "sign 是否要删除手动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除自动计算的的关系)")
+    @PostMapping(value = ["/eq2sp_in"])
+    fun calcEq2Sp(@RequestParam objectTypes: String?): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcEq2Sp --------------  $projectId")
+        return service.calcEq2Sp(objectTypes,projectId, false)
+    } // Function calcEq2Sp()
+
+    /**
+     * 楼层贯通关系
+     *
+     * @param   sign1   表示r_fl_through_fl表中要被删除的sign值
+     * @param   sign2   同上 与sign1是逻辑或的关系
+     */
+    @Operation(summary = "楼层贯通关系", description = "")
+    @PostMapping(value = ["/fl2fl"])
+    fun calcFl2Fl(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcFl2Fl --------------$projectId")
+        return service.calcFl2Fl(projectId)
+    } // Function calcFl2Fl()
+
+    /**
+     * 楼层下的业务空间
+     *
+     * @param  objectTypes  参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开
+     */
+    @Operation(summary = "楼层下的业务空间", description = "objectTypes 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone,FunctionZone,FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone")
+    @PostMapping(value = ["/fl2sp"])
+    fun calcFl2Sp(@RequestParam objectTypes: String?): SBaseResponse {
+        logger.debug("calcFl2Sp --------------")
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.calcFl2Sp(objectTypes,projectId)
+    } // Function calcFl2Sp()
+
+    /**
+     * 资产所在建筑
+     */
+    @Operation(summary = "资产所在建筑", description = "")
+    @PostMapping(value = ["/pe2bd"])
+    fun calcPe2Bd(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcPe2Bd --------------$projectId")
+        return service.calcPe2Bd(projectId)
+    } // Function calcPe2Bd()
+
+    /**
+     * 资产所在楼层
+     */
+    @Operation(summary = "资产所在楼层", description = "")
+    @PostMapping(value = ["/pe2fl"])
+    fun calcPe2Fl(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcPe2Fl --------------$projectId")
+        return service.calcPe2Fl(projectId)
+    } // Function calcPe2Fl()
+
+    /**
+     * 资产所在竖井
+     */
+    @Operation(summary = "资产所在竖井", description = "")
+    @PostMapping(value = ["/pe2sh"])
+    fun calcPe2Sh(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcPe2Sh --------------$projectId")
+        return service.calcPe2Sh(projectId)
+    } // Function property2Shaft()
+
+    /**
+     * 资产所在业务空间
+     */
+    @Operation(summary = "资产所在业务空间", description = "")
+    @PostMapping(value = ["/pe2sp"])
+    fun calcPe2Sp(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcPe2Sp --------------$projectId")
+        return service.calcPe2Sp(projectId)
+    } // Function calcPe2Sp()
+
+    /**
+     * 建筑下的竖井
+     */
+    @Operation(summary = "建筑下的竖井", description = "************************************************************")
+    @PostMapping(value = ["/sh2bd"])
+    fun calcSh2Bd(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSh2Bd --------------$projectId")
+        return service.calcSh2Bd(projectId)
+    } // Function calcSh2Bd()
+
+    /**
+     * 竖井贯通
+     */
+    @Operation(summary = "竖井贯通", description = "")
+    @PostMapping(value = ["/sh2sh"])
+    fun calcSh2Sh(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSh2Sh --------------$projectId")
+        return service.calcSh2Sh(projectId)
+    } // Function calcSh2Sh()
+
+    /**
+     * 建筑下的系统设备部件
+     */
+    @Operation(summary = "建筑下的系统设备部件", description = "")
+    @PostMapping(value = ["/syeq2bd"])
+    fun calcSyEq2Bd(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSyEq2Bd --------------$projectId")
+        return service.calcSyEq2Bd(projectId)
+    } // Function calcSyEq2Bd()
+
+    /**
+     * 系统所在建筑
+     */
+    @Operation(summary = "系统所在建筑", description = "")
+    @PostMapping(value = ["/sy2bd"])
+    fun calcSy2Bd(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Bd --------------$projectId")
+        return service.calcSy2Bd(projectId)
+    } // Function calcSy2Bd()
+
+    /**
+     * 系统所在楼层
+     */
+    @Operation(summary = "系统所在楼层", description = "")
+    @PostMapping(value = ["/sy2fl"])
+    fun calcSy2Fl(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Fl --------------$projectId")
+        return service.calcSy2Fl(projectId)
+    } // Function calcSy2Fl()
+
+    /**
+     * 系统所在竖井
+     */
+    @Operation(summary = "系统所在竖井", description = "")
+    @PostMapping(value = ["/sy2sh"])
+    fun calcSy2Sh(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Sh --------------$projectId")
+        return service.calcSy2Sh(projectId)
+    } // Function calcSy2Sh()
+
+    /**
+     * 系统所在业务空间
+     */
+    @Operation(summary = "系统所在业务空间", description = "")
+    @PostMapping(value = ["/sy2sp"])
+    fun calcSy2Sp(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Sp --------------$projectId")
+        return service.calcSy2Sp(projectId)
+    } // Function calcSy2Sp()
+
+    /**
+     * 空间普通交通
+     */
+    @Operation(summary = "空间普通交通", description = "")
+    @PostMapping(value = ["/sp2sp_TrafficNetwork_1"])
+    fun sp2spTrafficNetwork1(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.sp2spTransport(projectId)
+    } // Function sp2sp_TrafficNetwork_1()
+
+    /**
+     * 光照连通
+     */
+    @Operation(summary = "光照连通", description = "")
+    @PostMapping(value = ["/sp2sp_RadiationNetwork_1"])
+    fun sp2spRadiationNetwork1(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Sp --------------$projectId")
+        return service.sp2spLight(projectId)
+    } // Function sp2spRadiationNetwork1()
+
+    /**
+    * 空气自然对流
+    */
+    @Operation(summary = "空气自然对流", description = "")
+    @PostMapping(value = ["/sp2sp_ConvectionNetwork_1"])
+    fun sp2spConvectionNetwork1(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.sp2spConvection(projectId)
+    } // Fun
+
+    /**
+     * 空间连通
+     */
+    @Operation(summary = "空间连通", description = "")
+    @PostMapping(value = ["/sp2sp_SpaceNeighborhood_5"])
+    fun sp2spV2(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        return service.sp2spV2(projectId)
+    } // Fun
+
+    /**
+     * 传感器测量空间关系  SECT SETP SERH
+     */
+    @Operation(summary = "传感器测量空间关系", description = "")
+    @PostMapping(value = ["/eq2sp_SensorRelationship_ss2sp"])
+    fun ss2Sp(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSs2Sp --------------  $projectId")
+        return service.calcss2Sp(projectId)
+    }
+
+    /**
+     * 设备服务空间关系  空调风口(ATIO)、通风风口(VTIO)
+     */
+    @Operation(summary = "设备服务空间关系", description = "空调风口(ATIO)、通风风口(VTIO)")
+    @PostMapping(value = ["/eq2sp_for"])
+    fun eqForSp(@RequestParam objectTypes: String?): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcEq2Sp --------------  $projectId")
+        return service.calcEqForSp(objectTypes,projectId)
+    }
+
+    /**
+     * 关系变化时标记需要处理的计算
+     */
+    @Operation(summary = "标记需要计算关系", description = "")
+    @PostMapping(value = ["/sign"])
+    fun setMark(): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Sp --------------$projectId")
+        return service.setMarks(projectId)
+    } // Function calcSy2Sp()
+
+    /**
+     * 空间交通关系
+     */
+    @Operation(summary = "空间交通关系", description = "")
+    @PostMapping(value = ["/sp2sp"])
+    fun sp2spV3(@RequestParam buildingId: String,@RequestParam objectType: String,@RequestParam type: String): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcSy2Sp --------------$projectId")
+        return service.calcSp2Sp(projectId,buildingId,objectType,type)
+    } // Function calcSy2Sp()
+
+} // Class RelationCalcController

+ 19 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/ICalcSpecialMapper.kt

@@ -26,6 +26,7 @@
 
 package com.persagy.server.mappers
 
+import com.persagy.server.models.entities.Connector
 import org.apache.ibatis.annotations.Mapper
 import org.apache.ibatis.annotations.Select
 import org.springframework.stereotype.Repository
@@ -59,6 +60,24 @@ interface ICalcSpecialMapper {
     fun sysDirection(projectId: String, buildingId: String?, blockId: String, systemName: String,domain: String,isSource: Boolean): Boolean
 
 
+    /**
+     * @Description: 查询连接件并按指定顺序排序
+     * @Param: modelId 模型id
+     * @Return: List<Connector>
+     */
+    @Select(" SELECT * from revit.connector where model_id = #{modelId} order by case belong_type  " +
+            "when 'Equipment' then 1" +
+            "when 'EquipPart' then 2 " +
+            "when 'JoinObject' then 3 " +
+            "when 'Other' then 4 " +
+            "when 'Pipe' then 5 " +
+            "when 'FlexPipe' then 6" +
+            "when 'Duct' then 7 " +
+            "when 'FlexDuct' then 8 " +
+            "end asc")
+    fun connectorOrder(modelId:String): List<Connector>
+
+
 
 
 

+ 62 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/CalcSpecialService.kt

@@ -32,7 +32,11 @@ import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProje
 import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlock
 import com.persagy.server.datacenter.models.entities.rel.REq2Eq
 import com.persagy.server.mappers.ICalcSpecialMapper
+import com.persagy.server.models.entities.Connector
+import com.persagy.server.models.service.BaseDataService
 import com.persagy.server.services.assistant.RUpDateEquipAndSapceService
+import com.persagy.server.services.objects.EquipmentService
+import com.persagy.server.services.objects.FloorService
 import com.persagy.server.utils.IdUtils
 import com.persagy.service.SBaseService
 import com.persagy.service.SObjectService
@@ -245,4 +249,62 @@ open class CalcSpecialService {
         }
     } // Fun
 
+    /**
+     * @Description: 管网计算
+     * @Param:
+     * @Return:
+     */
+    fun calcNetworks(projectId: String,buildingId: String): SBaseResponse{
+        val floors = FloorService.select(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId)).exec()
+        val rEq2Eqs = ArrayList<REq2Eq>()
+        for (floor in floors) {
+            if(!floor.modelId.isNullOrEmpty()){
+                val connectors = mapper.connectorOrder(floor.modelId!!)
+                val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId), SFilter.eq("floorId",floor.id!!)).exec()
+                val dcEquipMap = HashMap<String,String>(1024)
+                for (equipment in dcEquipments) {
+                    dcEquipMap[equipment.bimId!!] = equipment.id!!
+                }
+
+
+                var currentConnector: Connector? = null
+                val map = HashMap<String,Connector>(100000)
+                for (connector in connectors) {
+                    map[connector.revitId!!] = connector
+                }
+                for (connector in connectors) {
+                    if(connector.isUsed == true){
+                        continue
+                    }
+                    currentConnector = connector
+                    val id1 = dcEquipMap[connector.belongBimId]
+                    if(id1 == null){
+                        continue
+                    }
+                    while(currentConnector!!.connectedIds!!.size == 1){
+                        val revitId = currentConnector!!.connectedIds?.get(0)
+                        currentConnector = map[revitId]!!
+                        if(currentConnector!!.belongType == "Equipment" && connector!!.belongType == "Equipment" && currentConnector != connector){
+
+                            val id2 = dcEquipMap[currentConnector.belongBimId]
+                            if(id2 != null){
+                                val rEq2Eq = REq2Eq()
+                                rEq2Eq.id1 = id1
+                                rEq2Eq.id2 = id2
+
+                            }
+
+
+
+                        }
+                        currentConnector.isUsed = true
+                    }
+                }
+            }
+
+        }
+        return SBaseResponse(SResponseType.failure, "e.message!!")
+
+    }
+
 } // Class CalcSpecialService

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

@@ -29,11 +29,25 @@ package com.persagy.server.services.relation_calc
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.datacenter.models.entities.graphtype.MPoint
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
+<<<<<<< HEAD:datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt
+import com.persagy.server.datacenter.models.entities.rel.REq2Sp
+import com.persagy.server.datacenter.models.entities.rel.RSp2Sp
+=======
+>>>>>>> 4f9446037d0c154f4028be83daa67ceef061bcfe:datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt
 import com.persagy.server.jms.RabbitMqService
 import com.persagy.server.mappers.IRelationCalcMapper
+import com.persagy.server.models.`object`.TwicePoint
+import com.persagy.server.models.service.BaseDataService
 import com.persagy.server.services.assistant.RUpDateEquipAndSapceService
+import com.persagy.server.services.base.RService
 import com.persagy.server.services.objects.EquipmentService
+<<<<<<< HEAD:datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt
+import com.persagy.server.services.objects.FloorService
+import com.persagy.server.services.objects.ZoneSpaceBaseService
+=======
+>>>>>>> 4f9446037d0c154f4028be83daa67ceef061bcfe:datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt
 import com.persagy.server.services.rel.REq2SpService
 import com.persagy.server.utils.IdUtils
 import com.persagy.service.SBaseService
@@ -1178,4 +1192,139 @@ open class RelationCalcService {
         }
     }
 
+
+    /**
+     * @Description: 空间交通关系
+     * @Param:
+     * @Return:
+     */
+    fun calcSp2Sp(projectId: String,buildingId: String,objectType: String,type: String):SBaseResponse{
+        val distance = 100.00
+        val floors = FloorService.select(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId)).exec()
+        val rSp2Sps =  ArrayList<RSp2Sp>()
+        for (floor in floors) {
+            if(!floor.modelId.isNullOrEmpty()){
+                val zoneSpaces = ZoneSpaceBaseService.select(SFilter.eq("projectId",projectId), SFilter.eq("floorId",floor.id!!), SFilter.eq("classCode",objectType)).exec()
+                val doors = BaseDataService.doorService.select(SFilter.eq("modelId",floor.modelId!!)).exec()
+                val pointList = ArrayList<TwicePoint>()
+
+                for (door in doors) {
+                    val outline = door.outline
+                    val point = door!!.location!!.points?.get(0)!!
+                    if(!outline.isNullOrEmpty()){
+                        val point1 = outline[0]!![0]
+                        val point2 = outline[0]!![1]
+                        val k = get_points(point1.x,point1.y,point2.x,point2.y)
+                        var twicePoint: TwicePoint
+                        if(k== null){
+                            twicePoint = TwicePoint(point.x,point.y+distance,point.x,point.y-distance)
+                        }else{
+//                            val distance = get_segment_distance(point1.x,point1.y,point2.x,point2.y)
+                            twicePoint = get_point_by_distance(point.x,point.y,k,distance*2)
+                        }
+                        pointList.add(twicePoint)
+                    }
+                }
+
+                val map = HashMap<Int,ArrayList<String>>()
+                for (index in 0 until pointList.size) {
+                    val mPoint1= MPoint(pointList[index].x1!!,pointList[index].y1!!,0.00)
+                    val mPoint2= MPoint(pointList[index].x2!!,pointList[index].y2!!,0.00)
+                    var isLocal1: Boolean
+                    var isLocal2: Boolean
+
+                    for (zoneSpace in zoneSpaces) {
+                        val zoneOutline = zoneSpace.outline
+                        if(zoneOutline.isNullOrEmpty()){
+                            continue
+                        }
+                        isLocal1 = CommonService.isPointInPolygonCheckWithJdkGeneralPath(mPoint1, zoneOutline?.get(0)?.get(0)!!)
+                        isLocal2 = CommonService.isPointInPolygonCheckWithJdkGeneralPath(mPoint2, zoneOutline?.get(0)?.get(0)!!)
+                        val spaceId = zoneSpace.id!!
+                        if(isLocal1 || isLocal2)
+                            if(map.containsKey(index)){
+                                val list = map[index]!!
+                                list.add(spaceId)
+                                map[index] = list
+                            }else{
+                                map[index] = arrayListOf(spaceId)
+                            }
+
+                    }
+
+                }
+                //map遍历
+                for (v in map.values) {
+
+                    val key = v[0] !!
+                    if(v.size > 1){
+                        for (index in  1 until v.size) {
+                            val rSp2SP = RSp2Sp()
+                            rSp2SP.id1 = key
+                            rSp2SP.id2 = v[index]
+                            rSp2SP.projectId = projectId
+                            rSp2SP.sign = 1
+                            rSp2SP.type = type
+                            rSp2SP.zoneType = objectType
+                            if(!rSp2Sps.contains(rSp2SP)){
+                                rSp2Sps.add(rSp2SP)
+                            }
+                        }
+                    }
+
+
+
+                }
+            }
+            val rSp2SpService = RService(SMybatisDao(RSp2Sp::class.java))
+            for (rSp2Sp in rSp2Sps) {
+                rSp2SpService.replace(rSp2Sp)
+            }
+        }
+        return SBaseResponse(SResponseType.success,"")
+    }
+
+
+    fun get_points(x1: Double, y1: Double , x2: Double, y2: Double): Double?{
+        if (x1 == y1 && x2 == y2){
+            return null
+        }
+        var k:Double? = null
+        // 计算当前线段的 k
+        if (x1 == x2){
+
+        }else{
+            k = (y2 - y1) / (x2 - x1)
+        }
+        var k2:Double?
+        //计算垂直方向的k
+        if (k == null){
+            k2 = 0.00
+        }else if(k == 0.00){
+            k2 = null
+        }else{
+            k2 = 1/k
+        }
+        return k2
+    }
+
+    //获取两点之间的距离
+    fun get_segment_distance(x1: Double, y1: Double , x2: Double, y2: Double): Double{
+        val x_diff = x2 - x1
+        val y_diff = y2 - y1
+        return Math.sqrt(x_diff * x_diff + y_diff * y_diff)
+    }
+
+    //获取坐标
+    fun  get_point_by_distance(base_x: Double, base_y: Double, k: Double, distance: Double): TwicePoint {
+        if(k == null){
+            return TwicePoint(base_x, base_y + distance, base_x, base_y - distance)
+        }
+        val vector_x1 = Math.sqrt(distance * distance / (1 + k * k))
+        val vector_x2 = -vector_x1
+        val vector_y1 = k * vector_x1
+        val vector_y2 = k * vector_x2
+        return TwicePoint(base_x + vector_x1,base_y + vector_y1,base_x + vector_x2,base_y + vector_y2)
+    }
+
 } // Class RelationCalcService

+ 37 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/BaseComponent.kt

@@ -0,0 +1,37 @@
+package cn.sagacloud.server.algorithm.models.entities
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.persagy.service.models.SBaseEntity
+import javax.persistence.Column
+import javax.persistence.Id
+
+/**
+ *
+ *
+ * @author jxing
+ */
+open class BaseComponent : SBaseEntity(){
+
+    /** 模型id */
+    @Column(name = "id", updatable = false)
+    @Id
+    var id: String? = null
+
+    /** 模型id(外键) */
+    @Column(name = "model_id")
+    var modelId: String? = null
+
+    @Column(name = "type")
+    var elementType : String? = null
+
+    @Column(name = "revit_id")
+    var revitId : String? = null
+
+    /** 对应Revit模型id */
+    @Column(name = "source_id")
+    var sourceId: String? = null
+
+    /** 模型所属楼层的id, 是uuid */
+    var modelFloorId: String? = null
+}

+ 105 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/Connector.kt

@@ -0,0 +1,105 @@
+package com.persagy.server.models.entities
+
+import cn.sagacloud.server.algorithm.models.entities.BaseComponent
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.persagy.server.datacenter.models.entities.graphtype.MPoint
+import javax.persistence.Column
+import javax.persistence.Table
+
+/**
+ *
+ *
+ * @author jxing
+ */
+@Table(name = "revit.connector")
+@JsonIgnoreProperties(ignoreUnknown = true)
+class Connector : BaseComponent(){
+
+    /** 所属对象的id */
+    @Column(name = "belong")
+    @JSONField(serialize = false)
+    var belong: String? = null
+
+    /** 所属对象的类型(pipe, duct, others, equipment, component) */
+    @Column(name = "belong_type")
+    @JSONField(serialize = false)
+    var belongType: String? = null
+
+    /** 名称 */
+    @Column(name = "name")
+    @JSONField(name = "name")
+    @JsonProperty("name")
+    var name: String? = null
+
+//    /** 对应Revit模型id */
+//    @ApiModelProperty(value = "对应Revit模型id")
+//    @Column(name = "source_id")
+//    @JSONField(name = "SourceId")
+//    @JsonProperty("SourceId")
+//    var sourceId: String? = null
+
+    /** 所属域 */
+    @Column(name = "domain")
+    @JSONField(name = "domain")
+    @JsonProperty("domain")
+    var domain: String? = null
+
+    /** 位置信息 */
+    @Column(name = "origin")
+    @JSONField(name = "origin")
+    @JsonProperty("origin")
+    var origin: MPoint? = null
+
+    /** 描述 */
+    @Column(name = "description")
+    @JSONField(name = "description")
+    @JsonProperty("description")
+    var description: String? = null
+
+    /** 是否连接其他连接件 */
+    @Column(name = "connected")
+    @JSONField(name = "isConnected")
+    @JsonProperty("isConnected")
+    var isConnected: Boolean? = null
+
+    /** 所属对象的revit_id */
+    @Column(name = "owner")
+    @JSONField(name = "owner")
+    @JsonProperty("owner")
+    var owner: String? = null
+
+    /** 连接的连接件id */
+    @Column(name = "connected_ids")
+    @JSONField(name = "connectedIds")
+    @JsonProperty("connectedIds")
+    var connectedIds: ArrayList<String>? = null
+
+    /** 管道系统类型名称 */
+    @Column(name = "mep_system_type")
+    @JSONField(name = "mepSystemTypeName")
+    @JsonProperty("mepSystemTypeName")
+    var mepSystemType: String? = null
+
+//    /** 连接件连接的连接件id */
+//    @ApiModelProperty(value = "连接件连接的连接件id")
+//    @Column(name = "connect_id")
+//    @JSONField(name = "ConnectId")
+//    @JsonProperty("ConnectId")
+//    var connectId: String? = null
+
+    /** 连接件连接的连接件id */
+    @Column(name = "connect_id_json")
+    @JSONField(name = "connectId")
+    @JsonProperty("connectId")
+    var connectIdJson: ArrayList<String>? = null
+
+    var isUsed: Boolean? = null
+
+    /** 所属BIMID */
+    @Column(name = "belong_bimid")
+    @JSONField(name = "belongBimId")
+    @JsonProperty("belongBimId")
+    var belongBimId: String? = null
+}

+ 102 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/Door.kt

@@ -0,0 +1,102 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package cn.sagacloud.server.algorithm.models.entities
+
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.persagy.server.datacenter.models.entities.graphtype.MLocation
+import com.persagy.server.datacenter.models.entities.graphtype.MPoint
+import javax.persistence.Column
+import javax.persistence.Table
+/**
+ * 门
+ *
+ * @author jxing
+ */
+@Table(name = "revit.door")
+@JsonIgnoreProperties(ignoreUnknown = true)
+class Door : WindowDoorBase() {
+
+    /** 名称 */
+    @Column(name = "name")
+    var name: String? = null
+
+
+    /** 定位点 */
+    @Column(name = "location")
+    var location: MLocation? = null
+
+    /** 轮廓线 */
+    @Column(name = "outline")
+    var outline: ArrayList<ArrayList<MPoint>>? = null
+
+    /** 面方向 */
+    @Column(name = "face_direction")
+    var faceDirection : MPoint? = null
+
+    /** Hand方向 */
+    @Column(name = "hand_direction")
+    var handDirection : MPoint? = null
+
+    /** 类型中文名称 */
+    @Column(name = "family_name")
+    var familyName: String? = null
+
+    /** 族符号 */
+    @Column(name = "family_symbol")
+    var familySymbol: String? = null
+
+
+    @Column(name = "thick")
+    var thick : Double? = null
+
+    // 以下是json解析字段
+
+//    @JSONField(name = "Owner")
+//    var jsonOwner : String? = null //
+//
+//    @JSONField(name = "Location")
+//    var jsonLocation : Location? = null //
+//
+//    @JSONField(name = "OutLine")
+//    var jsonOutline : ArrayList<ArrayList<Point>>? = null //
+//
+//    @JSONField(name = "SourceId")
+//    var jsonSourceId : String? = null //
+//
+//    @JSONField(name = "FaceDirection")
+//    var jsonFaceDirection : Point? = null //
+//
+//    @JSONField(name = "HandDirection")
+//    var jsonHandDirection : Point? = null //
+//
+//    @JSONField(name = "Thick")
+//    var jsonThick : Double? = null //
+//
+//    @JSONField(name = "Id")
+//    var jsonId : String? = null //
+//
+//    @JSONField(name = "ElementType")
+//    var jsonElementType : String? = null //
+//
+//    @JSONField(name = "Name")
+//    var jsonName: String? = null  //
+}

+ 119 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/Equipment.kt

@@ -0,0 +1,119 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.models.entities
+
+import cn.sagacloud.server.algorithm.models.entities.BaseComponent
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.persagy.server.datacenter.models.entities.graphtype.MLocation
+import com.persagy.server.datacenter.models.entities.graphtype.MPoint
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+/**
+ * 设备
+ *
+ * @author jxing
+ */
+@Table(name = "revit.equipment")
+@JsonIgnoreProperties(ignoreUnknown = true)
+class Equipment : BaseComponent(){
+
+    /** 名称 */
+
+    @Column(name = "name")
+    var name: String? = null
+
+    /** 补充信息 */
+
+    @Column(name = "tag")
+    var tag: String? = null
+
+    /** 本地编码 */
+
+    @Column(name = "local_id")
+    var localId: String? = null
+
+    /** 本地名称 */
+
+    @Column(name = "local_name")
+    var localName: String? = null
+
+    /** 4位部件类型编码 */
+
+    @Column(name = "family")
+    var family: String? = null
+    set(value) {
+        field = value?.trim()
+    }
+
+
+    /** 类型中文名称 */
+    @Column(name = "family_name")
+    var familyName: String? = null
+
+    /** 族符号 */
+    @Column(name = "family_symbol")
+    var familySymbol: String? = null
+
+    /** 定位点 */
+    @Column(name = "location")
+    var location: MLocation? = null
+
+    /** 设备轮廓 */
+    @Column(name = "outline")
+    var outline : ArrayList<ArrayList<MPoint>>? = null
+
+    /** 参数列表 */
+    @Column(name = "parameters")
+    var parameters: ArrayList<Parameter>? = null
+
+    /** 旋转角度 */
+    @Column(name = "rotation")
+    var rotation: Double? = null
+
+    /** 资产id */
+    @Column(name = "property_id")
+    var propertyId: String? = null
+
+    /** BIMID */
+    @Column(name = "bimid")
+    var bimId: String? = null
+
+
+    /** 万达BIMTypeID */
+    @Column(name = "bim_type_id")
+    var bimTypeID: String? = null
+
+    /** 系统分类 */
+    @Column(name = "sys_name")
+    var sysName: String? = null
+
+
+    /** 初始4位部件类型编码 */
+    @Column(name = "init_family")
+    var initFamily: String? = null
+
+    /** 转换后的信息点 */
+    @Column(name = "infos")
+    var infos: Map<String,String>? = null
+}

+ 22 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/Parameter.kt

@@ -0,0 +1,22 @@
+package com.persagy.server.models.entities
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ *
+ *
+ * @author jxing
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+class Parameter {
+
+    @JSONField(name = "Name")
+    @JsonProperty("Name")
+    var name : String? = null
+
+    @JSONField(name = "Value")
+    @JsonProperty("Value")
+    val value : String? = null
+}

+ 23 - 0
datacenter/src/main/kotlin/com/persagy/server/models/entities/WindowDoorBase.kt

@@ -0,0 +1,23 @@
+package cn.sagacloud.server.algorithm.models.entities
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonProperty
+import javax.persistence.Column
+
+/**
+ *
+ *
+ * @author jxing
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+open class WindowDoorBase : BaseComponent() {
+
+    /** 所属墙 */
+    @Column(name = "wall_id")
+    var wallId: String? = null
+
+    /** 拥有者的RevitId */
+    @Column(name = "owner")
+    var owner: String? = null
+}

+ 27 - 0
datacenter/src/main/kotlin/com/persagy/server/models/object/TwicePoint.kt

@@ -0,0 +1,27 @@
+package com.persagy.server.models.`object`
+
+/**
+ *
+ * @author  Cainga
+ * @date  2021/2/13 14:47
+ */
+open class TwicePoint(x1: Double,y1:Double,x2:Double,y2:Double) {
+
+
+
+    var x1: Double? = null
+
+    var x2: Double? = null
+
+    var y1: Double? = null
+
+    var y2: Double? = null
+
+    //init代码块中可以访问主构造方法中的变量
+    init {
+        this.x1=x1
+        this.y1=y1
+        this.x2 = x2
+        this.y2 = y2
+    }
+}

+ 11 - 0
datacenter/src/main/kotlin/com/persagy/server/models/service/BaseDataService.kt

@@ -0,0 +1,11 @@
+package com.persagy.server.models.service
+
+import cn.sagacloud.server.algorithm.models.entities.Door
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.models.entities.Connector
+import com.persagy.service.SObjectService
+
+object BaseDataService {
+    val doorService = SObjectService(SMybatisDao(Door::class.java))
+    val connectorService = SObjectService(SMybatisDao(Connector::class.java))
+}

+ 93 - 0
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CommonService.kt

@@ -0,0 +1,93 @@
+package com.persagy.server.services.relation_calc
+
+
+import com.persagy.server.datacenter.models.entities.assistant.PointPosition
+import com.persagy.server.datacenter.models.entities.graphtype.MPoint
+import org.springframework.util.DigestUtils
+import java.awt.geom.Area
+import java.awt.geom.GeneralPath
+import java.awt.geom.Point2D
+
+
+
+/**
+ *
+ *
+ * @author jxing
+ */
+object CommonService {
+
+
+    /**
+     * 获取MD5值
+     */
+    fun getMD5(btInput : ByteArray) : String {
+        return DigestUtils.md5DigestAsHex(btInput)
+    }
+
+    /**
+     * 获取文件服务器中的文件路径
+     */
+    fun getFilePathInFileService(uploadPath : String, modelId : String) : String{
+        return "${uploadPath}${modelId}.rvt"
+    }
+
+    /**
+     * 获取文件服务器中的key
+     */
+    fun getFileKeyInFileService(dir : String, modelId : String) : String{
+        return "${dir}/${modelId}.rvt"
+    }
+
+    /**
+     * 是否点在多边形内
+     */
+    fun isPointInPolygonCheckWithJdkGeneralPath(point: MPoint, polygon: ArrayList<PointPosition>): Boolean {
+        if(polygon.isEmpty())
+            return false
+        val p = getGeneralPath(polygon)
+        val newPoint = Point2D.Double()
+        newPoint.x = point.x
+        newPoint.y = point.y
+        return p.contains(newPoint)
+    }
+
+    /**
+     * 生成bimid前缀
+     */
+    fun generateBIMIDPrefix(projectId : String, folderId : String, floorName : String, hasColon : Boolean): String{
+        if(hasColon){
+            return "${projectId}${folderId}${floorName}:"
+        }
+        return "${projectId}${folderId}${floorName}"
+    }
+
+
+    /**
+     * 根据点数组获取围成的GeneralPath对象
+     */
+    fun getGeneralPath(polygon : ArrayList<PointPosition>) : GeneralPath{
+        val p = GeneralPath()
+        val first = polygon[0]
+        p.moveTo(first.x!!, first.y!!)
+        for (index in polygon.indices) {
+            if(index == 0)
+                continue
+            val tmpPoint = polygon[index]
+            p.lineTo(tmpPoint.x!!, tmpPoint.y!!)
+        }
+        p.lineTo(first.x!!, first.y!!)
+        p.closePath()
+        return p
+    }
+
+
+
+
+    /**
+     * 获取异常的堆栈信息
+     */
+    fun getStackTrace(e : Throwable): String? {
+        return org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e)
+    }
+}

+ 10 - 7
datacenter/src/main/resources/application-dev.yml

@@ -34,7 +34,10 @@ spring:
     type:                               com.alibaba.druid.pool.DruidDataSource
     driver-class-name:                  org.postgresql.Driver
 #    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
+<<<<<<< HEAD
+=======
 #    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
+>>>>>>> 4f9446037d0c154f4028be83daa67ceef061bcfe
     url:                                jdbc:postgresql://192.168.64.15:5432/datacenterwanda
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
@@ -46,13 +49,13 @@ spring:
       max-file-size:                   500MB        # 限制单个文件的最大值
 
     #配置rabbitMq 服务器
-#  rabbitmq:
-#    host: 39.102.43.179
-#    port: 9936
-#    username: admin
-#    password: brzj123456
-#    #虚拟host 可以不设置,使用 server 默认 host
-#    virtual-host: /test
+  rabbitmq:
+    host: 192.168.64.15
+    port: 9936
+    username: admin
+    password: brzj123456
+    #虚拟host 可以不设置,使用 server 默认 host
+    virtual-host: /test
 
 mqtopid: # 消息
   exchange:                           exchange-dmp

+ 8 - 0
datacenter/src/main/resources/logback-spring.xml

@@ -38,12 +38,20 @@
     </appender>
 
     <!-- 定义cn.sagacloud包的日志级别 -->
+<<<<<<< HEAD
+    <logger name="com.persagy" level="DEBUG" additivity="false">
+=======
     <logger name="com.persagy" level="debug" additivity="false">
+>>>>>>> 4f9446037d0c154f4028be83daa67ceef061bcfe
         <appender-ref ref="STDOUT"/>
     </logger>
 
     <!-- 定义com.persagy包的日志级别 -->
+<<<<<<< HEAD
+    <logger name="com.persagy" level="DEBUG" additivity="false">
+=======
     <logger name="com.persagy.server.datacenter" level="debug" additivity="false">
+>>>>>>> 4f9446037d0c154f4028be83daa67ceef061bcfe
         <appender-ref ref="STDOUT"/>
     </logger>