caiaf 3 years ago
parent
commit
03bfecd631

+ 43 - 21
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/objects/EquipmentService.kt

@@ -30,8 +30,10 @@ import com.persagy.database.SFilter
 import com.persagy.database.extensions.keyValue
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
 import com.persagy.server.datacenter.models.entities.dictnew.DefFuncIdProject
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
+import com.persagy.server.datacenter.wanda.dict.DictInfosWanDa
 import com.persagy.server.datacenter.wanda.obj.Equipment
 import com.persagy.server.datacenter.wanda.rel.REq2Sy
 import com.persagy.server.services.base.Service
@@ -73,7 +75,10 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
     private val rEq2SyService = SObjectService(SMybatisDao(REq2Sy::class.java))
 
     /** 设备与信息点关系 */
-    private val defFuncIdProjectService = SObjectService(SMybatisDao(DefFuncIdProject::class.java))
+    private val defFuncIdService = SObjectService(SMybatisDao(DefFuncId::class.java))
+
+    /** 对照表 */
+    private val dictInfosWanDaService = SObjectService(SMybatisDao(DictInfosWanDa::class.java))
 
     /**
      * 创建前赋值操作
@@ -235,25 +240,39 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
         response.contentType = "application/octet-stream"
         response.setHeader("Content-disposition", "attachment;filename=equip-$classCode.xlsx")
         response.flushBuffer()
-        val defFuncIds = defFuncIdProjectService.select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode)).exec()
+        val dictInfosWanDaGroupList = dictInfosWanDaService.select(SFilter.eq("groupCode", "WD"), SFilter.eq("projectId", "0"), SFilter.eq("stage","moms")).exec()
+        val dictInfosWanDaProjectList = dictInfosWanDaService.select(SFilter.eq("groupCode","WD"), SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("stage","moms")).exec()
+        val setCode = HashSet<String>()
+        for (dictInfosWanDaGroup in dictInfosWanDaGroupList){
+            setCode.add(dictInfosWanDaGroup.code!!)
+        }
+        if (dictInfosWanDaProjectList.size>0){
+            for (dictInfosWanDaProject in dictInfosWanDaProjectList){
+                setCode.add(dictInfosWanDaProject.code!!)
+            }
+        }
+//        if(setCode.size > 0){
+//
+//        }
+        val defFuncIds = defFuncIdService.select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode),SFilter.inList("code",ArrayList(setCode))).exec()
 
         val equipments = select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode)).exec()
         val list = ArrayList<List<Any>>()
         val firstList = ArrayList<String>()
         val codeList = ArrayList<String>()
         codeList.add("id")
-        codeList.add("bimTypeId")
-        codeList.add("systemCategory")
-        codeList.add("codeName")
+        codeList.add("bimTypeName")
+//        codeList.add("systemCategory")
+//        codeList.add("codeName")
         codeList.add("localId")
         firstList.add("设备ID-id")
-        firstList.add("BIM构件编码-bimTypeId")
-        firstList.add("系统分类-systemCategory")
-        firstList.add("设备类型名称-codeName")
+        firstList.add("构件分类名称-bimTypeName")
+//        firstList.add("系统分类-systemCategory")
+//        firstList.add("设备类型名称-codeName")
         firstList.add("本地编码-localId")
         for (defFuncId in defFuncIds) {
             codeList.add(defFuncId.code!!)
-            firstList.add("${defFuncId.name}-${defFuncId.code}")
+            firstList.add("${defFuncId.aliasName}-${defFuncId.code}")
         }
 
 
@@ -264,13 +283,15 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
             for (s in codeList) {
                 if(s == "id"){
                     itemList.add(equipment.id?:"")
-                } else if(s == "bimTypeId"){
-                    itemList.add(equipment.bimTypeId?:"")
-                }else if(s == "systemCategory"){
-                    itemList.add(equipment.systemCategory?:"")
-                }else if(s == "codeName"){
-                    itemList.add(equipment.codeName?:"")
-                }else if(s == "localId"){
+                } else if(s == "bimTypeName"){
+                    itemList.add(equipment.bimTypeName?:"")
+                }
+//                else if(s == "systemCategory"){
+//                    itemList.add(equipment.systemCategory?:"")
+//                }else if(s == "codeName"){
+//                    itemList.add(equipment.codeName?:"")
+//                }
+                else if(s == "localId"){
                     itemList.add(equipment.localId?:"")
                 }else{
                     if(infos != null && infos[s] != null){
@@ -280,7 +301,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                     }
                 }
 
-                
+
             }
             list.add(itemList)
 
@@ -340,15 +361,15 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                 equipMap[equipment.id!!] = equipment
             }
             val content = ArrayList<Equipment>()
-            val list = readExcel(file.inputStream,"")
+            val list = readExcel(file.inputStream,"设备绑点")
             for (map in list) {
                 val infos = HashMap<String,Any?>()
                 var equipId : String? = null
                 for (key in map.keys) {
-                    val code = key.substring(key.lastIndexOf("-"),key.length)
+                    val code = key.substring(key.lastIndexOf("-")+1,key.length)
                     if(code == "id"){
                         equipId = map[key]!!
-                    } else if(code == "bimTypeId"){
+                    } else if(code == "bimTypeName"){
 
                     }else if(code == "systemCategory"){
 
@@ -358,13 +379,14 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
 
                     }else{
                         if(!map[key].isNullOrEmpty()){
-                            infos[key] = map[key]
+                            infos[code] = map[key]
                         }
                     }
                 }
 
                 val equipment = equipMap[equipId]
                 if(equipment != null){
+                    equipment.infos = infos
                     content.add(equipment)
                 }
             }

+ 22 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/relation_calc/ManualRelationCalcAddService.kt

@@ -2,6 +2,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.RelationAddRequest
 import com.persagy.server.datacenter.datacenter.models.entities.graphtype.rel.RelZoneSpace
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
@@ -13,10 +14,12 @@ import com.persagy.server.datacenter.wanda.rel.REq2Eq
 import com.persagy.server.datacenter.wanda.rel.REq2Sp
 import com.persagy.server.datacenter.wanda.rel.REq2Sy
 import com.persagy.server.datacenter.wanda.rel.RSp2Sp
+import com.persagy.server.jms.RabbitMqService
 import com.persagy.server.services.objects.FloorService
 import com.persagy.service.SObjectService
 import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.utils.SSpringContextUtil
 import org.springframework.stereotype.Service
 import java.text.SimpleDateFormat
 import java.util.*
@@ -41,7 +44,11 @@ class ManualRelationCalcAddService {
     private val rEq2SpService = SObjectService(SMybatisDao(REq2Sp::class.java))
     /** 阀门限制设备关系 */
     private val rEq2EqService = SObjectService(SMybatisDao(REq2Eq::class.java))
+    /** RabbitMQ消息对象 */
 
+    val rabbitMqService by lazy {
+        SSpringContextUtil.getBean(RabbitMqService::class.java) as RabbitMqService
+    }
 
     /**
      * 添加关系
@@ -151,6 +158,9 @@ class ManualRelationCalcAddService {
             for (relZoneSpace in relZoneSpaceList) {
                 relZoneSpace.buildingId = buildingList[0].id
                 relZoneSpaceService.update(relZoneSpace)
+
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",relZoneSpace.buildingId!!,relZoneSpace.id!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -208,6 +218,8 @@ class ManualRelationCalcAddService {
                 relZoneSpace.floorId = floorList[0].id
                 relZoneSpace.buildingId = floorList[0].buildingId
                 relZoneSpaceService.update(relZoneSpace)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",relZoneSpace.floorId!!,relZoneSpace.id!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -267,6 +279,8 @@ class ManualRelationCalcAddService {
                 val equipment = equipmentList[0]
                 equipment.buildingId = building.id
                 EquipmentService.update(equipment)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",equipment.id!!,equipment.buildingId!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -327,6 +341,8 @@ class ManualRelationCalcAddService {
                 equipment.buildingId = floor.buildingId
                 equipment.floorId = floor.id
                 EquipmentService.update(equipment)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",equipment.id!!,equipment.floorId!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -459,6 +475,8 @@ class ManualRelationCalcAddService {
                 rSp2Sp.zoneType = relZoneSpace.classCode
                 rSp2Sp.sign = 1
                 rSp2SpService.replace(rSp2Sp)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",rSp2Sp.id1!!,rSp2Sp.id2!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -514,6 +532,8 @@ class ManualRelationCalcAddService {
                 rEq2Sy.sign = 1
                 rEq2Sy.projectId = projectId
                 rEq2SyService.replace(rEq2Sy)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",rEq2Sy.id1!!,rEq2Sy.id2!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"
@@ -588,6 +608,8 @@ class ManualRelationCalcAddService {
                 rEq2Sp.projectId = projectId
                 rEq2Sp.zoneType = zoneSpace.classCode
                 rEq2SpService.replace(rEq2Sp)
+                //rabbit同步
+                rabbitMqService.sendRel(Opt.projectId!!, relationAddRequest.graphicType!!,relationAddRequest.relType!!,"11",rEq2Sp.id1!!,rEq2Sp.id2!!)
             }
             sCreateResponse.result = SResponseType.success
             sCreateResponse.message = "添加成功"