Преглед изворни кода

**************************************万达adm*********************************************
添加数据平台地址

zhangweixin пре 4 година
родитељ
комит
58545582b4

+ 6 - 5
datasyn/src/main/kotlin/com/persagy/server/datacenter/syn/controllers/obj/ObjectToFromController.kt

@@ -128,10 +128,10 @@ class ObjectToFromController {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
             val floorList = floorService.select(SFilter.eq("projectId", projectId)).exec()
             for (floor in floorList){
-                val floorOutline = floorOutlineService.select(SFilter.eq("id", floor.id!!)).entity()
-                if (floorOutline!=null){
-                    floor.outline = floorOutline.outline
-                }
+//                val floorOutline = floorOutlineService.select(SFilter.eq("id", floor.id!!)).entity()
+//                if (floorOutline!=null){
+//                    floor.outline = floorOutline.outline
+//                }
                 val createObj = FloorApi.createObj(dictProject!!.groupCode!!, projectId, floor)
                 if (!createObj){
                     val updateObj = FloorApi.updateObj(dictProject!!.groupCode!!, projectId, floor)
@@ -140,6 +140,7 @@ class ObjectToFromController {
                     }
                 }
 
+
                 val ObjArray = toJsonObjArray("ArchSubset", "Bd2Fl", floor.buildingId!!, floor.id!!)
                 val createRel = EquipApi.createRel(dictProject.groupCode!!, projectId, ObjArray)
             }
@@ -174,7 +175,7 @@ class ObjectToFromController {
                         Configure.toJsonObjArray("MechInArch", "Eq2Bd", equip.id!!, equip.buildingId!!)
                     val toJsonObjArray2 =
                         Configure.toJsonObjArray("MechInArch", "Eq2Fl", equip.id!!, equip.floorId!!)
-                    toJsonObjArray.plus(toJsonObjArray2[0])
+                    toJsonObjArray.add(toJsonObjArray2[0])
                     val createRel = EquipApi.createRel(dictProject.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("设备和楼层的关系失败:${equip.toJson()}")

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

@@ -34,6 +34,7 @@ import com.persagy.server.datacenter.models.entities.dictnew.DictProject
 import com.persagy.server.datacenter.wanda.obj.Equipment
 import com.persagy.server.datacenter.models.entities.rel.*
 import com.persagy.server.datacenter.wanda.obj.Floor
+import com.persagy.server.datacenter.wanda.obj.ZoneSpace
 import com.persagy.server.datacenter.wanda.rel.REq2Eq
 import com.persagy.server.datacenter.wanda.rel.REq2Sp
 import com.persagy.server.datacenter.wanda.rel.RSp2Sp
@@ -132,9 +133,10 @@ 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("floorId"))).exec()
                 if (equipmentList.size>0) {
                     for (equipment in equipmentList) {
+
                         val toJsonObjArray =
                                 Configure.toJsonObjArray(graphCode, type, equipment.id!!, equipment.floorId!!,null)
                         if (isDel) {
@@ -656,15 +658,16 @@ class RelToFromController {
     fun fl2sp(@RequestParam projectId: String,@RequestParam graphCode: String,@RequestParam type: String,@RequestParam isDel: Boolean = false): SBaseResponse {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
-            val rSpinFlList = rSpinFlService.select(SFilter.eq("projectId", projectId)).exec()
-            if (rSpinFlList.size>0){
-                for (rSpinFl in rSpinFlList) {
+//            val rSpinFlList = rSpinFlService.select(SFilter.eq("projectId", projectId)).exec()
+            val spaceList = spaceService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("floorId"))).exec()
+            if (spaceList.size>0){
+                for (rSpinFl in spaceList) {
                     if (isDel) {
-                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinFl.floorId!!, null)
+                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinFl.floorId!!, rSpinFl.id!!)
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =
-                            Configure.toJsonObjArray(graphCode, type, rSpinFl.floorId!!, rSpinFl.spaceId!!)
+                            Configure.toJsonObjArray(graphCode, type, rSpinFl.floorId!!, rSpinFl.id!!)
                     val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("楼层下的业务空间关系:${toJsonObjArray.toJson()}")
@@ -678,6 +681,8 @@ class RelToFromController {
         }
     }
 
+    /** 数据中心空间服务 */
+    private val spaceService = SObjectService(SMybatisDao(ZoneSpace::class.java))
     /**
      * 建筑体下的业务空间
      */
@@ -686,15 +691,16 @@ class RelToFromController {
     fun bd2sp(@RequestParam projectId: String,@RequestParam graphCode: String,@RequestParam type: String,@RequestParam isDel: Boolean = false): SBaseResponse {
         try {
             val dictProject = dictProjectService.select(SFilter.eq("id", projectId)).entity()
-            val rSpinBdList = rSpinBdService.select(SFilter.eq("projectId", projectId)).exec()
-            if (rSpinBdList.size>0){
-                for (rSpinBd in rSpinBdList) {
+//            val rSpinBdList = rSpinBdService.select(SFilter.eq("projectId", projectId)).exec()
+            val spaceList = spaceService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("buildingId"))).exec()
+            if (spaceList.size>0){
+                for (rSpinBd in spaceList) {
                     if (isDel) {
-                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinBd.buildingId!!, null)
+                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSpinBd.buildingId!!, rSpinBd.id!!)
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =
-                            Configure.toJsonObjArray(graphCode, type, rSpinBd.buildingId!!, rSpinBd.spaceId!!)
+                            Configure.toJsonObjArray(graphCode, type, rSpinBd.buildingId!!, rSpinBd.id!!)
                     val createRel = EquipApi.createRel(dictProject!!.groupCode!!, projectId, toJsonObjArray)
                     if (!createRel){
                         logger.debug("建筑体下的业务空间关系:${toJsonObjArray.toJson()}")

+ 1 - 0
datasyn/src/main/kotlin/com/persagy/server/datacenter/syn/models/api/obj/EquipApi.kt

@@ -225,6 +225,7 @@ object EquipApi {
             logger.debug("url=${url}")
             logger.debug("boby=${listObj.toJson()}")
             val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listObj)
+            logger.debug("result=${postObject.toJson()}")
             if (postObject.result == "success") {
                 return true
             }

+ 12 - 20
datasyn/src/main/kotlin/com/persagy/server/datacenter/syn/services/jms/DataCenterSpace.kt

@@ -96,37 +96,29 @@ class DataCenterSpace {
                             val listRel = ArrayList<JSONObject>()
                             val jsonArray = JSONArray()
                             /** 业务空间的建筑 */
-                            if (rSpinBdList.size>0){
-                                for (rSpinBd in rSpinBdList) {
-                                    val toJsonObj =
-                                        toJsonObjArray("ArchSubset", "Bd2Sp", space.id!!, rSpinBd.buildingId!!)
+                            if (!space.buildingId.isNullOrEmpty()) {
+                                val toJsonObj =
+                                    toJsonObjArray("ArchSubset", "Bd2Sp", space.id!!, space.buildingId!!)
+                                jsonArray.add(toJsonObj)
+                                if (!space.floorId.isNullOrEmpty()) {
+                                    val toJsonObjFloor =
+                                        toJsonObjArray("ArchSubset", "Fl2Sp", space.id!!, space.floorId!!)
                                     jsonArray.add(toJsonObj)
                                 }
-                            }
-                            /** 业务空间的楼层 */
-                            if (rSpinFlList.size>0){
-                                for (rSpinFl in rSpinFlList){
-                                    val toJsonObj =
-                                        toJsonObjArray("ArchSubset", "Fl2Sp", space.id!!, rSpinFl.floorId!!)
-                                    jsonArray.add(toJsonObj)
-                                }
-                            }
-                            if (listRel.size>0) {
                                 val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, jsonArray)
                                 if (!createRel){
                                     message.sign = 2
-                                    message.count +1
+                                    message.count = message.count +1
                                 }
                             }
-
                         } else {
                             message.sign = 2
-                            message.count +1
+                            message.count = message.count +1
                         }
                     }else {
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count +1
                     }
 
                 }else {
@@ -152,7 +144,7 @@ class DataCenterSpace {
                     }else {
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count +1
                     }
                 }else {
                     message.sign = 0
@@ -169,7 +161,7 @@ class DataCenterSpace {
                 }else {
                     /** 失败 */
                     message.sign = 2
-                    message.count +1
+                    message.count = message.count +1
                 }
                 /** 更改标记 */
                 synchronousMessageObjService.update(message)