Browse Source

********************WX******************
调整空间关系

zhangweixin 4 years ago
parent
commit
aca50368c6

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/jms/TopicReceiver.kt

@@ -63,8 +63,8 @@ class TopicReceiver {
      *
      * @param
      */
-//    @RabbitListener(queues = ["queue-center-adm"])
-//    @RabbitHandler
+    @RabbitListener(queues = ["queue-center-adm"])
+    @RabbitHandler
     fun receiveMessage(message: String) {
         try {
             println("接收数据中心消息 , $message")

+ 14 - 13
datacenter/src/main/resources/application-test.yml

@@ -29,25 +29,26 @@ server:
 spring:
   datasource:
 #    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
-    url:                                jdbc:postgresql://datacenter:5432/datacenter
+    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://datacenter:5432/datacenter
     username:                           postgres
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-#  rabbitmq:
-#    host: 192.168.100.108
-#    port: 9936
-#    username: pbsage
-#    password: pbsage123
-#    #虚拟host 可以不设置,使用server默认host
-#    virtual-host: /adm
-
   rabbitmq:
-    host: 192.168.64.15
+    host: 192.168.100.108
     port: 9936
-    username: admin
-    password: brzj123456
+    username: pbsage
+    password: pbsage123
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: /test
+    virtual-host: /adm
+
+#  rabbitmq:
+#    host: 192.168.64.15
+#    port: 9936
+#    username: admin
+#    password: brzj123456
+#    #虚拟host 可以不设置,使用server默认host
+#    virtual-host: /test
 
 
   servlet:

+ 62 - 45
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/ObjectFromToControllers.kt

@@ -274,36 +274,49 @@ class ObjectFromToControllers {
                 val equipSynApi = EquipApi.equipSynApi(dictProject!!.groupCode!!,projectId, page,"equipment")
                 val equipDataList = equipSynApi.data
                 for (equipData in equipDataList!!){
-                    val equipSyn = EquipUtil.equipSyns(projectId, dictProject!!.groupCode!!, equipData)
-                    logger.debug("设备=${equipSyn.toJson()}")
-                    if (isBuildingFloor){
-                        /** 查询建筑 */
-                        val equipInBuildingList = EquipApi.equipInBuilding(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
-                        if (equipInBuildingList.size>0){
-                            val hashMap = equipInBuildingList[0]
-                            if (hashMap.containsKey("objTo")){
-                                equipSyn.buildingId = hashMap["objTo"].toString()
+                    try {
+                        val equipSyn = EquipUtil.equipSyns(projectId, dictProject!!.groupCode!!, equipData)
+                        logger.debug("设备=${equipSyn.toJson()}")
+                        if (isBuildingFloor){
+                            /** 查询建筑 */
+                            val equipInBuildingList = EquipApi.equipInBuilding(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
+                            if (equipInBuildingList.size>0){
+                                val hashMap = equipInBuildingList[0]
+                                if (hashMap.containsKey("objTo")){
+                                    equipSyn.buildingId = hashMap["objTo"].toString()
+                                }
                             }
-                        }
-                        /** 查询楼层 */
-                        val equipInFloorList = EquipApi.equipInFloor(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
-                        if (equipInFloorList.size>0){
-
-                            val hashMap = equipInFloorList[0]
-                            if (hashMap.containsKey("objTo")){
-                                equipSyn.floorId = hashMap["objTo"].toString()
+                            /** 查询楼层 */
+                            val equipInFloorList = EquipApi.equipInFloor(dictProject!!.groupCode!!,projectId, equipSyn.id!!)
+                            if (equipInFloorList.size>0){
+                                val hashMap = equipInFloorList[0]
+                                if (hashMap.containsKey("objTo")){
+                                    equipSyn.floorId = hashMap["objTo"].toString()
+                                }
                             }
-                        }
-                        if (equipSyn.buildingId.isNullOrEmpty()){
-                            if (!equipSyn.floorId.isNullOrEmpty()){
-                                val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
-                                if (floor!=null){
-                                    equipSyn.buildingId = floor.buildingId
+                            if (!equipSyn.buildingId.isNullOrEmpty()){
+                                val entity =
+                                    BaseDataService.buildingService.select(SFilter.eq("id", equipSyn.buildingId!!))
+                                        .entity()
+                                if (entity!=null) {
+                                    if (!equipSyn.floorId.isNullOrEmpty()){
+                                        val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                        if (floor==null){
+                                            equipSyn.floorId = null
+                                        }
+                                    }
+                                }else {
+                                    equipSyn.floorId = null
+                                    equipSyn.buildingId = null
                                 }
+
                             }
                         }
+                        BaseDataService.equipmentService.replace(equipSyn)
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+
                     }
-                    BaseDataService.equipmentService.replace(equipSyn)
 
                 }
                 if (equipSynApi.data!!.size>= 1000){
@@ -318,33 +331,37 @@ class ObjectFromToControllers {
                     val equipDataList = equipSynApi.data
                     for (equipData in equipDataList!!){
                         val equipSyn = EquipUtil.equipSyns(project.id!!, dictProject.groupCode!!, equipData)
-                        if (isBuildingFloor){
-                            /** 查询建筑 */
-                            val equipInBuildingList = EquipApi.equipInBuilding(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
-                            if (equipInBuildingList.size>0){
-                                val hashMap = equipInBuildingList[0]
-                                if (hashMap.containsKey("objTo")){
-                                    equipSyn.buildingId = hashMap["objTo"].toString()
+                        try {
+                            if (isBuildingFloor){
+                                /** 查询建筑 */
+                                val equipInBuildingList = EquipApi.equipInBuilding(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
+                                if (equipInBuildingList.size>0){
+                                    val hashMap = equipInBuildingList[0]
+                                    if (hashMap.containsKey("objTo")){
+                                        equipSyn.buildingId = hashMap["objTo"].toString()
+                                    }
                                 }
-                            }
-                            /** 查询楼层 */
-                            val equipInFloorList = EquipApi.equipInFloor(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
-                            if (equipInFloorList.size>0){
-                                val hashMap = equipInFloorList[0]
-                                if (hashMap.containsKey("objTo")){
-                                    equipSyn.floorId = hashMap["objTo"].toString()
+                                /** 查询楼层 */
+                                val equipInFloorList = EquipApi.equipInFloor(dictProject.groupCode!!,project.id!!, equipSyn.id!!)
+                                if (equipInFloorList.size>0){
+                                    val hashMap = equipInFloorList[0]
+                                    if (hashMap.containsKey("objTo")){
+                                        equipSyn.floorId = hashMap["objTo"].toString()
+                                    }
                                 }
-                            }
-                            if (equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
-                                if (!equipSyn.floorId.isNullOrEmpty()){
-                                    val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
-                                    if (floor!=null){
-                                        equipSyn.buildingId = floor.buildingId
+                                if (!equipSyn.buildingId.isNullOrEmpty()&&!equipSyn.floorId.isNullOrEmpty()){
+                                    if (!equipSyn.floorId.isNullOrEmpty()){
+                                        val floor = BaseDataService.floorService.select(SFilter.eq("id", equipSyn.floorId!!)).entity()
+                                        if (floor!=null){
+                                            equipSyn.buildingId = floor.buildingId
+                                        }
                                     }
                                 }
                             }
+                            BaseDataService.equipmentService.replace(equipSyn)
+                        } catch (e: Exception) {
+                            e.printStackTrace()
                         }
-                        BaseDataService.equipmentService.replace(equipSyn)
                     }
                     if (equipSynApi.data!!.size>= 1000){
                         num ++

+ 1 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelToFromController.kt

@@ -182,7 +182,7 @@ class RelToFromController {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
             if (graphCode == "MechInArch") {
-                val equipmentList = equipmentService.select(SFilter.eq("projectId", projectId)).exec()
+                val equipmentList = equipmentService.select(SFilter.eq("projectId", projectId),SFilter.not(SFilter.isNull("buildingId"))).exec()
                 if (equipmentList.size>0) {
                     for (equipment in equipmentList) {
                         val toJsonObjArray =

+ 2 - 2
equip-component/src/main/resources/application-test.yml

@@ -21,8 +21,8 @@ spring:
 #    password:                           123qwe!@#
 #    url:                                jdbc:postgresql://datacenter:5432/datacenter
 #    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
-    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
-#    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
+    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj