Browse Source

********************WX******************
删除建筑和楼层提示

zhangweixin 4 years ago
parent
commit
76e4e7435d

+ 1 - 1
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/Equipment.kt

@@ -217,7 +217,7 @@ open class Equipment : BaseInfo() {
     /** 备注 */
     @Schema(description = "备注")
     @Column(name = "note")
-    var note: Int? = null
+    var note: String? = null
 
     /** 备注 */
     @Schema(description = "客户端id")

+ 1 - 0
data-core/src/main/kotlin/com/persagy/server/scanbuilding/UserLog.kt

@@ -83,6 +83,7 @@ class UserLog : SBaseEntity() {
     var note:String? = null
 
     @Schema(description = "")
+    @Column(name = "comming")
     var comming:String? = null
 
 } // Class UserLog

+ 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")

+ 1 - 18
datacenter/src/main/kotlin/com/persagy/server/services/base/Service.kt

@@ -104,24 +104,7 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
                 e.printStackTrace()
             }
 
-            if (!Opt.coming.isNullOrEmpty()&&Opt.coming == "app") {
-                try {
-                    val user = PropertyService.userService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("name", Opt.account!!)).entity()
-                    val userLog = UserLog()
-                    userLog.comming = "app"
-                    userLog.action = "创建设备"
-                    userLog.id = IdUtils.uuidCreate()
-                    userLog.note = "创建现场发现的设备"
-                    userLog.phone = user?.phone
-                    userLog.projectId = Opt.projectId
-                    userLog.userId = user?.id
-                    userLog.name = user?.name
-                    userLog.objectId = it.keyValue("id").toString()
-                    PropertyService.userLogService.insert(userLog)
-                } catch (e: Exception) {
-                    e.printStackTrace()
-                }
-            }
+
         }
 
         return

+ 29 - 5
datacenter/src/main/kotlin/com/persagy/server/services/objects/EquipmentService.kt

@@ -120,8 +120,14 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                     equip.name = ShaftNameUtil.shaftName("设备-")
                 }
             }
-            if (!Opt.account.isNullOrEmpty()){
-                equip.findPeople = Opt.account
+
+            try {
+                if (!Opt.coming.isNullOrEmpty()&&Opt.coming == "app"&&!Opt.account.isNullOrEmpty()){
+                    val user = LocationPointServices.userService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("phone", Opt.account!!)).entity()
+                    equip.findPeople = user?.name
+                }
+            } catch (e: Exception) {
+                e.printStackTrace()
             }
             equip.codeType = 1
         } catch (e: Exception) {
@@ -345,7 +351,25 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                         e.printStackTrace()
                     }
                     //添加信息点创建 表号功能号
-                    ObjInfoService.createInfo(entity,true,"Eq",entity.classCode!!)
+//                    ObjInfoService.createInfo(entity,true,"Eq",entity.classCode!!)
+                }
+                if (!Opt.coming.isNullOrEmpty()&&Opt.coming == "app") {
+                    try {
+                        val user = PropertyService.userService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("phone", Opt.account!!)).entity()
+                        val userLog = UserLog()
+                        userLog.comming = "app"
+                        userLog.action = "创建设备"
+                        userLog.id = IdUtils.uuidCreate()
+                        userLog.note = "创建现场发现的设备"
+                        userLog.phone = user?.phone
+                        userLog.projectId = Opt.projectId
+                        userLog.userId = user?.id
+                        userLog.name = user?.name
+                        userLog.objectId = it.keyValue("id").toString()
+                        PropertyService.userLogService.insert(userLog)
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
                 }
 
             } catch (e: Exception) {
@@ -390,7 +414,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                 try {
                     if (!Opt.coming.isNullOrEmpty()){
                         if (Opt.coming == "app"){
-                            val user = LocationPointServices.userService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("name", Opt.account!!)).entity()
+                            val user = LocationPointServices.userService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("phone", Opt.account!!)).entity()
                             val userLog = UserLog()
                             userLog.comming = "app"
                             userLog.action = "更新设备"
@@ -432,7 +456,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                 }
 
                 try {//更新信息点 表号功能号
-                    oService.delete(SFilter.eq("projectId",Opt.projectId!!), SFilter.eq("objId",entity.id!!), SFilter.eq("objType","Eq"))
+//                    oService.delete(SFilter.eq("projectId",Opt.projectId!!), SFilter.eq("objId",entity.id!!), SFilter.eq("objType","Eq"))
                 } catch (e: Exception) {
                     e.printStackTrace()
                 }

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/services/objects/LocationPointServices.kt

@@ -92,7 +92,7 @@ object LocationPointServices : RService<LocationPoint>(SMybatisDao(LocationPoint
             for (entity in entityList){
                 try {
                     if (!Opt.coming.isNullOrEmpty()&&Opt.coming == "app"){
-                            val user = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("name", Opt.account!!)).entity()
+                            val user = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("phone", Opt.account!!)).entity()
                             val userLog = UserLog()
                             userLog.comming = "app"
                             userLog.action = "创建点位标签"

+ 74 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/TestControllers.kt

@@ -34,8 +34,12 @@ import com.persagy.server.datacenter.models.entities.dictnew.DictProject
 import com.persagy.server.datacenter.models.entities.objects.Equipment
 import com.persagy.server.datacenter.models.entities.objects.Floor
 import com.persagy.server.datacenter.models.entities.objects.Project
+import com.persagy.server.datacenter.models.entities.objects.ZoneSpace
+import com.persagy.server.datacenter.models.entities.rel.RSpinBd
+import com.persagy.server.datacenter.models.entities.rel.RSpinFl
 import com.persagy.server.syn.models.api.obj.BuildingApi
 import com.persagy.server.syn.models.api.obj.EquipApi
+import com.persagy.server.syn.models.test.ZoneSpaceTest
 import com.persagy.server.syn.models.tools.EquipUtil
 import com.persagy.server.syn.services.dict.DClassDefService
 import com.persagy.server.syn.utils.ShaftNameUtil
@@ -81,6 +85,13 @@ class TestControllers {
 
     /** 信息点 */
     private val dictDefFuncId = SObjectService(SMybatisDao(DefFuncId::class.java))
+    /** 空间-old */
+    private val zoneSpaceTestService = SObjectService(SMybatisDao(ZoneSpaceTest::class.java))
+    /** 空间-old */
+    private val zoneSpaceService = SObjectService(SMybatisDao(ZoneSpace::class.java))
+    /** 空间-old */
+    private val rSpinBdService = SObjectService(SMybatisDao(RSpinBd::class.java))
+    private val rSpinFlService = SObjectService(SMybatisDao(RSpinFl::class.java))
 
     /**
      * 设备
@@ -217,6 +228,69 @@ class TestControllers {
     }
 
 
+    /**
+     *
+     */
+    @Operation(summary = "恢复数据 ", description = "")
+    @PostMapping(value = ["/space/data"])
+    fun spaceData(@RequestParam projectId: String): SCreateResponse<Equipment>  {
+        return try {
+        val zoneSpaceList = zoneSpaceTestService.select(SFilter.eq("projectId", projectId)).exec()
+        for (zoneSpaceOld in zoneSpaceList) {
+
+            val zoneSpace = ZoneSpace()
+            zoneSpace.id = zoneSpaceOld.id
+            zoneSpace.localId = zoneSpaceOld.localId
+            zoneSpace.localName = zoneSpaceOld.localName
+            zoneSpace.bimLocation = zoneSpaceOld.bimLocation
+            zoneSpace.buildingId = zoneSpaceOld.buildingId
+            zoneSpace.classCode = zoneSpaceOld.classCode
+            zoneSpace.outline = zoneSpaceOld.outline
+            zoneSpace.name = zoneSpaceOld.name
+            zoneSpace.height = zoneSpaceOld.height
+            zoneSpace.projectId = zoneSpaceOld.projectId
+            zoneSpace.floorId = zoneSpaceOld.floorId
+            val replace = zoneSpaceService.replace(zoneSpace)
+            if (replace) {
+
+                if (!zoneSpaceOld.buildingId.isNullOrEmpty()) {
+                    try {
+                        val rSpinBd = RSpinBd()
+                        rSpinBd.buildingId =   zoneSpaceOld.buildingId
+                        rSpinBd.projectId = projectId
+                        rSpinBd.objectType = zoneSpace.classCode
+                        rSpinBd.sign = 1
+                        rSpinBd.spaceId = zoneSpace.id
+                        rSpinBdService.replace(rSpinBd)
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+                }
+
+                try {
+                    if (!zoneSpaceOld.buildingId.isNullOrEmpty()&&!zoneSpaceOld.floorId.isNullOrEmpty()) {
+                        val rSpinFl = RSpinFl()
+                        rSpinFl.buildingId =   zoneSpaceOld.buildingId
+                        rSpinFl.floorId = zoneSpaceOld.floorId
+                        rSpinFl.projectId = projectId
+                        rSpinFl.objectType = zoneSpace.classCode
+                        rSpinFl.sign = 1
+                        rSpinFl.spaceId = zoneSpace.id
+                        rSpinFlService.replace(rSpinFl)
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+
+
+            }
+        }
+            SCreateResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SCreateResponse(SResponseType.failure, e.message!!)
+        }
+    }
 
 
 

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

@@ -71,6 +71,8 @@ object EquipApi {
         /** 直接 http 请求还是通过注册中心 */
         if (!Configure.customProperties.eurekaorhttp) {
             val url = "${opts.data_rwd}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            logger.debug("url = ${url}")
+            logger.debug("boby= ${jsonObject.toJson()}")
             val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
             if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
                 return postObject
@@ -78,6 +80,8 @@ object EquipApi {
             return postObject
         } else {
             val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/query?groupCode=$groupCode&projectId=${projectId}"
+            logger.debug("url = ${url}")
+            logger.debug("boby= ${jsonObject.toJson()}")
             val postObject = Configure.restTemplate.postForObject(url, jsonObject, MiddleGroundDataRespose::class.java)
             if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
                 return postObject

+ 102 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/models/test/ZoneSpaceTest.kt

@@ -0,0 +1,102 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.syn.models.test
+
+import com.persagy.server.datacenter.models.entities.assistant.PointPosition
+import com.persagy.service.models.SBaseEntity
+import io.swagger.v3.oas.annotations.media.Schema
+import java.io.Serializable
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 空间父类
+ *
+ * @author  张维新
+ */
+@Schema(description = "空间父类实体类")
+@Table(name = "zone_space_base_copy002")
+open class ZoneSpaceTest: Serializable, SBaseEntity() {
+
+    /** 空间ID */
+    @Schema(description = "空间ID")
+    @Id
+    @Column(name = "id")
+    var id: String? = null
+
+    /** 空间名称 */
+    @Schema(description = "空间名称")
+    @Column(name = "name")
+    var name: String? = null
+
+    /** 空间本地编码 */
+    @Schema(description = "空间本地编码")
+    @Column(name = "local_id")
+    var localId: String? = null
+
+    /** 空间本地名称 */
+    @Schema(description = "空间本地名称")
+    @Column(name = "local_name")
+    var localName: String? = null
+
+    /** 项目id */
+    @Schema(description = "项目id")
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 建筑id */
+    @Schema(description = "建筑id")
+    @Column(name = "building_id")
+    var buildingId: String? = null
+
+    /** 楼层id */
+    @Schema(description = "楼层id")
+    @Column(name = "floor_id")
+    var floorId: String? = null
+
+    /** 轮廓线 */
+    @Schema(description = "轮廓线")
+    @Column(name = "outline")
+    var outline: ArrayList<ArrayList<ArrayList<PointPosition>>>? = null
+
+    /** BIM模型中坐标 */
+    @Schema(description = "BIM模型中坐标")
+    @Column(name = "bim_location")
+    var bimLocation: String? = null
+
+    /** 高度 */
+    @Schema(description = "高度")
+    @Column(name = "height")
+    var height: Double? = null
+
+    /** 对象类型 */
+    @Schema(description = "对象类型")
+    @Column(name = "object_type")
+     var classCode: String? = null
+
+}

+ 1 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/task/SchedulerTask.kt

@@ -53,7 +53,7 @@ class SchedulerTask {
     //cron表达式:每隔5秒执行一次
 //    @Scheduled(cron = "0 */5 * * * ?")
 //    @Scheduled(cron="0/30 * *  * * ? ")   //每5秒执行一次
-    @Scheduled(cron = "0 */1 * * * ?")
+//    @Scheduled(cron = "0 */1 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始至中台")
         messageProcessing.syncDataCenter()

+ 1 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/task/SchedulerTaskRel.kt

@@ -53,7 +53,7 @@ class SchedulerTaskRel {
     //cron表达式:每隔5秒执行一次
 //    @Scheduled(cron = "0 */5 * * * ?")
 //    @Scheduled(cron="0/5 * *  * * ? ")   //每5秒执行一次
-    @Scheduled(cron = "0 */3 * * * ?")
+//    @Scheduled(cron = "0 */3 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始至数据中台-关系数据")
         messageProcessing.syncDataCenterRel()

+ 2 - 2
datasyn/src/main/resources/application-dev.yml

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

+ 1 - 0
datasyn/src/main/resources/application-test.yml

@@ -19,6 +19,7 @@ spring:
 
 
 
+
     #配置rabbitMq 服务器
 #  rabbitmq:
 #    host: 192.168.100.108

+ 3 - 3
scanbuilding/src/main/kotlin/com/persagy/server/services/task/EquipScanTaskService.kt

@@ -115,10 +115,10 @@ object EquipScanTaskService : RService<EquipScanTask>(SMybatisDao(EquipScanTask:
                 }
 //                equipment.ledgerParam.PhotoDoc.Pic
                 if(equipment!!.infos != null){//设备图片信息
-                    val photoDoc = equipment!!.infos!!.get("PhotoDoc")
+                    val photoDoc = equipment!!.infos!!.get("photoDoc")
                     if( photoDoc != null){
                         val obj = JSONObject.parseObject(photoDoc!!.toJson())
-                        val pic = obj.getString("Pic")
+                        val pic = obj.getString("pic")
 
                         val type = object : TypeToken<ArrayList<TaskPic>>() {
                         }.type
@@ -325,7 +325,7 @@ object EquipScanTaskService : RService<EquipScanTask>(SMybatisDao(EquipScanTask:
 
             try {
                 if (!Opts.coming.isNullOrEmpty()&&Opts.coming == "app"){
-                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("name", Opts.account!!)).entity()
+                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("phone", Opts.account!!)).entity()
                         val userLog = UserLog()
                         userLog.comming = "app"
                         userLog.action = "修改任务"

+ 3 - 3
scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskService.kt

@@ -135,10 +135,10 @@ object ModelScanTaskService : RService<ModelScanTask>(SMybatisDao(ModelScanTask:
 
 //                equipment.ledgerParam.PhotoDoc.Pic
                     if(equipment!!.infos != null){//设备图片信息
-                        val photoDoc = equipment!!.infos!!.get("PhotoDoc")
+                        val photoDoc = equipment!!.infos!!.get("photoDoc")
                         if( photoDoc != null){
                             val obj = JSONObject.parseObject(photoDoc!!.toJson())
-                            val pic = obj.getString("Pic")
+                            val pic = obj.getString("pic")
 
                             val type = object : TypeToken<ArrayList<TaskPic>>() {
                             }.type
@@ -318,7 +318,7 @@ object ModelScanTaskService : RService<ModelScanTask>(SMybatisDao(ModelScanTask:
             try {
                 if (!Opts.coming.isNullOrEmpty()&&Opts.coming == "app"){
 
-                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("name", Opts.account!!)).entity()
+                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("phone", Opts.account!!)).entity()
                         val userLog = UserLog()
                         userLog.comming = "app"
                         userLog.action = "修改任务"

+ 1 - 1
scanbuilding/src/main/kotlin/com/persagy/server/services/task/PropertyScanTaskService.kt

@@ -279,7 +279,7 @@ object PropertyScanTaskService : RService<PropertyScanTask>(SMybatisDao(Property
             }
             try {
                 if (!Opts.coming.isNullOrEmpty()&&Opts.coming == "app"){
-                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("name", Opts.account!!)).entity()
+                        val entity = userService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("phone", Opts.account!!)).entity()
                         val userLog = UserLog()
                         userLog.comming = "app"
                         userLog.action = "修改资产任务"