Browse Source

********************WX***********************
修改管网计算,修改自动计算

zhangweixin 4 years ago
parent
commit
24799c25b9

+ 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,@RequestParam buildingId: String): SBaseResponse{
-        return service.sysBolck(relationType,buildingId)
+    fun sysBolck(@RequestParam relationType: String): SBaseResponse{
+        return service.sysBolck(relationType)
     } // Function sysBolck()
 
 

+ 18 - 21
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/CalcSpecialService.kt

@@ -43,7 +43,6 @@ 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
 
 /**
  * 关系计算-管网
@@ -72,9 +71,9 @@ open class CalcSpecialService {
      *@param systemName 需要计算的系统名称
      *@param domain 需要计算的管道系统类型,枚举(水管或风管):DomainPiping,DomainHvac
      */
-    fun sysBolck(relationType: String,buildingId: String): SBaseResponse {
+    fun sysBolck(relationType: 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()
@@ -92,27 +91,25 @@ open class CalcSpecialService {
                         }
                     }
                     // 设置源
-//                    val sourceType = mepSystemCalcService.setSourceType(projectId, calcName, null, systemName)
-//
-//                    if (!sourceType) {
-//                        upDateBiaoji(projectId,relationType ,5)
-//                        return SBaseResponse(SResponseType.success)
-//                    }
+                    val sourceType = mepSystemCalcService.setSourceType(projectId, calcName, null, systemName)
+                    if (!sourceType) {
+                        upDateBiaoji(projectId,relationType ,5)
+                        return SBaseResponse(SResponseType.success)
+                    }
                     // 计算流向
-//                    val exec = connectedBlockService.select(SFilter.eq("projectId", projectId), SFilter.inList("mepSystemType", systemName)).group("mepSystemType", "blockId").projection(arrayListOf("mepSystemType", "blockId")).exec()
-//                    exec.forEach {
-//                        val domain = toolsMap(it.mepSystemType!!)
-//                        val result = mapper.sysDirection(projectId, buildingId, it.blockId!!, it.mepSystemType!!, domain, true)
-//                        if (!result) {
-//                            upDateBiaoji(projectId,relationType ,5)
-//                            return SBaseResponse(SResponseType.success)
-//                        }
-//                    }
+                    val exec = connectedBlockService.select(SFilter.eq("projectId", projectId), SFilter.inList("mepSystemType", systemName)).group("mepSystemType", "blockId").projection(arrayListOf("mepSystemType", "blockId")).exec()
+                    exec.forEach {
+                        val domain = toolsMap(it.mepSystemType!!)
+                        val result = mapper.sysDirection(projectId, buildingId, it.blockId!!, it.mepSystemType!!, domain, true)
+                        if (!result) {
+                            upDateBiaoji(projectId,relationType ,5)
+                            return SBaseResponse(SResponseType.success)
+                        }
+                    }
                     try {
                         // 生成数据中心使用的关系
-//                        val generateRelation = mepSystemCalcService.generateRelation(projectId, relationType, null, systemName)
-//                        generateRelation.addAll(mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, null, systemName))
-                        val generateRelation = mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, buildingId, systemName)
+                        val generateRelation = mepSystemCalcService.generateRelation(projectId, relationType, null, systemName)
+                        generateRelation.addAll(mepSystemCalcService.generateNonDirectionalRelation(projectId, relationType, null, systemName))
                         if (generateRelation.size>0){
                             val delete = rEq2EqService.delete(SFilter.eq("projectId", projectId), SFilter.eq("type", relationType), SFilter.eq("sign", 2))
 

+ 5 - 13
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/RelationCalcService.kt

@@ -509,7 +509,7 @@ open class RelationCalcService {
             val result = mapper.calcFl2Sp(tablesName, projectId)
             if (result != null && result == 0) {
                 /** 发送消息 */
-                rabbitMqService.sendRel(Opt.projectId!!, "Fl2Sp_in", "20", tables!!, "456")
+                rabbitMqService.sendRel(Opt.projectId!!, "Fl2Sp_in", "20", "全量同步", "456")
                 upDate(projectId, "fl2sp")
                 return SBaseResponse(SResponseType.success)
             } else {
@@ -948,9 +948,7 @@ open class RelationCalcService {
      */
     fun upDateBiaoji(projectId: String, type: String, sing: Int) {
         try {
-            val list = ArrayList<String>()
-            list.add("ComputationalState")
-            list.add("ComputingTime")
+
             if (sing == 3) {
                 logger.debug("type1= $type********************************************")
                 val entity = relationTypeProjectservice.select(SFilter.eq("projectId", projectId), SFilter.eq("relationType", type)).entity()
@@ -958,7 +956,7 @@ open class RelationCalcService {
                     entity.computationalState = 3
                     entity.computingTime = IdUtils.time()
                     logger.debug("computingTime= ${entity.computingTime},graphic_id =${entity.graphicId} ,code = ${entity.relationTypeCode},id= ${entity.id},project_id = ${entity.projectId}********************************************")
-                    val update = relationTypeProjectservice.update(entity, list)
+                    val update = relationTypeProjectservice.update(entity)
                     logger.debug("update= ${update}********************************************")
                 }
                 logger.debug("type= $type********************************************")
@@ -967,7 +965,7 @@ open class RelationCalcService {
                 if (entity != null) {
                     entity.computationalState = 5
                     entity.computingTime = IdUtils.time()
-                    relationTypeProjectservice.update(entity, list)
+                    relationTypeProjectservice.update(entity)
                 }
                 logger.debug("type3= $type********************************************")
             }
@@ -1049,7 +1047,7 @@ open class RelationCalcService {
                 /** 处理关系 */
                 val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
                         SFilter.inList("classCode",
-                                arrayListOf("SETP", "SERH", "SECT"))).exec()
+                                arrayListOf("OTSETP", "OTSERH", "OTSECT"))).exec()
                 logger.debug("设备长度: ${equipmentList.size}")
                 logger.debug("设备长度: ${equipmentList.size}")
                 if (equipmentList.size > 0) {
@@ -1119,18 +1117,13 @@ open class RelationCalcService {
 
             /*************************上面添加数据**********************************/
 
-
-
 //            REq2SpService.delete(SFilter.eq("projectId", projectId),
 //                     SFilter.eq("type", "eq2sp_for"))
             val r2 = mapper.insertsp(projectId)
 //                logger.debug("设备关联业务空间计算结果= ${r1}+${r2}")
 
-
-
             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()
@@ -1143,7 +1136,6 @@ open class RelationCalcService {
                     e.printStackTrace()
                 }
 
-
                 /** 处理关系 */
                 val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId),
                         SFilter.inList("classCode",

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

@@ -235,12 +235,12 @@ class AutomaticCalculationSync {
                         val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, toJsonObjArray)
                         if (!createRel){
                             message.sign = 2
-                            message.count +1
+                            message.count= message.count +1
                         }
                     } catch (e: Exception) {
                         e.printStackTrace()
                         message.sign = 2
-                        message.count +1
+                        message.count =message.count +1
                     }
                 }
             }