Forráskód Böngészése

设备服务业务空间

caiaf 4 éve
szülő
commit
8071087047

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

@@ -62,8 +62,8 @@ open class CalcSpecialController {
      */
     @Operation(summary = "管网系统设备分块", description = "Domain 需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac;需要计算的building_id,如果没有提供时直接为空")
     @PostMapping(value = ["/sys-block"])
-    fun sysBolck(@RequestParam relationType: String): SBaseResponse{
-        return service.sysBolck(relationType)
+    fun sysBolck(@RequestParam relationType: String,@RequestParam buildingId: String): SBaseResponse{
+        return service.sysBolck(relationType,buildingId)
     } // Function sysBolck()
 
 

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

@@ -94,9 +94,9 @@ interface IRelationCalcMapper {
      *@param projectId 项目id
      */
     @Insert("insert into relationship.r_eq2sp(eq_id, sp_id, project_id, sign, type, zone_type,sign0) " +
-            "select eq.id2 as eqid,ep.sp_id as spid,ep.project_id as project_id,ep.sign as sign,ep.type as type,ep.zone_type as zone_type,3  from relationship.r_eq2eq  as eq " +
+            "select eq.id2 as eqid,ep.sp_id as spid,ep.project_id as project_id,ep.sign as sign,'eq2sp_for',ep.zone_type as zone_type,3  from relationship.r_eq2eq  as eq " +
             "inner join relationship.r_eq2sp  as ep on eq.id1 = ep.eq_id  where ep.project_id = #{projectId} union\n" +
-            "select eq.id1 as eqid,ep.sp_id as spid,ep.project_id as project_id,ep.sign as sign,ep.type as type,ep.zone_type as zone_type,3  from relationship.r_eq2eq  as eq " +
+            "select eq.id1 as eqid,ep.sp_id as spid,ep.project_id as project_id,ep.sign as sign,'eq2sp_for',ep.zone_type as zone_type,3  from relationship.r_eq2eq  as eq " +
             "inner join relationship.r_eq2sp as ep  on eq.id2= ep.eq_id where ep.project_id = #{projectId}")
     fun insertsp( projectId: String): Int?
 

+ 4 - 3
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CalcSpecialService.kt

@@ -43,6 +43,7 @@ import com.persagy.service.models.responses.SBaseResponse
 import org.json.JSONObject
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
+import org.springframework.web.bind.annotation.RequestParam
 
 /**
  * 关系计算-管网
@@ -71,9 +72,9 @@ open class CalcSpecialService {
      *@param systemName 需要计算的系统名称
      *@param domain 需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac
      */
-    fun sysBolck(relationType: String): SBaseResponse {
+    fun sysBolck(relationType: String,buildingId: String): SBaseResponse {
         try {
-            val buildingId: String? = null
+//            val buildingId: String? = null
             val projectId = SPageContext.getHeader("projectId").toString()
             upDateBiaoji(projectId,relationType ,3)
             val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", relationType)).entity()
@@ -111,7 +112,7 @@ open class CalcSpecialService {
                         // 生成数据中心使用的关系
 //                        val generateRelation = mepSystemCalcService.generateRelation(projectId, relationType, null, systemName)
 //                        generateRelation.addAll(mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, null, systemName))
-                        val generateRelation = mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, null, systemName)
+                        val generateRelation = mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, buildingId, systemName)
                         if (generateRelation.size>0){
                             val delete = rEq2EqService.delete(SFilter.eq("projectId", projectId), SFilter.eq("type", relationType), SFilter.eq("sign", 2))
 

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

@@ -169,7 +169,7 @@ class MepSystemCalcService {
             originData = connectedBlockService.select(SFilter.eq("projectId", projectId), SFilter.inList("mepSystemType", mepSystemTypeList),
                     SFilter.isNull("direction"), SFilter.isNull("buildingId")).order(SOrder("mepSystemType"), SOrder("blockId")).exec()
         } else
-            originData = connectedBlockService.select(SFilter.eq("projectId", projectId), SFilter.eq("buildingId", projectId),
+            originData = connectedBlockService.select(SFilter.eq("projectId", projectId), SFilter.eq("buildingId", buildingId),
                     SFilter.inList("mepSystemType", mepSystemTypeList), SFilter.isNull("direction"))
                     .order(SOrder("mepSystemType"), SOrder("blockId")).exec()
         // 2. 加入到MepSystemTransformer对象里组织, 并trim掉设备部件以外的对象

+ 6 - 144
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt

@@ -1114,153 +1114,15 @@ open class RelationCalcService {
 //            var result = 0
             logger.debug("计算结果= ${result}")
 
-            var equipment = EquipmentService.select(SFilter.eq("localId", "20.30.40.50.10.0001"), SFilter.contain("bimId", "3353659"), SFilter.eq("projectId", projectId)).entity()
-            var space = ZoneSpaceBaseService.select(SFilter.eq("localName", "F1-补风机房-01"), SFilter.eq("projectId", projectId)).entity()
-            val list = ArrayList<REq2Sp>()
-            if (equipment != null && space != null) {
-                val req = REq2Sp()
-                req.id1 = equipment.id
-                req.id2 = space.id
-                req.projectId = projectId
-                req.sign = 1
-                req.type = "eq2sp_for"
-                req.zoneType = "GeneralZone"
-                req.lastUpdate = Date()
-                list.add(req)
-            }
-
-            var equipment2 = EquipmentService.select(SFilter.eq("localId", "20.30.30.30.10.10.0860"), SFilter.contain("bimId", "3360171"), SFilter.eq("projectId", projectId)).entity()
-            var space2 = ZoneSpaceBaseService.select(SFilter.eq("localName", "F1-女卫生间-02"), SFilter.eq("projectId", projectId)).entity()
-            if (equipment2 != null && space2 != null) {
-                val req = REq2Sp()
-                req.id1 = equipment2.id
-                req.id2 = space2.id
-                req.projectId = projectId
-                req.sign = 1
-                req.type = "eq2sp_for"
-                req.zoneType = "GeneralZone"
-                req.lastUpdate = Date()
-                list.add(req)
-                if(equipment != null){
-                    val req = REq2Sp()
-                    req.id1 = equipment.id
-                    req.id2 = space2.id
-                    req.projectId = projectId
-                    req.sign = 1
-                    req.type = "eq2sp_for"
-                    req.zoneType = "GeneralZone"
-                    req.lastUpdate = Date()
-                    list.add(req)
-                }
-            }
-
-
-            var equipment3 = EquipmentService.select(SFilter.eq("localId", "20.30.30.30.10.10.0861"), SFilter.contain("bimId", "3360429"), SFilter.eq("projectId", projectId)).entity()
-            var equipment4 = EquipmentService.select(SFilter.eq("localId", "20.30.30.30.10.10.0862"), SFilter.contain("bimId", "3360571"), SFilter.eq("projectId", projectId)).entity()
-            var space3 = ZoneSpaceBaseService.select(SFilter.eq("localName", "F1-卫生间前室-02"), SFilter.eq("projectId", projectId)).entity()
-            if (equipment3 != null && space3 != null) {
-                val req = REq2Sp()
-                req.id1 = equipment3.id
-                req.id2 = space3.id
-                req.projectId = projectId
-                req.sign = 1
-                req.type = "eq2sp_for"
-                req.zoneType = "GeneralZone"
-                req.lastUpdate = Date()
-                list.add(req)
-                if(equipment != null){
-                    val req = REq2Sp()
-                    req.id1 = equipment.id
-                    req.id2 = space3.id
-                    req.projectId = projectId
-                    req.sign = 1
-                    req.type = "eq2sp_for"
-                    req.zoneType = "GeneralZone"
-                    req.lastUpdate = Date()
-                    list.add(req)
-                }
-            }
-
-            if (equipment4 != null && space3 != null) {
-                val req = REq2Sp()
-                req.id1 = equipment4.id
-                req.id2 = space3.id
-                req.projectId = projectId
-                req.sign = 1
-                req.type = "eq2sp_for"
-                req.zoneType = "GeneralZone"
-                req.lastUpdate = Date()
-                list.add(req)
-            }
-
-            var equipment5 = EquipmentService.select(SFilter.eq("localId", "20.30.30.30.10.10.0863"), SFilter.contain("bimId", "3360088"), SFilter.eq("projectId", projectId)).entity()
-            var equipment6 = EquipmentService.select(SFilter.eq("localId", "20.30.30.30.10.10.0864"), SFilter.contain("bimId", "3359745"), SFilter.eq("projectId", projectId)).entity()
-            var space4 = ZoneSpaceBaseService.select(SFilter.eq("localName", "F1-男卫生间-02"), SFilter.eq("projectId", projectId)).entity()
-
-            if (equipment5 != null && space4 != null && equipment6 != null) {
-                val req1 = REq2Sp()
-                req1.id1 = equipment5.id
-                req1.id2 = space4.id
-                req1.projectId = projectId
-                req1.sign = 1
-                req1.type = "eq2sp_for"
-                req1.zoneType = "GeneralZone"
-                req1.lastUpdate = Date()
-                list.add(req1)
-                val req2 = REq2Sp()
-                req2.id1 = equipment6.id
-                req2.id2 = space4.id
-                req2.projectId = projectId
-                req2.sign = 1
-                req2.type = "eq2sp_for"
-                req2.zoneType = "GeneralZone"
-                req2.lastUpdate = Date()
-                list.add(req2)
-                if(equipment != null){
-                    val req = REq2Sp()
-                    req.id1 = equipment.id
-                    req.id2 = space4.id
-                    req.projectId = projectId
-                    req.sign = 1
-                    req.type = "eq2sp_for"
-                    req.zoneType = "GeneralZone"
-                    req.lastUpdate = Date()
-                    list.add(req)
-                }
-            }
-
-//            for (rEq2Sp in list) {
-//
-//            }
-////                val element = REq2SpService.select(SFilter.eq("id1",mapKey), SFilter.eq("id2",mapValue)).exec()
-////                if(element != null && element.size >0){
-////                    continue
-////                }
-//                val req = REq2Sp()
-//                req.id1 = mapKey
-//                req.id2 = mapValue
-//                req.projectId = projectId
-//                req.sign = 1
-//                req.type = "eq2sp_for"
-//                req.zoneType = "GeneralZone"
-//                req.lastUpdate = Date()
-            for (rEq2Sp in list) {
-                REq2SpService.replace(rEq2Sp)
-            }
-
-            Thread.sleep(2000000);
-
             /*************************上面添加数据**********************************/
 
 
-            try {
-// //               val r1 = mapper.deletesp(projectId)
-//                val r1 = REq2SpService.delete(SFilter.eq("projectId", projectId), SFilter.eq("sign0", 3))
-//                val r2 = mapper.insertsp(projectId)
+
+//            REq2SpService.delete(SFilter.eq("projectId", projectId),
+//                     SFilter.eq("type", "eq2sp_for"))
+            val r2 = mapper.insertsp(projectId)
 //                logger.debug("设备关联业务空间计算结果= ${r1}+${r2}")
-            } catch (e: Exception) {
-                e.printStackTrace()
-            }
+
 
 
             if (result != null && result == 0) {
@@ -1282,7 +1144,7 @@ open class RelationCalcService {
                 /** 处理关系 */
                 val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
                         SFilter.inList("classCode",
-                                arrayListOf("ACATIO", "ACVTIO","ACATFC","ACVTAC"))).exec()
+                                arrayListOf("ACATIO", "ACVTIO","ACATFC","ACVTAC","FFSCIO"))).exec()
                 if (equipmentList.size > 0) {
                     var listId = ArrayList<String>()
                     for (equipment in equipmentList) {