Pārlūkot izejas kodu

********************WX************************
字典接口

zhangweixin 4 gadi atpakaļ
vecāks
revīzija
4a6e87a25a
35 mainītis faili ar 3011 papildinājumiem un 1 dzēšanām
  1. 1 1
      data-center/src/main/kotlin/com/persagy/server/controllers/dict/DictControllers.kt
  2. 101 0
      equip-componnet/build.gradle
  3. 8 0
      equip-componnet/src/main/kotlin/com/persagy/server/a.java
  4. 43 0
      equip-componnet/src/main/kotlin/com/persagy/server/controllers/BuildingController.kt
  5. 19 0
      equip-componnet/src/main/kotlin/com/persagy/server/controllers/EquipController.kt
  6. 41 0
      equip-componnet/src/main/kotlin/com/persagy/server/controllers/FloorController.kt
  7. 30 0
      equip-componnet/src/main/kotlin/com/persagy/server/controllers/PointController.kt
  8. 57 0
      equip-componnet/src/main/kotlin/com/persagy/server/controllers/PropertyController.kt
  9. 55 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/PointPorperty.kt
  10. 31 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/PropertyEquip.kt
  11. 29 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/PropertyFamily.kt
  12. 8 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/a.java
  13. 138 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/objects/Building.kt
  14. 175 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/objects/FloorCompon.kt
  15. 107 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/EquipUpDateEnclosure.kt
  16. 16 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/EquipUpDateEnclosureRequest.kt
  17. 35 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/RSQueryResponse.kt
  18. 28 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ShaftSpaceVertical.kt
  19. 34 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/SpatialRelationship.kt
  20. 16 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ZoneEquipQueryRequest.kt
  21. 13 0
      equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ZoneISpaceQueryRequest.kt
  22. 13 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/EquipFamilyService.kt
  23. 629 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/PropertyEquipService.kt
  24. 107 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/PropertyFamilyService.kt
  25. 74 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/base/Service.kt
  26. 76 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/objects/BuildingService.kt
  27. 73 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/objects/FloorService.kt
  28. 98 0
      equip-componnet/src/main/kotlin/com/persagy/server/service/objects/PropertyService.kt
  29. 49 0
      equip-componnet/src/main/kotlin/com/persagy/server/synchronize/MessageHandler.kt
  30. 179 0
      equip-componnet/src/main/kotlin/com/persagy/server/utils/DataVerification.kt
  31. 239 0
      equip-componnet/src/main/kotlin/com/persagy/server/utils/IdUtils.kt
  32. 423 0
      equip-componnet/src/main/kotlin/com/persagy/server/utils/MatchingProperty.kt
  33. 40 0
      equip-componnet/src/main/kotlin/com/persagy/server/utils/ShaftNameUtil.kt
  34. 25 0
      equip-componnet/src/main/kotlin/com/persagy/server/utils/SpaceRunnables.kt
  35. 1 0
      settings.gradle

+ 1 - 1
data-center/src/main/kotlin/com/persagy/server/controllers/dict/DictControllers.kt

@@ -43,7 +43,7 @@ class DictControllers {
     @PostMapping(value = ["/query"])
     fun categoryInfoQuery(@RequestBody categoryRequest: CategoryRequest): SQueryResponse<DefFuncId>{
         return DictDefClassService.categoryInfoQuery(categoryRequest)
-    } //
+    } // Function query()
 
 
 } // Class DictControllers

+ 101 - 0
equip-componnet/build.gradle

@@ -0,0 +1,101 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*             
+ *         =@$    ;;;!=%@@@@=!           =@!      
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;                              
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+group rootProject.group
+version rootProject.version
+
+apply plugin: "kotlin"
+apply plugin: "org.jetbrains.dokka"
+apply plugin: "war"
+apply plugin: 'org.springframework.boot'
+apply plugin: 'io.spring.dependency-management'
+
+sourceCompatibility = JVM_TARGET
+
+compileKotlin {
+    kotlinOptions.jvmTarget = JVM_TARGET
+}
+compileTestKotlin {
+    kotlinOptions.jvmTarget = JVM_TARGET
+}
+
+dependencies {
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // kotlin 依赖
+    compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: KOTLIN_VERSION
+    compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: KOTLIN_VERSION
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // spring boot 依赖
+    compile group: "org.springframework.boot", name: "spring-boot-starter-web", version: SPRING_BOOT_VERSION
+    compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION
+    compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION
+    //消息
+    compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
+    providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION
+    // spring boot 缓存
+    compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // spring cloud 依赖
+//    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka', version: SPRING_CLOUD_VERSION
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // MySQL
+    // https://mvnrepository.com/artifact/mysql/mysql-connector-java
+//    compile group: 'mysql', name: 'mysql-connector-java', version: MYSQL_VERSION
+
+    // PostgreSQL
+    //https://mvnrepository.com/artifact/org.postgresql/postgresql
+//    compile group: 'org.postgresql',    name: 'postgresql',     version: POSTGRESQL_VERSION
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // 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
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // Sybotan依赖
+//    compile group: "com.sybotan", name: "sybotan-kotlin-base", version: SYBOTAN_KOTLIN_VERSION
+//    compile group: "com.sybotan", name: "sybotan-kotlin-database", version: SYBOTAN_KOTLIN_VERSION
+//    compile group: "com.sybotan", name: "sybotan-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION
+//    compile group: "com.sybotan", name: "sybotan-kotlin-postgresql", version: SYBOTAN_KOTLIN_VERSION
+//    compile group: "com.sybotan", name: "sybotan-service-base", version: SYBOTAN_SERVICE_VERSION
+//    compile group: "com.sybotan", name: "sybotan-service-mybatis", version: SYBOTAN_SERVICE_VERSION
+
+    compile group: "com.persagy", name: "persagy-kotlin-base", version: PERSAGY_KOTLIN_VERSION
+    compile group: "com.persagy", name: "persagy-kotlin-database", version: PERSAGY_KOTLIN_VERSION
+    compile group: "com.persagy", name: "persagy-kotlin-mybatis", version: PERSAGY_KOTLIN_VERSION
+    compile group: "com.persagy", name: "persagy-kotlin-postgresql", version: PERSAGY_KOTLIN_VERSION
+    compile group: "com.persagy", name: "persagy-service-base", version: PERSAGY_SERVICE_VERSION
+    compile group: "com.persagy", name: "persagy-service-mybatis", version: PERSAGY_SERVICE_VERSION
+    compile group: "com.persagy", name: "persagy-service-postgresql", version: PERSAGY_SERVICE_VERSION
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // 数据中心依赖  
+    compile project(":data-core")
+}
+
+dependencyManagement {
+    imports {
+        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}"
+    }
+}

+ 8 - 0
equip-componnet/src/main/kotlin/com/persagy/server/a.java

@@ -0,0 +1,8 @@
+package com.persagy.server;
+
+/**
+ * @author wx
+ * @date 2020/9/24 19:54
+ */
+public class a {
+}

+ 43 - 0
equip-componnet/src/main/kotlin/com/persagy/server/controllers/BuildingController.kt

@@ -0,0 +1,43 @@
+package com.persagy.server.controllers
+
+
+import com.persagy.server.models.objects.Building
+import com.persagy.server.service.objects.BuildingService
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SQueryResponse
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import org.slf4j.LoggerFactory
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 建筑接口
+ *
+ * @author 张维新
+ */
+@Api(tags = ["建筑接口"])
+@RestController
+@RequestMapping("/building")
+class BuildingController {
+
+    companion object {
+        // 日志
+        private val logger = LoggerFactory.getLogger(BuildingController::class.java)
+    } // Companion object
+
+    /**
+     * 查询建筑信息
+     *
+     * @param   request     查询信息条件
+     * @return              查询结果
+     */
+    @ApiOperation(value = "查询建筑信息,以及楼层使用同一个模型文件数量", notes = "级联查询的对象:楼层(floor)、项目(project)")
+    @PostMapping(value = ["/query"])
+    fun query(@RequestBody request: SQueryRequest): SQueryResponse<Building> {
+        return BuildingService.queryBuilding(request)
+    } // Function query()
+
+} // Class BuildingController

+ 19 - 0
equip-componnet/src/main/kotlin/com/persagy/server/controllers/EquipController.kt

@@ -0,0 +1,19 @@
+package com.persagy.server.controllers
+
+import io.swagger.annotations.Api
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 设备接口
+ *
+ * @author  wx
+ * @date  2020/9/24 19:55
+ */
+@Api(tags = ["设备相关接口"])
+@RestController
+@RequestMapping("/equip-query")
+class EquipController {
+
+
+} // Class EquipController

+ 41 - 0
equip-componnet/src/main/kotlin/com/persagy/server/controllers/FloorController.kt

@@ -0,0 +1,41 @@
+package com.persagy.server.controllers
+
+import com.persagy.base.extensions.toJson
+import com.persagy.server.models.objects.FloorCompon
+import com.persagy.server.service.objects.FloorService
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SQueryResponse
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import org.slf4j.LoggerFactory
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 楼层数据接口
+ */
+@Api(tags = ["楼层相关接口"])
+@RestController
+@RequestMapping("/floor")
+class FloorController {
+    companion object {
+        // 日志
+        private val logger = LoggerFactory.getLogger(FloorController::class.java)
+    } // Companion object
+
+    /**
+     * 查询楼层信息
+     *
+     * @param   request     查询信息条件
+     * @return              查询结果
+     */
+    @ApiOperation(value = "查询楼层信息,以及使用同一个模型文件处理情况", notes = "级联对象:建筑(building)、项目(project)、楼层贯通关系(floorThroughList)")
+    @PostMapping(value = ["/query"])
+    fun query(@RequestBody request: SQueryRequest): SQueryResponse<FloorCompon> {
+        logger.debug("floorQuery =${request.toJson()}")
+        return FloorService.queryFloor(request)
+    } // Function query()
+
+} // Class FloorController

+ 30 - 0
equip-componnet/src/main/kotlin/com/persagy/server/controllers/PointController.kt

@@ -0,0 +1,30 @@
+package com.persagy.server.controllers
+
+import com.persagy.server.models.PointPorperty
+import com.persagy.server.service.PropertyFamilyService
+import com.persagy.service.models.responses.SQueryResponse
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+
+/**
+ * 点位标签接口
+ *
+ * @author 张维新
+ */
+@Api(tags = ["点位标签相关接口"])
+@RestController
+@RequestMapping("/point")
+class PointController {
+
+    /**
+     * 查询点位标信息状态
+     */
+    @ApiOperation(value = "查询点位标信息状态,未关联点位标签资产的数量,已经关联的数量", notes = " ")
+    @GetMapping(value = ["/point-property"])
+    fun pageQueryProperty(buildingId: String?, floorId: String?,startTime: String?, endingTime: String?): SQueryResponse<PointPorperty> {
+        return PropertyFamilyService.queryPointPorperty(buildingId,floorId,startTime,endingTime)
+    } // Function pageQueryProperty()
+} // Class PointController

+ 57 - 0
equip-componnet/src/main/kotlin/com/persagy/server/controllers/PropertyController.kt

@@ -0,0 +1,57 @@
+package com.persagy.server.controllers
+
+import cn.sagacloud.server.equipcomponent.models.requests.EquipUpDateEnclosure
+import cn.sagacloud.server.equipcomponent.models.requests.EquipUpDateEnclosureRequest
+import com.persagy.database.SFilter
+import com.persagy.server.models.PropertyEquip
+import com.persagy.server.models.PropertyFamily
+import com.persagy.server.service.PropertyEquipService
+import com.persagy.server.service.PropertyFamilyService
+import com.persagy.service.SPageContext
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SBaseResponse
+import com.persagy.service.models.responses.SQueryResponse
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import org.springframework.web.bind.annotation.*
+
+/**
+ * 资产接口
+ *
+ * @author 张维新
+ */
+@Api(tags = ["资产相关接口"])
+@RestController
+@RequestMapping("/property")
+class PropertyController {
+
+    /**
+     * 查询资产关联设备
+     */
+    @ApiOperation(value = "查询资产 同时关联设备信息", notes = " 设备相关字段:LinkeEquipName、LinkeEquipId、LinkeEquipLocalName")
+    @PostMapping(value = ["/property-query"])
+    fun pageQueryProperty(@RequestBody request: SQueryRequest): SQueryResponse<PropertyEquip> {
+        val withFilterList = ArrayList<SFilter>()
+        withFilterList.add(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString()))
+        return PropertyEquipService.pageQuery(request, withFilterList)
+    } // Function pageQueryProperty()
+
+    /**
+     * 查询项目下的设备族分类 以及数量
+     */
+    @ApiOperation(value = "查询项目下的设备族分类 以及相同设备族资产的数量数量", notes = " ")
+    @GetMapping(value = ["/property-family"])
+    fun pageQueryPropertyFamily(buildingId: String?, floorId: String?,startTime: String?, endingTime: String?,pointId: String?, checked: String?): SQueryResponse<PropertyFamily> {
+        return PropertyFamilyService.queryFamily(buildingId,floorId,startTime,endingTime,pointId,checked)
+    } // Function pageQueryProperty()
+
+    /**
+     * 修改资产的附件功能
+     */
+    @ApiOperation(value = " 修改资产的附件功能", notes = "")
+    @PostMapping(value = ["/update"])
+    fun equipUpDateEnclosure(@RequestBody equipUpDateEnclosureRequest: EquipUpDateEnclosureRequest<EquipUpDateEnclosure>) : SBaseResponse {
+        return PropertyEquipService.equipUpDateEnclosurs(equipUpDateEnclosureRequest)
+    } // Function equipUpDateEnclosure()
+
+} // Class PropertyContrpller

+ 55 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/PointPorperty.kt

@@ -0,0 +1,55 @@
+package com.persagy.server.models
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.persagy.server.datacenter.models.entities.base.BaseInfo
+import io.swagger.annotations.ApiModelProperty
+import javax.persistence.Column
+
+/**
+ * 点位信息和设备信息
+ */
+class PointPorperty : BaseInfo() {
+
+    /** id */
+    @ApiModelProperty(value = "id")
+    @Column(name = "id")
+    @JSONField(name = "Id")
+    var id: String? = null
+
+    /** 名称 */
+    @ApiModelProperty(value = "名称")
+    @Column(name = "name")
+    @JSONField(name = "Name")
+    var name: String? = null
+
+    /** 坐标x */
+    @ApiModelProperty(value = "坐标x")
+    @Column(name = "x")
+    @JSONField(name = "X")
+    var x: Double? = null
+
+    /** 坐标y */
+    @ApiModelProperty(value = "坐标y")
+    @Column(name = "y")
+    @JSONField(name = "Y")
+    var y: Double? = null
+
+    /** 数量资产 */
+    @ApiModelProperty(value = "数量资产")
+    @Column(name = "total")
+    @JSONField(name = "Total")
+    var total: Int? = null
+
+    /** 未修订数量 */
+    @ApiModelProperty(value = "未修订数量")
+    @Column(name = "nocheck")
+    @JSONField(name = "Nocheck")
+    var nocheck: Int? = null
+
+    /** 图片key值 */
+    @ApiModelProperty(value = "图片key值")
+    @Column(name = "image")
+    @JSONField(name = "Image")
+    var image: String? = null
+
+} // Class PointPorperty

+ 31 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/PropertyEquip.kt

@@ -0,0 +1,31 @@
+package com.persagy.server.models
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.persagy.server.datacenter.models.entities.objects.Property
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
+import javax.persistence.Column
+import javax.persistence.Table
+
+@ApiModel(description = "资产关联设备实体类")
+@Table(name = "v_property_equip")
+class PropertyEquip : Property() {
+
+    /** 设备名称 */
+    @ApiModelProperty(value = "设备名称")
+    @Column(name = "equipment_name")
+    @JSONField(name = "LinkEquipName")
+    var linkeEquipName: String? = null
+
+    /** 设备id */
+    @ApiModelProperty(value = "设备id")
+    @Column(name = "equipment_id")
+    @JSONField(name = "LinkEquipId")
+    var linkeEquipId: String? = null
+
+    /** 设备id */
+    @ApiModelProperty(value = "设备id")
+    @Column(name = "equipment_local_name")
+    @JSONField(name = "LinkEquipLocalName")
+    var linkeEquipLocalName: String? = null
+} // Class PropertyEquip

+ 29 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/PropertyFamily.kt

@@ -0,0 +1,29 @@
+package com.persagy.server.models
+
+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 javax.persistence.Column
+
+@ApiModel(description = "资产的设备族")
+class PropertyFamily : BaseInfo() {
+
+    /** 设备族编码 */
+    @ApiModelProperty(value = "设备族编码")
+    @Column(name = "family")
+    @JSONField(name = "Family")
+    var family: String? = null
+
+    /** 数量 */
+    @ApiModelProperty(value = "数量")
+    @Column(name = "count")
+    @JSONField(name = "Count")
+    var count: Int? = null
+
+    /** 设备族名 */
+    @ApiModelProperty(value = "设备族名")
+    @Column(name = "family_name")
+    @JSONField(name = "FamilyName")
+    var familyName: String? = null
+} // Class PropertyEquip

+ 8 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/a.java

@@ -0,0 +1,8 @@
+package com.persagy.server.models;
+
+/**
+ * @author wx
+ * @date 2020/9/24 20:23
+ */
+public class a {
+}

+ 138 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/objects/Building.kt

@@ -0,0 +1,138 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.models.objects
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.persagy.server.datacenter.models.entities.base.BaseInfo
+import com.persagy.server.datacenter.models.entities.objects.Project
+import com.persagy.service.models.annotations.SCascade
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 建筑信息实体类
+ *
+ * @author  张维新
+ */
+@ApiModel(description = "建筑信息实体类")
+@Table(name = "building")
+open class Building : BaseInfo() {
+
+    /** 建筑体ID */
+    @ApiModelProperty(value = "建筑体ID")
+    @Id
+    @Column(name = "id")
+    @JSONField(name = "BuildID")
+    var id: String? = null
+
+    /** 建筑体名称 */
+    @ApiModelProperty(value = "建筑体名称")
+    @Column(name = "name")
+    @JSONField(name = "BuildName")
+    var name: String? = null
+
+    /** 建筑本地编码 */
+    @ApiModelProperty(value = "建筑本地编码")
+    @Column(name = "local_id")
+    @JSONField(name = "BuildLocalID")
+    var localId: String? = null
+
+    /** 建筑本地名称 */
+    @ApiModelProperty(value = "建筑本地名称")
+    @Column(name = "local_name")
+    @JSONField(name = "BuildLocalName")
+    var localName: String? = null
+
+    /** 项目id */
+    @ApiModelProperty(value = "项目id")
+    @Column(name = "project_id")
+    @JSONField(name = "ProjectID")
+    var projectId: String? = null
+
+    /** BIM模型中编码 */
+    @ApiModelProperty(value = "BIM模型中编码")
+    @Column(name = "bim_id")
+    @JSONField(name = "BIMID")
+    var bimId: String? = null
+
+    /** 建筑信息 */
+    @ApiModelProperty(value = "建筑信息")
+    @Column(name = "building_info")
+    @JSONField(name = "BuildingInfo")
+    var buildingInfo: HashMap<String,Any?>? = null
+
+    /** 工作历 */
+    @ApiModelProperty(value = "工作历")
+    @Column(name = "schedule")
+    @JSONField(name = "Schedule")
+    var schedule: HashMap<String,Any?>? = null
+
+    /** 人员信息 */
+    @ApiModelProperty(value = "人员信息")
+    @Column(name = "people_info")
+    @JSONField(name = "PeopleInfo")
+    var peopleInfo: HashMap<String,Any?>? = null
+
+    /** 能耗信息 */
+    @ApiModelProperty(value = "能耗信息")
+    @Column(name = "consumption_info")
+    @JSONField(name = "ConsumptionInfo")
+    var consumptionInfo: HashMap<String,Any?>? = null
+
+    /** 自定义 */
+    @ApiModelProperty(value = "自定义")
+    @Column(name = "custom_param")
+    @JSONField(name = "CustomParam")
+    var customParam: HashMap<String,Any?>? = null
+
+    /** 建筑文档 */
+    @ApiModelProperty(value = "建筑文档")
+    @Column(name = "building_doc")
+    @JSONField(name = "BuildingDoc")
+    var buildingDoc: HashMap<String,Any?>? = null
+
+    /** 对象类型 */
+    @ApiModelProperty(value = "对象类型")
+    @Column(name = "object_type")
+    @JSONField(name = "ObjectType")
+    override var objectType: String? = "Building"
+
+    /** 楼层   table  对应关系表   idColumn 对应 本类的关系id    childIdColumn 级联对象的关系id */
+    @ApiModelProperty(value = "级联-楼层")
+    @SCascade(table="floor", idColumn="building_id", childIdColumn="id")
+    @JSONField(name = "Floor")
+    var floor: ArrayList<FloorCompon>? = null
+
+    /** 项目 */
+    @ApiModelProperty(value = "级联-项目")
+    @SCascade(table="building", idColumn="id", childIdColumn="project_id")
+    @JSONField(name = "Project")
+    var project: Project? = null
+
+    /** 数量 */
+    @ApiModelProperty(value = "数量")
+    @JSONField(name = "Count")
+    var count: Int? = 0
+
+} // Class Building

+ 175 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/objects/FloorCompon.kt

@@ -0,0 +1,175 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.models.objects
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.persagy.server.datacenter.models.entities.assistant.PointPosition
+import com.persagy.server.datacenter.models.entities.base.BaseInfo
+import com.persagy.server.datacenter.models.entities.objects.Building
+import com.persagy.server.datacenter.models.entities.objects.Project
+import com.persagy.server.datacenter.models.entities.objects.ZoneSpace
+import com.persagy.service.models.annotations.SCascade
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ * 楼层信息实体类
+ *
+ * @author  张维新
+ */
+@ApiModel(description = "楼层信息实体类")
+@Table(name = "floor")
+open class FloorCompon : BaseInfo() {
+
+    /** 楼层ID */
+    @ApiModelProperty(value = "楼层ID")
+    @Id
+    @Column(name = "id")
+    @JSONField(name = "FloorID")
+    var id: String? = null
+
+    /** 楼层名称 */
+    @ApiModelProperty(value = "楼层名称")
+    @Column(name = "name")
+    @JSONField(name = "FloorName")
+    var name: String? = null
+
+    /** 楼层本地编码 */
+    @ApiModelProperty(value = "楼层本地编码")
+    @Column(name = "local_id")
+    @JSONField(name = "FloorLocalID")
+    var localId: String? = null
+
+    /** 楼层本地名称 */
+    @ApiModelProperty(value = "楼层本地名称")
+    @Column(name = "local_name")
+    @JSONField(name = "FloorLocalName")
+    var localName: String? = null
+
+    /** 项目id */
+    @ApiModelProperty(value = "项目id")
+    @Column(name = "project_id")
+    @JSONField(name = "ProjectID")
+    var projectId: String? = null
+
+    /** 建筑id */
+    @ApiModelProperty(value = "建筑id")
+    @Column(name = "building_id")
+    @JSONField(name = "BuildID")
+    var buildId: String? = null
+
+    /** BIM模型中编码 */
+    @ApiModelProperty(value = "BIM模型中编码")
+    @Column(name = "bim_id")
+    @JSONField(name = "BIMID")
+    var bimId: String? = null
+
+    /** 楼层顺序码 */
+    @ApiModelProperty(value = "楼层顺序码")
+    @Column(name = "sequence_id")
+    @JSONField(name = "FloorSequenceID")
+    var sequenceId: Int? = null
+
+    /** 结构信息 */
+    @ApiModelProperty(value = "结构信息")
+    @Column(name = "structure_info")
+    @JSONField(name = "StructureInfo")
+    var structureInfo: HashMap<String,Any?>? = null
+
+    /** 人员信息 */
+    @ApiModelProperty(value = "结构信息")
+    @Column(name = "people_info")
+    @JSONField(name = "PeopleInfo")
+    var peopleInfo: HashMap<String,Any?>? = null
+
+    /** 自定义 */
+    @ApiModelProperty(value = "自定义")
+    @Column(name = "custom_param")
+    @JSONField(name = "CustomParam")
+    var customParam: HashMap<String,Any?>? = null
+
+    /** 对象类型 */
+    @ApiModelProperty(value = "对象类型")
+    @Column(name = "object_type")
+    @JSONField(name = "ObjectType")
+    override var objectType: String? = "Floor"
+
+    /** 工作历信息 */
+    @ApiModelProperty(value = "工作历信息")
+    @Column(name = "work_calendar")
+    @JSONField(name = "WorkCalendar")
+    var workCalendar: HashMap<String,Any?>? = null
+
+    /** 建筑   table  对应关系表   idColumn 对应 本类的关系id    childIdColumn 级联对象的关系id */
+    @ApiModelProperty(value = "级联-楼层")
+    @SCascade(table="floor", idColumn="id", childIdColumn="building_id")
+    @JSONField(name = "Building")
+    var building: Building? = null
+
+    /** 项目 */
+    @ApiModelProperty(value = "级联-项目")
+    @SCascade(table="floor", idColumn="id", childIdColumn="project_id")
+    @JSONField(name = "Project")
+    var project: Project? = null
+
+    /** 贯通关系   self = true  同样的对象查询时 id可以互相调换查询   */
+    @ApiModelProperty(value = "级联-贯通关系")
+    @SCascade(table="r_fl_through_fl", idColumn="floor_id", childIdColumn="floor_other_id", self = true)
+    @JSONField(name = "FloorThroughList")
+    var floorThroughList: ArrayList<FloorCompon>? = null
+
+//    /** 项目 */
+//    @ApiModelProperty(value = "级联-项目")
+//    @SCascade(table="floor", idColumn="id", childIdColumn="project_id")
+//    @JSONField(name = "Equipment")
+//    var Equipment: ArrayList<Equipment>? = null
+
+    /** 模型文件id */
+    @ApiModelProperty(value = "模型文件id")
+    @Column(name = "model_id")
+    @JSONField(name = "ModelId")
+    var modelId: String? = null
+
+    /** 轮廓线 */
+    @ApiModelProperty(value = "轮廓线")
+    @Column(name = "outline")
+    @JSONField(name = "Outline")
+    var outline: ArrayList<PointPosition>? = null
+
+    /** 标记 */
+    @ApiModelProperty(value = "标记")
+    @JSONField(name = "Sign")
+    var sign: Int? = 0
+
+    /** 数量 */
+    @ApiModelProperty(value = "数量")
+    @JSONField(name = "Count")
+    var count: Int? = 0
+
+    @ApiModelProperty(value = "业务空间")
+    @JSONField(name = "ZoneSpaceList")
+    var zoneSpaceList : ArrayList<ZoneSpace>? = null
+
+
+} // Class Floor

+ 107 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/EquipUpDateEnclosure.kt

@@ -0,0 +1,107 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import cn.sagacloud.server.datacenter.models.entities.task.TaskPic
+import com.alibaba.fastjson.annotation.JSONField
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+
+
+/**
+ * 增量附件
+ */
+class EquipUpDateEnclosure :Serializable {
+
+    /**
+     * 设备id
+     */
+    @ApiModelProperty(value = "设备id",required = true)
+    @JSONField(name = "EquipId")
+    var equipId: String? = null
+
+    /** 保险文件 */
+    @ApiModelProperty(value = "保险文件",required = true)
+    @JSONField(name = "InsuranceFile")
+    var insuranceFile: ArrayList<TaskPic>? = null
+
+    /** 设备铭牌照片 */
+    @ApiModelProperty(value = "设备铭牌照片",required = true)
+    @JSONField(name = "Nameplate")
+    var nameplate: ArrayList<TaskPic>? = null
+
+    /** 设备照片 */
+    @ApiModelProperty(value = "设备照片",required = true)
+    @JSONField(name = "Pic")
+    var Pic: ArrayList<TaskPic>? = null
+
+    /** 设备图纸 */
+    @ApiModelProperty(value = "设备图纸",required = true)
+    @JSONField(name = "Drawing")
+    var drawing: ArrayList<TaskPic>? = null
+
+    /** 设备文档 */
+    @ApiModelProperty(value = "设备文档",required = true)
+    @JSONField(name = "Archive")
+    var archive: ArrayList<TaskPic>? = null
+
+    /** 安装照片 */
+    @ApiModelProperty(value = "安装照片",required = true)
+    @JSONField(name = "InstallPic")
+    var installPic: ArrayList<TaskPic>? = null
+
+    /** 安装图纸 */
+    @ApiModelProperty(value = "安装图纸",required = true)
+    @JSONField(name = "InstallDrawing")
+    var installDrawing: ArrayList<TaskPic>? = null
+
+    /** 安装质检报告 */
+    @ApiModelProperty(value = "安装质检报告",required = true)
+    @JSONField(name = "CheckReport")
+    var checkReport: ArrayList<TaskPic>? = null
+
+    /** 操作说明书 */
+    @ApiModelProperty(value = "操作说明书",required = true)
+    @JSONField(name = "OperationManual")
+    var operationManual: ArrayList<TaskPic>? = null
+
+    /** 产品合格证 */
+    @ApiModelProperty(value = "产品合格证",required = true)
+    @JSONField(name = "ProductCertification")
+    var productCertification: ArrayList<TaskPic>? = null
+
+    /** 维修保养手册 */
+    @ApiModelProperty(value = "维修保养手册",required = true)
+    @JSONField(name = "MaintainManual")
+    var maintainManual: ArrayList<TaskPic>? = null
+
+    /** 安装说明书 */
+    @ApiModelProperty(value = "安装说明书",required = true)
+    @JSONField(name = "InstallInstruction")
+    var installInstruction: ArrayList<TaskPic>? = null
+
+    /** 验收报告 */
+    @ApiModelProperty(value = "验收报告",required = true)
+    @JSONField(name = "AcceptanceReport")
+    var acceptanceReport: ArrayList<TaskPic>? = null
+
+    /** 进场验收单 */
+    @ApiModelProperty(value = "进场验收单",required = true)
+    @JSONField(name = "ApproachingAcceptance")
+    var approachingAcceptance: ArrayList<TaskPic>? = null
+
+    /** 供应合同 */
+    @ApiModelProperty(value = "供应合同",required = true)
+    @JSONField(name = "SupplierContract")
+    var supplierContract: ArrayList<TaskPic>? = null
+
+    /** 检测报告 */
+    @ApiModelProperty(value = "检测报告",required = true)
+    @JSONField(name = "TestReport")
+    var testReport: ArrayList<TaskPic>? = null
+
+    /** 原厂证明 */
+    @ApiModelProperty(value = "原厂证明",required = true)
+    @JSONField(name = "OriginalCertificate")
+    var originalCertificate: ArrayList<TaskPic>? = null
+
+
+} // Class EquipUpDateEnclosure

+ 16 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/EquipUpDateEnclosureRequest.kt

@@ -0,0 +1,16 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+
+/**
+ *
+ */
+class EquipUpDateEnclosureRequest<ENTITY: Any> :Serializable {
+
+    /** 更新内容 */
+    @ApiModelProperty(value = "更新内容", required = true)
+    var content: ArrayList<ENTITY>? = null
+
+
+} //

+ 35 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/RSQueryResponse.kt

@@ -0,0 +1,35 @@
+package com.persagy.server.models.requests
+
+import com.persagy.database.SPageQueryInfo
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.responses.SBaseResponse
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+
+/**
+ * 查询请求应答对象基类
+ *
+ * @author  庞利祥(sybotan@126.com)
+ */
+@ApiModel(description = "查询请求应答对象基类")
+open class RSQueryResponse<ENTITY: Serializable>(result: SResponseType = SResponseType.success, message: String = "")
+    : SBaseResponse(result, message) {
+    /** 符合条件的总记录数 */
+    @ApiModelProperty(value = "符合条件的总记录数")
+    var total: Long? = null
+
+    /** 查询到的数据列表 */
+    @ApiModelProperty(value = "查询到的数据列表")
+    var content: List<ENTITY>? = null
+
+    /**
+     * 子构造函数
+     *
+     * @param   info    分页查询信息
+     */
+    constructor(info: SPageQueryInfo<ENTITY>): this(SResponseType.success, "") {
+        this.total = info.total
+        this.content = info.content
+    } // Function constructor()
+} // Class SQueryResponse

+ 28 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ShaftSpaceVertical.kt

@@ -0,0 +1,28 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import com.alibaba.fastjson.annotation.JSONField
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+
+/**
+ * 和竖井关联的空间垂直交通关系
+ */
+class ShaftSpaceVertical : Serializable{
+
+    @ApiModelProperty(value = "建筑体id")
+    @JSONField(name = "BuildingId")
+    var buildingId: String? = null
+
+    @ApiModelProperty(value = "竖井id")
+    @JSONField(name = "ShaftId")
+    var shaftId: String? = null
+
+    @ApiModelProperty(value = "空间类型")
+    @JSONField(name = "ObjectType")
+    var objectType: String? = null
+
+    @ApiModelProperty(value = "AI开关")
+    @JSONField(name = "AiSwitch")
+    var aiSwitch:Boolean? = false
+
+} // Class ShaftSpaceVertical

+ 34 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/SpatialRelationship.kt

@@ -0,0 +1,34 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import com.alibaba.fastjson.annotation.JSONField
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+
+/**
+ * 查看 关系
+ *
+ * @author 张维新
+ */
+class SpatialRelationship: Serializable {
+
+    /** 建筑体id */
+    @ApiModelProperty(value = "建筑体id")
+    @JSONField(name = "BuildingId")
+    var buildingId: String? = null
+
+    /** 楼层id */
+    @ApiModelProperty(value = "楼层id")
+    @JSONField(name = "FloorId")
+    var floorId: String? = null
+
+    /** 图实例 */
+    @ApiModelProperty(value = "图实例")
+    @JSONField(name = "GraphType")
+    var graphType: String? = null
+
+    /** 图实例 */
+    @ApiModelProperty(value = "图实例")
+    @JSONField(name = "RelType")
+    var relType: String? = null
+
+} // Class SpatialRelationship

+ 16 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ZoneEquipQueryRequest.kt

@@ -0,0 +1,16 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import com.sybotan.service.models.requests.SQueryRequest
+import io.swagger.annotations.ApiModelProperty
+
+class ZoneEquipQueryRequest : SQueryRequest() {
+
+    @ApiModelProperty(value = "所属业务空间类型", example = "TenantZone")
+    var zoneType: String? = null
+
+    @ApiModelProperty(value = "所属业务空间Id", example = "Sp*****")
+    var zoneId: String? = null
+
+    @ApiModelProperty(value = "不在任何业务空间内的设备或部件(true)", example = "true")
+    var notInZone: Boolean? = false
+}

+ 13 - 0
equip-componnet/src/main/kotlin/com/persagy/server/models/requests/ZoneISpaceQueryRequest.kt

@@ -0,0 +1,13 @@
+package cn.sagacloud.server.equipcomponent.models.requests
+
+import com.alibaba.fastjson.annotation.JSONField
+import com.sybotan.service.models.requests.SQueryRequest
+import io.swagger.annotations.ApiModelProperty
+
+class ZoneISpaceQueryRequest : SQueryRequest() {
+
+    @ApiModelProperty(value = "楼层Id", example = "Sp*****")
+    @JSONField(name = "FloorId")
+    var floorId: String? = null
+
+} //

+ 13 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/EquipFamilyService.kt

@@ -0,0 +1,13 @@
+package com.persagy.server.service
+
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.dict.EquipFamily
+import com.persagy.server.service.base.Service
+
+
+/**
+ * 设备族服务
+ */
+object EquipFamilyService : Service<EquipFamily>(SMybatisDao(EquipFamily::class.java))  {
+
+} // object EquipFamilyService

+ 629 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/PropertyEquipService.kt

@@ -0,0 +1,629 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.service
+
+import cn.sagacloud.server.equipcomponent.models.requests.EquipUpDateEnclosure
+import cn.sagacloud.server.equipcomponent.models.requests.EquipUpDateEnclosureRequest
+import com.alibaba.fastjson.JSONArray
+import com.alibaba.fastjson.JSONObject
+import com.persagy.base.extensions.toJson
+import com.persagy.database.SFilter
+import com.persagy.database.SQueryBuilder
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.assistant.TaskPic
+import com.persagy.server.models.PropertyEquip
+import com.persagy.server.service.base.Service
+import com.persagy.server.service.objects.PropertyService
+import com.persagy.service.SPageContext
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.responses.SBaseResponse
+import org.slf4j.LoggerFactory
+
+/**
+ * 资产关联设备信息服务
+ *
+ * @author 张维新
+ */
+object PropertyEquipService : Service<PropertyEquip>(SMybatisDao(PropertyEquip::class.java)) {
+    /** 日志 */
+     val logger = LoggerFactory.getLogger(PropertyEquipService::class.java)
+
+    /**
+     * 查询之前的操作
+     */
+    override fun onQueryBefore(queryBuilder: SQueryBuilder<PropertyEquip>) {
+        queryBuilder.tableName = "v_property_equip"
+        return
+    } // Function onQueryBefore()
+
+
+    /**
+     * 修改设备的附件,增量方式
+     */
+    fun equipUpDateEnclosurs(equipUpDateEnclosureRequest: EquipUpDateEnclosureRequest<EquipUpDateEnclosure>) : SBaseResponse {
+        return try {
+            val projectId = SPageContext.getHeader("ProjectId")
+            val equipUpDateEnclosureList = equipUpDateEnclosureRequest.content
+            if (!equipUpDateEnclosureList.isNullOrEmpty()){
+                for (equipUpDateEnclosure in equipUpDateEnclosureList){
+                    /** id不能为空 */
+                    if (equipUpDateEnclosure.equipId.isNullOrEmpty()){
+                        val sBaseResponse = SBaseResponse(SResponseType.failure)
+                        sBaseResponse.message = "设备id不能为空"
+                        sBaseResponse
+                    }
+                    val equip = PropertyService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("id", equipUpDateEnclosure.equipId!!)).entity()
+
+                    if (equip == null){
+
+                    }
+
+                    if (!equipUpDateEnclosure.Pic.isNullOrEmpty()){
+
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("Pic")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["Pic"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.Pic!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["Pic"] = equipUpDateEnclosure.Pic!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("Pic",equipUpDateEnclosure.Pic!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("Pic",equipUpDateEnclosure.Pic!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    if (!equipUpDateEnclosure.archive.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("Archive")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["Archive"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.archive!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["Archive"] = equipUpDateEnclosure.archive!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("Archive",equipUpDateEnclosure.archive!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("Archive",equipUpDateEnclosure.archive!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    if (!equipUpDateEnclosure.checkReport.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("Siteinstall")
+                            if (containsKey){
+                                logger.debug("Siteinstall存在")
+                                logger.debug("Siteinstall数据=${equip.ledgerParam!!["Siteinstall"]}")
+                                val photoDocMap = equip.ledgerParam!!["Siteinstall"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("CheckReport")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["CheckReport"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.checkReport!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["CheckReport"] = equipUpDateEnclosure.checkReport!!
+                                }
+                            }else{
+                                logger.debug("Siteinstall不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("CheckReport",equipUpDateEnclosure.checkReport!!)
+                                equip.ledgerParam!!.put("Siteinstall",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("CheckReport",equipUpDateEnclosure.checkReport!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("Siteinstall",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+
+                    }
+                    if (!equipUpDateEnclosure.drawing.isNullOrEmpty()){
+
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("Drawing")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["Drawing"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.drawing!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["Drawing"] = equipUpDateEnclosure.drawing!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("Drawing",equipUpDateEnclosure.drawing!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("Drawing",equipUpDateEnclosure.drawing!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+
+                    }
+                    if (!equipUpDateEnclosure.installDrawing.isNullOrEmpty()){
+
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("Siteinstall")
+                            if (containsKey){
+                                logger.debug("Siteinstall存在")
+                                logger.debug("Siteinstall数据=${equip.ledgerParam!!["Siteinstall"]}")
+                                val photoDocMap = equip.ledgerParam!!["Siteinstall"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("InstallDrawing")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["InstallDrawing"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.installDrawing!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["InstallDrawing"] = equipUpDateEnclosure.installDrawing!!
+                                }
+                            }else{
+                                logger.debug("Siteinstall不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("InstallDrawing",equipUpDateEnclosure.installDrawing!!)
+                                equip.ledgerParam!!.put("Siteinstall",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("InstallDrawing",equipUpDateEnclosure.installDrawing!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("Siteinstall",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    if (!equipUpDateEnclosure.installPic.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("Siteinstall")
+                            if (containsKey){
+                                logger.debug("Siteinstall存在")
+                                logger.debug("Siteinstall数据=${equip.ledgerParam!!["Siteinstall"]}")
+                                val photoDocMap = equip.ledgerParam!!["Siteinstall"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("InstallPic")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["InstallPic"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.installPic!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["InstallPic"] = equipUpDateEnclosure.installPic!!
+                                }
+                            }else{
+                                logger.debug("Siteinstall不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("InstallPic",equipUpDateEnclosure.installPic!!)
+                                equip.ledgerParam!!.put("Siteinstall",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("InstallPic",equipUpDateEnclosure.installPic!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("Siteinstall",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+
+                    if (!equipUpDateEnclosure.insuranceFile.isNullOrEmpty()){
+
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("InsuranceDoc")
+                            if (containsKey){
+                                logger.debug("InsuranceDoc存在")
+                                logger.debug("InsuranceDoc数据=${equip.ledgerParam!!["InsuranceDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["InsuranceDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("InsuranceFile")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["InsuranceFile"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.insuranceFile!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["InsuranceFile"] = equipUpDateEnclosure.insuranceFile!!
+                                }
+                            }else{
+                                logger.debug("InsuranceDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("InsuranceFile",equipUpDateEnclosure.insuranceFile!!)
+                                equip.ledgerParam!!.put("InsuranceDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("InsuranceFile",equipUpDateEnclosure.insuranceFile!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("InsuranceDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+
+                    }
+                    if (!equipUpDateEnclosure.nameplate.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("Nameplate")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["Nameplate"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.nameplate!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["Nameplate"] = equipUpDateEnclosure.nameplate!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("Nameplate",equipUpDateEnclosure.nameplate!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("Nameplate",equipUpDateEnclosure.nameplate!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 操作说明书 */
+                    if (!equipUpDateEnclosure.operationManual.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("OperationManual")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["OperationManual"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.operationManual!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["OperationManual"] = equipUpDateEnclosure.operationManual!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("OperationManual",equipUpDateEnclosure.operationManual!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("OperationManual",equipUpDateEnclosure.operationManual!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 产品合格证 */
+                    if (!equipUpDateEnclosure.productCertification.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("PhotoDoc")
+                            if (containsKey){
+                                logger.debug("PhotoDoc存在")
+                                logger.debug("PhotoDoc数据=${equip.ledgerParam!!["PhotoDoc"]}")
+                                val photoDocMap = equip.ledgerParam!!["PhotoDoc"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("ProductCertification")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["ProductCertification"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.productCertification!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["ProductCertification"] = equipUpDateEnclosure.productCertification!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("ProductCertification",equipUpDateEnclosure.productCertification!!)
+                                equip.ledgerParam!!.put("PhotoDoc",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("ProductCertification",equipUpDateEnclosure.productCertification!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("PhotoDoc",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 维修保养手册 */
+                    if (!equipUpDateEnclosure.maintainManual.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("OperationMainte")
+                            if (containsKey){
+                                logger.debug("OperationMainte存在")
+                                logger.debug("OperationMainte数据=${equip.ledgerParam!!["OperationMainte"]}")
+                                val photoDocMap = equip.ledgerParam!!["OperationMainte"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("MaintainManual")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["MaintainManual"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.maintainManual!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["MaintainManual"] = equipUpDateEnclosure.maintainManual!!
+                                }
+                            }else{
+                                logger.debug("OperationMainte不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("MaintainManual",equipUpDateEnclosure.maintainManual!!)
+                                equip.ledgerParam!!.put("OperationMainte",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("MaintainManual",equipUpDateEnclosure.maintainManual!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("OperationMainte",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 安装说明书 */
+                    if (!equipUpDateEnclosure.installInstruction.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("Siteinstall")
+                            if (containsKey){
+                                logger.debug("Siteinstall存在")
+                                logger.debug("Siteinstall数据=${equip.ledgerParam!!["Siteinstall"]}")
+                                val photoDocMap = equip.ledgerParam!!["Siteinstall"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("InstallInstruction")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["InstallInstruction"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.installInstruction!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["InstallInstruction"] = equipUpDateEnclosure.installInstruction!!
+                                }
+                            }else{
+                                logger.debug("Siteinstall不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("InstallInstruction",equipUpDateEnclosure.installInstruction!!)
+                                equip.ledgerParam!!.put("Siteinstall",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("InstallInstruction",equipUpDateEnclosure.installInstruction!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("Siteinstall",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 验收报告 */
+                    if (!equipUpDateEnclosure.acceptanceReport.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("SupplyPurchase")
+                            if (containsKey){
+                                logger.debug("SupplyPurchase存在")
+                                logger.debug("SupplyPurchase数据=${equip.ledgerParam!!["SupplyPurchase"]}")
+                                val photoDocMap = equip.ledgerParam!!["SupplyPurchase"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("AcceptanceReport")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["AcceptanceReport"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.acceptanceReport!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["AcceptanceReport"] = equipUpDateEnclosure.acceptanceReport!!
+                                }
+                            }else{
+                                logger.debug("SupplyPurchase不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("AcceptanceReport",equipUpDateEnclosure.acceptanceReport!!)
+                                equip.ledgerParam!!.put("SupplyPurchase",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("AcceptanceReport",equipUpDateEnclosure.acceptanceReport!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("SupplyPurchase",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 进场验收单 */
+                    if (!equipUpDateEnclosure.approachingAcceptance.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("SupplyPurchase")
+                            if (containsKey){
+                                logger.debug("SupplyPurchase存在")
+                                logger.debug("SupplyPurchase数据=${equip.ledgerParam!!["SupplyPurchase"]}")
+                                val photoDocMap = equip.ledgerParam!!["SupplyPurchase"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("ApproachingAcceptance")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["ApproachingAcceptance"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.approachingAcceptance!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["ApproachingAcceptance"] = equipUpDateEnclosure.approachingAcceptance!!
+                                }
+                            }else{
+                                logger.debug("SupplyPurchase不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("ApproachingAcceptance",equipUpDateEnclosure.approachingAcceptance!!)
+                                equip.ledgerParam!!.put("SupplyPurchase",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("ApproachingAcceptance",equipUpDateEnclosure.approachingAcceptance!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("SupplyPurchase",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 供应合同 */
+                    if (!equipUpDateEnclosure.supplierContract.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("SupplyPurchase")
+                            if (containsKey){
+                                logger.debug("SupplyPurchase存在")
+                                logger.debug("SupplyPurchase数据=${equip.ledgerParam!!["SupplyPurchase"]}")
+                                val photoDocMap = equip.ledgerParam!!["SupplyPurchase"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("SupplierContract")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["SupplierContract"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.supplierContract!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["SupplierContract"] = equipUpDateEnclosure.supplierContract!!
+                                }
+                            }else{
+                                logger.debug("PSupplyPurchase不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("SupplierContract",equipUpDateEnclosure.supplierContract!!)
+                                equip.ledgerParam!!.put("PSupplyPurchase",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("SupplierContract",equipUpDateEnclosure.supplierContract!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("SupplyPurchase",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+                    /** 检测报告 */
+                    if (!equipUpDateEnclosure.testReport.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("EquipManufactor")
+                            if (containsKey){
+                                logger.debug("EquipManufactor存在")
+                                logger.debug("EquipManufactor数据=${equip.ledgerParam!!["EquipManufactor"]}")
+                                val photoDocMap = equip.ledgerParam!!["EquipManufactor"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("TestReport")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["TestReport"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.testReport!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["TestReport"] = equipUpDateEnclosure.testReport!!
+                                }
+                            }else{
+                                logger.debug("PhotoDoc不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("TestReport",equipUpDateEnclosure.testReport!!)
+                                equip.ledgerParam!!.put("EquipManufactor",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("TestReport",equipUpDateEnclosure.testReport!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("EquipManufactor",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+
+                    /** 原厂证明 */
+                    if (!equipUpDateEnclosure.originalCertificate.isNullOrEmpty()){
+                        if (!equip!!.ledgerParam.isNullOrEmpty()){
+                            val containsKey = equip.ledgerParam!!.containsKey("EquipManufactor")
+                            if (containsKey){
+                                logger.debug("EquipManufactor存在")
+                                logger.debug("EquipManufactor数据=${equip.ledgerParam!!["EquipManufactor"]}")
+                                val photoDocMap = equip.ledgerParam!!["EquipManufactor"] as JSONObject
+                                val containsKeyPic = photoDocMap.containsKey("OriginalCertificate")
+                                if (containsKeyPic){
+                                    val any = photoDocMap["OriginalCertificate"] as JSONArray
+                                    any.addAll(equipUpDateEnclosure.originalCertificate!!)
+                                    logger.debug("图片数据=${any.toJson()}")
+                                }else{
+                                    photoDocMap["OriginalCertificate"] = equipUpDateEnclosure.originalCertificate!!
+                                }
+                            }else{
+                                logger.debug("EquipManufactor不存在")
+                                val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                                mapPic.put("OriginalCertificate",equipUpDateEnclosure.originalCertificate!!)
+                                equip.ledgerParam!!.put("EquipManufactor",mapPic)
+                            }
+                        }else{
+                            val mapPic = HashMap<String,ArrayList<TaskPic>>()
+                            mapPic.put("OriginalCertificate",equipUpDateEnclosure.originalCertificate!!)
+                            val mapPhotoDoc = HashMap<String,Any?>()
+                            mapPhotoDoc.put("EquipManufactor",mapPic)
+                            equip.ledgerParam = mapPhotoDoc
+                        }
+                    }
+
+
+                    /** 更新设备 */
+                    PropertyService.update(equip!!,null, SFilter.eq("projectId",projectId!!), SFilter.eq("id",equipUpDateEnclosure.equipId!!))
+
+                }
+
+
+                try {
+                    val jsonObject = org.json.JSONObject()
+                    jsonObject.put("type", "7")
+                    jsonObject.put("projectId", projectId)
+                    val jsonArray = org.json.JSONArray()
+                    for (entity in equipUpDateEnclosureList) {
+                        val jsonInfos = org.json.JSONObject()
+                        jsonInfos.put("id", entity.equipId)
+                        jsonArray.put(jsonInfos)
+                    }
+                    jsonObject.put("infos", jsonArray)
+
+                    /** 发送消息 */
+                    messageHandler.sendMessage(jsonObject.toString())
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+
+                val sBaseResponse = SBaseResponse(SResponseType.success)
+                sBaseResponse
+            }else{
+                val sBaseResponse = SBaseResponse(SResponseType.failure)
+                sBaseResponse.message = "不能传入空值"
+                sBaseResponse
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SBaseResponse(SResponseType.failure)
+        }
+    } //
+
+} // Object PropertyService

+ 107 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/PropertyFamilyService.kt

@@ -0,0 +1,107 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.service
+
+
+import com.persagy.database.SPageQueryInfo
+import com.persagy.database.SQueryBuilder
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.models.PointPorperty
+import com.persagy.server.models.PropertyFamily
+import com.persagy.server.service.base.Service
+import com.persagy.service.SObjectService
+import com.persagy.service.SPageContext
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SQueryResponse
+import org.slf4j.LoggerFactory
+
+/**
+ * 资产关联设备信息服务
+ *
+ * @author 张维新
+ */
+object PropertyFamilyService : Service<PropertyFamily>(SMybatisDao(PropertyFamily::class.java)) {
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(PropertyFamilyService::class.java)
+
+
+   val pointPorpertyService = SObjectService(SMybatisDao(PointPorperty::class.java))
+
+    /**
+     * 查询之前的操作
+     */
+    override fun onQueryBefore(queryBuilder: SQueryBuilder<PropertyFamily>) {
+        val projectId = SPageContext.getHeader("ProjectId").toString()
+        queryBuilder.tableName = "f_project_family('$projectId')"
+        return
+    } // Function onQueryBefore()
+
+    /**
+     * 查询项目下的设备族分类
+     *
+     * @param   buildingId      建筑id
+     * @param   floorId         楼层id
+     * @param   startTime       开始时间
+     * @param   endingTime      结束时间
+     * @param   pointId         点位标签id
+     * @param   checked         是否修订
+     */
+    fun queryFamily(buildingId: String?, floorId: String?,startTime: String?, endingTime: String?,pointId: String?, checked: String?): SQueryResponse<PropertyFamily> {
+        val pageQuery: SPageQueryInfo<PropertyFamily>
+        return try {
+            var request = SQueryRequest()
+            val projectId = SPageContext.getHeader("ProjectId").toString()
+            val queryBuilder = select(request.filters)
+            queryBuilder.tableName = "f_project_family('$projectId','$buildingId','$floorId','$startTime','$endingTime','$pointId','$checked')"
+            pageQuery = queryBuilder.pageQuery(1, 1000)
+            SQueryResponse(pageQuery)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SQueryResponse(SResponseType.failure, e.message!!)
+        }
+    } // Function queryFamily()
+
+    /**
+     * 查询项目下的设备族分类
+     *
+     * @param   buildingId      建筑id
+     * @param   floorId         楼层id
+     * @param   startTime       开始时间
+     * @param   endingTime      结束时间
+     */
+    fun queryPointPorperty(buildingId: String?, floorId: String?,startTime: String?, endingTime: String?): SQueryResponse<PointPorperty>{
+        val pageQuery: SPageQueryInfo<PointPorperty>
+        return try {
+            var request = SQueryRequest()
+            val projectId = SPageContext.getHeader("ProjectId").toString()
+            val queryBuilder = pointPorpertyService.select(request.filters)
+            queryBuilder.tableName = "f_point_poroerty('$projectId','$buildingId','$floorId','$startTime','$endingTime')"
+            pageQuery = queryBuilder.pageQuery(1, 1000)
+            SQueryResponse(pageQuery)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SQueryResponse(SResponseType.failure, e.message!!)
+        }
+    } // Function queryPointPorperty()
+
+
+} // Object PropertyService

+ 74 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/base/Service.kt

@@ -0,0 +1,74 @@
+package com.persagy.server.service.base
+
+
+import com.persagy.database.SAbstractDao
+import com.persagy.database.extensions.keyValue
+import com.persagy.server.datacenter.models.entities.base.BaseInfo
+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
+
+/**
+ * 服务基类
+ *
+ * @author 张维新
+ */
+open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectService<ENTITY>(daoClass) {
+    companion object {
+        /** 日志 */
+        private val logger = LoggerFactory.getLogger(Service::class.java)
+
+        /** MQ消息对象 */
+       val messageHandler by lazy {
+            SSpringContextUtil.getBean(MessageHandler::class.java) as MessageHandler
+        }
+    } // Companion object
+
+    /**
+     * 创建成功回调函数
+     *
+     * @param   entityList          创建成功对象
+     */
+    override fun onCreateSuccess(entityList: ArrayList<ENTITY>) {
+        val projectId = SPageContext.getHeader("ProjectId")
+        entityList.forEach {
+            val jsonObject = JSONObject()
+            jsonObject.put("type", "1")
+            jsonObject.put("projectId",projectId)
+            jsonObject.put("id", it.keyValue("id"))
+            /** 发送消息 */
+            messageHandler!!.sendMessage(jsonObject.toString())
+        }
+        logger.debug("创建完成 =******************************************************************")
+        return
+    } // Function onCreateSuccess()
+
+    /**
+     * 更新成功能回调函数
+     *
+     * @param   entityList      更新成功对象列表
+     */
+    override fun onUpdateSuccess(entityList: ArrayList<ENTITY>) {
+        val projectId = SPageContext.getHeader("ProjectId")
+        val jsonObject = JSONObject()
+        jsonObject.put("type", "7")
+        jsonObject.put("projectId", projectId)
+        val jsonArray = JSONArray()
+        for (entity in entityList) {
+            val jsonInfos = JSONObject()
+            jsonInfos.put("id", entity.keyValue("id"))
+            jsonArray.put(jsonInfos)
+        }
+        jsonObject.put("infos", jsonArray)
+        logger.debug("修改发送消息$jsonObject")
+        /** 发送消息 */
+        messageHandler!!.sendMessage(jsonObject.toString())
+
+        return
+    } // Function onUpdateSuccess()
+
+} // Class Service

+ 76 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/objects/BuildingService.kt

@@ -0,0 +1,76 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.service.objects
+
+import com.persagy.database.SFilter
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.models.objects.Building
+import com.persagy.server.service.base.Service
+import com.persagy.service.SPageContext
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SQueryResponse
+
+
+/**
+ * 建筑信息服务
+ *
+ * @author 张维新
+ */
+object BuildingService : Service<Building>(SMybatisDao(Building::class.java)) {
+
+    /**
+     * 查询建筑数据 以及楼层重复使用模型文件的数量
+     */
+    fun queryBuilding(request: SQueryRequest) : SQueryResponse<Building> {
+
+        return try {
+            val projectId = SPageContext.getHeader("ProjectId")
+            val pageQuery = pageQuery(request, arrayListOf(SFilter.eq("projectId", projectId!!)))
+            if (!pageQuery.content.isNullOrEmpty()){
+                for ( building in  pageQuery.content!!){
+                    val floorList = FloorService.select(SFilter.eq("projectId", projectId!!), SFilter.eq("BuildID", building.id!!)).exec()
+
+                    var count = 0
+                    for (floor in floorList){
+
+                        if (floor.outline == null&&!floor.modelId.isNullOrEmpty()){
+//                            val floorList = FloorService.select(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString()), SFilter.not(SFilter.eq("FloorID", floor.id!!)),
+//                                    SFilter.isNull("Outline"), SFilter.eq("ModelId", floor.modelId!!)).exec()
+                            val floorList = FloorService.select(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString()),
+                                     SFilter.eq("ModelId", floor.modelId!!)).exec()
+                            if (floorList.size>1){
+                                floor.sign = 1
+                                count++
+                            }
+                        }
+                    }
+                    building.count = count
+                }
+            }
+            pageQuery
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SQueryResponse(SResponseType.failure, e.message.toString())
+        }
+    } // // Function queryBuilding()
+
+} // Object BuildingService

+ 73 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/objects/FloorService.kt

@@ -0,0 +1,73 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.service.objects
+
+import com.persagy.database.SFilter
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.models.objects.FloorCompon
+import com.persagy.server.service.base.Service
+import com.persagy.service.SPageContext
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SQueryRequest
+import com.persagy.service.models.responses.SQueryResponse
+
+
+/**
+ * 楼层信息服务
+ *
+ * @author 张维新
+ */
+object FloorService : Service<FloorCompon>(SMybatisDao(FloorCompon::class.java)) {
+
+
+    /**
+     * 查询楼层信息 以及重复使用同一个模型文件楼层做标记
+     *
+     * @param   request     查询条件
+     */
+    fun queryFloor(request: SQueryRequest) : SQueryResponse<FloorCompon> {
+
+        return try {
+            val pageQuery = pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString())))
+            if (!pageQuery.content.isNullOrEmpty()){
+
+                for (floor in pageQuery.content!!){
+
+                    if (floor.outline == null&&!floor.modelId.isNullOrEmpty()){
+//                        val floorList = select(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString()),SFilter.not(SFilter.eq("FloorID", floor.id!!)),
+//                                SFilter.isNull("Outline"), SFilter.eq("ModelId", floor.modelId!!)).exec()
+                        val floorList = select(
+                            SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString()),
+                                 SFilter.eq("ModelId", floor.modelId!!)).exec()
+                        if (floorList.size>1){
+                            floor.sign = 1
+                        }
+                    }
+                }
+            }
+            pageQuery
+        } catch (e: Exception) {
+            e.printStackTrace()
+            SQueryResponse(SResponseType.failure, e.message.toString())
+        }
+    } // // Function queryFloor()
+
+} // Object FloorService

+ 98 - 0
equip-componnet/src/main/kotlin/com/persagy/server/service/objects/PropertyService.kt

@@ -0,0 +1,98 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                     :*$@@%$*:                         ;:                ;;    ;;
+ *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                  =@*                                  %!              @ $= % %@=   =%@!      %=
+ *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *         $@*   ;@@@%=!:                *@*
+ *         =@$    ;;;!=%@@@@=!           =@!
+ *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *           ;%@@$=$@@%*       *@@@$=%@@%;
+ *              ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+package com.persagy.server.service.objects
+
+import cn.sagacloud.server.equipcomponent.utils.ShaftNameUtil
+import com.persagy.database.SFilter
+import com.persagy.database.SQueryBuilder
+import com.persagy.mybatis.SMybatisDao
+import com.persagy.server.datacenter.models.entities.objects.Property
+import com.persagy.server.service.EquipFamilyService
+import com.persagy.server.service.base.Service
+import com.persagy.server.utils.IdUtils
+import com.persagy.service.SPageContext
+import org.slf4j.LoggerFactory
+
+/**
+ * 资产信息服务
+ *
+ * @author 张维新
+ */
+object PropertyService : Service<Property>(SMybatisDao(Property::class.java)) {
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(PropertyService::class.java)
+
+    /**
+     * 创建之前的操作
+     *
+     * @param   property    创建的对象
+     */
+    override fun onCreateBefore(property: Property): Boolean  {
+        if (!property.id.isNullOrEmpty()) {
+            val isStartsWith = property.id.toString().startsWith("Pe")
+            if (!isStartsWith) {
+                /** 资产id */
+                property.id = IdUtils.peIdCreate(property.projectId!!)
+            }
+        } else {
+            /** 资产id */
+            property.id = IdUtils.peIdCreate(property.projectId!!)
+        }
+//        /** 设备名字 */
+//        if (property.name.isNullOrEmpty()) {
+//            property.name = ShaftNameUtil.shaftName("资产-")
+//        }
+        if (!property.family.isNullOrEmpty()){
+            val family = EquipFamilyService.select(SFilter.eq("family", property.family!!)).entity()
+            if (family!=null){
+                /** 资产名字 */
+                if (property.name.isNullOrEmpty()) {
+                    property.name = ShaftNameUtil.shaftName(family.familyName+"-")
+                }
+            }else{
+                /** 资产名字 */
+                if (property.name.isNullOrEmpty()) {
+                    property.name = ShaftNameUtil.shaftName("资产-")
+                }
+            }
+            return true
+        }else{
+            return false
+        }
+    } // Function onCreateBefore()
+
+    /**
+     * 查询之前的操作
+     *
+     * @param   queryBuilder    查询条件
+     */
+    override fun onQueryBefore(queryBuilder: SQueryBuilder<Property>) {
+        queryBuilder.tableName = "v_property_equip"
+        return
+    } // Function onQueryBefore()
+
+    override fun onUpdateBefore(entity: Property): Boolean {
+        val projectId = SPageContext.getHeader("ProjectId")
+        entity.projectId = projectId
+        return super.onUpdateBefore(entity)
+    } // Function onUpdateBefore()
+
+} // Object PropertyService

+ 49 - 0
equip-componnet/src/main/kotlin/com/persagy/server/synchronize/MessageHandler.kt

@@ -0,0 +1,49 @@
+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
+
+/**
+ * 同步数据消息类
+ *
+ * @author  张维新
+ */
+@Component
+class MessageHandler {
+    companion object {
+        // 日志
+        private val logger = LoggerFactory.getLogger(MessageHandler::class.java)
+    } // Companion object
+
+    /** 发送方式 */
+    @Autowired
+    private var jmsTemplate = JmsTemplate()
+
+    /** 映射发送地址 */
+    @Value("\${topic}")
+    lateinit var topic: String
+
+    /**
+     * 消息发送
+     *
+     * @param content 消息内容
+     */
+    fun sendMessage(content: String) {
+        jmsTemplate.convertAndSend(topic, content)
+    } // Function sendMessage()
+
+    /**
+     * 测试打印发送的消息
+     *
+     * @param content 消息内容
+     */
+    @JmsListener(destination = "datacenter.broadcast")
+    fun localListener(content: String) {
+        logger.debug("本地消息3: $content")
+    } // Function localListener()
+
+} // Class MessageHandler

+ 179 - 0
equip-componnet/src/main/kotlin/com/persagy/server/utils/DataVerification.kt

@@ -0,0 +1,179 @@
+package cn.sagacloud.server.equipcomponent.utils
+
+import cn.sagacloud.server.datacenter.models.entities.ExplainAllCategories
+import cn.sagacloud.server.datacenter.models.entities.GeneralSystem
+import cn.sagacloud.server.datacenter.models.entities.ViewEquipSystem
+import cn.sagacloud.server.datacenter.models.response.EquipAssetComponentsReqponse
+import cn.sagacloud.server.equipcomponent.service.EquipmentService
+import com.sybotan.database.SFilter
+import com.sybotan.database.SPageQueryInfo
+import com.sybotan.database.functions.SLength
+import com.sybotan.mybatis.SMybatisDao
+import com.sybotan.service.SBaseService
+
+/**
+ * 数据校验
+ *
+ * @author 张维新
+ */
+object DataVerification {
+
+    /**
+     * 查询 设备关联的资产 部件数量帮助接口
+     */
+    fun getEquipAssetComponentsTools(equipAssetComponentsList: SPageQueryInfo<EquipAssetComponentsReqponse>): ArrayList<cn.sagacloud.server.datacenter.models.response.EquipAssetComponentsReqponse> {
+        /** 设备关联系统服务 */
+        val viewEquipSystemservice = SBaseService(SMybatisDao(ViewEquipSystem::class.java))
+        val generalSystemService = SBaseService(SMybatisDao(GeneralSystem::class.java))
+        val list = ArrayList<EquipAssetComponentsReqponse>()
+        if (equipAssetComponentsList.total!! > 0) {
+            val contentList = equipAssetComponentsList.content
+            for (content in contentList!!) {
+
+                val exec = EquipmentService.select(SFilter.lte(SLength("category"), 6), SFilter.eq("parentId", content.id!!)).exec()
+
+                content.count = exec.size
+//                var equipAssetComponentsReqponse = EquipAssetComponentsReqponse()
+//                equipAssetComponentsReqponse.id = content.id
+//                equipAssetComponentsReqponse.linkId = content.linkId
+//                equipAssetComponentsReqponse.linkEquipName = content.linkName
+//                equipAssetComponentsReqponse.linkFamily = content.linkFamily
+//                equipAssetComponentsReqponse.linkEquipLocalName = content.linkLocalName
+//                equipAssetComponentsReqponse.count = exec.size
+//                equipAssetComponentsReqponse.name = content.name
+//                equipAssetComponentsReqponse.customParam = content.customParam
+//                equipAssetComponentsReqponse.alram = content.alram
+//                equipAssetComponentsReqponse.settingParam = content.settingParam
+//                equipAssetComponentsReqponse.runParam = content.runParam
+//                equipAssetComponentsReqponse.techParam = content.techParam
+//                equipAssetComponentsReqponse.category = content.category
+//                equipAssetComponentsReqponse.buildingId = content.buildingId
+//                equipAssetComponentsReqponse.projectId = content.projectId
+//                equipAssetComponentsReqponse.floorId = content.floorId
+//                equipAssetComponentsReqponse.bimId = content.bimId
+//                equipAssetComponentsReqponse.bimLocation = content.bimLocation
+//                equipAssetComponentsReqponse.cadId = content.cadId
+//                equipAssetComponentsReqponse.commParam = content.commParam
+//                equipAssetComponentsReqponse.ledgerParam = content.ledgerParam
+//                equipAssetComponentsReqponse.localId = content.localId
+//                equipAssetComponentsReqponse.localName = content.localName
+//                equipAssetComponentsReqponse.qrCode = content.qrCode
+//                equipAssetComponentsReqponse.dpInsurerID = content.dpInsurerID
+//                equipAssetComponentsReqponse.dpMaintainerID = content.dpMaintainerID
+//                equipAssetComponentsReqponse.dpManufacturerID = content.dpManufacturerID
+//                equipAssetComponentsReqponse.dpSupplierID = content.dpSupplierID
+//                equipAssetComponentsReqponse.techParamGeneral = content.techParamGeneral
+//                equipAssetComponentsReqponse.runParamGeneral = content.runParamGeneral
+
+                val generalSystemList = ArrayList<cn.sagacloud.server.datacenter.models.entities.GeneralSystem>()
+                val systemList = viewEquipSystemservice.select(SFilter.eq("equipId", content.id!!)).exec()
+                try {
+                    if (!systemList.isEmpty()) {
+
+                        for (system in systemList) {
+                            if (!system.id.isNullOrEmpty()){
+                                val systemEntity = generalSystemService.select(SFilter.eq("id", system.id!!)).entity()
+                                if (systemEntity!=null){
+                                    val generalSystem = cn.sagacloud.server.datacenter.models.entities.GeneralSystem()
+                                    generalSystem.id = system.id
+                                    generalSystem.name = systemEntity.name
+                                    generalSystem.localName = systemEntity.localName
+                                    generalSystem.category = system.category
+                                    generalSystemList.add(generalSystem)
+                                }
+                            }
+                        }
+                    }
+                    content.linkSystem = generalSystemList
+                    list.add(content)
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+            }
+        }
+        return list
+    }
+
+    /**
+     * 查询 设备关联的资产 部件数量帮助接口
+     */
+    fun getEquipAssetComponentsToolsTwo(equipAssetComponentsList: List<EquipAssetComponentsReqponse>): ArrayList<EquipAssetComponentsReqponse> {
+        /** 设备关联系统服务 */
+        val viewEquipSystemservice = SBaseService(SMybatisDao(ViewEquipSystem::class.java))
+        val generalSystemService = SBaseService(SMybatisDao(GeneralSystem::class.java))
+        val explainAllCategoriesService = SBaseService(SMybatisDao(ExplainAllCategories::class.java))
+
+        val list = ArrayList<EquipAssetComponentsReqponse>()
+        if (equipAssetComponentsList.size!! > 0) {
+
+            for (content in equipAssetComponentsList!!) {
+
+                val exec = EquipmentService.select(SFilter.lte(SLength("category"), 6), SFilter.eq("parentId", content.id!!)).exec()
+
+                content.count = exec.size
+
+//                val exec1 = explainAllCategoriesService.select(SFilter.eq("parentId", content.category!!)).exec()
+//                content.componentCategory = exec1
+
+//                var equipAssetComponentsReqponse = EquipAssetComponentsReqponse()
+//                equipAssetComponentsReqponse.id = content.id
+//                equipAssetComponentsReqponse.linkId = content.linkId
+//                equipAssetComponentsReqponse.linkEquipName = content.linkName
+//                equipAssetComponentsReqponse.linkFamily = content.linkFamily
+//                equipAssetComponentsReqponse.linkEquipLocalName = content.linkLocalName
+//                equipAssetComponentsReqponse.count = exec.size
+//                equipAssetComponentsReqponse.name = content.name
+//                equipAssetComponentsReqponse.customParam = content.customParam
+//                equipAssetComponentsReqponse.alram = content.alram
+//                equipAssetComponentsReqponse.settingParam = content.settingParam
+//                equipAssetComponentsReqponse.runParam = content.runParam
+//                equipAssetComponentsReqponse.techParam = content.techParam
+//                equipAssetComponentsReqponse.category = content.category
+//                equipAssetComponentsReqponse.buildingId = content.buildingId
+//                equipAssetComponentsReqponse.projectId = content.projectId
+//                equipAssetComponentsReqponse.floorId = content.floorId
+//                equipAssetComponentsReqponse.bimId = content.bimId
+//                equipAssetComponentsReqponse.bimLocation = content.bimLocation
+//                equipAssetComponentsReqponse.cadId = content.cadId
+//                equipAssetComponentsReqponse.commParam = content.commParam
+//                equipAssetComponentsReqponse.ledgerParam = content.ledgerParam
+//                equipAssetComponentsReqponse.localId = content.localId
+//                equipAssetComponentsReqponse.localName = content.localName
+//                equipAssetComponentsReqponse.qrCode = content.qrCode
+//                equipAssetComponentsReqponse.dpInsurerID = content.dpInsurerID
+//                equipAssetComponentsReqponse.dpMaintainerID = content.dpMaintainerID
+//                equipAssetComponentsReqponse.dpManufacturerID = content.dpManufacturerID
+//                equipAssetComponentsReqponse.dpSupplierID = content.dpSupplierID
+//                equipAssetComponentsReqponse.techParamGeneral = content.techParamGeneral
+//                equipAssetComponentsReqponse.runParamGeneral = content.runParamGeneral
+
+                val generalSystemList = ArrayList<cn.sagacloud.server.datacenter.models.entities.GeneralSystem>()
+                val systemList = viewEquipSystemservice.select(SFilter.eq("equipId", content.id!!)).exec()
+                try {
+                    if (!systemList.isEmpty()) {
+
+                        for (system in systemList) {
+                            if (!system.id.isNullOrEmpty()){
+                                val systemEntity = generalSystemService.select(SFilter.eq("id", system.id!!)).entity()
+                                if (systemEntity!=null){
+                                    val generalSystem = cn.sagacloud.server.datacenter.models.entities.GeneralSystem()
+                                    generalSystem.id = system.id
+                                    generalSystem.name = systemEntity.name
+                                    generalSystem.localName = systemEntity.localName
+                                    generalSystem.category = system.category
+                                    generalSystemList.add(generalSystem)
+                                }
+                            }
+                        }
+                    }
+                    content.linkSystem = generalSystemList
+                    list.add(content)
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+            }
+        }
+        return list
+    }
+
+} // Object DataVerification

+ 239 - 0
equip-componnet/src/main/kotlin/com/persagy/server/utils/IdUtils.kt

@@ -0,0 +1,239 @@
+package com.persagy.server.utils
+
+import java.util.*
+
+
+/**
+ * id生成帮助类
+ *
+ * @author 张维新
+ */
+object IdUtils {
+
+    /**
+     * 生成项目id
+     *
+     * @param   code    城市六位编码
+     * @param   num     城市存在建筑的数量
+     * @return          返回项目id
+     */
+    fun projectIdCreate(code: String, num: Int): String {
+        try {
+            if (num + 1 > 9999) {
+                throw  SecurityException("建筑数量已超出最大值")
+            }
+            val nums = num + 1
+            val genId = String.format("%1$4s", nums).replace(' ', '0')
+            val sb = StringBuilder()
+            val appendId = sb.append("Pj").append(code).append(genId)
+
+            return appendId.toString()
+        } catch (e: Throwable) {
+            e.printStackTrace()
+        }
+        throw  SecurityException("id生成失败")
+    } // Function ProjectId
+
+    /**
+     * 生成建筑Id
+     *
+     * @param   projectId   项目id
+     * @return              建筑id
+     */
+    fun buildIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Bd")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val buildId = sb.append(bdid).append(uuId)
+        return buildId.toString()
+    } // Function buildIdCreate
+
+    /**
+     * 生成楼层Id
+     *
+     * @param   projectId   项目id
+     * @return              楼层id
+     */
+    fun floorIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Fl")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val floorId = sb.append(bdid).append(uuId)
+        return floorId.toString()
+    } // Function floorIdCreate
+
+    /**
+     * 生成空间Id
+     *
+     * @param   projectId   项目id
+     * @return              空间id
+     */
+    fun spaceIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Sp")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val spaceId = sb.append(bdid).append(uuId)
+        return spaceId.toString()
+    } // Function spaceIdCreate
+
+    /**
+     * 生成元空间Id
+     *
+     * @param   projectId   项目id
+     * @return              元空间id
+     */
+    fun iSpaceIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Si")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val siId = sb.append(bdid).append(uuId)
+        return siId.toString()
+    } // Function iSpaceIdCreate
+
+    /**
+     * 生成系统Id
+     *
+     * @param   projectId   项目id
+     * @return              系统id
+     */
+    fun systemIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Sy")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val systemId = sb.append(bdid).append(uuId)
+        return systemId.toString()
+    } // Function systemIdCreate
+
+    /**
+     * 生成设备Id
+     *
+     * @param   projectId   项目id
+     * @return              设备id
+     */
+    fun equipmentIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Eq")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val eqId = sb.append(bdid).append(uuId)
+        return eqId.toString()
+    } // Function equipmentIdCreate
+
+    /**
+     * 生成设备部件Id
+     *
+     * @param   projectId   项目id
+     * @return              设备部件id
+     */
+    fun equipmentComponentIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Ec")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val ecId = sb.append(bdid).append(uuId)
+        return ecId.toString()
+    } // Function equipmentComponentIdCreate
+
+    /**
+     * 生成设施Id
+     *
+     * @param   projectId   项目id
+     * @return              设施id
+     */
+    fun structureIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "St")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val stId = sb.append(bdid).append(uuId)
+        return stId.toString()
+    } // Function structureIdCreate
+
+    /**
+     * 生成设施部件Id
+     *
+     * @param   projectId   项目id
+     * @return              设施部件id
+     */
+    fun structureComponentIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Sc")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val scId = sb.append(bdid).append(uuId)
+        return scId.toString()
+    } // Function structureComponentIdCreate
+
+    /**
+     * 生成资产编码Id
+     *
+     * @param   projectId   项目id
+     * @return              设备资产编码id
+     */
+    fun peIdCreate(projectId: String): String {
+        val bdid = "Pe"
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val peId = sb.append(bdid).append(uuId)
+        return peId.toString()
+    } // Function peIdCreate
+
+    /**
+     * 生成竖井Id
+     *
+     * @param   projectId   项目id
+     * @return              竖井id
+     */
+    fun shaftIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "Sh")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val shId = sb.append(bdid).append(uuId)
+        return shId.toString()
+    } // Function shaftIdCreate
+
+    /**
+     * 生成租户Id
+     *
+     * @param   projectId   项目id
+     * @return              租户id
+     */
+    fun tenantIdCreate(projectId: String): String {
+        val bdid = projectId.replace("Pj", "VOTn")
+        val sb = StringBuilder()
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        val shId = sb.append(bdid).append(uuId)
+        return shId.toString()
+    } // Function shaftIdCreate
+
+    /**
+     * 生成uuid
+     *
+     * @return              uuid
+     */
+    fun uuidCreate(): String {
+        val uuid = UUID.randomUUID().toString()
+        val uuId = uuid.replace("-", "")
+        return uuId
+    } // Function uuidCreate
+
+    /**
+     * 编码审查
+     */
+    fun  codeExanine(){
+        try {
+            Thread.sleep(100)
+        } catch (e: InterruptedException) {
+            e.printStackTrace()
+        }
+    }
+
+} // Object IdUtils

+ 423 - 0
equip-componnet/src/main/kotlin/com/persagy/server/utils/MatchingProperty.kt

@@ -0,0 +1,423 @@
+package cn.sagacloud.server.equipcomponent.utils
+
+import cn.sagacloud.server.datacenter.models.entities.Equipment
+import cn.sagacloud.server.datacenter.models.entities.Property
+import cn.sagacloud.server.datacenter.models.entities.base.PointD
+import cn.sagacloud.server.equipcomponent.dao.mappers.EquipmentZoneMapper
+import cn.sagacloud.server.equipcomponent.models.entities.SimilarityDegree
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.sybotan.base.extensions.eq
+import com.sybotan.service.utils.SSpringContextUtil
+import org.slf4j.LoggerFactory
+import java.lang.reflect.Type
+import java.util.*
+import kotlin.collections.HashSet
+
+/**
+ * 根据设备匹配资产
+ *
+ * @author 张维新
+ */
+object MatchingProperty {
+
+    /** 日志 */
+    private val logger = LoggerFactory.getLogger(MatchingProperty::class.java)
+
+        /** 自定义查询 */
+        private val equipZoneMapper by lazy {
+            SSpringContextUtil.getBean(EquipmentZoneMapper::class.java) as EquipmentZoneMapper
+        }
+
+
+
+    /**
+     * 计算设备匹配的资产
+     */
+    fun equipMatchingProperty(equipment: Equipment, list: ArrayList<Property>): ArrayList<Property> {
+
+        var propertyList = ArrayList<Property>()
+
+            /** CADID 图纸中的id 判断 */
+            if (!equipment.cadId.isNullOrEmpty()) {
+//                if (equipment.cadId == "AA-A1-1(1#)-1"){
+////                    logger.debug("CADID = ${equipment.cadId}************************************************************")
+//                }
+
+                    /** 设计图纸重编码 */
+                    if (propertyList.size == 0){
+                        /** 设计图纸中编码 */
+                        for (property in list) {
+
+                            if (!equipment.cadId.isNullOrEmpty()&&!property.cadId.isNullOrEmpty()&&property.cadId == equipment.cadId ){
+                                propertyList.add(property)
+                                if (propertyList.size>3){
+                                    break
+                                }
+                            }
+                        }
+//                        logger.debug("匹配到的资产 = ${propertyList.size}************************************************************")
+                    }
+                if (!equipment.localId.isNullOrEmpty()){
+                    if (propertyList.size == 0){
+                        /** 判断本地编码 */
+                        for (property in list) {
+                            if (!property.localId.isNullOrEmpty()&&equipment.localId == property.localId){
+                                propertyList.add(property)
+                                if (propertyList.size>3){
+                                    break
+                                }
+                            }
+                        }
+                    }
+                }
+
+                if (!equipment.localName.isNullOrEmpty()){
+
+                    if (propertyList.size==0){
+                        /** 判断本地名称 */
+                        for (property in list) {
+
+                            if (!property.localName.isNullOrEmpty()&&property.localName == equipment.localName ){
+                                propertyList.add(property)
+                                if (propertyList.size>3){
+                                    break
+                                }
+                            }
+                        }
+                    }
+
+                }
+//                if (propertyList.size == 0) {
+                    if (equipment.locationJson != null && equipment.locationJson!!.x != null && !equipment.locationJson!!.x!!.eq(0.0)
+                            && equipment.locationJson!!.y != null && !equipment.locationJson!!.y!!.eq(0.0)) {
+                        /** 格局坐标计算  */
+                        val pointXYList = pointXY(equipment, list, propertyList)
+                        if (pointXYList.size > 0) {
+                            propertyList = pointXYList
+                        }
+
+                    } else if (!equipment.localName.isNullOrEmpty()) {
+                        /** 相似度 */
+                        val similarity = similarity(equipment, list, propertyList)
+                        if (similarity.size > 0) {
+                            propertyList = similarity
+                        }
+                    }
+//                }
+                if (propertyList.size >0){
+                    /** 删除已经筛选出来的资产在总的资产列表中 */
+                    for (i in propertyList.indices) {
+                        val iterator = list.iterator()
+                        while (iterator.hasNext()) {
+                            var propertyl = iterator.next()
+                            if (propertyList[i].id ==propertyl.id ){
+                                iterator.remove()
+                            }
+                        }
+                    }
+                    return propertyList
+                }
+
+            } else if (!equipment.localId.isNullOrEmpty()) {
+//                logger.debug("localId = ${equipment.localId}************************************************************")
+                /** 判断本地编码 */
+                for (property in list) {
+                    if (!property.localId.isNullOrEmpty()&&equipment.localId == property.localId){
+                        propertyList.add(property)
+                        if (propertyList.size>3){
+                            break
+                        }
+                    }
+                }
+
+                if (!equipment.cadId.isNullOrEmpty()){
+                    /** 设计图纸重编码 */
+                    if (propertyList.size == 0){
+                        /** 设计图纸中编码 */
+                        for (property in list) {
+
+                            if (!equipment.cadId.isNullOrEmpty()&&!property.cadId.isNullOrEmpty()&&property.cadId == equipment.cadId ){
+                                propertyList.add(property)
+                                if (propertyList.size>3){
+                                    break
+                                }
+                            }
+                        }
+
+                    }
+                }
+
+                if (!equipment.localName.isNullOrEmpty()){
+
+                    if (propertyList.size==0){
+                        /** 判断本地名称 */
+                        for (property in list) {
+
+                            if (!property.localName.isNullOrEmpty()&&property.localName == equipment.localName ){
+                                propertyList.add(property)
+                                if (propertyList.size>3){
+                                    break
+                                }
+                            }
+                        }
+                    }
+
+                }
+//                if (propertyList.size==0) {
+                    if (equipment.locationJson != null && equipment.locationJson!!.x != null && !equipment.locationJson!!.x!!.eq(0.0)
+                            && equipment.locationJson!!.y != null && !equipment.locationJson!!.y!!.eq(0.0)) {
+                        /** 格局坐标计算  */
+                        val pointXYList = pointXY(equipment, list, propertyList)
+                        if (pointXYList.size > 0) {
+                            propertyList = pointXYList
+                        }
+
+                    } else if (!equipment.localName.isNullOrEmpty()) {
+                        /** 相似度 */
+                        val similarity = similarity(equipment, list, propertyList)
+                        if (similarity.size > 0) {
+                            propertyList = similarity
+                        }
+                    }
+//                }
+                if (propertyList.size >0){
+                    /** 删除已经筛选出来的资产在总的资产列表中 */
+                    for (i in propertyList.indices) {
+                        val iterator = list.iterator()
+                        while (iterator.hasNext()) {
+                            var propertyl = iterator.next()
+                            if (propertyList[i].id ==propertyl.id ){
+                                iterator.remove()
+                            }
+                        }
+                    }
+                    return propertyList
+                }
+            } else if (!equipment.localName.isNullOrEmpty()) {
+//                logger.debug("本地名称匹配:${equipment.localName}********************************************************")
+                /** 判断本地名称 */
+                for (property in list) {
+
+                    if (!property.localName.isNullOrEmpty()&&property.localName == equipment.localName ){
+                        propertyList.add(property)
+                        if (propertyList.size>3){
+                            break
+                        }
+                    }
+                }
+
+                if (propertyList.size == 0){
+                    /** 设计图纸中编码 */
+                    for (property in list) {
+
+                        if (!equipment.cadId.isNullOrEmpty()&&!property.cadId.isNullOrEmpty()&&property.cadId == equipment.cadId ){
+                            propertyList.add(property)
+                            if (propertyList.size>3){
+                                break
+                            }
+                        }
+                    }
+
+                }
+
+                if (propertyList.size == 0){
+                    /** 本地编码 */
+                    for (property in list) {
+
+                        if (!equipment.localId.isNullOrEmpty()&&!property.localId.isNullOrEmpty()&&property.localId == equipment.localId ){
+                            propertyList.add(property)
+                            if (propertyList.size>3){
+                                break
+                            }
+                        }
+                    }
+                }
+
+//                    if (propertyList.size == 0){
+                        if (equipment.locationJson != null && equipment.locationJson!!.x != null && !equipment.locationJson!!.x!!.eq(0.0)
+                                && equipment.locationJson!!.y != null && !equipment.locationJson!!.y!!.eq(0.0)) {
+                            /** 格局坐标计算  */
+                            val pointXYList = pointXY(equipment, list, propertyList)
+                            if (pointXYList.size > 0) {
+                                propertyList = pointXYList
+                            }
+
+                        }else  if (!equipment.localName.isNullOrEmpty()) {
+                            /** 相似度 */
+                            val similarity = similarity(equipment, list, propertyList)
+                            if (similarity.size>0){
+                                propertyList = similarity
+                            }
+                        }
+//                    }
+
+                if (propertyList.size >0){
+                    /** 删除已经筛选出来的资产在总的资产列表中 */
+                    for (i in propertyList.indices) {
+                        val iterator = list.iterator()
+                        while (iterator.hasNext()) {
+                            var propertyl = iterator.next()
+                            if (propertyList[i].id ==propertyl.id ){
+                                iterator.remove()
+                            }
+                        }
+                    }
+
+                }
+                return propertyList
+            } else if (equipment.locationJson != null && equipment.locationJson!!.x != null && !equipment.locationJson!!.x!!.eq(0.0)
+                    && equipment.locationJson!!.y != null && !equipment.locationJson!!.y!!.eq(0.0)) {
+                /** 格局坐标计算  */
+                val pointXYList = pointXY(equipment, list, propertyList)
+
+
+                /** 获取模型空间数据,判断设备所在的模型空间 */
+                if (!equipment.floorId.isNullOrEmpty()){
+
+                }
+
+                if (pointXYList.size>0){
+                    return pointXYList
+                }else{
+                    if (!equipment.localName.isNullOrEmpty()) {
+                        /** 相似度 */
+                        propertyList = similarity(equipment, list, propertyList)
+                        return propertyList
+                    }
+                }
+
+            } else if (!equipment.localName.isNullOrEmpty()) {
+                /** 相似度 */
+                propertyList = similarity(equipment, list, propertyList)
+                return propertyList
+            }
+
+        return propertyList
+    }
+
+    /**
+     * 相似度 算法
+     */
+    fun similarityDegree(equipNmae: String, propertyName: String): Boolean {
+
+        return false
+    }
+
+    /**
+     * 相似度方法
+     */
+    fun similarity(equipment: Equipment, list: ArrayList<Property>,propertyList: ArrayList<Property> ): ArrayList<Property> {
+        /** 相似度 */
+        for (property in list) {
+            if (!property.localName.isNullOrEmpty()&&similarityDegree(equipment.localName!!,property.localName!!)){
+                propertyList.add(property)
+                if(propertyList.size==2){
+                    break
+                }
+            }
+        }
+        val setName = HashSet<String>()
+        for (property in list) {
+            if (!property.localName.isNullOrEmpty()){
+                setName.add(property.localName!!)
+            }
+        }
+
+        /** 匹配相似度 90% */
+        if (setName.size>0){
+            val similarList = equipZoneMapper.similarTwo(equipment.localName!!, setName.toList(),setName.toList().size)
+            val gson = Gson()
+            val type: Type = object : TypeToken<List<SimilarityDegree>>() {}.getType()
+            val lists: List<SimilarityDegree> = gson.fromJson(similarList, type)
+            if (lists.size>0){
+                val setName = HashSet<String>()
+                for (similarit in lists){
+                    if (similarit.value!! >0.9){
+                        setName.add(similarit.key!!)
+                    }
+                }
+                if (setName.size>0){
+                    for (property in list) {
+                        for (name in setName){
+                         if (name == property.localName){
+                             propertyList.add(property)
+                         }
+                        }
+                    }
+                }
+            }
+        }
+
+        if (propertyList.size>0){
+            for (i in propertyList.indices) {
+                val iterator = list.iterator()
+                while (iterator.hasNext()) {
+                    var propertyl = iterator.next()
+                    if (propertyList[i].id ==propertyl.id ){
+                        iterator.remove()
+                    }
+                }
+            }
+//            for (i in propertyList.indices) {
+//                for ( propertyL  in  list){
+//                    if (propertyList[i].id ==propertyL.id ){
+//                        list.remove(propertyL)
+//                    }
+//                }
+//            }
+        }
+        return propertyList
+    }
+
+
+    /**
+     * 根据坐标x,y
+     */
+    fun  pointXY(equipment: Equipment, list: ArrayList<Property>,propertyList: ArrayList<Property> ): ArrayList<Property> {
+        val distancePropertyList = ArrayList<Property>()
+
+        for (property in list) {
+            if (property.locationJson!=null&&property.locationJson!!.x!=null&&!property.locationJson!!.x!!.eq(0.0)&&!property.locationJson!!.y!!.eq(0.0)){
+                /**  计算两点间的距离  */
+                val point = PointD(equipment.locationJson!!.x!!,equipment.locationJson!!.y!!)
+                val distance = point.distance(property.locationJson!!.x!!, property.locationJson!!.y!!)
+                property.distance = distance
+                distancePropertyList.add(property)
+            }
+        }
+        /** 排序 从小到大 */
+        distancePropertyList.sortBy {
+            it.distance
+        }
+
+        for (i in distancePropertyList.indices) {
+            if (i<=2){
+                propertyList.add(distancePropertyList[i])
+            }
+        }
+
+
+        for (i in propertyList.indices) {
+            val iterator = list.iterator()
+            while (iterator.hasNext()) {
+                var propertyl = iterator.next()
+                if (propertyList[i].id ==propertyl.id ){
+                    iterator.remove()
+                }
+
+            }
+        }
+
+//        for (i in propertyList.indices) {
+//            for ( propertyL  in  list){
+//                if (propertyList[i].id ==propertyL.id ){
+//                    list.remove(propertyL)
+//                }
+//            }
+//        }
+
+        return propertyList
+    }
+
+} // Object MatchingProperty

+ 40 - 0
equip-componnet/src/main/kotlin/com/persagy/server/utils/ShaftNameUtil.kt

@@ -0,0 +1,40 @@
+package cn.sagacloud.server.equipcomponent.utils
+
+import java.util.*
+
+/**
+ * 竖井名称自动生成工具
+ *
+ * @author 张维新
+ */
+object ShaftNameUtil {
+
+    /**
+     * 竖井名字
+     *
+     * @param   name    名字
+     */
+    fun shaftName(name:String):String{
+        return name + getCode(5)
+    } // Function shaftName()
+
+    /**
+     * 字母和数字组合的随机数
+     *
+     * @param   n   随机数的位数
+     */
+    private fun getCode(n: Int): String {
+        val string = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"//保存数字0-9 和 大小写字母
+        val ch = CharArray(n) //声明一个字符数组对象ch 保存 验证码
+        for (i in 0 until n) {
+            val random = Random()//创建一个新的随机数生成器
+            val index = random.nextInt(string.length)//返回[0,string.length)范围的int值    作用:保存下标
+            ch[i] = string[index]//charAt() : 返回指定索引处的 char 值   ==》保存到字符数组对象ch里面
+        }
+        //将char数组类型转换为String类型保存到result
+        //String result = new String(ch);//方法一:直接使用构造方法      String(char[] value) :分配一个新的 String,使其表示字符数组参数中当前包含的字符序列。
+//        val result = String(ch)//方法二: String方法   valueOf(char c) :返回 char 参数的字符串表示形式。
+        return  String(ch)
+    }// Function getCode()
+
+} // Object ShaftNameUtil

+ 25 - 0
equip-componnet/src/main/kotlin/com/persagy/server/utils/SpaceRunnables.kt

@@ -0,0 +1,25 @@
+package cn.sagacloud.server.equipcomponent.utils
+
+import cn.sagacloud.server.equipcomponent.dao.mappers.EquipmentZoneMapper
+import cn.sagacloud.server.equipcomponent.service.ShaftService
+import com.sybotan.service.utils.SSpringContextUtil
+
+
+/**
+ * 业务空间
+ *
+ */
+class SpaceRunnables(internal val projectId: String,val buildingId: String,
+                      internal var zoneType: String,val list: ArrayList<String>) : Runnable {
+
+    /** 自定义查询 */
+    private val equipZoneMapper by lazy {
+        SSpringContextUtil.getBean(EquipmentZoneMapper::class.java) as EquipmentZoneMapper
+    }
+
+    override fun run() {
+    equipZoneMapper.spVerticallySp(projectId,buildingId,zoneType,list)
+
+    } //
+
+} //

+ 1 - 0
settings.gradle

@@ -6,4 +6,5 @@ include 'scanbuilding'      // 扫楼
 include 'labsl'             // 蜡笔森林
 include 'datasyn'           // 数据同步
 include 'meiku'             // 图例库
+include 'equip-componnet'