浏览代码

********************WX***********************
修改outline

zhangweixin 4 年之前
父节点
当前提交
500c82a0f6

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/controllers/objects/FloorController.kt

@@ -142,7 +142,7 @@ open class FloorController {
         list.add("name")
         list.add("localId")
         list.add("localName")
-        list.add("sutline")
+        list.add("outline")
         list.add("floorSequenceId")
         list.add("modelId")
         request.projection = list

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

@@ -305,6 +305,27 @@ class RelationCalcController {
         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(objectTypes: String?): SBaseResponse {
+        val projectId = SPageContext.getHeader("projectId").toString()
+        logger.debug("calcEq2Sp --------------  $projectId")
+        return service.calcEqForSp(objectTypes,projectId)
+    }
 
     /**
      * 关系变化时标记需要处理的计算

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

@@ -76,7 +76,7 @@ interface IRelationCalcMapper {
      */
     // @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(tables: String, outTables: String, projectId: String, sign1: Int, sign2: Int): Int?
+    fun calcEq2Sp( projectId: String): Int?
 
     /**
      * 楼层贯通关系

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

@@ -31,6 +31,8 @@ import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
 import com.persagy.server.mappers.IRelationCalcMapper
 import com.persagy.server.services.assistant.RUpDateEquipAndSapceService
+import com.persagy.server.services.objects.EquipmentService
+import com.persagy.server.services.rel.REq2SpService
 import com.persagy.server.utils.IdUtils
 import com.persagy.service.SBaseService
 import com.persagy.service.models.enums.SResponseType
@@ -338,7 +340,7 @@ open class RelationCalcService {
             } catch (e: Exception) {
                 e.printStackTrace()
             }
-            val result = mapper.calcEq2Sp(tablesName,outTablesName,projectId,sign1Int,sign2Int)
+            val result = mapper.calcEq2Sp(projectId)
             if(result!=null && result == 0){
                 try {
                     upDate(projectId,"fl2sp")
@@ -942,4 +944,161 @@ open class RelationCalcService {
 
     } // Fun
 
+
+    /**
+     * 设备所在业务空间  温度传感器(SETP)、湿度传感器(SERH)、浓度传感器(SECT)
+     *
+     *  @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 calcss2Sp( projectId: String): SBaseResponse {
+        try {
+
+            try {
+                upDateBiaoji(projectId,"eq2fl",3)
+                upDateBiaoji(projectId,"fl2sp",3)
+
+                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_SensorRelationship_ss2sp")).entity()
+                if (entity!=null){
+                    entity.computationalState = 3
+                    relationTypeProjectservice.update(entity)
+                }
+            } catch (e: Exception) {
+                e.printStackTrace()
+            }
+            /** 启动计算 */
+            val result = mapper.calcEq2Sp(projectId!!)
+            if(result!=null && result == 0){
+                try {
+                    upDate(projectId,"fl2sp")
+                    upDate(projectId,"eq2fl")
+                    val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_SensorRelationship_ss2sp")).entity()
+                    if (entity!=null){
+                        entity.computationalState = 1
+                        relationTypeProjectservice.update(entity)
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+
+
+                /** 处理关系 */
+                val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
+                    SFilter.inList("classCode",
+                        arrayListOf("SETP", "SERH", "SECT"))).exec()
+                logger.debug("设备长度: ${equipmentList.size}")
+                logger.debug("设备长度: ${equipmentList.size}")
+                if (equipmentList.size>0) {
+                    var listId = ArrayList<String>()
+                    for (equipment in equipmentList) {
+                        listId.add(equipment.id!!)
+                        logger.debug("设备id: ${equipment.id}")
+                    }
+                    val rEq2SpList = REq2SpService.select(SFilter.eq("projectId", projectId),
+                        SFilter.inList("id1", listId)
+                        , SFilter.eq("type", "eq2sp_in")).exec()
+                    logger.debug("关系长度: ${rEq2SpList.size}")
+                    if (rEq2SpList.size>0){
+                        for (rEq2Sp in rEq2SpList) {
+                            rEq2Sp.type = "eq2sp_SensorRelationship_ss2sp"
+                            REq2SpService.replace(rEq2Sp)
+                        }
+                    }
+                }
+
+                return SBaseResponse(SResponseType.success)
+            }else{
+                upDateBiaoji(projectId,"eq2fl",5)
+                upDateBiaoji(projectId,"fl2sp",5)
+                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_SensorRelationship_ss2sp")).entity()
+                if (entity!=null){
+                    entity.computationalState = 5
+                    relationTypeProjectservice.update(entity)
+                }
+            }
+
+            return SBaseResponse(SResponseType.failure)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
+    }
+
+    /**
+     * 设备所在业务空间  风口(空调风口、通风风口)
+     *
+     *  @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 {
+        try {
+
+            try {
+                upDateBiaoji(projectId,"eq2fl",3)
+                upDateBiaoji(projectId,"fl2sp",3)
+
+                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_for"), SFilter.eq("zoneType",tables!!)).entity()
+                if (entity!=null){
+                    entity.computationalState = 3
+                    relationTypeProjectservice.update(entity)
+                }
+            } catch (e: Exception) {
+                e.printStackTrace()
+            }
+            /** 启动计算 */
+            val result = mapper.calcEq2Sp(projectId)
+            if(result!=null && result == 0){
+                try {
+                    upDate(projectId,"fl2sp")
+                    upDate(projectId,"eq2fl")
+                    val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_for"), SFilter.eq("zoneType",tables!!)).entity()
+                    if (entity!=null){
+                        entity.computationalState = 1
+                        relationTypeProjectservice.update(entity)
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+
+
+                /** 处理关系 */
+                val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
+                    SFilter.inList("classCode",
+                        arrayListOf("ATIO", "VTIO"))).exec()
+                if (equipmentList.size>0) {
+                    var listId = ArrayList<String>()
+                    for (equipment in equipmentList) {
+                        listId.add(equipment.id!!)
+                    }
+                    val rEq2SpList = REq2SpService.select(SFilter.eq("projectId", projectId),
+                        SFilter.inList("id1", listId)
+                        , SFilter.eq("type", "eq2sp_in")).exec()
+                    if (rEq2SpList.size>0){
+                        for (rEq2Sp in rEq2SpList) {
+                            rEq2Sp.type = "eq2sp_for"
+                            REq2SpService.replace(rEq2Sp)
+                        }
+                    }
+                }
+
+                return SBaseResponse(SResponseType.success)
+            }else{
+                upDateBiaoji(projectId,"eq2fl",5)
+                upDateBiaoji(projectId,"fl2sp",5)
+                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", "eq2sp_for"), SFilter.eq("zoneType",tables!!)).entity()
+                if (entity!=null){
+                    entity.computationalState = 5
+                    relationTypeProjectservice.update(entity)
+                }
+            }
+
+            return SBaseResponse(SResponseType.failure)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure,e.message!!)
+        }
+    }
+
 } // Class RelationCalcService

+ 1 - 1
gradle.properties

@@ -25,7 +25,7 @@
 #
 
 PERSAGY_URL = http://www.persagy.cn
-PERSAGY_KOTLIN_VERSION = 1.4.115
+PERSAGY_KOTLIN_VERSION = 1.4.116
 PERSAGY_SERVICE_VERSION = 1.4.157
 
 MAVEN_REPO_PUBLIC_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-public/