瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhangweixin 4 年之前
父節點
當前提交
cbdc99026b
共有 26 個文件被更改,包括 558 次插入141 次删除
  1. 1 1
      data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/block/ConnectedBlock.kt
  2. 2 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/block/ConnectedBlockFamilyItem.kt
  3. 1 1
      data-core/src/main/kotlin/com/persagy/server/datacenter/wanda/rel/REq2SyTwo.kt
  4. 2 2
      datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/ICalcSpecialMapper.kt
  5. 2 2
      datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/IRelationCalcMapper.kt
  6. 0 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/BaseComponent.kt
  7. 2 2
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Connector.kt
  8. 0 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/Door.kt
  9. 1 1
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Equipment.kt
  10. 1 1
      datacenter/src/main/kotlin/com/persagy/server/models/entities/Parameter.kt
  11. 0 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/WindowDoorBase.kt
  12. 2 2
      datacenter/src/main/kotlin/com/persagy/server/models/service/BaseDataService.kt
  13. 35 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/models/wrapperobj/ClassCodeEnum.kt
  14. 2 2
      datacenter/src/main/kotlin/com/persagy/server/models/object/NetWork.kt
  15. 1 1
      datacenter/src/main/kotlin/com/persagy/server/models/object/TwicePoint.kt
  16. 27 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/CommonObjectService.kt
  17. 172 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/RelStatisticService.kt
  18. 20 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/RelationType.kt
  19. 202 71
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/CalcSpecialService.kt
  20. 1 2
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CommonService.kt
  21. 1 1
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/MepSystemCalcService.kt
  22. 64 17
      datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt
  23. 4 4
      datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/obj/ProjectController.kt
  24. 12 0
      datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/relation/GraphicTypeController.kt
  25. 3 3
      datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/relation/RelationCalcController.kt
  26. 0 28
      datacenter/src/main/kotlin/com/persagy/server/models/object/ClassCodeEnum.kt

+ 1 - 1
data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/block/ConnectedBlock.kt

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-package com.persagy.server.datacenter.models.entities.graphtype.block
+package com.persagy.server.datacenter.datacenter.models.entities.graphtype.block
 
 import com.persagy.server.datacenter.models.entities.base.RBaseInfo
 import io.swagger.v3.oas.annotations.media.Schema

+ 2 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/datacenter/models/entities/graphtype/block/ConnectedBlockFamilyItem.kt

@@ -120,4 +120,6 @@ open class ConnectedBlockFamilyItem : RBaseInfo() {
     @Column(name = "is_source")
     var isSource: Boolean? = null
 
+
+
 }

+ 1 - 1
data-core/src/main/kotlin/com/persagy/server/datacenter/wanda/rel/REq2SyTwo.kt

@@ -38,7 +38,7 @@ import javax.persistence.Table
  * @author 张维新
  */
 @Schema(description = "设备系统关系")
-@Table(name = "relationship.r_sy2eq")
+@Table(name = "v_system_sy2eq")
 class REq2SyTwo : RBaseInfo(){
 
     /** 设备Id */

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

@@ -27,7 +27,7 @@
 package com.persagy.server.mappers
 
 import com.persagy.server.datacenter.utils.JsonTypeHandler
-import com.persagy.server.models.entities.Connector
+import com.persagy.server.datacenter.models.entities.Connector
 import org.apache.ibatis.annotations.Mapper
 import org.apache.ibatis.annotations.Result
 import org.apache.ibatis.annotations.Results
@@ -75,7 +75,7 @@ interface ICalcSpecialMapper {
             "when 'JoinObject' then 3 " +
             "when 'Other' then 4 " +
             "when 'Pipe' then 5 " +
-            "when 'FlexPipe' then 6" +
+            "when 'FlexPipe' then 6 " +
             "when 'Duct' then 7 " +
             "when 'FlexDuct' then 8 " +
             "end asc")

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/IRelationCalcMapper.kt

@@ -77,8 +77,8 @@ interface IRelationCalcMapper {
      *@param projectId 项目id
      */
     // @Select(" SELECT * from public.f_rel_eq2sp(#{tables},#{outTables},#{projectId},#{sign1},#{sign2}) ")
-    @Select("select public.f_rel_calc('rel_eq2sp', #{projectId}, 'zone_space_base','relationship.r_eq2sp', 2, 2)")
-    fun calcEq2Sp( projectId: String): Int?
+    @Select("select public.f_rel_calc('rel_eq2sp', #{projectId}, 'zone_space_base','relationship.r_eq2sp', 2, 2,#{graphCode})")
+    fun calcEq2Sp( projectId: String,graphCode: String): Int?
 
 //    /**
 //     * 删除关联业务空间

datacenter/src/main/kotlin/com/persagy/server/models/entities/BaseComponent.kt → datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/BaseComponent.kt


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

@@ -1,4 +1,4 @@
-package com.persagy.server.models.entities
+package com.persagy.server.datacenter.models.entities
 
 import cn.sagacloud.server.algorithm.models.entities.BaseComponent
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties
@@ -96,7 +96,7 @@ class Connector : BaseComponent(),Cloneable{
     var belongBimId: String? = null
 
     @Override
-    public override fun clone():Connector{
+    public override fun clone(): Connector {
         return super.clone() as Connector
     }
 

datacenter/src/main/kotlin/com/persagy/server/models/entities/Door.kt → datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/Door.kt


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

@@ -18,7 +18,7 @@
  * ********************************************************************************************************************
  */
 
-package com.persagy.server.models.entities
+package com.persagy.server.datacenter.models.entities
 
 import cn.sagacloud.server.algorithm.models.entities.BaseComponent
 import com.alibaba.fastjson.annotation.JSONField

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

@@ -1,4 +1,4 @@
-package com.persagy.server.models.entities
+package com.persagy.server.datacenter.models.entities
 
 import com.alibaba.fastjson.annotation.JSONField
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties

datacenter/src/main/kotlin/com/persagy/server/models/entities/WindowDoorBase.kt → datacenter/src/main/kotlin/com/persagy/server/datacenter/models/entities/WindowDoorBase.kt


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

@@ -1,8 +1,8 @@
-package com.persagy.server.models.service
+package com.persagy.server.datacenter.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.server.datacenter.models.entities.Connector
 import com.persagy.service.SObjectService
 
 object BaseDataService {

+ 35 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/models/wrapperobj/ClassCodeEnum.kt

@@ -0,0 +1,35 @@
+package com.persagy.server.datacenter.models.wrapperobj
+
+import java.util.*
+
+
+/**
+ *
+ * @author  Cainga
+ * @date  2021/2/24 10:32
+ */
+enum class ClassCodeEnum(val cname: String,val value: Int) {
+    ACVTIO("通风风口",0),
+    FFSCIO("排烟风口",0),
+    ACATIO("空调风口",0),
+    ACVTSF("通风风机",1),
+    ACATAH("空调机组",1),
+    ACATFU("新风机组",1);
+    companion object {
+        fun toSourceList(value: Int?): List<String> {
+            val list = ArrayList<String>() //Lists.newArrayList()其实和new ArrayList()几乎一模
+            //  一样, 唯一它帮你做的(其实是javac帮你做的), 就是自动推导(不是"倒")尖括号里的数据类型.
+            for (classCodeEnum in ClassCodeEnum.values()) {
+                if(value == null){
+                    list.add(classCodeEnum.name)
+                }else if(classCodeEnum.value == value){
+                        list.add(classCodeEnum.name)
+                }
+
+            }
+            return list
+        }
+    }
+
+
+}

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/models/object/NetWork.kt

@@ -1,4 +1,4 @@
-package com.persagy.server.models.`object`
+package com.persagy.server.datacenter.models.wrapperobj
 
 /**
  *
@@ -9,7 +9,7 @@ open class NetWork {
 
     var fullConnectors: HashSet<String>? = null
 
-    constructor(fullConnectors: HashSet<String>?, directConnectors: HashSet<String>?) {
+    constructor(fullConnectors: HashSet<String>?, directConnectors: HashSet<String>) {
         this.fullConnectors = fullConnectors
         this.directConnectors = directConnectors
     }

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

@@ -1,4 +1,4 @@
-package com.persagy.server.models.`object`
+package com.persagy.server.datacenter.models.wrapperobj
 
 /**
  *

+ 27 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/CommonObjectService.kt

@@ -0,0 +1,27 @@
+package com.persagy.server.datacenter.services.rel
+
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.datacenter.models.entities.dictnew.DefClass
+import com.persagy.server.datacenter.wanda.obj.Equipment
+import com.persagy.server.datacenter.wanda.obj.ZoneSpace
+import com.persagy.server.datacenter.wanda.rel.REq2Sp
+import com.persagy.server.datacenter.wanda.rel.REq2Sy
+import com.persagy.server.datacenter.wanda.rel.REq2SyTwo
+import com.persagy.server.datacenter.wanda.rel.RSp2Sp
+import com.persagy.service.SObjectService
+
+/**
+ *
+ * @author  Cainga
+ * @date  2021/3/3 15:42
+ */
+object CommonObjectService {
+
+    val rEq2SpService = SObjectService<REq2Sp>(SMybatisDao(REq2Sp::class.java))
+    val equipmentService = SObjectService<Equipment>(SMybatisDao(Equipment::class.java))
+    val dictClassService = SObjectService<DefClass>(SMybatisDao(DefClass::class.java))
+    val eq2SyService = SObjectService<REq2Sy>(SMybatisDao(REq2Sy::class.java))
+    val zoneSpaceService = SObjectService<ZoneSpace>(SMybatisDao(ZoneSpace::class.java))
+    val sp2SpService = SObjectService<RSp2Sp>(SMybatisDao(RSp2Sp::class.java))
+    val rEq2SyTwoService = SObjectService(SMybatisDao(REq2SyTwo::class.java))
+}

+ 172 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/RelStatisticService.kt

@@ -0,0 +1,172 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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.datacenter.services.rel
+
+import com.persagy.database.SFilter
+import com.persagy.server.datacenter.services.objects.EquipmentService
+import com.persagy.server.datacenter.wanda.obj.Equipment
+import com.persagy.server.mappers.ICalcSpaceMapper
+import com.persagy.service.SPageContext
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.responses.SQueryResponse
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+import java.util.stream.Collectors
+
+/**
+ * 关系统计
+ *
+ */
+@Service
+open class RelStatisticService {
+    /** 实例化 mapper 对象 */
+//    @Autowired
+//    lateinit var mapper: ICalcSpaceMapper
+    /**
+     * @Description: 查询关系相关的数据类型
+     * @Param:
+     * @Return:
+     */
+    fun relToType(zoneType: String?,graphCode: String,type: String,relType: String,status: Int): SQueryResponse<HashMap<String,String?>> {
+        val projectId = SPageContext.getHeader("ProjectId")
+        if(projectId == null){
+            return SQueryResponse(SResponseType.failure,"项目ID不能为空")
+        }
+        val results = ArrayList<HashMap<String,String?>>()
+        val defClasses  = CommonObjectService.dictClassService.select(SFilter.eq("type","group"), SFilter.eq("groupCode","WD")).exec()
+        val eqMap = HashMap<String,String>(512)
+//        val spMap = HashMap<String,String>()
+        for (defClass in defClasses) {
+//            if(defClass.objType == "equipment"){
+//                eqMap[defClass.code!!] = defClass.name!!
+//            }else if(defClass.objType == "space"){
+//                spMap[defClass.code!!] = defClass.name!!
+//            }
+            eqMap[defClass.code!!] = defClass.name!!
+        }
+        when (relType) {
+            RelationType.Eq2Bd -> {
+                val bdEquipments = CommonObjectService.equipmentService.select(SFilter.eq("projectId",projectId), SFilter.not(SFilter.isNull("buildingId"))).projection(listOf("classCode")).distinct().exec()
+                for (bdEquipment in bdEquipments) {
+                    val classCode = bdEquipment.classCode!!
+                    val item = HashMap<String,String?>()
+                    item["classCode"] = classCode
+                    item["className"] = eqMap[classCode]
+                    results.add(item)
+                }
+            }
+            RelationType.Eq2Fl -> {
+                val flEquipments = CommonObjectService.equipmentService.select(SFilter.eq("projectId",projectId), SFilter.not(SFilter.isNull("floorId"))).projection(listOf("classCode")).distinct().exec()
+                for (flEquipment in flEquipments) {
+                    val classCode = flEquipment.classCode!!
+                    val item = HashMap<String,String?>()
+                    item["classCode"] = classCode
+                    item["className"] = eqMap[classCode]
+                    results.add(item)
+                }
+
+            }
+            RelationType.Eq2Sp -> {
+                val rEq2Sps = CommonObjectService.rEq2SpService.select(SFilter.eq("projectId",projectId),SFilter.eq("type",type), SFilter.eq("graphCode",graphCode), SFilter.eq("zoneType",zoneType!!)).exec()
+                val equipIds = rEq2Sps.stream().map { r -> r.id1!! }.collect(Collectors.toList())
+                if(equipIds.size > 0){
+                    val equipments = EquipmentService.select(SFilter.eq("projectId",projectId), SFilter.inList("id",equipIds)).exec()
+                    for (equipment in equipments) {
+                        val classCode = equipment.classCode!!
+                        val item = HashMap<String,String?>()
+                        item["classCode"] = classCode
+                        item["className"] = eqMap[classCode]
+                        results.add(item)
+                    }
+                }
+
+            }
+            RelationType.Sy2Eq -> {
+                val rEq2Sys = CommonObjectService.rEq2SyTwoService.select(SFilter.eq("projectId",projectId)).exec()
+                if(status == 1){
+                    for (rEq2Sy in rEq2Sys) {
+                        val classCode = rEq2Sy.classCode1!!
+                        val item = HashMap<String,String?>()
+                        item["classCode"] = classCode
+                        item["className"] = eqMap[classCode]
+                        results.add(item)
+                    }
+                }else if(status == 2){
+                    for (rEq2Sy in rEq2Sys) {
+                        val classCode = rEq2Sy.classCode2!!
+                        val item = HashMap<String,String?>()
+                        item["classCode"] = classCode
+                        item["className"] = eqMap[classCode]
+                        results.add(item)
+                    }
+
+
+                }
+
+
+            }
+            RelationType.Sp2Bd -> {
+                val bdZoneSpaces = CommonObjectService.zoneSpaceService.select(SFilter.eq("projectId",projectId), SFilter.not(SFilter.isNull("buildingId"))).projection(listOf("classCode")).distinct().exec()
+                for (bdZoneSpace in bdZoneSpaces) {
+                    val classCode = bdZoneSpace.classCode!!
+                    val item = HashMap<String,String?>()
+                    item["classCode"] = classCode
+                    item["className"] = eqMap[classCode]
+                    results.add(item)
+                }
+            }
+            RelationType.Sp2Fl -> {
+                val flZoneSpaces = CommonObjectService.zoneSpaceService.select(SFilter.eq("projectId",projectId), SFilter.not(SFilter.isNull("floorId"))).projection(listOf("classCode")).distinct().exec()
+                for(flZoneSpace in flZoneSpaces){
+                    val classCode = flZoneSpace.classCode!!
+                    val item = HashMap<String,String?>()
+                    item["classCode"] = classCode
+                    item["className"] = eqMap[classCode]
+                    results.add(item)
+                }
+            }
+            RelationType.Sp2Sp -> {
+                val rSp2Sps = CommonObjectService.sp2SpService.select(SFilter.eq("projectId",projectId),SFilter.eq("type",type), SFilter.eq("graphCode",graphCode)).projection(listOf("zoneType")).distinct().exec()
+                for(rSp2Sp in rSp2Sps){
+                    val classCode = rSp2Sp.zoneType!!
+                    val item = HashMap<String,String?>()
+                    item["classCode"] = classCode
+                    item["className"] = eqMap[classCode]
+                    results.add(item)
+                }
+
+            }
+
+        }
+        val response = SQueryResponse<HashMap<String,String?>>()
+        response.content = results
+        return response
+        
+    }
+
+
+} // Class CalcSpaceService

+ 20 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/rel/RelationType.kt

@@ -0,0 +1,20 @@
+package com.persagy.server.datacenter.services.rel
+
+/**
+ *
+ * @author  Cainga
+ * @date  2021/3/3 18:14
+ */
+interface RelationType {
+
+    companion object {
+        const val Eq2Bd: String = "eq2bd"
+        const val Eq2Fl: String = "eq2fl"
+        const val Eq2Sp: String = "eq2sp"
+        const val Sy2Eq: String = "sy2eq"
+        const val Sp2Bd: String = "sp2bd"
+        const val Sp2Fl: String = "sp2fl"
+        const val Sp2Sp: String = "sp2sp"
+
+    }
+}

+ 202 - 71
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/CalcSpecialService.kt

@@ -26,14 +26,17 @@
 
 package com.persagy.server.datacenter.services.relation_calc
 
+import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
-import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlock
+import com.persagy.server.datacenter.datacenter.models.entities.graphtype.block.ConnectedBlock
 import com.persagy.server.datacenter.wanda.rel.REq2Eq
 import com.persagy.server.mappers.ICalcSpecialMapper
-import com.persagy.server.models.`object`.NetWork
-import com.persagy.server.models.entities.Connector
+import com.persagy.server.datacenter.models.entities.Connector
+import com.persagy.server.datacenter.models.wrapperobj.ClassCodeEnum
+import com.persagy.server.datacenter.services.objects.EquipmentService
+import com.persagy.server.datacenter.wanda.obj.Equipment
 import com.persagy.server.services.assistant.RUpDateEquipAndSapceService
 import com.persagy.server.services.objects.FloorService
 import com.persagy.server.utils.IdUtils
@@ -255,39 +258,24 @@ open class CalcSpecialService {
     fun calcNetworks(projectId: String,buildingId: String): SBaseResponse{
         val floors = FloorService.select(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId),SFilter.eq("id","Fl440307000355ee6382da6d42cf87f19551cc4b4e60")).exec()
         val connectedBlocks = ArrayList<ConnectedBlock>()
-//        val connectorList = listOf("Equipment","JoinObject")
         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,Equipment>(1024)
-//                for (equipment in dcEquipments) {
-//                    if(!equipment.bimId.isNullOrEmpty()){
-//                        dcEquipMap[equipment.bimId!!] = equipment
-//                    }
-//
-//                }
+                val dcEquipments = EquipmentService.select(SFilter.eq("projectId",projectId), SFilter.eq("floorId",floor.id!!)).exec()
+                val dcEquipMap = HashMap<String, Equipment>(1024)
+                for (equipment in dcEquipments) {
+                    if(!equipment.bimId.isNullOrEmpty()){
+                        dcEquipMap[equipment.bimId!!] = equipment
+                    }
 
+                }
 
-                val equipmentsConnector = ArrayList<Connector>()
-//                val map = HashMap<String, ArrayList<Connector>>(10000)
                 val connectorMap = HashMap<String, Connector>(100000)
-                val typeMap = HashMap<String, String>(10000)
+                val typeMap = HashMap<String, String>(20000)
                 for (connector in connectors) {
                     connectorMap[connector.revitId!!] = connector
-                    if (connector.belongType == "Equipment") {
-                        equipmentsConnector.add(connector)
-                    }
 
-                    val belong = connector.belong ?: continue
-                    //                    if (map.containsKey(belong)) {
-//                        val connectorss = map[belong]!!
-//                        connectorss.add(connector)
-//                        map[belong] = connectorss
-//
-//                    } else {
-//                        map[belong] = arrayListOf(connector)
-//                    }
+                    val belong = connector.belongBimId ?: continue
                     val belongType = connector.belongType
                     if (belongType != null) {
                         typeMap[belong] = belongType
@@ -295,44 +283,73 @@ open class CalcSpecialService {
 
                 }
                 val belongMap = HashMap<String, HashSet<String>>()
-
+                val eqBelongSet = HashSet<String>()
                 //遍历连接件
                 for (connector in connectors) {
                     //拿到所属类
                     val belongType = connector.belongType
                     //拿到所属id
-                    val belong = connector.belong
-
-
-//                    //如果连接件有连接
-                    if (connector.connectedIds!!.size > 0 && belong != null) {
-                        val revitId = connector!!.connectedIds?.get(0)
-                        var currentConnector = connectorMap[revitId!!]
-                        val cBelong = currentConnector?.belong
-                        if (cBelong != null) {
-
-                            if (belongMap.containsKey(belong)) {
-                                val belongs = belongMap[belong]!!
-                                belongs.add(cBelong)
-                                belongMap[belong] = belongs
-                            } else {
-                                belongMap[belong] = hashSetOf(cBelong)
+                    val belong = connector.belongBimId
+                    if(belong != null){
+                        eqBelongSet.add(belong)
+                        //如果连接件有连接
+                        if (connector.connectedIds!!.size > 0) {
+                            val revitId = connector!!.connectedIds?.get(0)
+                            var currentConnector = connectorMap[revitId!!]
+                            val cBelong = currentConnector?.belongBimId
+                            if (cBelong != null) {
+//                                if(belongType == "Equipment"){
+//                                    eqBelongSet.add(belong)
+//                                }
+
+                                if (belongMap.containsKey(belong)) {
+                                    val belongs = belongMap[belong]!!
+                                    belongs.add(cBelong)
+                                    belongMap[belong] = belongs
+                                } else {
+                                    belongMap[belong] = hashSetOf(cBelong)
+                                }
+                            }else{
+                                belongMap[belong] = HashSet()
                             }
+                        }else {
+                            belongMap[belong] = HashSet()
                         }
                     }
                 }
-                for (key in belongMap.keys) {
-                    if(typeMap[key] != "Equipment"){
+                var fBlockId: Int =0
+                var dBlockId: Int =0
+                var cBlockId = 0
+                val fBlockMap = HashMap<Int,HashSet<String>>()
+//                val dBlockMap = HashMap<Int,HashSet<String>>()
+                val enumList = ClassCodeEnum.toSourceList(null)
+                var fSet: HashSet<String>? = null
+                var dSet: HashSet<String>
+                println(eqBelongSet.size)
+                for (key in eqBelongSet) {
+                    val e1 = dcEquipMap[key]
+                    if(e1 == null || !enumList.contains(e1.classCode)){
                         continue
                     }
+
                     val belongSet = belongMap[key]!!
-                    val newWork = dist(belongSet,belongSet, belongMap,typeMap,belongSet)
-                    for (s in newWork.fullConnectors!!) {
+
+                    dSet = directDist(HashSet(belongSet),belongMap,typeMap)
+                    dBlockId ++
+
+                    for (s in dSet!!) {
                         if(typeMap[s] == "Equipment" && key != s){
+                            val e2 = dcEquipMap[s]
+                            if(e2 == null || !enumList.contains(e2.classCode)){
+                                continue
+                            }
+                            if(e1.classCode == e2.classCode){
+                                continue
+                            }
 
                             val connectedBlock = ConnectedBlock()
-                            connectedBlock.id1 = key
-                            connectedBlock.id2 = s
+                            connectedBlock.id1 = e1.id!!
+                            connectedBlock.id2 = e2.id!!
                             connectedBlock.type1 = "Equipment"
                             connectedBlock.type2 = "Equipment"
                             connectedBlock.modelId1 = floor.modelId
@@ -341,21 +358,57 @@ open class CalcSpecialService {
 //                                connectedBlock.mepSystemType = connector.mepSystemType
                             connectedBlock.projectId = projectId
                             connectedBlock.buildingId = buildingId
-                            connectedBlock.depth = 1
-//                                connectedBlock.typeCode1 = e1?.classCode
-//                                connectedBlock.typeCode2 = e2?.classCode
+                            connectedBlock.depth = 0
+                            connectedBlock.blockId = dBlockId.toString()
+                            connectedBlock.typeCode1 = e1?.classCode
+                            connectedBlock.typeCode2 = e2?.classCode
                             if (!connectedBlocks.contains(connectedBlock)) {
                                 connectedBlocks.add(connectedBlock)
                             }
 
                         }
                     }
-                    for (s in newWork.directConnectors!!) {
+//                    if(listOf("Eq4403070003129ce8d657c94c648d2d164ccfc6802c",
+//                                    "Eq4403070003db010203b5e54a0e8e4de56234cb6ac9",
+//                                    "Eq4403070003666459bd6a7e434f8c091392bada823a",
+//                                    "Eq4403070003956fbc1b234a4007bdce0653ae7faba2").contains(e1.id!!)){
+//                        fSet = fullDist(HashSet(belongSet),belongMap)
+//                    }
+
+                    for (block in fBlockMap.keys) {
+                        val set = fBlockMap[block]!!
+                        if(set.contains(key)){
+                            fSet = set
+                            cBlockId = block
+                            break
+                        }
+                    }
+                    if(fSet == null){
+                        fSet = fullDist(HashSet(belongSet),belongMap)
+                        fBlockId ++
+                        cBlockId = fBlockId
+                        fBlockMap[cBlockId] = HashSet(fSet)
+                        if(cBlockId == 1){
+                            println(fBlockMap[cBlockId]!!.toJson())
+                        }
+                    }
+//                    fSet = fullDist(HashSet(belongSet),belongMap)
+//                    println(fSet.contains(key))
+//                    println(fSet.size)
+                    for (s in fSet!!) {
                         if(typeMap[s] == "Equipment" && key != s){
+                            val e2 = dcEquipMap[s]
+                            if(e2 == null || !enumList.contains(e2.classCode)){
+                                continue
+                            }
+                            if(e1.classCode == e2.classCode){
+                                continue
+                            }
 
                             val connectedBlock = ConnectedBlock()
-                            connectedBlock.id1 = key
-                            connectedBlock.id2 = s
+
+                            connectedBlock.id1 = e1.id!!
+                            connectedBlock.id2 = e2.id!!
                             connectedBlock.type1 = "Equipment"
                             connectedBlock.type2 = "Equipment"
                             connectedBlock.modelId1 = floor.modelId
@@ -364,17 +417,46 @@ open class CalcSpecialService {
 //                                connectedBlock.mepSystemType = connector.mepSystemType
                             connectedBlock.projectId = projectId
                             connectedBlock.buildingId = buildingId
-                            connectedBlock.depth = 0
-//                                connectedBlock.typeCode1 = e1?.classCode
-//                                connectedBlock.typeCode2 = e2?.classCode
+                            connectedBlock.depth = 1
+                            connectedBlock.blockId = cBlockId.toString()
+                            connectedBlock.typeCode1 = e1?.classCode
+                            connectedBlock.typeCode2 = e2?.classCode
                             if (!connectedBlocks.contains(connectedBlock)) {
                                 connectedBlocks.add(connectedBlock)
                             }
 
                         }
                     }
+//                    for (block in dBlockMap.keys) {
+//                        val set = dBlockMap[block]!!
+//                        if(set.contains(key)){
+//                            dSet = set
+//                            cBlockId = block
+//                            break
+//                        }
+//                    }
+//                    if(dSet == null){
+//                        dSet = directDist(HashSet(belongSet),belongMap,typeMap)
+//                        dBlockId ++
+//                        cBlockId = dBlockId
+//                        dBlockMap[cBlockId] = dSet
+//                    }
+
+
+//                    val newWork = dist(ArrayList(belongSet),ArrayList(belongSet), belongMap,typeMap,ArrayList(belongSet),0)
+//                    val newWork = dist(HashSet(belongSet),HashSet(belongSet), belongMap,typeMap)
+//                    newWork.fullConnectors!!.removeAll(newWork.directConnectors!!)
+//                    for (s in newWork.fullConnectors!!) {
+//
+//                    }
+//                    for (s in newWork.directConnectors!!) {
+//
+//                    }
+
                 }
             }
+
+
         }
         connectedBlockService.delete(SFilter.eq("projectId",projectId), SFilter.eq("buildingId",buildingId))
         val request = SCreateRequest<ConnectedBlock>()
@@ -384,12 +466,14 @@ open class CalcSpecialService {
 
     }
 
+
+
     /**
      * @Description:递归查找连接
      * @Param:
      * @Return:
      */
-     fun searchConnector(connector: Connector,currentConnector: Connector,map: HashMap<String,ArrayList<Connector>>,connectorMap: HashMap<String,Connector>): Connector?{
+     fun searchConnector(connector: Connector, currentConnector: Connector, map: HashMap<String,ArrayList<Connector>>, connectorMap: HashMap<String, Connector>): Connector?{
         val belong = currentConnector.belong ?: return null
         if(currentConnector.belongType == "Equipment" && currentConnector != connector){
             return currentConnector
@@ -409,25 +493,72 @@ open class CalcSpecialService {
         }
      }
 
-    fun dist(list: HashSet<String>,directList:HashSet<String>, belongMap: HashMap<String,HashSet<String>>,typeMap: HashMap<String,String>,newList: HashSet<String>): NetWork{
-//        val list = belongMap[key]!!
-//                    val connectList = ArrayList<String>()
-//        while(list)
+//    fun dist(list: ArrayList<String>,directList:ArrayList<String>, belongMap: HashMap<String,HashSet<String>>,typeMap: HashMap<String,String>,beforeList: ArrayList<String>,index: Int): NetWork {
+//        var belong: String? = null
+//        for(i in index until beforeList.size){
+//            belong = beforeList[i]
+//            if(belongMap[belong] != null){
+//                val belongList = belongMap[belong]!!
+//                for (s in belongList) {
+////                    if(!directList.contains(s)){
+////
+////                    }
+//                    if(!list.contains(s)){
+//                        list.add(s)
+//                        if(typeMap[belong] != "Equipment"){
+//                            directList.add(s)
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//
+//        return if(beforeList.containsAll(list)){
+//            NetWork(list, directList)
+//        }else{
+////            newList.clear()
+////            newList.addAll(list)
+////            newList.removeAll(beforeList)
+//            println(list.size)
+//            println("${HashSet<String>(list).size}=====")
+//            dist(list,beforeList,belongMap,typeMap,ArrayList(list),beforeList.size)
+//        }
+//    }
+
+    fun fullDist(list: HashSet<String>, belongMap: HashMap<String,HashSet<String>>): HashSet<String>{
         val beforeList = HashSet<String>(list)
-        for (belong in newList) {
+        for (belong in beforeList) {
             if(belongMap[belong] == null){
                 continue
             }
+            val belongs =  HashSet<String>(belongMap[belong]!!)
+//            if(typeMap[belong] != "Equipment"){
+//                directList.addAll(belongs)
+//            }
+            list.addAll(belongs)
+        }
+        if(beforeList.containsAll(list)){
+            return list
+        }else{
+            return fullDist(list,belongMap)
+        }
+    }
+
+    fun directDist(directList:HashSet<String>, belongMap: HashMap<String,HashSet<String>>,typeMap: HashMap<String,String>): HashSet<String>{
+        val beforeList = HashSet<String>(directList)
+        for (belong in beforeList) {
+            if(belongMap[belong] == null){
+                continue
+            }
+            val belongs =  HashSet<String>(belongMap[belong]!!)
             if(typeMap[belong] != "Equipment"){
-                directList.addAll(belongMap[belong]!!)
+                directList.addAll(belongs)
             }
-            list.addAll(belongMap[belong]!!)
         }
-        if(beforeList.containsAll(list)){
-            return NetWork(list,directList)
+        if(beforeList.containsAll(directList)){
+            return directList
         }else{
-            newList.removeAll(beforeList)
-            return dist(list,beforeList,belongMap,typeMap,newList)
+            return directDist(directList,belongMap,typeMap)
         }
     }
 

+ 1 - 2
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CommonService.kt

@@ -1,10 +1,9 @@
-package com.persagy.server.services.relation_calc
+package com.persagy.server.datacenter.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
 

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/MepSystemCalcService.kt

@@ -29,7 +29,7 @@ package com.persagy.server.datacenter.services.relation_calc
 import com.persagy.database.SFilter
 import com.persagy.database.SOrder
 import com.persagy.mybatis.SMybatisDao
-import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlock
+import com.persagy.server.datacenter.datacenter.models.entities.graphtype.block.ConnectedBlock
 import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlockSource
 import com.persagy.server.datacenter.models.entities.graphtype.block.EquipIdUUIDMap
 import com.persagy.server.datacenter.models.entities.graphtype.block.MepSourceTypeEntity

+ 64 - 17
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/RelationCalcService.kt

@@ -29,6 +29,7 @@ package com.persagy.server.datacenter.services.relation_calc
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.datacenter.datacenter.models.entities.graphtype.block.ConnectedBlock
 import com.persagy.server.datacenter.models.entities.graphtype.MPoint
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
 import com.persagy.server.datacenter.services.base.RService
@@ -37,14 +38,17 @@ import com.persagy.server.datacenter.services.objects.ZoneSpaceBaseService
 import com.persagy.server.datacenter.wanda.rel.RSp2Sp
 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.datacenter.models.wrapperobj.TwicePoint
+import com.persagy.server.datacenter.models.service.BaseDataService
+import com.persagy.server.datacenter.models.wrapperobj.ClassCodeEnum
+import com.persagy.server.datacenter.wanda.rel.REq2Sp
 import com.persagy.server.services.assistant.RUpDateEquipAndSapceService
+import com.persagy.server.services.graphtype.ConnectedBlockService
 import com.persagy.server.services.objects.FloorService
 import com.persagy.server.services.rel.REq2SpService
-import com.persagy.server.services.relation_calc.CommonService
 import com.persagy.server.utils.IdUtils
 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 com.persagy.service.utils.SSpringContextUtil
@@ -68,6 +72,7 @@ open class RelationCalcService {
     val rabbitMqService by lazy {
         SSpringContextUtil.getBean(RabbitMqService::class.java) as RabbitMqService
     }
+    val connectedBlockService = SObjectService(SMybatisDao(ConnectedBlock::class.java))
 
     /** 关系总览服务 */
     val relationTypeProjectservice = SBaseService(SMybatisDao(RelationTypeProject::class.java))
@@ -256,7 +261,7 @@ open class RelationCalcService {
      *  @param  projectId   项目id
      *  @param  sign        是否要删除自动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除手动计算的的关系)
      */
-    fun calcEq2Sp(tables: String?, projectId: String, sign: Boolean): SBaseResponse {
+    fun calcEq2Sp(tables: String?, projectId: String, sign: Boolean,graphCode: String): SBaseResponse {
         try {
             var tablesName = ""
             var outTablesName = ""
@@ -367,7 +372,7 @@ open class RelationCalcService {
             } catch (e: Exception) {
                 e.printStackTrace()
             }
-            val result = mapper.calcEq2Sp(projectId)
+            val result = mapper.calcEq2Sp(projectId,graphCode)
             if (result != null && result == 0) {
                 try {
                     /** 发送消息 */
@@ -1015,7 +1020,7 @@ open class RelationCalcService {
      *  @param  projectId   项目id
      *  @param  sign        是否要删除自动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除手动计算的的关系)
      */
-    fun calcss2Sp(projectId: String): SBaseResponse {
+    fun calcss2Sp(projectId: String,graphCode: String): SBaseResponse {
         try {
 
             try {
@@ -1031,7 +1036,7 @@ open class RelationCalcService {
                 e.printStackTrace()
             }
             /** 启动计算 */
-            val result = mapper.calcEq2Sp(projectId!!)
+            val result = mapper.calcEq2Sp(projectId!!,graphCode)
             if (result != null && result == 0) {
                 try {
                     /** 发送消息 */
@@ -1091,14 +1096,16 @@ open class RelationCalcService {
     }
 
     /**
-     * 设备所在业务空间  风口(空调风口、通风风口)
+     * 设备服务业务空间  风口(空调风口、通风风口)
      *
      *  @param  tables      参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone FunctionZone,FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone
      *  @param  projectId   项目id
      *  @param  sign        是否要删除自动维护的关系(不填默认为false), boolean型, 值为true或false (true表示删除自动和手动维护的关系, false表示只删除手动计算的的关系)
      */
-    fun calcEqForSp(tables: String?, projectId: String): SBaseResponse {
+    fun calcEqForSp(tables: String?, projectId: String,graphCode: String): SBaseResponse {
+        val codeList= ClassCodeEnum.toSourceList(1)
 
+        val connectedBlocks = connectedBlockService.select(SFilter.eq("projectId",projectId), SFilter.or(SFilter.inList("typeCode1",codeList), SFilter.inList("typeCode2",codeList))).exec()
 
         try {
 
@@ -1115,7 +1122,7 @@ open class RelationCalcService {
                 e.printStackTrace()
             }
             /** 启动计算   ******************************/
-            val result = mapper.calcEq2Sp(projectId)
+            val result = mapper.calcEq2Sp(projectId,graphCode)
 //            var result = 0
             logger.debug("计算结果= ${result}")
 
@@ -1125,7 +1132,7 @@ open class RelationCalcService {
 
 //            REq2SpService.delete(SFilter.eq("projectId", projectId),
 //                     SFilter.eq("type", "eq2sp_for"))
-            val r2 = mapper.insertsp(projectId)
+//            val r2 = mapper.insertsp(projectId)
 //                logger.debug("设备关联业务空间计算结果= ${r1}+${r2}")
 
 
@@ -1145,25 +1152,65 @@ open class RelationCalcService {
                     e.printStackTrace()
                 }
 
-
+                val sourceList = ClassCodeEnum.toSourceList(0)
                 /** 处理关系 */
                 val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
                         SFilter.inList("classCode",
                                 arrayListOf("ACATIO", "ACVTIO","ACATFC","ACVTAC","FFSCIO"))).exec()
+                val typeMap = HashMap<String,String>();
                 if (equipmentList.size > 0) {
                     var listId = ArrayList<String>()
                     for (equipment in equipmentList) {
                         listId.add(equipment.id!!)
+                        typeMap[equipment.id!!] = equipment.classCode!!
                     }
                     val rEq2SpList = REq2SpService.select(SFilter.eq("projectId", projectId),
                             SFilter.inList("id1", listId)
-                            , SFilter.eq("type", "eq2sp_in")).exec()
+                            , SFilter.eq("graphCode", graphCode)).exec()
+                    val rEq2Sps = ArrayList<REq2Sp>()
                     if (rEq2SpList.size > 0) {
                         for (rEq2Sp in rEq2SpList) {
-                            rEq2Sp.type = "eq2sp_for"
-                            REq2SpService.replace(rEq2Sp)
+                            rEq2Sp.type = "Eq2Sp"
+                            rEq2Sp.graphCode = graphCode
+                            rEq2Sps.add(rEq2Sp)
+//                            REq2SpService.replace(rEq2Sp)
+                            //获取设备类型
+                            val typeCode = typeMap[rEq2Sp.id1]
+                            //如果是风口才计算关系
+                            if( typeCode!= null && sourceList.contains(typeCode)){
+                                for (connectedBlock in connectedBlocks) {
+                                    val typeCode1 = connectedBlock.typeCode1
+                                    val typeCode2 = connectedBlock.typeCode2
+                                    if(sourceList.contains(typeCode1)){
+                                        val fullREq2Sp = REq2Sp()
+                                        fullREq2Sp.type = "Eq2Sp"
+                                        fullREq2Sp.graphCode = graphCode
+                                        fullREq2Sp.projectId = projectId
+                                        fullREq2Sp.id1 = connectedBlock.id2
+                                        fullREq2Sp.id2 = rEq2Sp.id2
+                                        fullREq2Sp.zoneType = tables
+                                        fullREq2Sp.sign =2
+                                        rEq2Sps.add(fullREq2Sp)
+                                    }else if(sourceList.contains(typeCode2)){
+                                        val fullREq2Sp = REq2Sp()
+                                        fullREq2Sp.type = "Eq2Sp"
+                                        fullREq2Sp.graphCode = graphCode
+                                        fullREq2Sp.projectId = projectId
+                                        fullREq2Sp.id1 = connectedBlock.id1
+                                        fullREq2Sp.id2 = rEq2Sp.id2
+                                        fullREq2Sp.zoneType = tables
+                                        fullREq2Sp.sign =2
+                                        rEq2Sps.add(fullREq2Sp)
+                                    }
+                                }
+                            }
+
                         }
                     }
+                    for (rEq2Sp in rEq2Sps) {
+                        REq2SpService.replace(rEq2Sp)
+                    }
+
                 }
                 /** 发送消息 */
                 rabbitMqService.sendRel(Opt.projectId!!, "fengkou_for", "20", "123", "456")
@@ -1211,7 +1258,7 @@ open class RelationCalcService {
                         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)
+                            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)
@@ -1318,7 +1365,7 @@ open class RelationCalcService {
         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)
+        return TwicePoint(base_x + vector_x1, base_y + vector_y1, base_x + vector_x2, base_y + vector_y2)
     }
 
 } // Class RelationCalcService

+ 4 - 4
datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/obj/ProjectController.kt

@@ -105,11 +105,11 @@ private open class ProjectController {
     @PostMapping(value = ["/query"])
     fun query(@RequestBody request: SQueryRequest): SQueryResponse<Project> {
         val projectId = SPageContext.getHeader("projectId")
-        if (projectId.isNullOrEmpty()){
+//        if (projectId.isNullOrEmpty()){
             return ProjectService.pageQuery(request)
-        }else{
-            return ProjectService.pageQuery(request, arrayListOf(SFilter.eq("id",projectId)))
-        }
+//        }else{
+//            return ProjectService.pageQuery(request, arrayListOf(SFilter.eq("id",projectId)))
+//        }
     }
 
     @Operation(summary = "查询所有项目信息", description = "")

+ 12 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/relation/GraphicTypeController.kt

@@ -28,6 +28,7 @@ import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBl
 import com.persagy.server.datacenter.models.entities.graphtype.block.ConnectedBlockSourceRequest
 import com.persagy.server.datacenter.services.graphtype.GraphicTypeMapperService
 import com.persagy.server.datacenter.services.graphtype.RelationTypeProjectService
+import com.persagy.server.datacenter.services.rel.RelStatisticService
 import com.persagy.server.services.graphtype.*
 import com.persagy.service.SObjectService
 import com.persagy.service.SPageContext
@@ -64,6 +65,9 @@ open class GraphicTypeController {
     @Autowired
     lateinit var graphicTypeMapperService: GraphicTypeMapperService
 
+    @Autowired
+    lateinit var relStatisticService: RelStatisticService
+
     /**
      * 查询关系总览
      */
@@ -155,6 +159,14 @@ open class GraphicTypeController {
         return service.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString())))
     } // Fun replaceConnectedBlockSource()
 
+    /**
+     * 查看关系相关的数据类型
+     */
+    @Operation(summary="查看关系相关的数据类型*", description="")
+    @GetMapping(value = ["/relToType"])
+    fun relToType(@RequestParam(required = false) zoneType: String?,@RequestParam graphCode: String,@RequestParam type: String,@RequestParam relType: String,@RequestParam status: Int): SQueryResponse<HashMap<String,String?>>{
+        return relStatisticService.relToType(zoneType,graphCode,type,relType,status)
+    }
 
 
 } // Class EquipScanTaskController

+ 3 - 3
datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/relation/RelationCalcController.kt

@@ -113,7 +113,7 @@ class RelationCalcController {
     fun calcEq2Sp(@RequestParam objectTypes: String?): SBaseResponse {
         val projectId = SPageContext.getHeader("projectId").toString()
         logger.debug("calcEq2Sp --------------  $projectId")
-        return service.calcEq2Sp(objectTypes,projectId, false)
+        return service.calcEq2Sp(objectTypes,projectId, false,"MechInArch")
     } // Function calcEq2Sp()
 
     /**
@@ -313,7 +313,7 @@ class RelationCalcController {
     fun ss2Sp(): SBaseResponse {
         val projectId = SPageContext.getHeader("projectId").toString()
         logger.debug("calcSs2Sp --------------  $projectId")
-        return service.calcss2Sp(projectId)
+        return service.calcss2Sp(projectId,"MechInArch")
     }
 
     /**
@@ -324,7 +324,7 @@ class RelationCalcController {
     fun eqForSp(@RequestParam objectTypes: String?): SBaseResponse {
         val projectId = SPageContext.getHeader("projectId").toString()
         logger.debug("calcEq2Sp --------------  $projectId")
-        return service.calcEqForSp(objectTypes,projectId)
+        return service.calcEqForSp(objectTypes,projectId,"MechForArch")
     }
 
     /**

+ 0 - 28
datacenter/src/main/kotlin/com/persagy/server/models/object/ClassCodeEnum.kt

@@ -1,28 +0,0 @@
-package com.persagy.server.models.`object`
-
-import java.util.*
-
-
-/**
- *
- * @author  Cainga
- * @date  2021/2/24 10:32
- */
-enum class ClassCodeEnum(val cname: String) {
-    ACVTIO("通风风口"),
-    FFSCIO("排烟风口"),
-    ACATIO("空调风口"),
-    ACVTSF("通风风机"),
-    ACATAH("空调机组"),
-    ACATFU("新风机组");
-
-    open fun toList(): List<String> {
-        val list = ArrayList<String>() //Lists.newArrayList()其实和new ArrayList()几乎一模
-        //  一样, 唯一它帮你做的(其实是javac帮你做的), 就是自动推导(不是"倒")尖括号里的数据类型.
-        for (classCodeEnum in ClassCodeEnum.values()) {
-            list.add(classCodeEnum.name)
-        }
-        return list
-    }
-
-}