소스 검색

********************WX************************
蜡笔森林:<wip>> <修改服务接口>
数据中心:<wip>> <添加MQ>
数据中同步:<wip>> <添加MQ>

zhangweixin 4 년 전
부모
커밋
57bcfad542
54개의 변경된 파일1281개의 추가작업 그리고 806개의 파일을 삭제
  1. 1 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dictnew/DefClass.kt
  2. 47 11
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/logs/DataCenterLogs.kt
  3. 1 1
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/Floor.kt
  4. 5 3
      datacenter/build.gradle
  5. 12 14
      datacenter/src/main/kotlin/com/persagy/server/DataCenterApp.kt
  6. 6 0
      datacenter/src/main/kotlin/com/persagy/server/Opt.kt
  7. 1 2
      datacenter/src/main/kotlin/com/persagy/server/Swagger2Config.kt
  8. 123 0
      datacenter/src/main/kotlin/com/persagy/server/Swagger3Config.kt
  9. 4 6
      datacenter/src/main/kotlin/com/persagy/server/controllers/objects/FloorController.kt
  10. 118 9
      datacenter/src/main/kotlin/com/persagy/server/jms/RabbitMqService.kt
  11. 2 4
      datacenter/src/main/kotlin/com/persagy/server/jms/TopicReceiver.kt
  12. 17 1
      datacenter/src/main/kotlin/com/persagy/server/jms/bean/MessageNotice.kt
  13. 3 1
      datacenter/src/main/kotlin/com/persagy/server/jms/bean/SBaseNotice.kt
  14. 42 0
      datacenter/src/main/kotlin/com/persagy/server/jms/bean/SynchronousMessageObj.kt
  15. 38 0
      datacenter/src/main/kotlin/com/persagy/server/jms/bean/SynchronousMessageRel.kt
  16. 27 29
      datacenter/src/main/kotlin/com/persagy/server/services/assistant/ObjInfoService.kt
  17. 1 1
      datacenter/src/main/kotlin/com/persagy/server/services/assistant/SchemeService.kt
  18. 70 104
      datacenter/src/main/kotlin/com/persagy/server/services/base/Service.kt
  19. 38 0
      datacenter/src/main/kotlin/com/persagy/server/services/log/DataCenterLogsService.kt
  20. 218 222
      datacenter/src/main/kotlin/com/persagy/server/services/objects/FloorService.kt
  21. 1 1
      datacenter/src/main/kotlin/com/persagy/server/services/objects/ZoneSpaceBaseService.kt
  22. 2 2
      datacenter/src/main/kotlin/com/persagy/server/synchronize/KafkaService.kt
  23. 2 4
      datacenter/src/main/kotlin/com/persagy/server/synchronize/MessageHandler.kt
  24. 15 0
      datacenter/src/main/kotlin/com/persagy/server/utils/MessageEnum.kt
  25. 2 1
      datacenter/src/main/resources/application-dev.yml
  26. 9 3
      datacenter/src/main/resources/application-prod.yml
  27. 11 11
      datacenter/src/main/resources/application.yml
  28. 31 0
      datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/ObjectFromToControllers.kt
  29. 13 11
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/dict/DictTypeApi.kt
  30. 5 5
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/BuildingApi.kt
  31. 3 3
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt
  32. 22 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ProjectApi.kt
  33. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ShaftApi.kt
  34. 3 3
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SpaceApi.kt
  35. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SystemApi.kt
  36. 1 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/BuildingUtil.kt
  37. 3 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/EquipUtil.kt
  38. 1 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/FloorUtil.kt
  39. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/ProjectUtil.kt
  40. 1 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/ShaftUtil.kt
  41. 315 316
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/SpaceUtil.kt
  42. 1 2
      datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/SystemUtil.kt
  43. 2 2
      datasyn/src/main/kotlin/com/persagy/server/syn/services/dict/DClassDefService.kt
  44. 3 2
      datasyn/src/main/resources/application-dev.yml
  45. 1 1
      equip-componnet/src/main/kotlin/com/persagy/server/service/EquipORComponCategoryService.kt
  46. 2 1
      equip-componnet/src/main/resources/application-prod.yml
  47. 2 1
      gradle.properties
  48. 1 1
      meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKu.kt
  49. 2 2
      meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKuAnchor.kt
  50. 2 2
      meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKuState.kt
  51. 4 4
      meiku/src/main/kotlin/com/persagy/server/meiku/services/MeiKuService.kt
  52. 5 0
      meiku/src/main/resources/application-dev.yml
  53. 0 7
      meiku/src/main/resources/application-prod.yml
  54. 39 0
      pendingIssues.md

+ 1 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/dictnew/DefClass.kt

@@ -25,6 +25,7 @@ class DefClass : SBaseEntity(){
 
     /** 编码 */
     @ApiModelProperty(value = "编码")
+    @Id
     @Column(name = "code")
     var  code: String? = null
 

+ 47 - 11
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/logs/DataCenterLogs.kt

@@ -1,9 +1,9 @@
 package com.persagy.server.datacenter.models.entities.logs
 
-import com.alibaba.fastjson.annotation.JSONField
-import com.persagy.server.datacenter.models.entities.base.BaseInfo
 import io.swagger.annotations.ApiModel
 import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+import java.util.*
 import javax.persistence.Column
 import javax.persistence.Table
 
@@ -14,54 +14,90 @@ import javax.persistence.Table
  */
 @ApiModel(description = "建筑信息实体类")
 @Table(name = "data_center_log")
-class DataCenterLogs : BaseInfo(){
+class DataCenterLogs : Serializable {
+
+
+
+
+
+    constructor(
+        id: String?,
+        projectId: String?,
+        type: String?,
+        dataSource: HashMap<String, Any?>?,
+        author: String?,
+        objectId: String?,
+        coming: String?,
+        account: String?,
+        objectType: String
+    ) : super() {
+        this.id = id
+        this.projectId = projectId
+        this.type = type
+        this.dataSource = dataSource
+        this.author = author
+        this.objectId = objectId
+        this.coming = coming
+        this.account = account
+        this.objectType = objectType
+    }
+
+    constructor()
 
     /** ID */
     @ApiModelProperty(value = "ID")
     @Column(name = "id")
-    @JSONField(name = "Id")
     var id: String? = null
 
     /** 项目id */
     @ApiModelProperty(value = "项目id")
     @Column(name = "project_id")
-    @JSONField(name = "ProjectId")
     var projectId: String? = null
 
     /** 操作类型 */
     @ApiModelProperty(value = "操作类型")
     @Column(name = "type")
-    @JSONField(name = "Type")
     var type: String? = null
 
     /** 数据 */
     @ApiModelProperty(value = "数据")
     @Column(name = "data_source")
-    @JSONField(name = "DataSource")
     var dataSource: HashMap<String,Any?>? = null
 
     /** 操作者 */
     @ApiModelProperty(value = "操作者")
     @Column(name = "author")
-    @JSONField(name = "Author")
     var author: String? = null
 
     /** 对象id */
     @ApiModelProperty(value = "对象id")
     @Column(name = "object_id")
-    @JSONField(name = "ObjectId")
     var objectId: String? = null
 
     /** 来源 */
     @ApiModelProperty(value = "来源")
     @Column(name = "coming")
-    @JSONField(name = "Coming")
     var coming: String? = null
 
     /** 操作者 */
     @ApiModelProperty(value = "操作者")
     @Column(name = "account")
-    @JSONField(name = "Account")
     var account: String? = null
 
+    /** 对象类型 */
+    @ApiModelProperty(value = "对象类型")
+    @Column(name = "object_type")
+    var objectType: String? = null
+
+    /** 最后更新日期 */
+    @ApiModelProperty(value = "最后更新日期", example = "2009-04-21 13:16:00")
+    @Column(name = "last_update", updatable = false, insertable = false)
+    var lastUpdate: Date? = null
+
+    /** 创建时间 */
+    @ApiModelProperty(value = "创建时间", example = "2017-10-15 08:30:00")
+    @Column(name = "create_time", updatable = false, insertable = false)
+    var createTime: Date? = null
+
+
 } // Class DataCenterLogs

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

@@ -127,7 +127,7 @@ open class Floor : BaseInfo() {
     /** 对象类型 */
     @ApiModelProperty(value = "对象类型")
     @Column(name = "object_type")
-    override var objectType: String? = "Floor"
+    override var objectType: String? = "floor"
 
     /** 工作历信息 */
     @ApiModelProperty(value = "工作历信息")

+ 5 - 3
datacenter/build.gradle

@@ -73,9 +73,11 @@ dependencies {
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // RESTful API 文档生成工具
-    // https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
-    compile group: "io.springfox", name: "springfox-swagger-ui", version: SWAGGER_VERSION
-    compile group: "io.springfox", name: "springfox-swagger2", version: SWAGGER_VERSION
+//    // https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
+////    compile group: "io.springfox", name: "springfox-swagger-ui", version: SWAGGER_VERSION
+////    compile group: "io.springfox", name: "springfox-swagger2", version: SWAGGER_VERSION
+    // https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui
+    compile group: 'org.springdoc', name: 'springdoc-openapi-ui', version: SPRING_DOC_VERSION
 //    compile group: "com.github.xiaoymin", name: "swagger-bootstrap-ui", version: SWAGGER_BOOTSTRAP_VERSION
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

+ 12 - 14
datacenter/src/main/kotlin/com/persagy/server/DataCenterApp.kt

@@ -20,14 +20,12 @@
 
 package com.persagy.server
 
-import com.persagy.service.json.SJsonHttpMessageConverter
 import org.mybatis.spring.annotation.MapperScan
 import org.slf4j.LoggerFactory
 import org.springframework.boot.SpringApplication
 import org.springframework.boot.autoconfigure.SpringBootApplication
 import org.springframework.boot.builder.SpringApplicationBuilder
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
-import org.springframework.context.annotation.Bean
 import org.springframework.context.annotation.ComponentScan
 import org.springframework.scheduling.annotation.EnableScheduling
 
@@ -55,18 +53,18 @@ open class DataCenterApp : SpringBootServletInitializer() {
         return application.sources(DataCenterApp::class.java)
     } // Function configure
 
-    /**
-     * 配置FastJson
-     *
-     * @return  HttpMessageConverters
-     */
-    @Bean
-    @Suppress("MoveLambdaOutsideParentheses")
-    open fun jsonHttpMessageConverters(): SJsonHttpMessageConverter {
-        val fastConverter = SJsonHttpMessageConverter()
-        fastConverter.propertyNamingStrategy = com.alibaba.fastjson.PropertyNamingStrategy.CamelCase
-        return fastConverter
-    } // Function fastJsonHttpMessageConverters()
+//    /**
+//     * 配置FastJson
+//     *
+//     * @return  HttpMessageConverters
+//     */
+//    @Bean
+//    @Suppress("MoveLambdaOutsideParentheses")
+//    open fun jsonHttpMessageConverters(): SJsonHttpMessageConverter {
+//        val fastConverter = SJsonHttpMessageConverter()
+//        fastConverter.propertyNamingStrategy = com.alibaba.fastjson.PropertyNamingStrategy.CamelCase
+//        return fastConverter
+//    } // Function fastJsonHttpMessageConverters()
 
 } // Class Application
 

+ 6 - 0
datacenter/src/main/kotlin/com/persagy/server/Opt.kt

@@ -12,4 +12,10 @@ object Opt {
     /** key */
     const val routingKey = "routing-center-adm"
 
+    /** 创建 */
+    const val CREATE = "create"
+    /** 修改 */
+    const val UPDATE = "update"
+    /** 删除 */
+    const val DELETE = "delete"
 }

+ 1 - 2
datacenter/src/main/kotlin/com/persagy/server/Swagger2Config.kt

@@ -50,8 +50,7 @@ import javax.annotation.PostConstruct
  *
  * @author  PLX
  */
-@Configuration
-@EnableSwagger2
+
 open class Swagger2Config {
     companion object {
         // 日志

+ 123 - 0
datacenter/src/main/kotlin/com/persagy/server/Swagger3Config.kt

@@ -0,0 +1,123 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server
+
+import io.swagger.v3.oas.annotations.enums.ParameterIn
+import io.swagger.v3.oas.models.Components
+import io.swagger.v3.oas.models.OpenAPI
+import io.swagger.v3.oas.models.Operation
+import io.swagger.v3.oas.models.info.Contact
+import io.swagger.v3.oas.models.info.Info
+import io.swagger.v3.oas.models.info.License
+import io.swagger.v3.oas.models.media.StringSchema
+import io.swagger.v3.oas.models.parameters.Parameter
+import io.swagger.v3.oas.models.security.SecurityScheme
+import org.springdoc.core.GroupedOpenApi
+import org.springdoc.core.customizers.OperationCustomizer
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.web.method.HandlerMethod
+
+/**
+ * RESTful API文档生成器Swagger2配置
+ *
+ * @author  PLX
+ */
+@Configuration
+open class Swagger3Config {
+
+    /** 标题 */
+    private val title = "数据管理平台 API"
+    /** API 版本号 */
+    private val version = "1.0"
+
+    val operationCustomizer = GlobalHeaderOperationCustomizer()
+
+    /**
+     * API 信息
+     */
+    @Bean
+    open fun openApi(): OpenAPI {
+        val contact = Contact().name("庞利祥").email("sybotan@126.com")
+        return OpenAPI()
+            .components(
+                Components()
+                .addSecuritySchemes("basicScheme", SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic")))
+            .info(
+                Info()
+                .title(title)
+                .version(version)
+                .termsOfService("http://www.sybotan.com")
+                .contact(contact)
+                .license(
+                    License()
+                    .name("Apache 2.0")
+                    .url("http://www.sybotan.com")))
+    }
+
+
+
+    /**
+     * 字典 API 组
+     */
+    @Bean
+    open fun dictApiGroup(): GroupedOpenApi {
+        return GroupedOpenApi.builder()
+            .group("字典")
+            .pathsToMatch("/dict/**")
+            .build()
+    }
+
+    /**
+     * 对象 API 组
+     */
+    @Bean
+    open fun objectApiGroup(): GroupedOpenApi {
+        return GroupedOpenApi.builder()
+            .group("对象")
+            .pathsToMatch("/object/**")
+            .addOperationCustomizer(operationCustomizer)
+            .build()
+    }
+
+    /**
+     * 全局参数
+     *
+     * @author  庞利祥 <sybotan@126.com>
+     */
+    class GlobalHeaderOperationCustomizer : OperationCustomizer {
+        /**
+         * 接口定义器
+         *
+         * @param   operation       接口
+         * @param   handlerMethod   原接口方法
+         * @return  新定义的接口
+         */
+        override fun customize(operation: Operation, handlerMethod: HandlerMethod): Operation {
+            val projectId = Parameter().`in`(ParameterIn.HEADER.toString())
+                .name("projectId").description("项目 id")
+                .schema(StringSchema()).required(false)
+            operation.addParametersItem(projectId)
+            return operation
+        }
+    }
+
+} // Class Swagger2Config

+ 4 - 6
datacenter/src/main/kotlin/com/persagy/server/controllers/objects/FloorController.kt

@@ -20,10 +20,10 @@
 
 package com.persagy.server.controllers.objects
 
-import com.persagy.server.datacenter.models.entities.objects.Floor
-import com.persagy.server.services.objects.FloorService
 import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
+import com.persagy.server.datacenter.models.entities.objects.Floor
+import com.persagy.server.services.objects.FloorService
 import com.persagy.service.SPageContext
 import com.persagy.service.models.requests.SCreateRequest
 import com.persagy.service.models.requests.SQueryRequest
@@ -62,8 +62,7 @@ open class FloorController {
     @ApiOperation(value = "创建楼层", notes = "")
     @PostMapping(value = ["/create"])
     fun create(@RequestBody request: SCreateRequest<Floor>): SCreateResponse<Floor> {
-        logger.debug("floor =${request.toJson()}")
-        return FloorService.createList(request)
+        return FloorService.create(request)
     } // Function create()
 
     /**
@@ -88,8 +87,7 @@ open class FloorController {
     @ApiOperation(value = "更新楼层信息", notes = "")
     @PostMapping(value = ["/update"])
     fun update(@RequestBody request: SUpdateRequest<Floor>): SBaseResponse {
-        logger.debug("floorUpdate =${request.toJson()}")
-        return FloorService.updateList(request)
+        return FloorService.upDates(request)
     } // Function update()
 
     /**

+ 118 - 9
datacenter/src/main/kotlin/com/persagy/server/jms/RabbitMqService.kt

@@ -1,12 +1,19 @@
 package com.persagy.server.jms
 
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.Opt
 import com.persagy.server.jms.bean.MessageNotice
 import com.persagy.server.jms.bean.SBaseNotice
+import com.persagy.server.jms.bean.SynchronousMessageObj
+import com.persagy.server.jms.bean.SynchronousMessageRel
+import com.persagy.service.SObjectService
 import com.persagy.service.utils.SJsonUtil
+import org.slf4j.LoggerFactory
 import org.springframework.amqp.rabbit.annotation.RabbitHandler
 import org.springframework.amqp.rabbit.annotation.RabbitListener
 import org.springframework.stereotype.Component
 import org.springframework.stereotype.Service
+import java.util.*
 
 /**
  * 消息
@@ -17,6 +24,15 @@ import org.springframework.stereotype.Service
 @Component
 @Service
 class RabbitMqService: RabbitMqBaseService() {
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(com.persagy.server.services.base.Service::class.java)
+    }
+
+    /** 缓存对象数据服务 */
+    var synchronousMessageObjService = SObjectService(SMybatisDao(SynchronousMessageObj::class.java))
+    /** 缓存关系数据服务 */
+    var snchronousMessageRelService = SObjectService(SMybatisDao(SynchronousMessageRel::class.java))
 
     /**
      * 接收消息
@@ -28,17 +44,44 @@ class RabbitMqService: RabbitMqBaseService() {
     fun receiveMessage(message: String) {
         println("我是监听queue-adm的,仅满足queue-adm的过来 , $message")
         val messageNotice = SJsonUtil.fromJson(message, MessageNotice::class.java)
-        if (messageNotice!=null){
-            when(messageNotice.objOrRel){
-                    "objects" ->{
-
-                    }
-                    "" ->{
-
+        if (messageNotice != null) {
+            when(messageNotice.objOrRel) {
+                "objects" -> {
+                    try {
+                        /** id 列表不可以为空 */
+                        if (!messageNotice.idList.isNullOrEmpty()) {
+                            /** 遍历 id 列表 */
+                            for (id in messageNotice.idList!!) {
+                                /** 同步消息对象 */
+                                val messageObj = SynchronousMessageObj()
+                                messageObj.projectId = messageNotice.projectId
+                                messageObj.objId = id
+                                messageObj.id =  UUID.randomUUID().toString().replace("-", "")
+                                messageObj.sign = 1
+                                messageObj.objectType = objType(id)
+                                messageObj.type = messageNotice.type
+                                /** 插入数据 */
+                                synchronousMessageObjService.insert(messageObj)
+                            }
+                        }
+                    } catch (e: Exception) {
+                        e.printStackTrace()
                     }
+                }
+                "rel" -> {
+                    /** 关系消息对象 */
+                    val messageRel = SynchronousMessageRel()
+                    messageRel.projectId = messageNotice.projectId
+                    messageRel.id = UUID.randomUUID().toString().replace("-", "")
+                    messageRel.sign = 1
+                    messageRel.ops = messageNotice.ops
+                    messageRel.type = messageNotice.type
+                    messageRel.fromId = messageNotice.fromId
+                    messageRel.toId = messageNotice.toId
+                    snchronousMessageRelService.insert(messageRel)
+                }
             }
         }
-
     }
 
 
@@ -59,7 +102,7 @@ class RabbitMqService: RabbitMqBaseService() {
                 return false
             }
             // 合并消息
-            last.idList.addAll(notice.idList)
+            notice.idList?.let { last.idList?.addAll(it) }
             return true
         }
 //        else if (notice is RelationNotice) {  // 关系消息合并
@@ -69,6 +112,72 @@ class RabbitMqService: RabbitMqBaseService() {
         return false
     }
 
+    /**
+     * 发送消息(对象消息)
+     *
+     * @param projectId     项目 id
+     * @param type          操作符类型
+     * @param objId         对象 id
+     */
+    fun sendObjects(projectId: String, type: String, objId: String){
+       logger.debug("发送消息= ***********************************************************************************")
+        /** 生成 id */
+        val id = UUID.randomUUID().toString().replace("-", "")
+        /** 消息对象 */
+        val messageNotice = MessageNotice(projectId, "objects", type, null, id,
+            hashSetOf(objId), null, null)
+        /** 发送消息 */
+        sendMessage(Opt.exchange,Opt.routingKey,messageNotice)
+    }
 
+    /**
+     * 发送消息(关系)
+     *
+     * @param projectId     项目 id
+     * @param type          关系类型
+     * @param fromId        主 id
+     * @param toId          从 id
+     */
+    fun sendRel(projectId: String,type: String,fromId: String,toId: String){
+        /** 生成 id */
+        val id = UUID.randomUUID().toString().replace("-", "")
+        /** 消息对象 */
+        val messageNotice = MessageNotice(projectId, "rel", type, null, id,
+            null, fromId, toId)
+        /** 发送消息 */
+        sendMessage(Opt.exchange,Opt.routingKey,messageNotice)
+    }
 
+    /**
+     * 根据对象 id 转换对象类型
+     *
+     * @param id    对象 id
+     * @return 对象类型
+     */
+    private fun objType(id: String): String {
+        when {
+            id.startsWith("Eq") -> {
+                return "equipment"
+            }
+            id.startsWith("Fl") -> {
+                return "floor"
+            }
+            id.startsWith("Bd") -> {
+                return "building"
+            }
+            id.startsWith("Sp") -> {
+                return "space"
+            }
+            id.startsWith("Sy") -> {
+                return "system"
+            }
+            id.startsWith("Sh") -> {
+                return "shaft"
+            }
+            id.startsWith("Ec") -> {
+                return "component"
+            }
+            else -> return "object"
+        }
+    }
 }

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

@@ -1,7 +1,5 @@
 package com.persagy.server.jms
 
-import org.springframework.amqp.rabbit.annotation.RabbitHandler
-import org.springframework.amqp.rabbit.annotation.RabbitListener
 import org.springframework.stereotype.Component
 
 /**
@@ -12,8 +10,8 @@ import org.springframework.stereotype.Component
 @Component
 class TopicReceiver {
 
-    @RabbitListener(queues = ["queue-adm"])
-    @RabbitHandler
+//    @RabbitListener(queues = ["queue-adm"])
+//    @RabbitHandler
     fun receiveMessage1(str: String) {
         println("我是监听queue-adm的,仅满足queue-adm的过来 , $str")
     }

+ 17 - 1
datacenter/src/main/kotlin/com/persagy/server/jms/bean/MessageNotice.kt

@@ -6,5 +6,21 @@ package com.persagy.server.jms.bean
  * @author wx  <zhangweixin@sagacloud.com>
  * @date  2020/10/27 22:24
  */
-class MessageNotice(var projectId: String, var objOrRel: String, type: String, ops: String, val id: String,var idList: HashSet<String>, val fromId: String, val toId: String?)
+class MessageNotice (
+    /** 项目 id */
+    var projectId: String,
+    /** 对象或关系 */
+    var objOrRel: String,
+    /** 操作类型 */
+    type: String,
+    /** 操作符 */
+    ops: String?,
+    /** 消息 id */
+    var id: String,
+    /** 对象 id 列表 */
+    var idList: HashSet<String>?,
+    /** 关系主 id */
+    var fromId: String?,
+    /** 从 id */
+    var toId: String?)
     : SBaseNotice(type,ops)

+ 3 - 1
datacenter/src/main/kotlin/com/persagy/server/jms/bean/SBaseNotice.kt

@@ -1,8 +1,10 @@
 package com.persagy.server.jms.bean
 
+import java.io.Serializable
+
 /**
  * 消息基类
  *
  * @author wx
  */
-open class SBaseNotice(val type: String, val ops: String)
+open class SBaseNotice(val type: String, val ops: String?) : Serializable

+ 42 - 0
datacenter/src/main/kotlin/com/persagy/server/jms/bean/SynchronousMessageObj.kt

@@ -0,0 +1,42 @@
+package com.persagy.server.jms.bean
+
+import java.io.Serializable
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 同步消息体
+ *
+ * @author 张维新
+ */
+@Table(name = "synchronization.sync_data")
+class SynchronousMessageObj : Serializable {
+
+    /** 同步任务 id */
+    @Column(name = "id")
+    @Id
+    var id: String? = null
+
+    /** 项目 id */
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 对象 id */
+    @Column(name = "obj_id")
+    var objId: String? = null
+
+    /** 操作类型 ,创建、修改、删除 */
+    @Column(name = "type")
+    var type: String? = null
+
+    /** 对象类型 */
+    @Column(name = "object_type")
+    var objectType: String? = null
+
+    /** 标记 0已处理,1待处理,2处理失败 */
+    @Column(name = "sign")
+    var sign: Int? = null
+
+
+} // Class SynchronousMessageObj

+ 38 - 0
datacenter/src/main/kotlin/com/persagy/server/jms/bean/SynchronousMessageRel.kt

@@ -0,0 +1,38 @@
+package com.persagy.server.jms.bean
+
+import java.io.Serializable
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 同步消息体
+ *
+ * @author 张维新
+ */
+@Table(name = "synchronization.sync_data_relation")
+class SynchronousMessageRel : Serializable {
+    /** 消息 id */
+    @Column(name = "id")
+    @Id
+    var id: String? = null
+    /** 项目 id */
+    @Column(name = "project_id")
+    var projectId: String? = null
+    /** 关系类型 */
+    @Column(name = "type")
+    var type: String? = null
+    /** 标记 */
+    @Column(name = "sign")
+    var sign: Int? = null
+    /** 操作符 */
+    @Column(name = "ops")
+    var ops: String? = null
+    /** 主 id */
+    @Column(name = "from_id")
+    var fromId: String? = null
+    /** 从 id */
+    @Column(name = "to_id")
+    var toId: String? = null
+
+} // Class SynchronousMessageObj

+ 27 - 29
datacenter/src/main/kotlin/com/persagy/server/services/assistant/ObjInfoService.kt

@@ -1,16 +1,13 @@
 package com.persagy.server.services.assistant
 
-import com.persagy.server.datacenter.models.entities.assistant.ObjInfos
-import com.persagy.server.datacenter.models.entities.tool.ObjectBaseRequest
-import com.persagy.server.services.dict.PropertyDefProjectService
 import com.persagy.base.extensions.toJson
 import com.persagy.base.extensions.toMap
-import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.assistant.ObjInfos
+import com.persagy.server.datacenter.models.entities.tool.ObjectBaseRequest
 import com.persagy.service.SObjectService
 import org.json.JSONObject
 import java.text.SimpleDateFormat
-import java.util.*
 
 /**
  * 信息点服务
@@ -35,31 +32,32 @@ object ObjInfoService :  SObjectService<ObjInfos>(SMybatisDao(ObjInfos::class.ja
                 request.addInfo(key, value, false)
             }
         }
-        val pro = PropertyDefProjectService.select(SFilter.eq("projectId",map["projectId"].toString()), SFilter.eq("type",type), SFilter.or(SFilter.eq("inputMode","L"), SFilter.eq("inputMode","M"))).exec()
-        val requestInfos = request.infos
-        if(requestInfos!=null){
-            if(pro!=null){
 
-                for (propertyDefProjectInfo in pro) {
-                    val infoPointCode = propertyDefProjectInfo.infoPointCode
-                    if(requestInfos.containsKey(infoPointCode)){
-                        var objInfos = ObjInfos()
-                        objInfos.objType = objType
-                        objInfos.projectId = map["projectId"].toString()
-                        objInfos.objId = map["id"].toString()
-                        objInfos.infoId = infoPointCode
-                        objInfos.value = requestInfos[infoPointCode].toString()
-                        if(flag){
-                            objInfos.time = SIMPLEDATEFORMAT_DC.format(Date())
-                            insert(objInfos)
-                        }else{
-                            objInfos.time = SIMPLEDATEFORMAT_DC.format(map["lastUpdate"].toString())
-                            update(objInfos)
-                        }
-                    }
-                }
-            }
-        }
+//        val pro = PropertyDefProjectService.select(SFilter.eq("projectId",map["projectId"].toString()), SFilter.eq("type",type), SFilter.or(SFilter.eq("inputMode","L"), SFilter.eq("inputMode","M"))).exec()
+//        val requestInfos = request.infos
+//        if(requestInfos!=null){
+//            if(pro!=null){
+//
+//                for (propertyDefProjectInfo in pro) {
+//                    val infoPointCode = propertyDefProjectInfo.infoPointCode
+//                    if(requestInfos.containsKey(infoPointCode)){
+//                        var objInfos = ObjInfos()
+//                        objInfos.objType = objType
+//                        objInfos.projectId = map["projectId"].toString()
+//                        objInfos.objId = map["id"].toString()
+//                        objInfos.infoId = infoPointCode
+//                        objInfos.value = requestInfos[infoPointCode].toString()
+//                        if(flag){
+//                            objInfos.time = SIMPLEDATEFORMAT_DC.format(Date())
+//                            insert(objInfos)
+//                        }else{
+//                            objInfos.time = SIMPLEDATEFORMAT_DC.format(map["lastUpdate"].toString())
+//                            update(objInfos)
+//                        }
+//                    }
+//                }
+//            }
+//        }
     } // Fun
 
 } // Object ObjInfoService

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/services/assistant/SchemeService.kt

@@ -130,7 +130,7 @@ open class SchemeService {
                    val containsKey = attributeMap.containsKey("FloorElevation")
                    if (containsKey){
                        try {
-                           val toDouble = attributeMap["FloorElevation"]!!.toString().toDouble()
+                           val toDouble = attributeMap["FloorElevation"]!!.toString().toDoubleOrNull()
                            if (toDouble!=null){
                                floorEntity.structureInfo!!["FloorElevation"] = toDouble!!/1000
                            }

+ 70 - 104
datacenter/src/main/kotlin/com/persagy/server/services/base/Service.kt

@@ -1,21 +1,21 @@
 package com.persagy.server.services.base
 
-import cn.sagacloud.server.datacenter.utils.IdUtils
 import com.persagy.database.SAbstractDao
 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.base.BaseInfo
 import com.persagy.server.datacenter.models.entities.logs.DataCenterLogs
+import com.persagy.server.jms.RabbitMqService
 import com.persagy.server.services.assistant.SchemeService
+import com.persagy.server.services.log.DataCenterLogsService
 import com.persagy.server.services.rel.RSpInBdService
 import com.persagy.server.services.rel.RSpInFlService
 import com.persagy.server.synchronize.MessageHandler
 import com.persagy.service.SObjectService
 import com.persagy.service.SPageContext
 import com.persagy.service.utils.SSpringContextUtil
-import org.json.JSONArray
-import org.json.JSONObject
 import org.slf4j.LoggerFactory
 
 
@@ -35,15 +35,14 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
         }
 
         /** 自定义sql */
-         val schemeService by lazy {
+        val schemeService by lazy {
             SSpringContextUtil.getBean(SchemeService::class.java) as SchemeService
         }
 
-        /** kafka消息对象 */
-//        val kafkaService by lazy {
-//            SSpringContextUtil.getBean(KafkaService::class.java) as KafkaService
-//        }
-
+        /** RabbitMQ消息对象 */
+        val rabbitMqService by lazy {
+            SSpringContextUtil.getBean(RabbitMqService::class.java) as RabbitMqService
+        }
     } // Companion object
     /** 日志 */
     var logService = SObjectService(SMybatisDao(DataCenterLogs::class.java))
@@ -57,52 +56,37 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
 
         entityList.forEach {
             val projectId = SPageContext.getHeader("projectId")
-            val comming = SPageContext.getHeader("Coming")
-            val account = SPageContext.getHeader("Account")
-
+            val coming = SPageContext.getHeader("coming")
+            val account = SPageContext.getHeader("account")
             try {
-                val jsonObject = JSONObject()
-                jsonObject.put("type", "1")
-                jsonObject.put("projectId", projectId)
-                jsonObject.put("id", it.keyValue("id"))
-                jsonObject.put("obj_type", it.objectType)
-                /** 发送消息 */
-                messageHandler.sendMessage(jsonObject.toString())
-//                kafkaService.sendNotice("datacenter", ObjectNotice(projectId!!, it.objectType!!, "create",IdUtils.uuidCreate(), hashSetOf(it.keyValue("id").toString())),false)
-
+                rabbitMqService.sendObjects(projectId!!, Opt.CREATE,it.keyValue("id").toString())
             } catch (e: Exception) {
                 e.printStackTrace()
             }
             try {
                 /** 日志 */
-                val dataCenterLogs = DataCenterLogs()
-                dataCenterLogs.id = IdUtils.uuidCreate()
-                dataCenterLogs.author = "dataCenter"
-                dataCenterLogs.projectId = projectId
-                dataCenterLogs.objectType = it.objectType
-                dataCenterLogs.type = "create"
-                dataCenterLogs.coming = comming
-                dataCenterLogs.account = account
-                dataCenterLogs.objectId = it.keyValue("id").toString()
-                val hashMap = HashMap<String, Any?>()
-                hashMap[it.objectType!!] = it
-                dataCenterLogs.dataSource = hashMap
-                logService.insert(dataCenterLogs)
+//                val dataCenterLogs = DataCenterLogs()
+//                dataCenterLogs.id = IdUtils.uuidCreate()
+//                dataCenterLogs.author = "dataCenter"
+//                dataCenterLogs.projectId = projectId
+//                dataCenterLogs.objectType = it.objectType
+//                dataCenterLogs.type = "create"
+//                dataCenterLogs.coming = comming
+//                dataCenterLogs.account = account
+//                dataCenterLogs.objectId = it.keyValue("id").toString()
+//                val hashMap = HashMap<String, Any?>()
+//                hashMap[it.objectType!!] = it
+//                dataCenterLogs.dataSource = hashMap
+//                logService.insert(dataCenterLogs)
+                DataCenterLogsService.addLogs(projectId!!,"create",it.objectType!!,
+                    it.keyValue("id").toString(),it,account,coming)
             } catch (e: Exception) {
                 e.printStackTrace()
             }
-
-
         }
-//        entityList.forEach {
-//            if (it.objectType =="Equipment") {
-//                logger.debug("设备数据id${it.keyValue("id")}*******************************")
-//                logger.debug("资产数据id${it.keyValue("propertyId")}*******************************")
-//            }
-//        }
 
         return
-    } // Function onCreateSuccess()
+    }
 
     /**
      * 删除成功回调函数
@@ -111,8 +95,9 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
      */
     override fun onDeleteSuccess(entityList: ArrayList<ENTITY>) {
         val projectId = SPageContext.getHeader("projectId")
+        val coming = SPageContext.getHeader("coming")
+        val account = SPageContext.getHeader("account")
         entityList.forEach {
-
             try {
                 if (it.keyValue("id").toString().startsWith("Sp")){
                     /** 清除空间和建筑楼层的的数据 */
@@ -124,17 +109,15 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
             }
 
             try {
-                val jsonObject = JSONObject()
-                jsonObject.put("type", "2")
-                jsonObject.put("projectId", projectId)
-                jsonObject.put("id", it.keyValue("id"))
-                jsonObject.put("obj_type", it.objectType)
-                /** 发送消息 */
-                messageHandler.sendMessage(jsonObject.toString())
-//                kafkaService.sendNotice("datacenter", ObjectNotice(projectId!!, it.objectType!!, "delete",IdUtils.uuidCreate(), hashSetOf(it.keyValue("id").toString())),false)
+                rabbitMqService.sendObjects(projectId!!, Opt.DELETE,it.keyValue("id").toString())
             } catch (e: Exception) {
                 e.printStackTrace()
             }
+            try {
+                DataCenterLogsService.addLogs(projectId!!,"delete",it.objectType!!,
+                    it.keyValue("id").toString(),it,account,coming)
+            } catch (e: Exception) {
+            }
         }
         return
     } // Function onDeleteSuccess()
@@ -144,22 +127,24 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
 
         try {
             val projectId = SPageContext.getHeader("projectId")
-            val comming = SPageContext.getHeader("Coming")
-            val account = SPageContext.getHeader("Account")
+            val coming = SPageContext.getHeader("coming")
+            val account = SPageContext.getHeader("account")
             /** 日志 */
-            val dataCenterLogs = DataCenterLogs()
-            dataCenterLogs.id = IdUtils.uuidCreate()
-            dataCenterLogs.author = "dataCenter"
-            dataCenterLogs.projectId = projectId
-            dataCenterLogs.objectType = entity.objectType
-            dataCenterLogs.type = "update-before"
-            dataCenterLogs.account = account
-            dataCenterLogs.coming = comming
-            dataCenterLogs.objectId = entity.keyValue("id").toString()
-            val hashMap = HashMap<String, Any?>()
-            hashMap[entity.objectType!!] = entity
-            dataCenterLogs.dataSource = hashMap
-            logService.insert(dataCenterLogs)
+//            val dataCenterLogs = DataCenterLogs()
+//            dataCenterLogs.id = IdUtils.uuidCreate()
+//            dataCenterLogs.author = "dataCenter"
+//            dataCenterLogs.projectId = projectId
+//            dataCenterLogs.objectType = entity.objectType
+//            dataCenterLogs.type = "update-before"
+//            dataCenterLogs.account = account
+//            dataCenterLogs.coming = comming
+//            dataCenterLogs.objectId = entity.keyValue("id").toString()
+//            val hashMap = HashMap<String, Any?>()
+//            hashMap[entity.objectType!!] = entity
+//            dataCenterLogs.dataSource = hashMap
+//            logService.insert(dataCenterLogs)
+            DataCenterLogsService.addLogs(projectId!!,"update-before",entity.objectType!!,
+                entity.keyValue("id").toString(),entity,account,coming)
         } catch (e: Exception) {
             e.printStackTrace()
     }
@@ -175,50 +160,31 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
     override fun onUpdateSuccess(entityList: ArrayList<ENTITY>) {
         try {
             val projectId = SPageContext.getHeader("projectId")
-            val comming = SPageContext.getHeader("Coming")
-            val account = SPageContext.getHeader("Account")
-            val jsonObject = JSONObject()
-            jsonObject.put("type", "7")
-            jsonObject.put("projectId", projectId)
-            jsonObject.put("obj_type", entityList[0].objectType)
-            val jsonArray = JSONArray()
+            val coming = SPageContext.getHeader("coming")
+            val account = SPageContext.getHeader("account")
             for (entity in entityList) {
-                val jsonInfos = JSONObject()
-                jsonInfos.put("id", entity.keyValue("id"))
-                jsonInfos.put("obj_type", entity.objectType)
-                jsonArray.put(jsonInfos)
-
+                rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,entity.keyValue("id").toString())
                 try {
                     /** 日志 */
-                    val dataCenterLogs = DataCenterLogs()
-                    dataCenterLogs.id = IdUtils.uuidCreate()
-                    dataCenterLogs.author = "dataCenter"
-                    dataCenterLogs.projectId = projectId
-                    dataCenterLogs.objectType = entity.objectType
-                    dataCenterLogs.type = "update-after"
-                    dataCenterLogs.account = account
-                    dataCenterLogs.coming = comming
-                    dataCenterLogs.objectId = entity.keyValue("id").toString()
-                    val hashMap = HashMap<String, Any?>()
-                    hashMap[entity.objectType!!] = entity
-                    dataCenterLogs.dataSource = hashMap
-                    logService.insert(dataCenterLogs)
+//                    val dataCenterLogs = DataCenterLogs()
+//                    dataCenterLogs.id = IdUtils.uuidCreate()
+//                    dataCenterLogs.author = "dataCenter"
+//                    dataCenterLogs.projectId = projectId
+//                    dataCenterLogs.objectType = entity.objectType
+//                    dataCenterLogs.type = "update-after"
+//                    dataCenterLogs.account = account
+//                    dataCenterLogs.coming = comming
+//                    dataCenterLogs.objectId = entity.keyValue("id").toString()
+//                    val hashMap = HashMap<String, Any?>()
+//                    hashMap[entity.objectType!!] = entity
+//                    dataCenterLogs.dataSource = hashMap
+//                    logService.insert(dataCenterLogs)
+                    DataCenterLogsService.addLogs(projectId!!,"update-after",entity.objectType!!,
+                        entity.keyValue("id").toString(),entity,account,coming)
                 } catch (e: Exception) {
                     e.printStackTrace()
                 }
-
-                try {
-                    /** 发送消息 */
-//                    kafkaService.sendNotice("datacenter", ObjectNotice(projectId!!, entity.objectType!!, "update",IdUtils.uuidCreate(), hashSetOf(entity.keyValue("id").toString())),false)
-                } catch (e: Exception) {
-                    e.toString()
-                }
-
             }
-            jsonObject.put("infos", jsonArray)
-            logger.debug("修改发送消息$jsonObject")
-            /** 发送消息 */
-            messageHandler.sendMessage(jsonObject.toString())
         } catch (e: Exception) {
             e.printStackTrace()
         }

+ 38 - 0
datacenter/src/main/kotlin/com/persagy/server/services/log/DataCenterLogsService.kt

@@ -0,0 +1,38 @@
+package com.persagy.server.services.log
+
+import cn.sagacloud.server.datacenter.utils.IdUtils
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.logs.DataCenterLogs
+import com.persagy.service.SObjectService
+
+/**
+ * 日志服务
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2020/10/31 8:24
+ */
+object DataCenterLogsService : SObjectService<DataCenterLogs>(SMybatisDao(DataCenterLogs::class.java)){
+
+    /**
+     * 条件日志
+     *
+     * @param projectId     项目 id
+     * @param type          操作类型
+     * @param objType       对象类型
+     * @param objId         对象 id
+     * @param objects       对象信息
+     * @param account       账号
+     * @param comming       平台
+     */
+    fun addLogs(projectId: String,type: String,objType: String,objId: String,objects:Any,account: String?,comming: String?){
+        val hashMap = HashMap<String, Any?>()
+        hashMap[objType] = objects
+        /** 日志 */
+        val dataCenterLogs = DataCenterLogs(IdUtils.uuidCreate(),projectId,
+            type,hashMap,"dataCenter",objId,comming,account,objType)
+        /** 插入日志 */
+        insert(dataCenterLogs)
+    }
+
+
+}

+ 218 - 222
datacenter/src/main/kotlin/com/persagy/server/services/objects/FloorService.kt

@@ -24,18 +24,18 @@ import cn.sagacloud.server.datacenter.utils.IdUtils
 import cn.sagacloud.server.datacenter.utils.ShaftNameUtil
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
-import com.persagy.server.datacenter.models.entities.logs.DataCenterLogs
+import com.persagy.server.Opt
 import com.persagy.server.datacenter.models.entities.objects.Floor
 import com.persagy.server.services.assistant.ObjInfoService
 import com.persagy.server.services.base.Service
+import com.persagy.server.services.log.DataCenterLogsService
 import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
 import com.persagy.service.models.requests.SCreateRequest
 import com.persagy.service.models.requests.SUpdateRequest
 import com.persagy.service.models.responses.SBaseResponse
 import com.persagy.service.models.responses.SCreateResponse
-import org.json.JSONArray
-import org.json.JSONObject
+import org.slf4j.LoggerFactory
 
 /**
  * 楼层信息服务
@@ -44,6 +44,9 @@ import org.json.JSONObject
  */
 object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
 
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(FloorService::class.java)
+
     /**
      * 创建之前操作
      */
@@ -76,124 +79,115 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
         return true
     } // Function onCreateBefore()
 
-  fun create(request: SCreateRequest<Floor>): SCreateResponse<Floor> {
-      return try {
-          val projectId = SPageContext.getHeader("projectId")
-          val comming = SPageContext.getHeader("Coming")
-          val account = SPageContext.getHeader("Account")
-          if (!request.content.isNullOrEmpty()){
-              for (floor in request.content){
-                  try {
-                      floor.projectId = projectId
-                      /** 楼层id */
-                      if (!floor.id.isNullOrEmpty()) {
-                          val isWith = floor.id!!.startsWith("Fl")
-                          if (!isWith) {
-                              floor.id = IdUtils.floorIdCreate(projectId!!)
-                          }
-                      } else {
-                          floor.id = IdUtils.floorIdCreate(projectId!!)
-                      }
-
-                      if (floor.name.isNullOrEmpty()){
-                          floor.name = ShaftNameUtil.shaftName("楼层-")
-                      }
-                      if (!floor.buildingId.isNullOrEmpty()){
-                          val floorList = select(SFilter.eq("projectId", projectId!!), SFilter.eq("buildId", floor.buildingId!!)).exec()
-                          if (floorList.size>0){
-                              for (floor001 in floorList){
-                                  if (floor001.floorSequenceId == floor.floorSequenceId){
-                                      val sCreateResponse = SCreateResponse<Floor>(SResponseType.failure)
-                                      sCreateResponse.message = "楼层顺序号不可以重复"
-                                      return sCreateResponse
-                                  }
-                              }
-                          }
-                      }
-                      val insert = insert(floor)
-                      if (insert){
-                          try {
-                              val jsonObject = JSONObject()
-                              jsonObject.put("type", "1")
-                              jsonObject.put("projectId", projectId)
-                              jsonObject.put("id", floor.id)
-                              jsonObject.put("obj_type", "Floor")
-                              /** 发送消息 */
-                              messageHandler.sendMessage(jsonObject.toString())
-    //                kafkaService.sendNotice("datacenter", ObjectNotice(projectId!!, it.objectType!!, "create",IdUtils.uuidCreate(), hashSetOf(it.keyValue("id").toString())),false)
-
-                          } catch (e: Exception) {
-                              e.printStackTrace()
-                          }
-                          try {
-                              /** 日志 */
-                              val dataCenterLogs = DataCenterLogs()
-                              dataCenterLogs.id = IdUtils.uuidCreate()
-                              dataCenterLogs.author = "dataCenter"
-                              dataCenterLogs.projectId = projectId
-                              dataCenterLogs.objectType = "Floor"
-                              dataCenterLogs.type = "create"
-                              dataCenterLogs.coming = comming
-                              dataCenterLogs.account = account
-                              dataCenterLogs.objectId = floor.id
-                              val hashMap = HashMap<String, Any?>()
-                              hashMap["Floor"] = floor
-                              dataCenterLogs.dataSource = hashMap
-                              logService.insert(dataCenterLogs)
-                          } catch (e: Exception) {
-                              e.printStackTrace()
-                          }
-                      }
-                  } catch (e: Exception) {
-                      e.printStackTrace()
-                  }
-              }
-              val sCreateResponse = SCreateResponse<Floor>(SResponseType.success)
-              sCreateResponse.entityList = request.content
-              return sCreateResponse
+    /**
+     * 创建楼层对象
+     *
+     * @param request       对象列表
+     * @return 返回结果
+     */
+    fun create(request: SCreateRequest<Floor>): SCreateResponse<Floor> {
+        return try {
+            /** 项目 id */
+            val projectId = SPageContext.getHeader("projectId")
+            /** 来源 */
+            val coming = SPageContext.getHeader("coming")
+            /** 账号 */
+            val account = SPageContext.getHeader("account")
+            /** 内容不可以为空 */
+            if (!request.content.isNullOrEmpty()){
+                for (floor in request.content){
+                    try {
+                        floor.projectId = projectId
+                        /** 楼层id */
+                        if (!floor.id.isNullOrEmpty()) {
+                            val isWith = floor.id!!.startsWith("Fl")
+                            if (!isWith) {
+                                floor.id = IdUtils.floorIdCreate(projectId!!)
+                            }
+                        } else {
+                            floor.id = IdUtils.floorIdCreate(projectId!!)
+                        }
+                        if (floor.name.isNullOrEmpty()){
+                            floor.name = ShaftNameUtil.shaftName("楼层-")
+                        }
+                        if (!floor.buildingId.isNullOrEmpty()){
+                            val floorList = select(SFilter.eq("projectId", projectId!!),
+                                SFilter.eq("buildingId", floor.buildingId!!)).exec()
+                            if (floorList.size>0){
+                                for (floor001 in floorList){
+                                    if (floor001.floorSequenceId == floor.floorSequenceId){
+                                        val sCreateResponse = SCreateResponse<Floor>(SResponseType.failure)
+                                        sCreateResponse.message = "楼层顺序号不可以重复"
+                                        return sCreateResponse
+                                    }
+                                }
+                            }
+                        }
+                        val insert = insert(floor)
+                        if (insert){
+                            try {
+                                rabbitMqService.sendObjects(projectId!!, Opt.CREATE,floor.id!!)
+                            } catch (e: Exception) {
+                                e.printStackTrace()
+                            }
+                            try {
+                                /** 日志 */
+                                DataCenterLogsService.addLogs(projectId!!,"create","floor",
+                                    floor!!.id!!,floor,account,coming)
+                            } catch (e: Exception) {
+                                e.printStackTrace()
+                            }
+                        }
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+                }
+                val sCreateResponse = SCreateResponse<Floor>(SResponseType.success)
+                sCreateResponse.entityList = request.content
+                return sCreateResponse
 
-          }else{
-              val sCreateResponse = SCreateResponse<Floor>(SResponseType.failure)
-              sCreateResponse.message = "不可以传入空列表"
-              return sCreateResponse
-          }
-      } catch (e: Exception) {
-          e.printStackTrace()
-          SCreateResponse(SResponseType.failure,e.message.toString())
-      }
-  } // Fun
+            }else{
+                val sCreateResponse = SCreateResponse<Floor>(SResponseType.failure)
+                sCreateResponse.message = "不可以传入空列表"
+                return sCreateResponse
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SCreateResponse(SResponseType.failure,e.message.toString())
+        }
+    } // Fun
 
-    fun upDates(request: SUpdateRequest<Floor>): SBaseResponse{
+    /**
+     * 更新楼层信息
+     *
+     * @param request       楼层对象列表
+     * @return 返回结果
+     */
+    fun upDates(request: SUpdateRequest<Floor>): SBaseResponse {
         return try {
+            /** 项目 id */
             val projectId = SPageContext.getHeader("projectId")
-            val comming = SPageContext.getHeader("Coming")
-            val account = SPageContext.getHeader("Account")
+            /** 来源 */
+            val comming = SPageContext.getHeader("coming")
+            /** 账号 */
+            val account = SPageContext.getHeader("account")
             val listId = ArrayList<String>()
+            /** 对象列表不可以为空 */
             if (!request.content.isNullOrEmpty()){
-                val jsonObject = JSONObject()
-                jsonObject.put("type", "7")
-                jsonObject.put("projectId", projectId)
-                jsonObject.put("obj_type", "Floor")
-                val jsonArray = JSONArray()
+//                val jsonObject = JSONObject()
+//                jsonObject.put("type", "7")
+//                jsonObject.put("projectId", projectId)
+//                jsonObject.put("obj_type", "Floor")
+//                val jsonArray = JSONArray()
+                /** 遍历楼层列表 */
                 for (floor in request.content!!){
                     if (!floor.buildingId.isNullOrEmpty()){
-
-                        val floorList = select(SFilter.eq("projectId", projectId!!), SFilter.eq("buildingId", floor.buildingId!!), SFilter.not(SFilter.eq("id",floor.id!!))).exec()
+                        val floorList = select(SFilter.eq("projectId", projectId!!),
+                            SFilter.eq("buildingId", floor.buildingId!!), SFilter.not(SFilter.eq("id",floor.id!!))).exec()
                         if (floorList.size>0){
                             for (floor001 in floorList){
                                 try {
                                     if (floor001.floorSequenceId == floor.floorSequenceId){
-                                        if (listId.size>0){
-                                            for (id in listId){
-                                                val jsonInfos = JSONObject()
-                                                jsonInfos.put("id", id)
-                                                jsonInfos.put("obj_type", "Floor")
-                                                jsonArray.put(jsonInfos)
-                                            }
-                                            jsonObject.put("infos", jsonArray)
-                                            /** 发送消息 */
-                                            messageHandler.sendMessage(jsonObject.toString())
-                                        }
                                         val sBaseResponse = SBaseResponse(SResponseType.failure)
                                         sBaseResponse.message = "楼层顺序号不可以重复"
                                         return sBaseResponse
@@ -211,43 +205,55 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
                             if (update){
                                 listId.add(floor.id!!)
                                 try {
-                                    /** 日志 */
-                                    val dataCenterLogs = DataCenterLogs()
-                                    dataCenterLogs.id = IdUtils.uuidCreate()
-                                    dataCenterLogs.author = "dataCenter"
-                                    dataCenterLogs.projectId = projectId
-                                    dataCenterLogs.objectType = "Floor"
-                                    dataCenterLogs.type = "update-after"
-                                    dataCenterLogs.account = account
-                                    dataCenterLogs.coming = comming
-                                    dataCenterLogs.objectId = floor.id
-                                    val hashMap = HashMap<String, Any?>()
-                                    hashMap["Floor"] = floor
-                                    dataCenterLogs.dataSource = hashMap
-                                    logService.insert(dataCenterLogs)
+//                                    val hashMap = HashMap<String, Any?>()
+//                                    hashMap["Floor"] = floor
+//                                    /** 日志 */
+//                                    val dataCenterLogs = DataCenterLogs(IdUtils.uuidCreate(),projectId,
+//                                        "update-after",hashMap,"dataCenter",floor.id,comming,account)
+//                                    dataCenterLogs.id = IdUtils.uuidCreate()
+//                                    dataCenterLogs.author = "dataCenter"
+//                                    dataCenterLogs.projectId = projectId
+//                                    dataCenterLogs.objectType = "Floor"
+//                                    dataCenterLogs.type = "update-after"
+//                                    dataCenterLogs.account = account
+//                                    dataCenterLogs.coming = comming
+//                                    dataCenterLogs.objectId = floor.id
+//
+//                                    dataCenterLogs.dataSource = hashMap
+//                                    logService.insert(dataCenterLogs)
+
+                                    rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,floor.id!!)
+                                    DataCenterLogsService.addLogs(projectId!!,"update-after","floor",
+                                        floor.id!!,floor,account,comming)
                                 } catch (e: Exception) {
                                     e.printStackTrace()
                                 }
                             }
                         }else{
                             val update = update(floor)
+
                             if (update){
                                 listId.add(floor.id!!)
                                 try {
                                     /** 日志 */
-                                    val dataCenterLogs = DataCenterLogs()
-                                    dataCenterLogs.id = IdUtils.uuidCreate()
-                                    dataCenterLogs.author = "dataCenter"
-                                    dataCenterLogs.projectId = projectId
-                                    dataCenterLogs.objectType = "Floor"
-                                    dataCenterLogs.type = "update-after"
-                                    dataCenterLogs.account = account
-                                    dataCenterLogs.coming = comming
-                                    dataCenterLogs.objectId = floor.id
-                                    val hashMap = HashMap<String, Any?>()
-                                    hashMap["Floor"] = floor
-                                    dataCenterLogs.dataSource = hashMap
-                                    logService.insert(dataCenterLogs)
+//                                    val dataCenterLogs = DataCenterLogs()
+//                                    dataCenterLogs.id = IdUtils.uuidCreate()
+//                                    dataCenterLogs.author = "dataCenter"
+//                                    dataCenterLogs.projectId = projectId
+//                                    dataCenterLogs.objectType = "Floor"
+//                                    dataCenterLogs.type = "update-after"
+//                                    dataCenterLogs.account = account
+//                                    dataCenterLogs.coming = comming
+//                                    dataCenterLogs.objectId = floor.id
+//                                    val hashMap = HashMap<String, Any?>()
+//                                    hashMap["Floor"] = floor
+//                                    dataCenterLogs.dataSource = hashMap
+//                                    logService.insert(dataCenterLogs)
+
+                                    rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,floor.id!!)
+                                    logger.debug("更新标记= ***********************************************************************************")
+                                    DataCenterLogsService.addLogs(projectId!!,"update","floor",
+                                        floor.id!!,floor,account,comming)
                                 } catch (e: Exception) {
                                     e.printStackTrace()
                                 }
@@ -260,14 +266,16 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
 
                 if (listId.size>0){
                     for (id in listId){
-                        val jsonInfos = JSONObject()
-                        jsonInfos.put("id", id)
-                        jsonInfos.put("obj_type", "Floor")
-                        jsonArray.put(jsonInfos)
+//                        val jsonInfos = JSONObject()
+//                        jsonInfos.put("id", id)
+//                        jsonInfos.put("obj_type", "Floor")
+//                        jsonArray.put(jsonInfos)
+                        rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,id)
                     }
-                    jsonObject.put("infos", jsonArray)
-                    /** 发送消息 */
-                    messageHandler.sendMessage(jsonObject.toString())
+//                    jsonObject.put("infos", jsonArray)
+//                    /** 发送消息 */
+//                    messageHandler.sendMessage(jsonObject.toString())
+
                 }
                 val sBaseResponse = SBaseResponse(SResponseType.success)
                 return sBaseResponse
@@ -291,22 +299,24 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
         val  floor = this.select(SFilter.eq("id", entity.id!!)).entity()
 
         val projectId = SPageContext.getHeader("projectId")
-        val coming = SPageContext.getHeader("Coming")
-        val account = SPageContext.getHeader("Account")
+        val coming = SPageContext.getHeader("coming")
+        val account = SPageContext.getHeader("account")
         /** 日志 */
-        val dataCenterLogs = DataCenterLogs()
-        dataCenterLogs.id = IdUtils.uuidCreate()
-        dataCenterLogs.author = "dataCenter"
-        dataCenterLogs.projectId = projectId
-        dataCenterLogs.objectType = entity.objectType
-        dataCenterLogs.type = "delete"
-        dataCenterLogs.coming = coming
-        dataCenterLogs.account = account
-        dataCenterLogs.objectId = floor!!.id
-        val hashMap = HashMap<String, Any?>()
-        hashMap[entity.objectType!!] = floor
-        dataCenterLogs.dataSource = hashMap
-        logService.insert(dataCenterLogs)
+//        val dataCenterLogs = DataCenterLogs()
+//        dataCenterLogs.id = IdUtils.uuidCreate()
+//        dataCenterLogs.author = "dataCenter"
+//        dataCenterLogs.projectId = projectId
+//        dataCenterLogs.objectType = entity.objectType
+//        dataCenterLogs.type = "delete"
+//        dataCenterLogs.coming = coming
+//        dataCenterLogs.account = account
+//        dataCenterLogs.objectId = floor!!.id
+//        val hashMap = HashMap<String, Any?>()
+//        hashMap[entity.objectType!!] = floor
+//        dataCenterLogs.dataSource = hashMap
+//        logService.insert(dataCenterLogs)
+        DataCenterLogsService.addLogs(projectId!!,"delete","floor",
+            floor!!.id!!,floor,account,coming)
         return super.onDeleteBefore(entity)
     } // Function onDeleteBefore()
 
@@ -316,41 +326,43 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
     fun updateOutline(request: SUpdateRequest<Floor>): SBaseResponse{
         return try {
             val projectId = SPageContext.getHeader("projectId")
-            val comming = SPageContext.getHeader("Coming")
-            val account = SPageContext.getHeader("Account")
+            val coming = SPageContext.getHeader("coming")
+            val account = SPageContext.getHeader("account")
             val listId = ArrayList<String>()
             if (!request.content.isNullOrEmpty()){
-                val jsonObject = JSONObject()
-                jsonObject.put("type", "7")
-                jsonObject.put("projectId", projectId)
-                jsonObject.put("obj_type", "Floor")
-                val jsonArray = JSONArray()
+//                val jsonObject = JSONObject()
+//                jsonObject.put("type", "7")
+//                jsonObject.put("projectId", projectId)
+//                jsonObject.put("obj_type", "Floor")
+//                val jsonArray = JSONArray()
                 for (floor in request.content!!){
                     try {
                         val listOutline = ArrayList<String>()
                         listOutline.add("Outline")
-                            val update = update(floor,listOutline)
-                            if (update){
-                                listId.add(floor.id!!)
-                                try {
-                                    /** 日志 */
-                                    val dataCenterLogs = DataCenterLogs()
-                                    dataCenterLogs.id = IdUtils.uuidCreate()
-                                    dataCenterLogs.author = "dataCenter"
-                                    dataCenterLogs.projectId = projectId
-                                    dataCenterLogs.objectType = "Floor"
-                                    dataCenterLogs.type = "update-after"
-                                    dataCenterLogs.account = account
-                                    dataCenterLogs.coming = comming
-                                    dataCenterLogs.objectId = floor.id
-                                    val hashMap = HashMap<String, Any?>()
-                                    hashMap["Floor"] = floor
-                                    dataCenterLogs.dataSource = hashMap
-                                    logService.insert(dataCenterLogs)
-                                } catch (e: Exception) {
-                                    e.printStackTrace()
-                                }
+                        val update = update(floor,listOutline)
+                        if (update){
+                            listId.add(floor.id!!)
+                            try {
+                                /** 日志 */
+//                                val dataCenterLogs = DataCenterLogs()
+//                                dataCenterLogs.id = IdUtils.uuidCreate()
+//                                dataCenterLogs.author = "dataCenter"
+//                                dataCenterLogs.projectId = projectId
+//                                dataCenterLogs.objectType = "Floor"
+//                                dataCenterLogs.type = "update-after"
+//                                dataCenterLogs.account = account
+//                                dataCenterLogs.coming = coming
+//                                dataCenterLogs.objectId = floor.id
+//                                val hashMap = HashMap<String, Any?>()
+//                                hashMap["Floor"] = floor
+//                                dataCenterLogs.dataSource = hashMap
+//                                logService.insert(dataCenterLogs)
+                                DataCenterLogsService.addLogs(projectId!!,"update-after","floor",
+                                    floor!!.id!!,floor,account,coming)
+                            } catch (e: Exception) {
+                                e.printStackTrace()
                             }
+                        }
 
                     } catch (e: Exception) {
                         e.printStackTrace()
@@ -359,14 +371,15 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
 
                 if (listId.size>0){
                     for (id in listId){
-                        val jsonInfos = JSONObject()
-                        jsonInfos.put("id", id)
-                        jsonInfos.put("obj_type", "Floor")
-                        jsonArray.put(jsonInfos)
+//                        val jsonInfos = JSONObject()
+//                        jsonInfos.put("id", id)
+//                        jsonInfos.put("obj_type", "Floor")
+//                        jsonArray.put(jsonInfos)
+                        rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,id)
                     }
-                    jsonObject.put("infos", jsonArray)
-                    /** 发送消息 */
-                    messageHandler.sendMessage(jsonObject.toString())
+//                    jsonObject.put("infos", jsonArray)
+//                    /** 发送消息 */
+//                    messageHandler.sendMessage(jsonObject.toString())
 
                     try {
                         /** 处理关系标记 */
@@ -403,52 +416,34 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
     } // Fun
 
     /**
-     * @Description: 删除之后
-     * @Param: entityList
+     * 删除之后
+     *
+     * @Param entityList    楼层列表
      */
     override fun onDeleteSuccess(entityList: ArrayList<Floor>) {
         super.onDeleteSuccess(entityList)
-
         try {
             val projectId = SPageContext.getHeader("projectId")
             for (floor in entityList) {
                 ObjInfoService.delete(SFilter.eq("projectId",projectId!!), SFilter.eq("objId",floor.id!!), SFilter.eq("objType","Fl"))
+                rabbitMqService.sendObjects(floor.projectId!!, Opt.DELETE,floor.id!!)
             }
         } catch (e: Exception) {
             e.printStackTrace()
         }
     }
 
-//    /**
-//     * @Description: 查找信息点选择创建或修改
-//     * @Param: entityList,flag
-//     */
-//    fun findInfo(entityList: ArrayList<Floor>, flag: Boolean){
-//        val prodefs = PropertyDefProjectService.select(SFilter.eq("projectId",entityList.get(0).projectId!!),SFilter.eq("firstTag","PeopleInfo"),SFilter.eq("type","Floor"), SFilter.or(SFilter.eq("inputMode","L"), SFilter.eq("inputMode","M"))).exec()
-//        var peopleList = ArrayList<HashMap<String,String?>>()
-//        for (prodef in prodefs) {
-//            var itemMap = HashMap<String,String?>()
-//            itemMap["firstTag"] = prodef.firstTag
-//            itemMap["secondTag"] = prodef.secondTag
-//            itemMap["infoPointCode"] = prodef.infoPointCode
-//            peopleList.add(itemMap)
-//        }
-//        for (floor in entityList) {
-//            if(floor.peopleInfo!=null){
-//                BuildingService.createInfo("Fl",floor.projectId!!,floor.id!!,floor.lastUpdate,peopleList,floor.peopleInfo,flag)
-//            }
-//        }
-//    }
-
     /**
-     * @Description:创建成功后
-     * @Param:entityList
+     * 创建成功后
+     *
+     * @Param entityList    楼层列表
      */
     override fun onCreateSuccess(entityList: ArrayList<Floor>) {
         super.onCreateSuccess(entityList)
         try {
             for (floor in entityList) {
                 ObjInfoService.createInfo(floor,true,"Fl","Floor")
+                rabbitMqService.sendObjects(floor.projectId!!, Opt.CREATE,floor.id!!)
             }
         } catch (e: Exception) {
             e.printStackTrace()
@@ -456,8 +451,9 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
     }
 
     /**
-     * @Description:更新成功后
-     * @Param:entityList
+     * 更新成功后
+     *
+     * @Param entityList    楼层列表
      */
     override fun onUpdateSuccess(entityList: ArrayList<Floor>) {
         super.onUpdateSuccess(entityList)
@@ -465,7 +461,7 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
             val projectId = SPageContext.getHeader("projectId")
             for (floor in entityList) {
                 ObjInfoService.createInfo(floor,false,"Fl","Floor")
-//                ObjInfoService.delete(SFilter.eq("projectId",projectId!!), SFilter.eq("objId",floor.id!!), SFilter.eq("objType","Fl"))
+                rabbitMqService.sendObjects(floor.projectId!!, Opt.UPDATE,floor.id!!)
             }
         } catch (e: Exception) {
             e.printStackTrace()

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

@@ -544,7 +544,7 @@ object ZoneSpaceBaseService : ServiceSpace<ZoneSpace>(SMybatisDao(ZoneSpace::cla
                         if (!entity1.structureInfo.isNullOrEmpty()){
                             val containsKey = entity1.structureInfo!!.containsKey("Height")
                             if (containsKey){
-                                entity.height = entity1.structureInfo!!["Height"].toString()!!.toDouble()
+                                entity.height = entity1.structureInfo!!["Height"].toString()!!.toDoubleOrNull()
                             }
                         }
                     }

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/synchronize/KafkaService.kt

@@ -25,8 +25,8 @@
 //
 //import cn.sagacloud.server.datacenter.models.entities.syncmessage.ObjectNoticeOther
 //import cn.sagacloud.server.datacenter.models.entities.syncmessage.RelationNoticeOther
-//import cn.sagacloud.server.dataplatform.entities.syncmessage.SynchronousMessageObj
-//import cn.sagacloud.server.dataplatform.entities.syncmessage.SynchronousMessageRel
+//import com.persagy.server.jms.bean.SynchronousMessageObj
+//import com.persagy.server.jms.bean.SynchronousMessageRel
 //import cn.sagacloud.server.synchronize.entities.ObjectNotice
 //import cn.sagacloud.server.synchronize.entities.RelationNotice
 //import com.google.gson.Gson

+ 2 - 4
datacenter/src/main/kotlin/com/persagy/server/synchronize/MessageHandler.kt

@@ -2,8 +2,6 @@ package com.persagy.server.synchronize
 
 import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.jms.annotation.JmsListener
 import org.springframework.jms.core.JmsTemplate
 import org.springframework.stereotype.Component
 
@@ -24,7 +22,7 @@ class MessageHandler {
     private lateinit var jmsTemplate : JmsTemplate
 
     /** 映射发送地址 */
-    @Value("\${topic}")
+//    @Value("\${topic}")
     lateinit var topic: String
 
     /**
@@ -41,7 +39,7 @@ class MessageHandler {
      *
      * @param content 消息内容
      */
-    @JmsListener(destination = "datacenter.broadcast")
+//    @JmsListener(destination = "datacenter.broadcast")
     fun localListener(content: String) {
         logger.debug("本地消息2: $content")
     } // Function localListener()

+ 15 - 0
datacenter/src/main/kotlin/com/persagy/server/utils/MessageEnum.kt

@@ -0,0 +1,15 @@
+package com.persagy.server.utils
+
+/**
+ * 消息枚举类
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2020/10/30 21:14
+ */
+enum class MessageEnum {
+
+    create,    // 创建
+    update,    // 更新
+    delete     // 删除
+
+}

+ 2 - 1
datacenter/src/main/resources/application-dev.yml

@@ -36,7 +36,8 @@ spring:
 #    url:                                jdbc:postgresql://60.205.177.43:5432/datacenter
     url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
-    password:                           persagy_2020qwe!@#
+#    password:                           persagy_2020qwe!@#
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
   servlet:
     multipart:

+ 9 - 3
datacenter/src/main/resources/application-prod.yml

@@ -33,10 +33,16 @@ spring:
 #    password:                           123qwe!@#
     url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
     username:                           postgres
-    password:                           persagy_2020qwe!@#
+#    password:                           persagy_2020qwe!@#
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-  activemq:
-#    broker-url:                         tcp://activemq:61616
+  rabbitmq:
+    host: 172.17.100.14
+    port: 9936
+    username: admin
+    password: brzj123456
+    #虚拟host 可以不设置,使用server默认host
+    virtual-host: /test
 
   servlet:
     multipart:

+ 11 - 11
datacenter/src/main/resources/application.yml

@@ -56,17 +56,17 @@ spring:
       # 属性按字母顺序输出
       sort_properties_alphabetically:   true
 
-  activemq:
-    in-memory:                          true
-    pool.enabled:                       false
-    user:                               admin
-    password:                           admin
-#    broker-url:                         tcp://172.17.11.222:61616
-  jms:
-    pub-sub-domain: true
-
-topic:                                 datacenter.broadcast
-
+# spring-doc 配置
+springdoc:
+  # springdoc 扫描的包,多个包之间使用逗号分隔
+  packagesToScan:                           com.sybotan.ibms.dmp, org.sybotan
+  swagger-ui:
+    # API 组排序方式:asc 升序,desc 降序
+    groups-order:                           asc
+    # 标识排序方式:alpha 按字母升序排列
+    tags-sorter:                            alpha
+    # API 接口排序方式:alpha 按字母升序排列,method 按方法的定义顺序。
+    operations-sorter:                      alpha
 
 mybatis:
   typeAliasesPackage:                   cn.sagacloud.server.datacenter.entities

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

@@ -94,6 +94,37 @@ class ObjectFromToControllers {
     }
 
     /**
+     * 项目信息 - 数据中台存储到数据中心,根据集团获取集团写所有项目
+     */
+    @ApiOperation(value = "项目信息-数据中台存储到数据中心,根据 id 同步 ", notes = "")
+    @PostMapping(value = ["/project-syn-id"])
+    fun projectId(projectId: String): SBaseResponse {
+        return try {
+            /** 集团数据 */
+            DClassDefService.groupQuerys()
+            /** 项目数据 */
+            DClassDefService.dictProject()
+            val dictProject = dictProjectService.select(SFilter.eq("id",projectId)).entity()
+                val projectQueryList = ProjectApi.projectQuery(projectId!!)
+                if (projectQueryList.size > 0) {
+                    for (projectQuery in projectQueryList) {
+                        val projectDataConversion = ProjectUtil.projectDataConversions(dictProject!!.groupCode!!, projectQuery)
+                        logger.debug("项目:  ${projectDataConversion.toJson()} ")
+                        projectService.replace(projectDataConversion)
+                    }
+                }
+            SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SBaseResponse(SResponseType.failure, e.message!!)
+        }
+
+    }
+
+
+
+
+    /**
      * 建筑信息 - 数据中台存储到数据中心
      */
     @ApiOperation(value = "建筑信息-数据中台存储到数据中心 ", notes = "switch true  根据输入的项目 id  同步建筑,false 同步所有项目的 建筑")

+ 13 - 11
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/dict/DictTypeApi.kt

@@ -46,7 +46,7 @@ object DictTypeApi {
     fun groupQuery():ArrayList<Group> {
         var data = ArrayList<Group>()
         try {
-            val url = "${opts.dataPlatform}/group/query"
+            val url = "${opts.dataPlatform}/org/group/query"
             val jsonObject = JSONObject()
             val jsonObject2 = JSONObject()
             jsonObject["criteria"] = jsonObject2
@@ -70,7 +70,7 @@ object DictTypeApi {
      * @return 项目对象列表
      */
     fun dictProjectQuery(code: String): ArrayList<DictProject>{
-        val url = "${opts.dataPlatform}/project/query"
+        val url = "${opts.dataPlatform}/org/project/query?userId=123456&groupCode=$code"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["groupCode"] = code
@@ -90,7 +90,7 @@ object DictTypeApi {
      * 平台字典对象类型
      */
     fun dictPlatform(): ArrayList<DictPlatformType>{
-        val url = "${opts.dataPlatform}/def/class/"
+        val url = "${opts.dataPlatform}/rwd/def/class/"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["type"] = "common"
@@ -105,8 +105,6 @@ object DictTypeApi {
     } // Fun dictPlatform()
 
 
-
-
     /**
      * 对象详细信息点
      *
@@ -114,7 +112,7 @@ object DictTypeApi {
      * @param   type        平台或集团
      */
     fun dictPlatformInfo(category: String,type: String): ArrayList<DictPlatformInfo>{
-        val url = "${opts.dataPlatform}/def/funcid"
+        val url = "${opts.dataPlatform}/rwd/def/funcid"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["type"] = type
@@ -137,7 +135,7 @@ object DictTypeApi {
      * @return 专业列表
      */
     fun dictMajor(type: String): ArrayList<DictMajorResponse.DataBean>{
-        val url = "${opts.dataPlatform}/dt/data/query"
+        val url = "${opts.dataPlatform}/dic/dt/data/query"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["type"] = type
@@ -153,6 +151,7 @@ object DictTypeApi {
 
     /**
      * 集团下的方案
+     * 待处理
      */
     fun dictGroupScheme(groupId: String): ArrayList<DictGroupSchemeResponse.DataBean>{
         val url = "${opts.dataPlatform}/dict/scheme/query"
@@ -171,6 +170,7 @@ object DictTypeApi {
 
     /**
      * 方案订阅的对象类型
+     * 待处理
      */
     fun dictSchemeCategoty(schemeId: Int): ArrayList<DictSchemeCategoryResponse.DataBean>{
         val url = "${opts.dataPlatform}/dict/scheme/class/query"
@@ -189,6 +189,7 @@ object DictTypeApi {
 
     /**
      * 方案对象对应的信息点
+     * 待处理
      */
     fun dictSchemeCategotyInfo(schemeId: Int,code: String): ArrayList<DictSchemeCategoryResponseInfo.DataBean>{
         val url = "${opts.dataPlatform}/dict/scheme/funcid/query"
@@ -208,6 +209,7 @@ object DictTypeApi {
 
     /**
      * 查询项目和方案的关系
+     * 待处理
      */
     fun dictSchemeAndProject(projectId: String): ArrayList<DictSchemeAndProjectResponse.DataBean>{
         val url = "${opts.dataPlatform}/dict/scheme/project/query"
@@ -233,7 +235,7 @@ object DictTypeApi {
      */
     fun dictGroup(groupId: String): ArrayList<DictPlatformType>{
         //type=group&groupCode=wd
-        val url = "${opts.dataPlatform}/def/class?groupCode=$groupId"
+        val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupId"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject["criteria"] = jsonObject2
@@ -250,7 +252,7 @@ object DictTypeApi {
      * 集团下对象信息点
      */
     fun dictGroupInfo(groupId: String,code: String): ArrayList<DictPlatformInfo>{
-        val url = "${opts.dataPlatform}/def/funcid?groupCode=$groupId"
+        val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = code
@@ -271,7 +273,7 @@ object DictTypeApi {
      */
     fun dictProject(groupCode: String,projectId: String): ArrayList<DictPlatformType>{
         //type=group&groupCode=wd
-        val url = "${opts.dataPlatform}/def/class?groupCode=$groupCode&projectId=$projectId"
+        val url = "${opts.dataPlatform}/rwd/def/class?groupCode=$groupCode&projectId=$projectId"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject["criteria"] = jsonObject2
@@ -290,7 +292,7 @@ object DictTypeApi {
      * 集团下对象信息点
      */
     fun dictProjectInfo(groupId: String,code: String,projectId: String): ArrayList<DictPlatformInfo>{
-        val url = "${opts.dataPlatform}/def/funcid?groupCode=$groupId&projectId=$projectId"
+        val url = "${opts.dataPlatform}/rwd/def/funcid?groupCode=$groupId&projectId=$projectId"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = code

+ 5 - 5
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/BuildingApi.kt

@@ -29,7 +29,7 @@ object BuildingApi {
      * @return              返回结果
      */
     fun buildingSyn(projectId: String,type: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = type
@@ -50,7 +50,7 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  createBuilding(projectId: String, building:Building): Boolean {
-        val url = "${opts.dataPlatform}/instance/object/create?projectId=${projectId}&appId=datacenter"
+        val url = "${opts.dataPlatform}/rwd/instance/object/create?projectId=${projectId}&appId=datacenter"
         val buildingTools = BuildingUtil.buildingTools(projectId, building)
         val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
         if (postObject.result == "success") {
@@ -67,7 +67,7 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  updateBuilding(projectId: String, building:Building): Boolean {
-        val url = "${opts.dataPlatform}/instance/object/update?projectId=${projectId}&appId=datacenter"
+        val url = "${opts.dataPlatform}/rwd/instance/object/update?projectId=${projectId}&appId=datacenter"
         val buildingTools = BuildingUtil.buildingTools(projectId, building)
         val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, buildingTools)
         if (postObject.result == "success") {
@@ -84,7 +84,7 @@ object BuildingApi {
      * @return 是否成功
      */
     fun  delBuilding(projectId: String, buildingId: String): Boolean {
-        val url = "${opts.dataPlatform}/instance/object/delete?projectId=${projectId}&appId=datacenter"
+        val url = "${opts.dataPlatform}/rwd/instance/object/delete?projectId=${projectId}&appId=datacenter"
         val listId = ArrayList<String>()
         listId.add(buildingId)
         val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, listId)
@@ -102,7 +102,7 @@ object BuildingApi {
      * @return 返回结果
      */
     fun queryBuilding(projectId: String,id: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["id"] = id

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

@@ -25,7 +25,7 @@ object EquipApi {
      * @return 返回值
      */
     fun equipSynApi(projectId: String,page: Int): MiddleGroundDataRespose{
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "equipment"
@@ -48,7 +48,7 @@ object EquipApi {
      * @return 返回结果
      */
     fun equipInFloor(projectId: String,equipId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/relation/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/relation/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "MechInArch"
@@ -70,7 +70,7 @@ object EquipApi {
      * @return 返回结果
      */
     fun equipInBuilding(projectId: String,equipId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/relation/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/relation/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "MechInArch"

+ 22 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/ProjectApi.kt

@@ -25,8 +25,8 @@ object ProjectApi {
      * @param projectId     集团编码
      * @return
      */
-    fun projectQuery(projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+    fun projectQueryGroup(id: String): ArrayList<HashMap<String, Any?>> {
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?groupCode=${id}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = "project"
@@ -40,6 +40,26 @@ object ProjectApi {
         return ArrayList<HashMap<String, Any?>>()
     }
 
+    /**
+     * 根据集团查询集团下所有的项目
+     *
+     * @param projectId     集团编码
+     * @return
+     */
+    fun projectQuery(projectId: String): ArrayList<HashMap<String, Any?>> {
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
+        val jsonObject = JSONObject()
+        val jsonObject2 = JSONObject()
+        jsonObject2["classCode"] = "project"
+        jsonObject2["valid"] = 1
+        jsonObject["criteria"] = jsonObject2
+
+        val postObject = SHttpUtil.postObject<MiddleGroundDataRespose>(url, jsonObject)
+        if (postObject.result == "success"&&!postObject.data.isNullOrEmpty()) {
+            return postObject.data!!
+        }
+        return ArrayList<HashMap<String, Any?>>()
+    }
 
 
 }

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

@@ -19,7 +19,7 @@ object ShaftApi {
     }
 
     fun shaftQuery(projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = "shaft"

+ 3 - 3
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/SpaceApi.kt

@@ -26,7 +26,7 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceSynApi(projectId: String): ArrayList<HashMap<String, Any?>>{
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["objType"] = "space"
@@ -47,7 +47,7 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceInBuilding(projectId: String,spaceId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/relation/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/relation/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "ArchSubset"
@@ -69,7 +69,7 @@ object SpaceApi {
      * @return 返回结果
      */
     fun spaceInFloor(projectId: String,spaceId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/relation/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/relation/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 =  JSONObject()
         jsonObject2["graphCode"] = "ArchSubset"

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

@@ -25,7 +25,7 @@ object SystemApi {
      * @return 返回结果
      */
     fun systemQuery(projectId: String): ArrayList<HashMap<String, Any?>> {
-        val url = "${opts.dataPlatform}/instance/object/query?projectId=${projectId}"
+        val url = "${opts.dataPlatform}/rwd/instance/object/query?projectId=${projectId}"
         val jsonObject = JSONObject()
         val jsonObject2 = JSONObject()
         jsonObject2["classCode"] = "system"

+ 1 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/BuildingUtil.kt

@@ -1,6 +1,5 @@
 package com.persagy.server.syn.models.tools
 
-import com.persagy.base.extensions.toDouble
 import com.persagy.base.extensions.toInt
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
@@ -358,7 +357,7 @@ object BuildingUtil {
                                     if (building.infos.isNullOrEmpty()){
                                         building.infos = HashMap<String,Any?>()
                                     }
-                                    building.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    building.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (building.infos.isNullOrEmpty()){

+ 3 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/EquipUtil.kt

@@ -2348,6 +2348,7 @@ object EquipUtil {
         logger.debug("打印= ${mapObj.toJson()}")
         val equipment = Equipment()
         equipment.projectId = projectId
+        equipment.classCode = mapObj["classCode"].toString()
         for (key in mapObj.keys) {
             val containsKey = mapEx.containsKey(key)
             if (containsKey){
@@ -2369,7 +2370,7 @@ object EquipUtil {
                                     if (equipment.infos.isNullOrEmpty()){
                                         equipment.infos = HashMap<String,Any?>()
                                     }
-                                    equipment.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    equipment.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (equipment.infos.isNullOrEmpty()){
@@ -2443,7 +2444,7 @@ object EquipUtil {
                         "bimTypeId" -> equipment.bimTypeId =  mapObj[key]!!.toString()
                         "bimId" -> equipment.bimId =  mapObj[key]!!.toString()
                         "bimLocation" -> equipment.bimLocation =  mapObj[key]!!.toString()
-                        "equipSerial" -> equipment.equipSerial =  mapObj[key]!!.toString().toDouble()
+                        "equipSerial" -> equipment.equipSerial =  mapObj[key]!!.toString().toDoubleOrNull()
                     }
                 }
 

+ 1 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/FloorUtil.kt

@@ -2,7 +2,6 @@ package com.persagy.server.syn.models.tools
 
 import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
-import com.persagy.base.extensions.toDouble
 import com.persagy.base.extensions.toInt
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
@@ -169,7 +168,7 @@ object FloorUtil {
                                     if (floor.infos.isNullOrEmpty()){
                                         floor.infos = HashMap<String,Any?>()
                                     }
-                                    floor.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    floor.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (floor.infos.isNullOrEmpty()){

+ 1 - 1
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/ProjectUtil.kt

@@ -317,7 +317,7 @@ object ProjectUtil {
                                     if (project.infos.isNullOrEmpty()){
                                         project.infos = HashMap<String,Any?>()
                                     }
-                                    project.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    project.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (project.infos.isNullOrEmpty()){

+ 1 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/ShaftUtil.kt

@@ -1,6 +1,5 @@
 package com.persagy.server.syn.models.tools
 
-import com.persagy.base.extensions.toDouble
 import com.persagy.base.extensions.toInt
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
@@ -145,7 +144,7 @@ object ShaftUtil {
                                     if (shaft.infos.isNullOrEmpty()){
                                         shaft.infos = HashMap<String,Any?>()
                                     }
-                                    shaft.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    shaft.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (shaft.infos.isNullOrEmpty()){

+ 315 - 316
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/SpaceUtil.kt

@@ -3,7 +3,6 @@ package com.persagy.server.syn.models.tools
 import com.alibaba.fastjson.JSON
 import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
-import com.persagy.base.extensions.toDouble
 import com.persagy.base.extensions.toInt
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
@@ -34,313 +33,313 @@ object SpaceUtil {
         SSpringContextUtil.getBean(Opts::class.java) as Opts
     }
 
-    /**
-     * 空间转换工具
-     *
-     * @param projectId     项目 id
-     * @param groupCode     集团编码
-     * @param mapObj        中台数据对象
-     * @return 返回结果
-     */
-    fun spaceDataConversion(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): ZoneSpace {
-
-        /** 查建楼层型字典 */
-        val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode), SFilter.eq("classCode", mapObj["classCode"].toString())).exec()
-        val mapEx = HashMap<String, Any?>()
-        val mapTwo = HashMap<String, Any?>()
-
-        for (explainProject in dictDefFuncIdList) {
-            mapEx[explainProject.code!!] = explainProject.firstName
-            if (!explainProject.secondName.isNullOrEmpty()) {
-                mapTwo[explainProject.code!!] = explainProject.secondName
-            }
-        }
-        /** 租户信息 */
-        val tenantInfo = HashMap<String, Any?>()
-        /** 环境参数 */
-        val envParam = HashMap<String, Any?>()
-        /** 人员信息 */
-        val peopleInfo = HashMap<String, Any?>()
-        /** 能耗信息 */
-        val consumptionInfo = HashMap<String, Any?>()
-        /** 运行参数 */
-        val runParam = HashMap<String, Any?>()
-        /** 动态信息 */
-        val dynamicInfor = HashMap<String,Any?>()
-        /** 工作历信息 */
-        val workCalendar = HashMap<String,Any?>()
-        /** 反馈参数 */
-        val feedbackParam = HashMap<String,Any?>()
-        /** 静态参数 */
-        val staticParam = HashMap<String,Any?>()
-        /** 自定义 */
-        val customParam = HashMap<String, Any?>()
-
-        /** 温湿度 */
-        val temperatureHumidity = HashMap<String, Any?>()
-        /** 压力 */
-        val pressure = HashMap<String, Any?>()
-        /** 空气质量 */
-        val airQuality = HashMap<String, Any?>()
-        /** 光照 */
-        val illumination = HashMap<String, Any?>()
-        /** 声强 */
-        val soundIntensity = HashMap<String, Any?>()
-        /** 风速 */
-        val windSpeed = HashMap<String, Any?>()
-        /**  关键指标*/
-        val keyIndic = HashMap<String, Any?>()
-        /** 逐时 */
-        val hourly = HashMap<String, Any?>()
-        /** 累计 */
-        val cumulative = HashMap<String, Any?>()
-        /** 租赁信息 */
-        val leaseInfo = java.util.HashMap<String, Any?>()
-        /** 环境参数 */
-        val envParamTwo = HashMap<String, Any?>()
-
-        val zoneSpace = ZoneSpace()
-        zoneSpace.projectId = projectId
-        zoneSpace.classCode = mapObj["classCode"].toString()
-        /** id 是否存在 */
-        val containsKeyId = mapObj.containsKey("id")
-        if(containsKeyId){
-            zoneSpace.id = mapObj["id"].toString()
-        }
-        /** name 是否存在 */
-        val containsKeyName = mapObj.containsKey("name")
-        if(containsKeyName){
-            zoneSpace.name = mapObj["name"].toString()
-        }
-        for (key in mapObj.keys) {
-            val containsKey = mapEx.containsKey(key)
-            if (containsKey) {
-                val value = mapEx[key]
-//                logger.info("value= ${key}*${ value}****************************************************************")
-                if (value == opts.TenantInfo) {
-                    /** 租户信息 */
-                    tenantInfo[key] = mapObj[key]
-                } else if (value == opts.EnvParam) {
-                    /** 环境参数 */
-                    val contains = mapTwo.containsKey(key)
-                    if (contains) {
-                        val any = mapTwo[key]
-                        if (any == "温湿度") {
-                            temperatureHumidity[key] = mapObj[key]
-                        } else if (any == "压力") {
-                            pressure[key] = mapObj[key]
-                        } else if (any == "空气质量") {
-                            airQuality[key] = mapObj[key]
-                        } else if (any == "光照") {
-                            illumination[key] = mapObj[key]
-                        } else if (any == "声强") {
-                            soundIntensity[key] = mapObj[key]
-                        } else if (any == "风速") {
-                            windSpeed[key] = mapObj[key]
-                        } else if (any == "关键指标") {
-                            keyIndic[key] = mapObj[key]
-                        } else {
-                            envParam[key] = mapObj[key]
-                        }
-                    } else {
-                        envParam[key] = mapObj[key]
-                    }
-                } else if (value == opts.PeopleInfo) {
-                    /** 人员信息 */
-                    peopleInfo[key] = mapObj[key]
-                } else if (value == opts.ConsumptionInfo) {
-                    /** 能耗信息 */
-                    val contains = mapTwo.containsKey(key)
-                    if (contains) {
-                        val any = mapTwo[key]
-                        if (any == "逐时") {
-                            hourly[key] = mapObj[key]
-                        } else if (any == "累计") {
-                            cumulative[key] = mapObj[key]
-                        } else {
-                            consumptionInfo[key] = mapObj[key]
-                        }
-                    } else {
-                        consumptionInfo[key] = mapObj[key]
-                    }
-                } else if (value == "动态信息"){
-                    /** 动态信息 */
-                    val contains = mapTwo.containsKey(key)
-                    if (contains) {
-                        val any = mapTwo[key]
-                        if (any == "租赁信息") {
-                            leaseInfo[key] = mapObj[key]
-                        } else {
-                            dynamicInfor[key] = mapObj[key]
-                        }
-                    } else {
-                        dynamicInfor[key] = mapObj[key]
-                    }
-                } else if (value == opts.RunParam) {
-                    /** 运行参数 */
-                    val contains = mapTwo.containsKey(key)
-                    if (contains) {
-                        val any = mapTwo[key]
-                        if (any == "环境参数") {
-                            envParamTwo[key] = mapObj[key]
-                        } else if (any == "关键指标") {
-                            keyIndic[key] = mapObj[key]
-                        } else {
-                            runParam[key] = mapObj[key]
-                        }
-                    } else {
-                        runParam[key] = mapObj[key]
-                    }
-                } else if (value == "关联工作历"){
-                    workCalendar[key] = mapObj[key]
-                } else if (value == "反馈参数"){
-                    feedbackParam[key] = mapObj[key]
-                } else if (value == "静态参数"){
-                    staticParam [key] = mapObj[key]
-                } else {
-                    try {
-                        when (key) {
-                            "localId" -> zoneSpace.localId = mapObj[key].toString()
-                            "localName" -> zoneSpace.localName = mapObj[key].toString()
-                            "bimId" -> zoneSpace.bimId = mapObj[key].toString()
-                            "qRCodePic" -> zoneSpace.qRCodePic = mapObj[key].toString()
-                            "bimLocation" -> zoneSpace.bimLocation = mapObj[key].toString()
-                            "roomFuncType" -> zoneSpace.roomFuncType = mapObj[key].toString()
-                            "depth" -> zoneSpace.depth = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
-                            "width" -> {
-//                                logger.info("key1= ${key}*${ infos[key]!!.javaClass.simpleName}****************************************************************")
-                                if (mapObj[key].toString().isNullOrEmpty()) {
-                                    zoneSpace.width = null
-                                } else {
-                                    zoneSpace.width = mapObj[key]!!.toDouble()
-                                }
-                            }
-                            "buildArea" -> zoneSpace.buildArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
-                            "netArea" -> zoneSpace.netArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
-                            "height" -> zoneSpace.height = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
-                            "elecCap" -> zoneSpace.elecCap = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
-                            "pollutionDegree" -> zoneSpace.pollutionDegree = mapObj[key].toString()
-                            "intro" -> zoneSpace.intro
-                            "pic" -> {
-
-                                try {
-                                    val attPicList = JSON.parseArray(mapObj[key].toString(), AttPic::class.java) as ArrayList<AttPic>
-                                    val listTaskPic = ArrayList<TaskPic>()
-                                    for (attPic in attPicList){
-                                        val taskPic = TaskPic()
-                                        taskPic.type = attPic.type
-                                        taskPic.systemId = attPic.systemId
-                                        taskPic.name = attPic.name
-                                        taskPic.key = attPic.key
-                                        taskPic.createTime = attPic.createTime
-                                        listTaskPic.add(taskPic)
-                                    }
-                                    zoneSpace.pic = listTaskPic
-                                } catch (e: Exception) {
-                                    e.printStackTrace()
-                                }
-                            }
-                            "outline" -> {
-
-                                try {
-
-
-                                    val replace1 = mapObj[key].toString().replace("X", "x")
-                                    val replace2 = replace1.replace("Y", "y")
-                                    val replace3 = replace2.replace("Z", "z")
-                                    logger.debug("坐标= ${replace3}")
-                                    val type = object : TypeToken<ArrayList<ArrayList<ArrayList<PointPosition>>>>() {
-                                    }.getType()
-                                    var outline=  Gson().fromJson<ArrayList<ArrayList<ArrayList<PointPosition>>>>(replace3,type)
-                                    zoneSpace.outline = outline
-                                } catch (e: Exception) {
-                                    e.printStackTrace()
-                                }
-                            }
-                        }
-                    } catch (e: Exception) {
-                        e.printStackTrace()
-                    }
-                }
-
-            } else if (key.startsWith("ctm-")) {
-                /** 自定义 */
-                customParam[key] = mapObj[key]
-            }
-        }
-        if (temperatureHumidity.size > 0) {
-            envParam["temperatureHumidity"] = temperatureHumidity
-        }
-        if (pressure.size > 0) {
-            envParam["pressure"] = pressure
-        }
-        if (airQuality.size > 0) {
-            envParam["airQuality"] = airQuality
-        }
-        if (illumination.size > 0) {
-            envParam["illumination"] = illumination
-        }
-        if (soundIntensity.size > 0) {
-            envParam["soundIntensity"] = soundIntensity
-        }
-        if (windSpeed.size > 0) {
-            envParam["windSpeed"] = windSpeed
-        }
-        if (keyIndic.size > 0) {
-            envParam["keyIndic"] = keyIndic
-        }
-
-        if (hourly.size > 0) {
-            consumptionInfo["hourly"] = hourly
-        }
-        if (cumulative.size > 0) {
-            consumptionInfo["cumulative"] = cumulative
-        }
-
-        if (leaseInfo.size>0){
-            dynamicInfor["leaseInfo"] = leaseInfo
-        }
-
-        if (envParamTwo.size>0){
-            runParam["envParam"] = envParamTwo
-        }
-        if (keyIndic.size>0){
-            runParam["keyIndic"] = keyIndic
-        }
-
-        if (workCalendar.size>0){
-            zoneSpace.workCalendar = workCalendar
-        }
-
-        if (dynamicInfor.size > 0){
-            zoneSpace.dynamicInfor = dynamicInfor
-        }
-        if (tenantInfo.size > 0) {
-            zoneSpace.tenantInfo = tenantInfo
-        }
-        if (envParam.size > 0) {
-            zoneSpace.envParam = envParam
-        }
-        if (peopleInfo.size > 0) {
-            zoneSpace.peopleInfo = peopleInfo
-        }
-        if (consumptionInfo.size > 0) {
-            zoneSpace.consumptionInfo = consumptionInfo
-        }
-        if (customParam.size > 0) {
-            zoneSpace.customParam = customParam
-        }
-        if (runParam.size > 0){
-            zoneSpace.runParam = runParam
-        }
-        if (feedbackParam.size > 0){
-            zoneSpace.feedbackParam = feedbackParam
-        }
-        if (staticParam.size > 0){
-            zoneSpace.staticParam = staticParam
-        }
-        return zoneSpace
-    }
+//    /**
+//     * 空间转换工具
+//     *
+//     * @param projectId     项目 id
+//     * @param groupCode     集团编码
+//     * @param mapObj        中台数据对象
+//     * @return 返回结果
+//     */
+//    fun spaceDataConversion(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): ZoneSpace {
+//
+//        /** 查建楼层型字典 */
+//        val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode), SFilter.eq("classCode", mapObj["classCode"].toString())).exec()
+//        val mapEx = HashMap<String, Any?>()
+//        val mapTwo = HashMap<String, Any?>()
+//
+//        for (explainProject in dictDefFuncIdList) {
+//            mapEx[explainProject.code!!] = explainProject.firstName
+//            if (!explainProject.secondName.isNullOrEmpty()) {
+//                mapTwo[explainProject.code!!] = explainProject.secondName
+//            }
+//        }
+//        /** 租户信息 */
+//        val tenantInfo = HashMap<String, Any?>()
+//        /** 环境参数 */
+//        val envParam = HashMap<String, Any?>()
+//        /** 人员信息 */
+//        val peopleInfo = HashMap<String, Any?>()
+//        /** 能耗信息 */
+//        val consumptionInfo = HashMap<String, Any?>()
+//        /** 运行参数 */
+//        val runParam = HashMap<String, Any?>()
+//        /** 动态信息 */
+//        val dynamicInfor = HashMap<String,Any?>()
+//        /** 工作历信息 */
+//        val workCalendar = HashMap<String,Any?>()
+//        /** 反馈参数 */
+//        val feedbackParam = HashMap<String,Any?>()
+//        /** 静态参数 */
+//        val staticParam = HashMap<String,Any?>()
+//        /** 自定义 */
+//        val customParam = HashMap<String, Any?>()
+//
+//        /** 温湿度 */
+//        val temperatureHumidity = HashMap<String, Any?>()
+//        /** 压力 */
+//        val pressure = HashMap<String, Any?>()
+//        /** 空气质量 */
+//        val airQuality = HashMap<String, Any?>()
+//        /** 光照 */
+//        val illumination = HashMap<String, Any?>()
+//        /** 声强 */
+//        val soundIntensity = HashMap<String, Any?>()
+//        /** 风速 */
+//        val windSpeed = HashMap<String, Any?>()
+//        /**  关键指标*/
+//        val keyIndic = HashMap<String, Any?>()
+//        /** 逐时 */
+//        val hourly = HashMap<String, Any?>()
+//        /** 累计 */
+//        val cumulative = HashMap<String, Any?>()
+//        /** 租赁信息 */
+//        val leaseInfo = java.util.HashMap<String, Any?>()
+//        /** 环境参数 */
+//        val envParamTwo = HashMap<String, Any?>()
+//
+//        val zoneSpace = ZoneSpace()
+//        zoneSpace.projectId = projectId
+//        zoneSpace.classCode = mapObj["classCode"].toString()
+//        /** id 是否存在 */
+//        val containsKeyId = mapObj.containsKey("id")
+//        if(containsKeyId){
+//            zoneSpace.id = mapObj["id"].toString()
+//        }
+//        /** name 是否存在 */
+//        val containsKeyName = mapObj.containsKey("name")
+//        if(containsKeyName){
+//            zoneSpace.name = mapObj["name"].toString()
+//        }
+//        for (key in mapObj.keys) {
+//            val containsKey = mapEx.containsKey(key)
+//            if (containsKey) {
+//                val value = mapEx[key]
+////                logger.info("value= ${key}*${ value}****************************************************************")
+//                if (value == opts.TenantInfo) {
+//                    /** 租户信息 */
+//                    tenantInfo[key] = mapObj[key]
+//                } else if (value == opts.EnvParam) {
+//                    /** 环境参数 */
+//                    val contains = mapTwo.containsKey(key)
+//                    if (contains) {
+//                        val any = mapTwo[key]
+//                        if (any == "温湿度") {
+//                            temperatureHumidity[key] = mapObj[key]
+//                        } else if (any == "压力") {
+//                            pressure[key] = mapObj[key]
+//                        } else if (any == "空气质量") {
+//                            airQuality[key] = mapObj[key]
+//                        } else if (any == "光照") {
+//                            illumination[key] = mapObj[key]
+//                        } else if (any == "声强") {
+//                            soundIntensity[key] = mapObj[key]
+//                        } else if (any == "风速") {
+//                            windSpeed[key] = mapObj[key]
+//                        } else if (any == "关键指标") {
+//                            keyIndic[key] = mapObj[key]
+//                        } else {
+//                            envParam[key] = mapObj[key]
+//                        }
+//                    } else {
+//                        envParam[key] = mapObj[key]
+//                    }
+//                } else if (value == opts.PeopleInfo) {
+//                    /** 人员信息 */
+//                    peopleInfo[key] = mapObj[key]
+//                } else if (value == opts.ConsumptionInfo) {
+//                    /** 能耗信息 */
+//                    val contains = mapTwo.containsKey(key)
+//                    if (contains) {
+//                        val any = mapTwo[key]
+//                        if (any == "逐时") {
+//                            hourly[key] = mapObj[key]
+//                        } else if (any == "累计") {
+//                            cumulative[key] = mapObj[key]
+//                        } else {
+//                            consumptionInfo[key] = mapObj[key]
+//                        }
+//                    } else {
+//                        consumptionInfo[key] = mapObj[key]
+//                    }
+//                } else if (value == "动态信息"){
+//                    /** 动态信息 */
+//                    val contains = mapTwo.containsKey(key)
+//                    if (contains) {
+//                        val any = mapTwo[key]
+//                        if (any == "租赁信息") {
+//                            leaseInfo[key] = mapObj[key]
+//                        } else {
+//                            dynamicInfor[key] = mapObj[key]
+//                        }
+//                    } else {
+//                        dynamicInfor[key] = mapObj[key]
+//                    }
+//                } else if (value == opts.RunParam) {
+//                    /** 运行参数 */
+//                    val contains = mapTwo.containsKey(key)
+//                    if (contains) {
+//                        val any = mapTwo[key]
+//                        if (any == "环境参数") {
+//                            envParamTwo[key] = mapObj[key]
+//                        } else if (any == "关键指标") {
+//                            keyIndic[key] = mapObj[key]
+//                        } else {
+//                            runParam[key] = mapObj[key]
+//                        }
+//                    } else {
+//                        runParam[key] = mapObj[key]
+//                    }
+//                } else if (value == "关联工作历"){
+//                    workCalendar[key] = mapObj[key]
+//                } else if (value == "反馈参数"){
+//                    feedbackParam[key] = mapObj[key]
+//                } else if (value == "静态参数"){
+//                    staticParam [key] = mapObj[key]
+//                } else {
+//                    try {
+//                        when (key) {
+//                            "localId" -> zoneSpace.localId = mapObj[key].toString()
+//                            "localName" -> zoneSpace.localName = mapObj[key].toString()
+//                            "bimId" -> zoneSpace.bimId = mapObj[key].toString()
+//                            "qRCodePic" -> zoneSpace.qRCodePic = mapObj[key].toString()
+//                            "bimLocation" -> zoneSpace.bimLocation = mapObj[key].toString()
+//                            "roomFuncType" -> zoneSpace.roomFuncType = mapObj[key].toString()
+//                            "depth" -> zoneSpace.depth = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDoubleOrNull() else null
+//                            "width" -> {
+////                                logger.info("key1= ${key}*${ infos[key]!!.javaClass.simpleName}****************************************************************")
+//                                if (mapObj[key].toString().isNullOrEmpty()) {
+//                                    zoneSpace.width = null
+//                                } else {
+//                                    zoneSpace.width = mapObj[key]!!.toDouble()
+//                                }
+//                            }
+//                            "buildArea" -> zoneSpace.buildArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
+//                            "netArea" -> zoneSpace.netArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
+//                            "height" -> zoneSpace.height = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
+//                            "elecCap" -> zoneSpace.elecCap = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
+//                            "pollutionDegree" -> zoneSpace.pollutionDegree = mapObj[key].toString()
+//                            "intro" -> zoneSpace.intro
+//                            "pic" -> {
+//
+//                                try {
+//                                    val attPicList = JSON.parseArray(mapObj[key].toString(), AttPic::class.java) as ArrayList<AttPic>
+//                                    val listTaskPic = ArrayList<TaskPic>()
+//                                    for (attPic in attPicList){
+//                                        val taskPic = TaskPic()
+//                                        taskPic.type = attPic.type
+//                                        taskPic.systemId = attPic.systemId
+//                                        taskPic.name = attPic.name
+//                                        taskPic.key = attPic.key
+//                                        taskPic.createTime = attPic.createTime
+//                                        listTaskPic.add(taskPic)
+//                                    }
+//                                    zoneSpace.pic = listTaskPic
+//                                } catch (e: Exception) {
+//                                    e.printStackTrace()
+//                                }
+//                            }
+//                            "outline" -> {
+//
+//                                try {
+//
+//
+//                                    val replace1 = mapObj[key].toString().replace("X", "x")
+//                                    val replace2 = replace1.replace("Y", "y")
+//                                    val replace3 = replace2.replace("Z", "z")
+//                                    logger.debug("坐标= ${replace3}")
+//                                    val type = object : TypeToken<ArrayList<ArrayList<ArrayList<PointPosition>>>>() {
+//                                    }.getType()
+//                                    var outline=  Gson().fromJson<ArrayList<ArrayList<ArrayList<PointPosition>>>>(replace3,type)
+//                                    zoneSpace.outline = outline
+//                                } catch (e: Exception) {
+//                                    e.printStackTrace()
+//                                }
+//                            }
+//                        }
+//                    } catch (e: Exception) {
+//                        e.printStackTrace()
+//                    }
+//                }
+//
+//            } else if (key.startsWith("ctm-")) {
+//                /** 自定义 */
+//                customParam[key] = mapObj[key]
+//            }
+//        }
+//        if (temperatureHumidity.size > 0) {
+//            envParam["temperatureHumidity"] = temperatureHumidity
+//        }
+//        if (pressure.size > 0) {
+//            envParam["pressure"] = pressure
+//        }
+//        if (airQuality.size > 0) {
+//            envParam["airQuality"] = airQuality
+//        }
+//        if (illumination.size > 0) {
+//            envParam["illumination"] = illumination
+//        }
+//        if (soundIntensity.size > 0) {
+//            envParam["soundIntensity"] = soundIntensity
+//        }
+//        if (windSpeed.size > 0) {
+//            envParam["windSpeed"] = windSpeed
+//        }
+//        if (keyIndic.size > 0) {
+//            envParam["keyIndic"] = keyIndic
+//        }
+//
+//        if (hourly.size > 0) {
+//            consumptionInfo["hourly"] = hourly
+//        }
+//        if (cumulative.size > 0) {
+//            consumptionInfo["cumulative"] = cumulative
+//        }
+//
+//        if (leaseInfo.size>0){
+//            dynamicInfor["leaseInfo"] = leaseInfo
+//        }
+//
+//        if (envParamTwo.size>0){
+//            runParam["envParam"] = envParamTwo
+//        }
+//        if (keyIndic.size>0){
+//            runParam["keyIndic"] = keyIndic
+//        }
+//
+//        if (workCalendar.size>0){
+//            zoneSpace.workCalendar = workCalendar
+//        }
+//
+//        if (dynamicInfor.size > 0){
+//            zoneSpace.dynamicInfor = dynamicInfor
+//        }
+//        if (tenantInfo.size > 0) {
+//            zoneSpace.tenantInfo = tenantInfo
+//        }
+//        if (envParam.size > 0) {
+//            zoneSpace.envParam = envParam
+//        }
+//        if (peopleInfo.size > 0) {
+//            zoneSpace.peopleInfo = peopleInfo
+//        }
+//        if (consumptionInfo.size > 0) {
+//            zoneSpace.consumptionInfo = consumptionInfo
+//        }
+//        if (customParam.size > 0) {
+//            zoneSpace.customParam = customParam
+//        }
+//        if (runParam.size > 0){
+//            zoneSpace.runParam = runParam
+//        }
+//        if (feedbackParam.size > 0){
+//            zoneSpace.feedbackParam = feedbackParam
+//        }
+//        if (staticParam.size > 0){
+//            zoneSpace.staticParam = staticParam
+//        }
+//        return zoneSpace
+//    }
 
     /**
      * 空间转换工具
@@ -388,7 +387,7 @@ object SpaceUtil {
                                     if (zoneSpace.infos.isNullOrEmpty()){
                                         zoneSpace.infos = HashMap<String,Any?>()
                                     }
-                                    zoneSpace.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    zoneSpace.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (zoneSpace.infos.isNullOrEmpty()){
@@ -455,17 +454,17 @@ object SpaceUtil {
                         "localName" -> zoneSpace.localName =  mapObj[key]!!.toString()
                         "defaultQRCode" -> zoneSpace.defaultQRCode =  mapObj[key]!!.toString()
                         "qRCodePic" -> zoneSpace.qRCodePic =  mapObj[key]!!.toString()
-                        "roomSerial" -> zoneSpace.roomSerial =  mapObj[key]!!.toString().toDouble()
+                        "roomSerial" -> zoneSpace.roomSerial =  mapObj[key]!!.toString().toDoubleOrNull()
                         "roomFuncType" -> zoneSpace.roomFuncType =  mapObj[key]!!.toString()
-                        "depth" -> zoneSpace.depth =  mapObj[key]!!.toString().toDouble()
-                        "width" -> zoneSpace.width =  mapObj[key]!!.toString().toDouble()
-                        "buildArea" -> zoneSpace.buildArea =  mapObj[key]!!.toString().toDouble()
+                        "depth" -> zoneSpace.depth =  mapObj[key]!!.toString().toDoubleOrNull()
+                        "width" -> zoneSpace.width =  mapObj[key]!!.toString().toDoubleOrNull()
+                        "buildArea" -> zoneSpace.buildArea =  mapObj[key]!!.toString().toDoubleOrNull()
                         "bimId" -> zoneSpace.bimId =  mapObj[key]!!.toString()
                         "bimLocation" -> zoneSpace.bimLocation =  mapObj[key]!!.toString()
-                        "netArea" -> zoneSpace.netArea =  mapObj[key]!!.toString().toDouble()
-                        "height" -> zoneSpace.height =  mapObj[key]!!.toString().toDouble()
+                        "netArea" -> zoneSpace.netArea =  mapObj[key]!!.toString().toDoubleOrNull()
+                        "height" -> zoneSpace.height =  mapObj[key]!!.toString().toDoubleOrNull()
                         "zoneOrientation" -> zoneSpace.zoneOrientation =  mapObj[key]!!.toString()
-                        "elecCap" -> zoneSpace.elecCap =  mapObj[key]!!.toString().toDouble()
+                        "elecCap" -> zoneSpace.elecCap =  mapObj[key]!!.toString().toDoubleOrNull()
                         "pollutionDegree" -> zoneSpace.pollutionDegree =  mapObj[key]!!.toString()
                         "permanentPeopleNum" -> zoneSpace.permanentPeopleNum =  mapObj[key]!!.toString().toInt()
                         "intro" -> zoneSpace.intro =  mapObj[key]!!.toString()

+ 1 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/models/tools/SystemUtil.kt

@@ -1,6 +1,5 @@
 package com.persagy.server.syn.models.tools
 
-import com.persagy.base.extensions.toDouble
 import com.persagy.base.extensions.toInt
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
@@ -542,7 +541,7 @@ object SystemUtil {
                                     if (generalSystem.infos.isNullOrEmpty()){
                                         generalSystem.infos = HashMap<String,Any?>()
                                     }
-                                    generalSystem.infos!![key] = mapObj[key]!!.toString().toDouble()
+                                    generalSystem.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                 }
                                 "BOOLEAN" -> {
                                     if (generalSystem.infos.isNullOrEmpty()){

+ 2 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/services/dict/DClassDefService.kt

@@ -520,7 +520,7 @@ object DClassDefService : SObjectService<DClassDef>(SMybatisDao(DClassDef::class
                 for (group in groupList){
                     for (defClass in defClassList){
                         val dictGroupInfoList = DictTypeApi.dictGroupInfo(group.code!!, defClass.code!!)
-                        defFuncIdService.delete(SFilter.eq("groupCode",group.code!!),SFilter.eq("classCode",defClass.code!!))
+                        defFuncIdService.delete(SFilter.eq("groupCode",group.code!!),SFilter.eq("classCode",defClass.code!!),SFilter.eq("projectId","0"))
                         if (dictGroupInfoList.size>0){
                             for (dictGroupInfo in dictGroupInfoList){
                                 /** 开头字母大写转小写 */
@@ -625,7 +625,7 @@ object DClassDefService : SObjectService<DClassDef>(SMybatisDao(DClassDef::class
                                 }
                                 defFuncId.secondName = dictGroupInfo.secondTag
                                 defFuncId.subFlag = dictGroupInfo.subFlag
-                                defFuncId.type = dictGroupInfo.type
+                                defFuncId.type = "group`"
                                 defFuncId.unit = dictGroupInfo.unit
                                 defFuncId.origCode = dictGroupInfo.origCode
                                 defFuncId.origDataType = dictGroupInfo.origDataType

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

@@ -8,7 +8,8 @@ spring:
 #    password:                           123qwe!@#
     url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
-    password:                           persagy_2020qwe!@#
+#    password:                           persagy_2020qwe!@#
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
     #配置rabbitMq 服务器
   rabbitmq:
@@ -20,5 +21,5 @@ spring:
     virtual-host: /test
 
 saga:
-  dataPlatform:                        http://39.102.54.110:9002
+  dataPlatform:                        http://39.102.40.239:9970
 

+ 1 - 1
equip-componnet/src/main/kotlin/com/persagy/server/service/EquipORComponCategoryService.kt

@@ -25,7 +25,7 @@ object EquipORComponCategoryService : RService<EquipORComponCategory>(SMybatisDa
     fun getEquipORComponCategory(): SQueryResponse<EquipORComponCategory> {
         return try {
             val request = SQueryRequest()
-            val projectId = SPageContext.getHeader("ProjectId")
+            val projectId = SPageContext.getHeader("projectId")
             val queryBuilder = select(request.filters)
             queryBuilder.tableName = "public.f_equip_or_component_category('$projectId')"
             if (null != request.projection) {

+ 2 - 1
equip-componnet/src/main/resources/application-prod.yml

@@ -21,7 +21,8 @@ spring:
 #    password:                           123qwe!@#
     url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
     username:                           postgres
-    password:                           persagy_2020qwe!@#
+#    password:                           persagy_2020qwe!@#
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
 #  activemq:
 #    user:                               admin

+ 2 - 1
gradle.properties

@@ -128,6 +128,7 @@ TESTNG_VERSION = 7.1.0
 
 LOMBOK_VERSION = 1.16.16
 
-
+# https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui
+SPRING_DOC_VERSION = 1.4.8
 
 

+ 1 - 1
meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKu.kt

@@ -41,7 +41,7 @@ class MeiKu : Serializable, SBaseEntity() {
 
     /** 锚点列表 */
     @ApiModelProperty(value = "锚点列表")
-    @SCascade(table="labsl_meiku.meiku_anchor", idColumn="meitu_id", childIdColumn="id")
+    @SCascade(table="labsl_meiku.meiku_anchor", idColumn="meiku_id", childIdColumn="id")
     var anchorList: ArrayList<MeiKuAnchor>? = null
 
     @ApiModelProperty(value = "状态")

+ 2 - 2
meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKuAnchor.kt

@@ -27,8 +27,8 @@ class MeiKuAnchor: Serializable, SBaseEntity() {
     /** 图id */
     @ApiModelProperty(value = "图id")
     @Id
-    @Column(name = "meitu_id")
-    var meiTuId: String? = null
+    @Column(name = "meiku_id")
+    var meiKuId: String? = null
 
     /** 锚点坐标 */
     @ApiModelProperty(value = "锚点坐标")

+ 2 - 2
meiku/src/main/kotlin/com/persagy/server/meiku/models/entities/MeiKuState.kt

@@ -26,8 +26,8 @@ class MeiKuState: Serializable, SBaseEntity() {
     /** 图id */
     @ApiModelProperty(value = "图id")
     @Id
-    @Column(name = "meitu_id")
-    var meiTuId: String? = null
+    @Column(name = "meiku_id")
+    var meiKuId: String? = null
 
     /** 状态内容 */
     @ApiModelProperty(value = "状态内容")

+ 4 - 4
meiku/src/main/kotlin/com/persagy/server/meiku/services/MeiKuService.kt

@@ -36,7 +36,7 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
             val insert = insert(meiKu)
             if (!meiKu.anchorList.isNullOrEmpty()) {
                 for (anchor in meiKu.anchorList!!) {
-                    anchor.meiTuId = meiKu.id
+                    anchor.meiKuId = meiKu.id
                     if (anchor.id.isNullOrEmpty()) {
                         anchor.id = UUID.randomUUID().toString().replace("-", "")
                     }
@@ -46,7 +46,7 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
             if (!meiKu.state .isNullOrEmpty()) {
                 val stateList = meiKu.state
                 for (state in stateList!!){
-                    state!!.meiTuId = meiKu.id
+                    state!!.meiKuId = meiKu.id
                     if (state!!.id.isNullOrEmpty()) {
                         state!!.id = UUID.randomUUID().toString().replace("-", "")
                     }
@@ -77,7 +77,7 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
                 val insert = insert(meiKu)
                 if (!meiKu.anchorList.isNullOrEmpty()){
                     for (anchor in meiKu.anchorList!!) {
-                        anchor.meiTuId = meiKu.id
+                        anchor.meiKuId = meiKu.id
                         if (anchor.id.isNullOrEmpty()) {
                             anchor.id = UUID.randomUUID().toString().replace("-", "")
                         }
@@ -87,7 +87,7 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
                 if (!meiKu.state.isNullOrEmpty()) {
                     val stateList = meiKu.state
                     for (state in stateList!!){
-                        state!!.meiTuId = meiKu.id
+                        state!!.meiKuId = meiKu.id
                         if (state!!.id.isNullOrEmpty()) {
                             state!!.id = UUID.randomUUID().toString().replace("-", "")
                         }

+ 5 - 0
meiku/src/main/resources/application-dev.yml

@@ -14,3 +14,8 @@ spring:
 
   activemq:
     broker-url:                         tcp://172.16.42.210:61616
+
+
+
+# persagy_2020labsl%#$
+# cGVyc2FneV8yMDIwbGFic2wlIyQ=

+ 0 - 7
meiku/src/main/resources/application-prod.yml

@@ -12,10 +12,3 @@ spring:
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
-
-  activemq:
-    broker-url:                         tcp://activemq:61616
-
-
-
-  alter user postgres with password 'cGVyc2FneV8yMDIwcXdlIUAj';

+ 39 - 0
pendingIssues.md

@@ -0,0 +1,39 @@
+# 问题
+## 待处理的视图
+v_general_system
+v_equip_component_count
+
+
+
+
+
+## 服务器密码
+服务器1 
+```metadata json
+ 公网ip: 60.205.177.43
+ 内网ip: 172.17.11.228
+ 账号: root
+ 密码: cGVyc2FneV8yMDIwbGFic2wlIyQ=
+ 原文密码: persagy_2020labsl%#$ (base64 转码后使用)
+```
+
+服务器2
+```metadata json
+ 公网ip: 47.93.22.124
+ 内网ip: 172.17.11.227
+ 账号: root
+ 密码: WWW.sagacloud.mail@2020
+
+```
+
+服务器3
+```metadata json
+ 公网ip: 47.94.89.44
+ 内网ip: 172.17.11.175
+ 账号: root
+ 密码: saga@)!^cloud
+ 账号: user1
+ 密码: @)!^sagacloud
+```
+
+