Bläddra i källkod

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/archforarch/RBd2Bd.kt
weixinVSjinlai 4 år sedan
förälder
incheckning
b903dcc3d8
42 ändrade filer med 3418 tillägg och 2223 borttagningar
  1. 5 5
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/graphtype/block/RelationAddRequest.kt
  2. 1 1
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/Property.kt
  3. 80 2
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/archforarch/RBd2Bd.kt
  4. 85 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/archforarch/RBd2Fl.kt
  5. 3 0
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/jms/SynchronousMessage.kt
  6. 34 1
      datacenter/src/main/kotlin/com/persagy/server/controllers/graphtype/GraphicTypeController.kt
  7. 6 1
      datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/ManualRelationCalcController.kt
  8. 111 10
      datacenter/src/main/kotlin/com/persagy/server/mappers/IRelationExcelExportMapper.kt
  9. 684 36
      datacenter/src/main/kotlin/com/persagy/server/services/graphtype/RelationTypeProjectService.kt
  10. 3 3
      datacenter/src/main/kotlin/com/persagy/server/services/objects/ComponentService.kt
  11. 2 1
      datacenter/src/main/kotlin/com/persagy/server/services/objects/EquipmentService.kt
  12. 25 16
      datacenter/src/main/kotlin/com/persagy/server/services/objects/FloorService.kt
  13. 3 2
      datacenter/src/main/kotlin/com/persagy/server/services/rel/REqInShService.kt
  14. 0 1
      datacenter/src/main/kotlin/com/persagy/server/services/rel/RShContainSpBaseService.kt
  15. 2149 0
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationAddService.kt
  16. 65 2064
      datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationCalcService.kt
  17. 9 8
      datacenter/src/main/resources/application-test.yml
  18. 1 2
      datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt
  19. 3 0
      datasyn/src/main/kotlin/com/persagy/server/syn/Opts.kt
  20. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/controllers/obj/RelToFromController.kt
  21. 3 0
      datasyn/src/main/kotlin/com/persagy/server/syn/jms/DataCenterSync.kt
  22. 8 8
      datasyn/src/main/kotlin/com/persagy/server/syn/jms/MessageProcessing.kt
  23. 3 0
      datasyn/src/main/kotlin/com/persagy/server/syn/models/api/obj/EquipApi.kt
  24. 8 8
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterBuilding.kt
  25. 7 7
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterComponent.kt
  26. 5 5
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterEquipment.kt
  27. 5 5
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterFloor.kt
  28. 5 6
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterSpace.kt
  29. 3 3
      datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterSystem.kt
  30. 1 1
      datasyn/src/main/kotlin/com/persagy/server/syn/task/SchedulerTaskRel.kt
  31. 13 10
      datasyn/src/main/resources/application-dev.yml
  32. 0 2
      datasyn/src/main/resources/application-test.yml
  33. 2 2
      equip-component/src/main/kotlin/com/persagy/server/service/base/Service.kt
  34. 9 3
      equip-component/src/main/kotlin/com/persagy/server/service/labsl/CustomSqlLabslService.kt
  35. 2 5
      equip-component/src/main/kotlin/com/persagy/server/service/objects/ShaftService.kt
  36. 4 2
      equip-component/src/main/resources/application-test.yml
  37. 3 0
      gradle.properties
  38. 46 0
      message-center/src/main/resources/application-test.yml
  39. 1 1
      scanbuilding/src/main/kotlin/com/persagy/server/controller/UserController.kt
  40. 1 0
      scanbuilding/src/main/kotlin/com/persagy/server/entities/User.kt
  41. 3 1
      scanbuilding/src/main/resources/application-dev.yml
  42. 16 0
      scanbuilding/src/main/resources/application-test.yml

+ 5 - 5
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/graphtype/block/RelationAddRequest.kt

@@ -49,10 +49,10 @@ class RelationAddRequest : Serializable {
     @Schema(description = "从对象内容")
     var fromContent: ArrayList<String>? = null
 
-//    /** 图类型编码 */
-//    @Schema(description = "图类型编码")
-//    @Column(name = "graphic_type")
-//    var graphicType: String? = null
+    /** 图类型编码 */
+    @Schema(description = "图类型编码")
+    @Column(name = "graphic_type")
+    var graphicType: String? = null
 
 
-} // Class RelationAddRequest
+}

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

@@ -170,7 +170,7 @@ open class Property : BaseInfo(),Comparator<Property> {
     /** 贴码状态 */
     @Schema(description = "贴码状态")
     @Column(name = "code_type")
-    var codeType: Int? = null
+    var codeType: Long? = null
 
     /** 选择状态 */
     @Schema(description = "选择状态")

+ 80 - 2
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/archforarch/RBd2Bd.kt

@@ -1,7 +1,85 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2021.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
 package com.persagy.server.datacenter.models.entities.rel.archforarch
 
+import com.persagy.server.datacenter.models.entities.base.RBaseInfo
+import io.swagger.v3.oas.annotations.media.Schema
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
 /**
- * 建筑和建筑的关系
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2021/3/4 15:29
  */
-class RBd2Bd {
+@Schema(description = "设备与设备的关系")
+@Table(name = "relationship.r_bd2bd")
+class RBd2Bd : RBaseInfo() {
+
+    /** id1 */
+    @Schema(description = "id1")
+    @Id
+    @Column(name = "id1")
+    var id1: String? = null
+
+    /** id2 */
+    @Schema(description = "id2")
+    @Id
+    @Column(name = "id2")
+    var id2: String? = null
+
+    /** 项目Id */
+    @Schema(description = "项目Id")
+    @Id
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 类型 */
+    @Schema(description = "类型 " )
+    @Id
+    @Column(name = "type")
+    var type: String? = null
+
+    /** 图类型 */
+    @Schema(description = "图类型 " )
+    @Id
+    @Column(name = "graph_code")
+    var graphCode: String? = null
+
+
+    /** 计算标记 1 为手动 2为自动 */
+    @Schema(description = "计算标记 1 为手动 2为自动 ")
+    @Column(name = "sign")
+    var sign: Int? = null
+
+    /** 是否有方向性 */
+    @Schema(description = "是否有方向性")
+    @Column(name = "has_direction")
+    var hasDirection: Boolean? = null
+
 }

+ 85 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/rel/archforarch/RBd2Fl.kt

@@ -0,0 +1,85 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2021.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.datacenter.models.entities.rel.archforarch
+
+import com.persagy.server.datacenter.models.entities.base.RBaseInfo
+import io.swagger.v3.oas.annotations.media.Schema
+import javax.persistence.Column
+import javax.persistence.Id
+import javax.persistence.Table
+
+/**
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2021/3/4 15:29
+ */
+@Schema(description = "设备与设备的关系")
+@Table(name = "relationship.r_bd2fl")
+class RBd2Fl : RBaseInfo() {
+
+    /** id1 */
+    @Schema(description = "id1")
+    @Id
+    @Column(name = "id1")
+    var id1: String? = null
+
+    /** id2 */
+    @Schema(description = "id2")
+    @Id
+    @Column(name = "id2")
+    var id2: String? = null
+
+    /** 项目Id */
+    @Schema(description = "项目Id")
+    @Id
+    @Column(name = "project_id")
+    var projectId: String? = null
+
+    /** 类型 */
+    @Schema(description = "类型 " )
+    @Id
+    @Column(name = "type")
+    var type: String? = null
+
+    /** 图类型 */
+    @Schema(description = "图类型 " )
+    @Id
+    @Column(name = "graph_code")
+    var graphCode: String? = null
+
+
+    /** 计算标记 1 为手动 2为自动 */
+    @Schema(description = "计算标记 1 为手动 2为自动 ")
+    @Column(name = "sign")
+    var sign: Int? = null
+
+    /** 是否有方向性 */
+    @Schema(description = "是否有方向性")
+    @Column(name = "has_direction")
+    var hasDirection: Boolean? = null
+
+}

+ 3 - 0
data-core/src/main/kotlin/com/persagy/server/datacenter/models/jms/SynchronousMessage.kt

@@ -70,6 +70,7 @@ class SynchronousMessage : Serializable {
     var ops: String? = null
 
     /** 操作符名称 */
+    @Column(name = "ops_name")
     var opsName: String? = null
 
     /** 主 id */
@@ -98,9 +99,11 @@ class SynchronousMessage : Serializable {
     var name: String? = null
 
     /** 对象类型名称 */
+    @Column(name = "obj_name")
     var objName: String? = null
 
     /** 对象类型名称 */
+    @Column(name = "code_name")
     var classCodeName: String? = null
 
     /** 最后更新日期 */

+ 34 - 1
datacenter/src/main/kotlin/com/persagy/server/controllers/graphtype/GraphicTypeController.kt

@@ -150,6 +150,39 @@ open class GraphicTypeController {
     @PostMapping(value = ["/relation_type_project"])
     fun relationTypeProject(@RequestBody request: SQueryRequest): SQueryResponse<RelationTypeProject> {
         val service = SObjectService(RelationTypeProject::class.java)
-        return service.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString())))
+        return service.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("projectId").toString())))
     } // Fun replaceConnectedBlockSource()
+
+
+    /**
+     * 导出关系
+     */
+    @Operation(summary="导出-点位模板 ", description="")
+    @GetMapping(value = ["/export/point"])
+    fun exportExcelPoint(response: HttpServletResponse, @RequestParam buildingId: String,floorId: String,category: String) {
+        RelationTypeProjectService.exportExcelPoint(response,buildingId,floorId,category)
+    } // Fun exportExcel
+
+    /**
+     * 导入excel
+     *
+     * @param   file            导入的excel文件
+     * @return  导入状态
+     */
+    @Operation(summary = "导入excel-点表", description = "")
+    @PostMapping("/import/point")
+    fun importExcelPointLocalId(@RequestParam("file") file: MultipartFile) : SBaseResponse{
+        try {
+            return RelationTypeProjectService.importExcelPoint(file)
+        }catch (e : Exception){
+            return SBaseResponse(SResponseType.failure,"error:" + e.message)
+        }
+    } // Fun importExcel()
+
+    @Operation(summary="下载报告-点表", description="")
+    @GetMapping(value = ["/downloads/point"])
+    fun reportDownloadsPoint(response: HttpServletResponse, @RequestParam key: String) {
+        RelationTypeProjectService.reportDownloadsPoint(response, key)
+    } // Fun reportDownloads()
+
 } // Class EquipScanTaskController

+ 6 - 1
datacenter/src/main/kotlin/com/persagy/server/controllers/relation_calc/ManualRelationCalcController.kt

@@ -31,6 +31,7 @@ import com.persagy.server.datacenter.models.requests.ManualRelationCalcDel
 import com.persagy.server.datacenter.models.requests.ManualRelationCalcRequest
 import com.persagy.server.datacenter.models.response.ManualRelationCalcResponse
 import com.persagy.server.datacenter.models.response.ManualRelationCalcSCreateResponse
+import com.persagy.server.services.relation_calc.ManualRelationAddService
 import com.persagy.server.services.relation_calc.ManualRelationCalcService
 import com.persagy.service.models.responses.SBaseResponse
 import io.swagger.v3.oas.annotations.Operation
@@ -57,6 +58,10 @@ class ManualRelationCalcController {
     @Autowired
     lateinit var service: ManualRelationCalcService
 
+    @Autowired
+    lateinit var serviceAdd: ManualRelationAddService
+
+
     /**
      * 查询关系数据
      */
@@ -72,7 +77,7 @@ class ManualRelationCalcController {
     @Operation(summary = "添加关系", description = "")
     @PostMapping(value = ["/add"])
     fun addRels(@RequestBody relationAddRequest: RelationAddRequest): ManualRelationCalcSCreateResponse {
-        return service.addRel(relationAddRequest)
+        return serviceAdd.addRel(relationAddRequest)
     }
 
     /**

+ 111 - 10
datacenter/src/main/kotlin/com/persagy/server/mappers/IRelationExcelExportMapper.kt

@@ -93,6 +93,20 @@ interface IRelationExcelExportMapper {
     fun eq2bd(projectId: String, type: String): List<HashMap<String, Any?>>
 
     /**
+     * 建筑与设备关系
+     *
+     * @param   projectId       项目id
+     * @param   type            关系类型
+     * @return  关系记录
+     */
+    @Select("SELECT r.building_id AS id, bd.name, bd.local_id, bd.local_name, '建筑' AS object_type,\n" +
+            "r.equip_id AS _id, eq.name AS _name, eq.local_id AS _local_id, eq.local_name as _local_name , '设备' AS _object_type,eq.cad_id as _cad_id , \n" +
+            "(SELECT local_name FROM public.building WHERE id = eq.building_id) AS _building_name,\n" +
+            "(SELECT local_name FROM public.floor WHERE id = eq.floor_id) AS _floor_name\n" +
+            "FROM public.r_eq_for_bd r JOIN equipment AS eq ON r.equip_id = eq.id JOIN building AS bd ON r.building_id = bd.id WHERE r.project_id = #{projectId} ")
+    fun eq2bd_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
      * 建筑下的设备
      *
      * @param   projectId       项目id
@@ -111,10 +125,13 @@ interface IRelationExcelExportMapper {
      * @param   type            关系类型
      * @return  关系记录
      */
-    @Select("SELECT r.id1 AS id, eq1.name, eq1.local_id, eq1.local_name, '设备' AS object_type,\n" +
-            "       r.id2 AS _id, eq2.name AS _name, eq2.local_id AS _local_id, eq2.local_name AS _local_name, '设备' AS _object_type \n" +
-            "FROM relationship.r_eq2eq r JOIN equipment AS eq1 ON r.id1 = eq1.id JOIN equipment AS eq2 ON r.id2 = eq2.id\n" +
-            "WHERE r.project_id = #{projectId} AND r.type = #{type}")
+    @Select("SELECT r.eq_id AS id, eq.name, eq.local_id, eq.local_name,eq.cad_id, '设备' AS object_type,\n" +
+            "(SELECT local_name FROM public.building WHERE id = eq.building_id) AS building_name,\n" +
+            "(SELECT local_name FROM public.floor WHERE id = eq.floor_id) AS floor_name\n" +
+            ",r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type, \n" +
+            "(SELECT local_name FROM building WHERE id = sp.building_id ) AS _building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = sp.floor_id) AS _floor_name \n" +
+            "FROM relationship.r_eq2sp r JOIN equipment AS eq ON r.eq_id = eq.id JOIN zone_space_base AS sp ON r.sp_id = sp.id WHERE r.project_id = #{projectId} AND r.type = #{type} ")
     fun eq2eq(projectId: String, type: String): List<HashMap<String, Any?>>
 
     /**
@@ -144,6 +161,35 @@ interface IRelationExcelExportMapper {
     fun eq2fl(projectId: String, type: String): List<HashMap<String, Any?>>
 
     /**
+     * 楼层与设备关系
+     *
+     * @param   projectId       项目id
+     * @param   type            关系类型
+     * @return  关系记录
+     */
+    @Select("SELECT r.equip_id AS id, eq.name AS name, eq.local_id , eq.local_name, '设备' AS object_type,eq.cad_id,\n" +
+            "(SELECT local_name FROM building WHERE id = eq.building_id) AS building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = eq.floor_id) AS floor_name,\n" +
+            "r.floor_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '楼层' AS _object_type,\n" +
+            "(SELECT local_name FROM building WHERE id = fl.building_id) AS _building_name\n" +
+            "FROM public.r_eq_for_fl r JOIN equipment AS eq ON r.equip_id = eq.id JOIN floor AS fl ON r.floor_id = fl.id WHERE r.project_id = #{projectId}")
+    fun eq2fl_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 设备与空间关系
+     *
+     * @param   projectId       项目id
+     * @param   type            关系类型
+     * @param   zoneType        空间类型
+     * @return  关系记录
+     */
+    @Select("SELECT r.eq_id AS id, eq.name, eq.local_id, eq.local_name, '设备' AS object_type,\n" +
+            "       r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type\n" +
+            "FROM relationship.r_eq2sp r JOIN equipment AS eq ON r.eq_id = eq.id JOIN zone_space_base AS sp ON r.sp_id = sp.id\n" +
+            "WHERE r.project_id = #{projectId} AND r.type = #{type} ")
+    fun eq2spIn(projectId: String, type: String): List<HashMap<String, Any?>>
+
+    /**
      * 设备与空间关系
      *
      * @param   projectId       项目id
@@ -229,9 +275,13 @@ interface IRelationExcelExportMapper {
      * @param   type            关系类型
      * @return  excel需要的记录
      */
-    @Select("SELECT r.pe_id AS id, pe.name, pe.local_id, pe.local_name, '资产' AS object_type,\n" +
-            "       r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type\n" +
-            "FROM relationship.r_pe2sp r JOIN property AS pe ON r.pe_id = pe.id JOIN zone_space_base AS sp ON r.sp_id = sp.id\n" +
+    @Select("SELECT r.eq_id AS id, pe.name, pe.local_id, pe.local_name, pe.cad_id,'资产' AS object_type,\n" +
+            "(SELECT local_name FROM public.building WHERE id = pe.building_id) AS building_name,\n" +
+            "(SELECT local_name FROM public.floor WHERE id = pe.floor_id) AS floor_name,\n" +
+            "r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type ,\n" +
+            "(SELECT local_name FROM building WHERE id = sp.building_id ) AS _building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = sp.floor_id) AS _floor_name \n" +
+            "FROM relationship.r_pe2sp r JOIN property AS pe ON r.eq_id = pe.id JOIN zone_space_base AS sp ON r.sp_id = sp.id\n" +
             "WHERE r.project_id = #{projectId} AND r.type = #{type}")
     fun pe2sp(projectId: String, type: String): List<HashMap<String, Any?>>
 
@@ -321,9 +371,12 @@ interface IRelationExcelExportMapper {
      * @return  excel需要的记录
      */
     @Select("SELECT r.id1 AS id, sp1.name, sp1.local_id, sp1.local_name, '空间' AS object_type,\n" +
-            "       r.id2 AS _id, sp2.name AS _name, sp2.local_id AS _local_id, sp2.local_name AS _local_name, '空间' AS _object_type\n" +
-            "FROM relationship.r_sp2sp r JOIN zone_space_base AS sp1 ON r.id1 = sp1.id JOIN zone_space_base AS sp2 ON r.id2 = sp2.id\n" +
-            "WHERE r.project_id = #{projectId} AND r.type = #{type}")
+            "(SELECT local_name FROM building WHERE id = sp1.building_id ) AS building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = sp1.floor_id) AS floor_name,\n" +
+            "r.id2 AS _id, sp2.name AS _name, sp2.local_id AS _local_id, sp2.local_name AS _local_name, '空间' AS _object_type ,\n" +
+            "(SELECT local_name FROM building WHERE id = sp2.building_id ) AS _building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = sp2.floor_id) AS _floor_name \n" +
+            "FROM relationship.r_sp2sp r JOIN zone_space_base AS sp1 ON r.id1 = sp1.id JOIN zone_space_base AS sp2 ON r.id2 = sp2.id WHERE r.project_id = #{projectId} AND r.type = #{type}")
     fun sp2sp(projectId: String, type: String): List<HashMap<String, Any?>>
 
     /**
@@ -391,4 +444,52 @@ interface IRelationExcelExportMapper {
             "WHERE r.project_id = #{projectId} AND r.type = #{type}")
     fun tn2sp(projectId: String, type: String): List<HashMap<String, Any?>>
 
+    /**
+     * 设备设施服务的竖井
+     */
+    @Select("SELECT r.equip_id AS id, eq.name AS name, eq.local_id , eq.local_name, '设备' AS object_type,eq.cad_id,\n" +
+            "(SELECT local_name FROM building WHERE id = eq.building_id) AS building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = eq.floor_id) AS floor_name,\n" +
+            "r.shaft_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '竖井' AS _object_type\n" +
+            "FROM public.r_eq_for_sh r JOIN equipment AS eq ON r.equip_id = eq.id JOIN shaft AS fl ON r.shaft_id = fl.id WHERE r.project_id = #{projectId}")
+    fun eq2sh_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 系统服务于建筑
+     */
+    @Select("SELECT r.sys_id AS id, eq.name AS name, eq.local_id , eq.local_name, '系统' AS object_type,eq.cad_id,\n" +
+            "r.building_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '建筑' AS _object_type\n" +
+            "FROM public.r_sy_for_bd r JOIN general_system AS eq ON r.sys_id = eq.id JOIN building AS fl ON r.building_id = fl.id WHERE r.project_id = #{projectId}")
+    fun sy2bd_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 系统服务于楼层
+     */
+    @Select("SELECT r.sys_id AS id, eq.name AS name, eq.local_id , eq.local_name, '系统' AS object_type,eq.cad_id,\n" +
+            "r.floor_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '楼层' AS _object_type,\n" +
+            "(SELECT local_name FROM public.building WHERE id = fl.building_id) AS _building_name\n" +
+            "FROM public.r_sy_for_fl r JOIN general_system AS eq ON r.sys_id = eq.id JOIN public.floor AS fl ON r.floor_id = fl.id WHERE r.project_id = #{projectId}")
+    fun sy2fl_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 系统服务于竖井
+     */
+    @Select("SELECT r.sys_id AS id, eq.name AS name, eq.local_id , eq.local_name, '系统' AS object_type,eq.cad_id,\n" +
+            "r.shaft_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '竖井' AS _object_type\n" +
+            "FROM public.r_sy_for_sh r JOIN general_system AS eq ON r.sys_id = eq.id JOIN shaft AS fl ON r.shaft_id = fl.id WHERE r.project_id = #{projectId}")
+    fun sy2sh_for(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 系统服务于空间
+     */
+    @Select("SELECT r.sy_id AS id, eq.name, eq.local_id, eq.local_name,eq.cad_id, '系统' AS object_type,\n" +
+            "r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type, \n" +
+            "(SELECT local_name FROM building WHERE id = sp.building_id ) AS _building_name,\n" +
+            "(SELECT local_name FROM floor WHERE id = sp.floor_id) AS _floor_name \n" +
+            "FROM relationship.r_sy2sp r JOIN general_system AS eq ON r.sy_id = eq.id JOIN zone_space_base AS sp ON r.sp_id = sp.id WHERE r.project_id = #{projectId} AND r.type = 'sy2sp_for' ")
+    fun sy2sp_for(projectId: String): List<HashMap<String, Any?>>
+
+    @Select("SELECT id,local_name,local_id,category FROM equipment WHERE project_id = #{projectId} AND building_Id = #{buildingId} and floor_id = #{floorId} AND category = #{category}")
+    fun equipPoint(projectId: String,buildingId: String,floorId: String,category: String):List<HashMap<String, Any?>>
+
 } // Interface IRelationExcelExportMapper

+ 684 - 36
datacenter/src/main/kotlin/com/persagy/server/services/graphtype/RelationTypeProjectService.kt

@@ -26,24 +26,33 @@
 
 package com.persagy.server.services.graphtype
 
+import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
+import com.persagy.server.datacenter.models.entities.objects.Equipment
 import com.persagy.server.mappers.IRelationExcelExportMapper
 import com.persagy.server.mappers.IRelationExcelImportMapper
 import com.persagy.server.services.base.RService
+import com.persagy.server.services.objects.EquipmentService
 import com.persagy.server.utils.IdUtils
 import com.persagy.service.SObjectService
 import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SUpdateRequest
 import com.persagy.service.models.responses.SBaseResponse
 import com.persagy.service.utils.SSpringContextUtil
+import org.apache.poi.ss.usermodel.CellType
 import org.apache.poi.xssf.usermodel.XSSFSheet
 import org.apache.poi.xssf.usermodel.XSSFWorkbook
 import org.slf4j.LoggerFactory
 import org.springframework.web.multipart.MultipartFile
 import java.io.File
+import java.io.FileOutputStream
+import java.io.OutputStream
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
 import javax.servlet.http.HttpServletResponse
 
 /**
@@ -91,6 +100,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
 
     val itemList = arrayOf("_sbm", "abc", "name", "id", "local_id", "local_name", "object_type", "building_floor",
             "_sbm", "_abc", "_name", "_id", "_local_id", "_local_name","_object_type", "_building_floor")
+    val itemListTwo = arrayOf( "id", "local_id", "local_name","category")
 
     /** 关系记录启始行 */
     private const val rowStart = 5
@@ -183,54 +193,92 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
      */
     @Suppress("UNCHECKED_CAST")
     private fun writeExcelRelation(sheet: XSSFSheet, projectId: String, relType: String, code: String, zoneType: String? = null) {
-        val len = relType.indexOf("_")
-        val cmd = if (len > 0) {
-            relType.substring(0, len)
-        } else {
-            relType
-        }
-        val type = relType
+        try {
+            val len = relType.indexOf("_")
+            var cmd = if (len > 0) {
+                relType.substring(0, len)
+            } else {
+                relType
+            }
+            val type = relType
 //        val type = if (len > 0) {
 //            relType.substring(len + 1)
 //        } else {
 //            ""
 //        }
-
-        val list = if (relType == "eq2bd" || relType == "pe2bd") {
-            val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
-            exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
-        } else if (relType == "eq2fl" || relType == "pe2fl") {
-            val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
-            exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
-        } else {
-            if(zoneType.isNullOrEmpty()) {
-                val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java)
-                exportMethod!!.invoke(excelExport, projectId, type) as List<HashMap<String, Any?>>
+            logger.debug("type= ${relType}")
+            val list = if (relType == "eq2bd" || relType == "pe2bd") {
+                val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
+                exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
+            } else if (relType == "eq2fl" || relType == "pe2fl") {
+                val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
+                exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
+            } else if (relType == "eq2bd_for"||relType == "eq2fl_for"||relType == "eq2sh_for"||relType =="sy2bd_for"||relType =="sy2fl_for"
+                ||relType =="sy2sh_for"||relType =="sy2sp_for"){
+                logger.debug("type= **************************************************************************************")
+                val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}", String::class.java)
+                exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
             } else {
-                val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java, String::class.java)
-                exportMethod!!.invoke(excelExport, projectId, type, zoneType) as List<HashMap<String, Any?>>
+                if (relType == "eq2sp_SensorRelationship_ss2sp"){
+                    cmd = "eq2spIn"
+                }
+                if(zoneType.isNullOrEmpty()) {
+                    val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java)
+                    exportMethod!!.invoke(excelExport, projectId, type) as List<HashMap<String, Any?>>
+                } else {
+                    val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java, String::class.java)
+                    exportMethod!!.invoke(excelExport, projectId, type, zoneType) as List<HashMap<String, Any?>>
+                }
             }
-        }
+            var rowNum = rowStart
+            logger.debug("数据长度= ${list.toJson()}   ****************************************************************")
+            // 填写识别码对应
+            sheet.getRow(2).getCell(1).setCellValue(code)
 
-        var rowNum = rowStart
+            for (it in list) {
+                val row = sheet.createRow(rowNum)
+                for ((i, item) in itemList.withIndex()) {
+                    val cellValue = it[item]
+                    if (item == "building_floor"){
+                        val buildingName = it["building_name"]
+                        val floorName = it["floor_name"]
+                        if (buildingName!=null&&floorName!=null&&!buildingName.toString().isEmpty()&&!floorName.toString().isEmpty()){
+                            val cells = row.createCell(i)
+                            cells.setCellValue(buildingName.toString()+"-"+floorName.toString())
+                        }else if (buildingName!=null&&!buildingName.toString().isEmpty()) {
+                            val cells = row.createCell(i)
+                            cells.setCellValue(buildingName.toString())
+                        }
+
+                    }else if(item == "_building_floor"){
+                        val buildingName = it["_building_name"]
+                        val floorName = it["_floor_name"]
+                        if (buildingName!=null&&floorName!=null&&!buildingName.toString().isNullOrEmpty()&&!floorName.toString().isNullOrEmpty()){
+                            val cells = row.createCell(i)
+                            cells.setCellValue(buildingName.toString()+"-"+floorName.toString())
+                        }else if (buildingName!=null&&!buildingName.toString().isNullOrEmpty()) {
+                            val cells = row.createCell(i)
+                            cells.setCellValue(buildingName.toString())
+                        }
+                    } else {
+                        val cell = row.createCell(i)
+                        if (cellValue != null) {
+                            cell.setCellValue(cellValue.toString())
+                        }
+                    }
+                    logger.debug("数据item= ${item?.toString()}")
+                    logger.debug("数据= ${cellValue?.toString()}")
 
-        // 填写识别码对应
-        sheet.getRow(2).getCell(1).setCellValue(code)
 
-        for (it in list) {
-            val row = sheet.createRow(rowNum)
-            for ((i, item) in itemList.withIndex()) {
-                val cellValue = it[item]
-                val cell = row.createCell(i)
-                if (cellValue != null) {
-                    cell.setCellValue(cellValue.toString())
                 }
-            }
 
-            // 添加识别码
-            row.createCell(0).setCellValue(row.getCell(id1Col).toString())
-            row.createCell(8).setCellValue(row.getCell(id2Col).toString())
-            rowNum++
+                // 添加识别码
+                row.createCell(0).setCellValue(row.getCell(id1Col).toString())
+                row.createCell(8).setCellValue(row.getCell(id2Col).toString())
+                rowNum++
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
     } // Fun writeExcelRelation()
 
@@ -420,5 +468,605 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
         }
     } // Fun readExcelRelation()
 
+
+    /**
+     * 导出 exportExcelPoint
+     *
+     * @param   response        应答体
+     * @param   relType         关系类型
+     * @param   code            识别码类型
+     * @param   zoneType        业务空间类型
+     */
+    fun exportExcelPoint(response: HttpServletResponse,buildingId: String,floorId: String,category: String) {
+        val projectId = SPageContext.getHeader("ProjectId")
+        val workbook = XSSFWorkbook(RelationTypeProjectService::class.java.classLoader.getResourceAsStream("excel/point_infos.xlsx"))
+        response.contentType = "application/octet-stream"
+        response.setHeader("Content-disposition", "attachment;filename=${projectId}-${category}.xlsx")
+        response.flushBuffer()
+
+        val sheet = workbook.getSheet("信息点")
+
+//        val projectId = SPageContext.getHeader("ProjectId")
+
+        try {
+            writeExcelPoint(sheet, projectId!!, buildingId, floorId, category)
+        }catch (e: Exception) {
+            // DO NOTHING
+            e.printStackTrace()
+        }
+
+        workbook.write(response.outputStream)
+    } // Function exportExcel()
+
+    /**
+     * 向excel表中写关系
+     *
+     * @param   sheet           Excel Sheet
+     * @param   projectId       项目ID
+     * @param   relType         关系类型
+     * @param   code            识别码类型
+     * @param   zoneType        业务空间类型
+     */
+    @Suppress("UNCHECKED_CAST")
+    private fun writeExcelPoint(sheet: XSSFSheet, projectId: String, buildingId: String,floorId: String,category: String) {
+        val exportMethod = excelExport.javaClass.getDeclaredMethod("equipPoint", String::class.java,String::class.java, String::class.java, String::class.java)
+        val list = exportMethod!!.invoke(excelExport, projectId,buildingId,floorId,category) as List<HashMap<String, Any?>>
+
+
+        var rowNum = 1
+        // 填写识别码对应
+//        sheet.getRow(2).getCell(1).setCellValue(code)
+
+        for (it in list) {
+            val row = sheet.createRow(rowNum)
+            for ((i, item) in itemListTwo.withIndex()) {
+                logger.debug("数据= ${i?.toString()}")
+                val cellValue = it[item]
+                val cell = row.createCell(i)
+                if (cellValue != null) {
+                    cell.setCellValue(cellValue.toString())
+                }
+                logger.debug("数据= ${cellValue?.toString()}")
+            }
+            // 添加识别码
+//            row.createCell(0).setCellValue(row.getCell(id1Col).toString())
+//            row.createCell(8).setCellValue(row.getCell(id2Col).toString())
+            rowNum++
+        }
+    } // Fun writeExcelRelation()
+
+    /**
+     * 导入excel
+     *
+     * @param   file            上传的Excel文件
+     * @param   relType         关系类型
+     * @param   zoneType        业务空间类型
+     * @return  应答体
+     */
+    fun importExcelPoint(file: MultipartFile): SBaseResponse {
+        try {
+            if (file.isEmpty) {
+                throw Exception("未选择文件")
+            }
+
+            val projectId = SPageContext.getHeader("ProjectId")
+            // 转为 XSSFWorkbook 对象
+            val workbook = XSSFWorkbook(file.inputStream)
+            // 读取第一个 sheet
+            val sheet = workbook.getSheetAt(0)
+
+            readExcelPoint(sheet, projectId!!)
+            // 时间
+            val date: String = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
+            var path:String
+            // Tomcat 路径
+            val tomcat_path = System.getProperty("user.dir")
+            // 上传的文件名
+            val myFileName = file.originalFilename
+            // 重组文件名
+            val fileName = projectId +  date + "." + myFileName.substring(myFileName.lastIndexOf(".") + 1)
+            //获取tomcat中项目同级路径
+            val bin_path = tomcat_path.substring(tomcat_path.lastIndexOf("/") + 1, tomcat_path.length)
+            if ("bin" == bin_path) {
+                path = tomcat_path.substring(0, System.getProperty("user.dir").lastIndexOf("/")) + "/temp/" + "/upload/"
+            } else {
+                path = "$tomcat_path/temp/upload/"
+            }
+            val fileDir = File(path)
+            //如果不存在 则创建
+            if (!fileDir.exists()) {
+                fileDir.mkdirs()
+            }
+            // 文件
+            val files = File(path,fileName)
+            // 文件流
+            val os: OutputStream = FileOutputStream(files)
+            // 写入
+            workbook.write(os)
+            os.flush()
+            os.close()
+            return SBaseResponse(SResponseType.success,fileName)
+//            return SBaseResponse(SResponseType.success)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            return SBaseResponse(SResponseType.failure, e.message!!)
+        }
+        return SBaseResponse(SResponseType.success)
+    } // Fun importExcel()
+
+    /**
+     * 从Excel读取关系并存入数据库中
+     *
+     * @param   sheet           Excel Sheet
+     * @param   projectId       项目ID
+     * @param   relType         关系类型
+     * @param   zoneType        业务空间类型
+     */
+    private fun readExcelPoint(sheet: XSSFSheet, projectId: String) = try {
+
+        logger.debug("id3= ***************************************************")
+        val rowNum = 1
+        for (i in rowNum .. sheet.lastRowNum) {
+            val row = sheet.getRow(i)
+            try {
+                if (row == null){
+                    sheet.getRow(0).createCell(stateCol).setCellValue("第$i 行数据为空")
+                    continue
+                }
+                if (row != null){
+                    val cell = row.getCell(0)
+                    cell.setCellType(CellType.STRING);
+                    val cell1 = row.getCell(1)
+                    cell1.setCellType(CellType.STRING);
+                    val cell2 = row.getCell(2)
+                    cell2.setCellType(CellType.STRING);
+                    val cell3 = row.getCell(3)
+                    cell3.setCellType(CellType.STRING);
+                    val id0 =cell.toString().trim()
+                    val id1 = cell1.toString().trim()
+                    val id2 = cell2.toString().trim()
+                    val id3 = cell3.toString().trim()
+                    logger.debug("id0= $id0")
+                    logger.debug("id1= $id1")
+                    logger.debug("id2= $id2")
+                    logger.debug("id3= $id3")
+                    if (!id0.isNullOrEmpty()&&!id1.isNullOrEmpty()&&!id2.isNullOrEmpty()&&!id3.isNullOrEmpty()) {
+
+                        val equipmentList = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.eq("localId", id0.trim())).exec()
+                        if (equipmentList.isEmpty()){
+                            row.createCell(4).setCellValue("不存在")
+                        }else if (equipmentList.size>1) {
+                            row.createCell(4).setCellValue("重复")
+                        }else {
+
+
+                            val equip = equipUpdate(equipmentList[0], id1, id2, id3)
+                            val request = SUpdateRequest<Equipment>()
+                            request.content = arrayListOf(equip)
+                            try {
+                                val updateList = EquipmentService.updateList(request)
+                                if (updateList.result == SResponseType.success){
+                                    row.createCell(4).setCellValue("成功")
+                                }else{
+                                    row.createCell(4).setCellValue("失败")
+                                }
+                            } catch (e: Exception) {
+                                e.printStackTrace()
+                                row.createCell(4).setCellValue("失败")
+                            }
+                            row.createCell(4).setCellValue("成功")
+                        }
+                    }else {
+                        row.createCell(4).setCellValue("信息不全")
+                    }
+                }
+
+
+            } catch (e: Exception) {
+                e.printStackTrace()
+                row.createCell(4).setCellValue("失败")
+            }
+        }
+    } catch (e: Exception) {
+        e.printStackTrace()
+    } // Fun readExcelRelation()
+
+    fun equipUpdate(equipment: Equipment,id1: String,id2: String,id3: String):Equipment {
+//        val entity = dPropertyDefProjectservice.select(SFilter.eq("type", equipment.category!!), SFilter.eq("infoPointCode", id1)).entity()
+//        logger.debug("信息点1=${equipment.category}")
+//        logger.debug("信息点=${entity?.toJson()}")
+//        if (entity!=null){
+//
+//            if (entity.firstTag == "LedgerParam"){
+//                if (equipment.ledgerParam.isNullOrEmpty()){
+//                    equipment.ledgerParam = HashMap<String,Any?>()
+//                }
+//
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.ledgerParam!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.ledgerParam!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.ledgerParam!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.ledgerParam!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "CommParam") {
+//                /** 通讯参数 */
+//                if (equipment.commParam.isNullOrEmpty()){
+//                    equipment.commParam = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.commParam!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.commParam!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.commParam!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.commParam!![id1] = "$id2-$id3"
+//                }
+//            }else if (entity.firstTag == "TechParam") {
+//                /** 技术参数 */
+//                if (equipment.techParam.isNullOrEmpty()){
+//                    equipment.techParam = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.techParam!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.techParam!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.techParam!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.techParam!![id1] = "$id2-$id3"
+//                }
+//
+//
+//            }else if (entity.firstTag == "RunParam") {
+//                /** 运行参数 */
+//                if (equipment.runParam.isNullOrEmpty()){
+//                    equipment.runParam = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.runParam!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.runParam!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.runParam!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.runParam!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "SettingParam") {
+//                /** 设定参数 */
+//                if (equipment.settingParam.isNullOrEmpty()){
+//                    equipment.settingParam = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.settingParam!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.settingParam!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.settingParam!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.settingParam!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "Alram") {
+//                /** 报警消息 */
+//                if (equipment.alram.isNullOrEmpty()){
+//                    equipment.alram = HashMap<String,Any?>()
+//                }
+//                equipment.alram!![id1] = "$id2-$id3"
+//
+//            }else if (entity.firstTag == "TempSensor") {
+//                /** 温度传感器 */
+//                if (equipment.tempSensor.isNullOrEmpty()){
+//                    equipment.tempSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.tempSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.tempSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.tempSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.tempSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "TechParamGeneral") {
+//                /** 技术参数-通用 */
+//                if (equipment.techParamGeneral.isNullOrEmpty()){
+//                    equipment.techParamGeneral = HashMap<String,Any?>()
+//                }
+//                equipment.techParamGeneral!![id1] = "$id2-$id3"
+//            }else if (entity.firstTag == "RunParamGeneral") {
+//                /** 运行参数-通用 */
+//                if (equipment.runParamGeneral.isNullOrEmpty()){
+//                    equipment.runParamGeneral = HashMap<String,Any?>()
+//                }
+//                equipment.runParamGeneral!![id1] = "$id2-$id3"
+//            }else if (entity.firstTag == "SpeedSensor") {
+//                /** 速度传感器 */
+//                if (equipment.speedSensor.isNullOrEmpty()){
+//                    equipment.speedSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.speedSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.speedSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.speedSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.speedSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "SoundSensor") {
+//                /** 声音传感器 */
+//                if (equipment.soundSensor.isNullOrEmpty()){
+//                    equipment.soundSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.soundSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.soundSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.soundSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.soundSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "HumiditySensor") {
+//                /** 湿度传感器 */
+//                if (equipment.humiditySensor.isNullOrEmpty()){
+//                    equipment.humiditySensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.humiditySensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.humiditySensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.humiditySensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.humiditySensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "PressTransd") {
+//                /** 压力传感器 */
+//                if (equipment.pressTransd.isNullOrEmpty()){
+//                    equipment.pressTransd = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.pressTransd!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.pressTransd!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.pressTransd!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.pressTransd!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "HeatSensor") {
+//                /** 热量传感器 */
+//                if (equipment.heatSensor.isNullOrEmpty()){
+//                    equipment.heatSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.heatSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.heatSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.heatSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.heatSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "FlowSensor") {
+//                /** 流量传感器 */
+//                if (equipment.flowSensor.isNullOrEmpty()){
+//                    equipment.flowSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.flowSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.flowSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.flowSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.flowSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "ElectricitySensor") {
+//                /** 电度传感器 */
+//                if (equipment.electricitySensor.isNullOrEmpty()){
+//                    equipment.electricitySensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.electricitySensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.electricitySensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.electricitySensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.electricitySensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "DisplSensor") {
+//                /** 位移传感器 */
+//                if (equipment.displSensor.isNullOrEmpty()){
+//                    equipment.displSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.displSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.displSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.displSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.displSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "ConcentSensor") {
+//                /** 浓度传感器 */
+//                if (equipment.concentSensor.isNullOrEmpty()){
+//                    equipment.concentSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.concentSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.concentSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.concentSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.concentSensor!![id1] = "$id2-$id3"
+//                }
+//
+//            }else if (entity.firstTag == "ImageSensor") {
+//                /** 图像传感器 */
+//                if (equipment.imageSensor.isNullOrEmpty()){
+//                    equipment.imageSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.imageSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.imageSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.imageSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.imageSensor!![id1] = "$id2-$id3"
+//                }
+//            }else if (entity.firstTag =="ManFlowSensor"){
+//                /** 人流量传感器 */
+//                if (equipment.manFlowSensor.isNullOrEmpty()){
+//                    equipment.manFlowSensor = HashMap<String,Any?>()
+//                }
+//                if (!entity.secondTag.isNullOrEmpty()){
+//                    val containsKey = equipment.manFlowSensor!!.containsKey(entity.secondTag!!)
+//                    if (containsKey){
+//                        val photoDocMap = equipment.manFlowSensor!![entity.secondTag!!] as JSONObject
+//                        photoDocMap[id1] = "$id2-$id3"
+//                    }else{
+//                        val mapPic = HashMap<String,Any>()
+//                        mapPic[id1] = "$id2-$id3"
+//                        equipment.manFlowSensor!![entity.secondTag!!] = mapPic
+//                    }
+//                }else{
+//                    equipment.manFlowSensor!![id1] = "$id2-$id3"
+//                }
+//            }else {
+//                /** 自定义 */
+//                if (equipment.customParam.isNullOrEmpty()){
+//                    equipment.customParam = HashMap<String,Any?>()
+//                }
+//                equipment.customParam!![id1] = "$id2-$id3"
+//            }
+//
+//        }else{
+//            /** 自定义 */
+//            if (equipment.customParam.isNullOrEmpty()){
+//                equipment.customParam = HashMap<String,Any?>()
+//            }
+//            equipment.customParam!![id1] = "$id2-$id3"
+//        }
+        return equipment
+    }
+
+    /**
+     * 下载报告
+     *
+     * @param   response        应答体
+     * @param   relType         关系类型
+     * @param   zoneType        业务空间类型
+     */
+    fun reportDownloadsPoint(response: HttpServletResponse,key:String) {
+        var path:String
+        val projectId = SPageContext.getHeader("projectId")
+
+
+        val tomcat_path = System.getProperty("user.dir")
+
+        //获取tomcat中项目同级路径
+        val bin_path = tomcat_path.substring(tomcat_path.lastIndexOf("/") + 1, tomcat_path.length)
+        if ("bin" == bin_path) {
+            path = tomcat_path.substring(0, System.getProperty("user.dir").lastIndexOf("/")) + "/temp/" + "/upload/"
+        } else {
+            path = "$tomcat_path/temp/upload/"
+        }
+        val file = File(path+key)
+        val workbook = if (file.exists()) {
+            XSSFWorkbook(file)
+        } else {
+            XSSFWorkbook(RelationTypeProjectService::class.java.classLoader.getResourceAsStream("excel/relation-template.xlsx"))
+        }
+        response.contentType = "application/octet-stream"
+        response.setHeader("Content-disposition", "attachment;filename=${key}")
+        response.flushBuffer()
+        workbook.write(response.outputStream)
+    } // Function templateDownloads()
+
 } // Class RelationTypeProjectService
 

+ 3 - 3
datacenter/src/main/kotlin/com/persagy/server/services/objects/ComponentService.kt

@@ -26,8 +26,6 @@
 
 package com.persagy.server.services.objects
 
-import com.persagy.server.utils.IdUtils
-import com.persagy.server.utils.ShaftNameUtil
 import com.persagy.database.SFilter
 import com.persagy.database.SQueryBuilder
 import com.persagy.database.extensions.keyValue
@@ -37,6 +35,8 @@ import com.persagy.server.datacenter.models.entities.objects.Equipment
 import com.persagy.server.services.assistant.ObjInfoService
 import com.persagy.server.services.base.Service
 import com.persagy.server.services.log.DataCenterLogsService
+import com.persagy.server.utils.IdUtils
+import com.persagy.server.utils.ShaftNameUtil
 
 /**
  * 部件信息服务
@@ -157,7 +157,7 @@ object ComponentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
             } catch (e: Exception) {
                 e.printStackTrace()
             }
-            ObjInfoService.createInfo(equipment,false,"Ec",equipment.classCode!!)
+//            ObjInfoService.createInfo(equipment,false,"Ec",equipment.classCode!!)
         }
     }
 

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

@@ -90,7 +90,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                     SFilter.eq("projectId", equip.projectId!!),
                     SFilter.endWith("code", equip.classCode!!)
             ).entity()
-            if (entity!=null){
+            if (entity!=null&&equip.classCode!!.length>=6){
                 equip.classCode = entity.code
             } else {
                 return false
@@ -189,6 +189,7 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
                         list.add(property)
                         val sUpdateRequest = SUpdateRequest<Property>()
                         sUpdateRequest.content = list
+                        sUpdateRequest.nullItems = arrayListOf("equipId","bimId")
                         val updateList = PropertyService.updateList(sUpdateRequest)
                         val pr = PropertyService.select(SFilter.eq("id", entity.propertyId!!)).entity()
                         val listp = ArrayList<Property>()

+ 25 - 16
datacenter/src/main/kotlin/com/persagy/server/services/objects/FloorService.kt

@@ -26,6 +26,7 @@
 
 package com.persagy.server.services.objects
 
+import com.persagy.base.extensions.toJson
 import com.persagy.database.SFilter
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
@@ -250,12 +251,16 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
 //                                }
 //                            }
 //                        }else{
-                            val update = update(floor)
-
-                            if (update){
-                                listId.add(floor.id!!)
-                                try {
-                                    /** 日志 */
+                        val update: Boolean
+                        if (!request.nullItems.isNullOrEmpty()) {
+                            update = update(floor,request.nullItems)
+                        }else {
+                            update = update(floor)
+                        }
+                        if (update){
+                            listId.add(floor.id!!)
+                            try {
+                                /** 日志 */
 //                                    val dataCenterLogs = DataCenterLogs()
 //                                    dataCenterLogs.id = IdUtils.uuidCreate()
 //                                    dataCenterLogs.author = "dataCenter"
@@ -270,14 +275,14 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
 //                                    dataCenterLogs.dataSource = hashMap
 //                                    logService.insert(dataCenterLogs)
 
-                                    rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,floor.id!!)
-                                    logger.debug("更新标记= ***********************************************************************************")
-                                    DataCenterLogsService.addLogs(projectId,"update","floor",
-                                        floor.id!!,floor,account,comming)
-                                } catch (e: Exception) {
-                                    e.printStackTrace()
-                                }
+                                rabbitMqService.sendObjects(projectId!!, Opt.UPDATE,floor.id!!)
+                                logger.debug("更新标记= ***********************************************************************************")
+                                DataCenterLogsService.addLogs(projectId,"update","floor",
+                                    floor.id!!,floor,account,comming)
+                            } catch (e: Exception) {
+                                e.printStackTrace()
                             }
+                        }
 
                     } catch (e: Exception) {
                         e.printStackTrace()
@@ -330,11 +335,15 @@ object FloorService : Service<Floor>(SMybatisDao(Floor::class.java)) {
         return try {
             val sBaseResponse = SBaseResponse(SResponseType.success)
             if (!request.content.isNullOrEmpty()){
-                val listOutline = ArrayList<String>()
-                listOutline.add("outline")
                 if (!request.content.isNullOrEmpty()){
                     for (floorOutline in request.content!!){
-                        val update = update(floorOutline, listOutline)
+                        logger.debug("楼层=${floorOutline.toJson()}")
+                        val update: Boolean
+                        if (!request.nullItems.isNullOrEmpty()) {
+                            update = update(floorOutline,request.nullItems)
+                        }else {
+                            update = update(floorOutline)
+                        }
                         if (update) {
                             rabbitMqService.sendObjects(Opt.projectId!!, Opt.UPDATE,floorOutline.id!!)
                         }

+ 3 - 2
datacenter/src/main/kotlin/com/persagy/server/services/rel/REqInShService.kt

@@ -37,7 +37,6 @@ import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
 import com.persagy.service.models.responses.SBaseResponse
 import com.persagy.service.models.responses.SCreateResponse
-import org.json.JSONObject
 
 /**
  * 设备所在竖井关系服务
@@ -204,7 +203,9 @@ object REqInShService: RService<REqInSh>(SMybatisDao(REqInSh::class.java)) {
                 }
             }
             if (successList.size>0){
-                rabbitMqService.sendRel(Opt.projectId!!, "EquipinShaft","14",rShInEqList.shaftId!!,successList.toJson()!!)
+                for (id  in successList) {
+                    rabbitMqService.sendRel(Opt.projectId!!, "EquipinShaft","11",id as String,rShInEqList.shaftId!!)
+                }
                 if (failureList.size>0){
                     val sCreateResponse = SCreateResponse<REqInSh>(SResponseType.success)
                     sCreateResponse.message ="失败对象:"+failureList.toJson()

+ 0 - 1
datacenter/src/main/kotlin/com/persagy/server/services/rel/RShContainSpBaseService.kt

@@ -345,7 +345,6 @@ object RShContainSpBaseService: RService<RShContainSpBase>(SMybatisDao(RShContai
             val allSpaceIdFilterList = ArrayList<SFilter>()
             val zoneSpaceBaseTableService = SBaseService(SMybatisDao(ZoneSpace::class.java))
 
-
             //查出和当前竖井关联并为当前空间类型的的业务空间id
             val list1 =  rSh2SpService.select(SFilter.eq("projectId",projectId!!),SFilter.eq("Id1",rShContainSpBaseList.shaftId!!),SFilter.eq("zoneType",type)).projection("id2").distinct().exec()
             for(rShContainSpBase in list1){

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2149 - 0
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationAddService.kt


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 65 - 2064
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationCalcService.kt


+ 9 - 8
datacenter/src/main/resources/application-test.yml

@@ -28,17 +28,18 @@ server:
 
 spring:
   datasource:
-    url:                                jdbc:postgresql://192.168.64.15:5432/datacenterlabsl
+    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://datacenter:5432/datacenter
     username:                           postgres
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-#  rabbitmq:
-#    host: 39.102.43.179
-#    port: 9936
-#    username: admin
-#    password: brzj123456
-#    #虚拟host 可以不设置,使用server默认host
-#    virtual-host: /test
+  rabbitmq:
+    host: 192.168.64.15
+    port: 9936
+    username: admin
+    password: brzj123456
+    #虚拟host 可以不设置,使用server默认host
+    virtual-host: /test
 
   servlet:
     multipart:

+ 1 - 2
datasyn/src/main/kotlin/com/persagy/server/syn/Configure.kt

@@ -29,7 +29,6 @@ package com.persagy.server.syn
 import com.alibaba.fastjson.JSONArray
 import com.alibaba.fastjson.JSONObject
 import com.persagy.service.utils.SSpringContextUtil
-import org.slf4j.LoggerFactory
 import org.springframework.web.client.RestTemplate
 
 /**
@@ -121,7 +120,7 @@ object Configure {
         jsonObject["objTo"] = objTo
         if (!relValue.isNullOrEmpty()) {
             /** 边类型属性, */
-            jsonObject["relValue"] = objTo
+            jsonObject["relValue"] = relValue
         }
         /** 添加到列表 */
         jsonArray.add(jsonObject)

+ 3 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/Opts.kt

@@ -50,6 +50,9 @@ open class Opts {
     /** 物理世界地址 */
     lateinit var dataPlatform: String
 
+    lateinit var data_org: String
+    lateinit var data_rwd: String
+
     val SUCCESS_CODE = "success"
 
 

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

@@ -435,7 +435,7 @@ class RelToFromController {
             if (rSh2SpList.size>0) {
                 for (rSh2Sp in rSh2SpList) {
                     if (isDel) {
-                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSh2Sp.id1!!, null)
+                        val toJsonObj = Configure.toJsonObj(graphCode, type, rSh2Sp.id1!!, rSh2Sp.id2!!)
                         EquipApi.delRel(dictProject!!.groupCode!!, projectId,toJsonObj)
                     }
                     val toJsonObjArray =

+ 3 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/jms/DataCenterSync.kt

@@ -323,6 +323,9 @@ class DataCenterSync {
                         "12" -> { // 删除关系
                             equipInSpaceSync.delRel(message, "MechInArch", "Eq2Sh")
                         }
+//                        "14" -> {
+//
+//                        }
                     }
                 }
                 "Fl2Fl" -> {

+ 8 - 8
datasyn/src/main/kotlin/com/persagy/server/syn/jms/MessageProcessing.kt

@@ -74,10 +74,10 @@ class MessageProcessing {
 
         try {
             logger.debug("状态-中台-  ${messageTypeRwd}")
-            if (messageTypeRwd!=0){
+//            if (messageTypeRwd!=0){
                 try {
                     messageTypeRwd = 0
-                    val syncRwdMessageList = syncRwdMessageService.select(SFilter.not(SFilter.eq("state", 0))).order("lastUpdate").limit(1000).exec()
+                    val syncRwdMessageList = syncRwdMessageService.select(SFilter.not(SFilter.eq("state", 0)),SFilter.lte("count",20)).order("lastUpdate").limit(1000).exec()
                     if (syncRwdMessageList.size >0){
                         rwdSync.dataSync(syncRwdMessageList)
                         messageTypeRwd = 1
@@ -90,7 +90,7 @@ class MessageProcessing {
                     e.printStackTrace()
                     messageTypeRwd = 1
                 }
-            }
+//            }
         } catch (e: Exception) {
             e.printStackTrace()
             messageTypeRwd = 1
@@ -114,14 +114,14 @@ class MessageProcessing {
         try {
             logger.debug("标记状态= ${messageTypeDataCerten}  *********************************************************")
             /** 不等于 0 时候执行同步 */
-            if (messageTypeDataCerten!=0){
+//            if (messageTypeDataCerten!=0){
                 logger.debug("执行任务*********************************************************")
                 /** 设置为 0  防止重复执行 */
                 messageTypeDataCerten =0
                 /** 查询待处理的消息 */
                 try {
                     val messageList =
-                        synchronousMessageObjService.select(SFilter.not(SFilter.eq("sign", 0)),SFilter.lte("count",20)).order("createTime").exec()
+                        synchronousMessageObjService.select(SFilter.not(SFilter.eq("sign", 0)),SFilter.lte("count",20)).order("createTime ").limit(1000).exec()
                     if (messageList.size>0) {
                         /** 处理消息 */
                         dataCenterSync.dataSync(messageList)
@@ -138,7 +138,7 @@ class MessageProcessing {
                     e.printStackTrace()
                     messageTypeDataCerten = 1
                 }
-            }
+//            }
         } catch (e: Exception) {
             e.printStackTrace()
             messageTypeDataCerten = 1
@@ -152,7 +152,7 @@ class MessageProcessing {
 
         try {
             /** 不等于 0 时候执行同步 */
-            if (messageTypeDataCenterRel!=0){
+//            if (messageTypeDataCenterRel!=0){
                 /** 设置为 0  防止重复执行 */
                 messageTypeDataCenterRel =0
                 /** 查询待处理的消息 */
@@ -169,7 +169,7 @@ class MessageProcessing {
                     /** 开启下次执行 */
                     messageTypeDataCenterRel = 1
                 }
-            }
+//            }
         } catch (e: Exception) {
             e.printStackTrace()
             /** 开启下次执行 */

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

@@ -228,6 +228,9 @@ object EquipApi {
             } else {
                 val url = "http://${Configure.serviceNameConfig.DMPRWD}/rwd/instance/object/create?groupCode=$groupCode&projectId=${projectId}&appId=datacenter"
                 val postObject = Configure.restTemplate.postForObject(url, listObj, MiddleGroundDataRespose::class.java)
+                logger.debug("url= ${url}")
+                logger.debug("url= ${listObj.toJson()}")
+                logger.debug("结果=${postObject.toJson()}")
                 if (postObject.result == "success") {
                     return postObject
                 }

+ 8 - 8
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterBuilding.kt

@@ -85,12 +85,12 @@ class DataCenterBuilding {
                             /** 失败 */
                             message.sign = 2
                             message.error = sign!!.toJson()
-                            message.count+1
+                            message.count = message.count+1
                         } else {
                             /** 失败 */
                             message.sign = 2
                             message.error = "服务未连通"
-                            message.count+1
+                            message.count = message.count+1
                         }
                     }
                 }else {
@@ -118,12 +118,12 @@ class DataCenterBuilding {
                             /** 失败 */
                             message.sign = 2
                             message.error = sign!!.toJson()
-                            message.count+1
+                            message.count = message.count+1
                         } else {
                             /** 失败 */
                             message.sign = 2
                             message.error = "服务未连通"
-                            message.count+1
+                            message.count = message.count+1
                         }
                     }
                 } else {
@@ -151,7 +151,7 @@ class DataCenterBuilding {
                         /** 失败 */
                         message.sign = 2
                         message.error = sign!!.toJson()
-                        message.count +1
+                        message.count = message.count+1
                     }
 
                 } else {
@@ -160,11 +160,11 @@ class DataCenterBuilding {
                     }else if (query!=null){
                         message.sign = 2
                         message.error = query!!.toJson()
-                        message.count +1
+                        message.count = message.count+1
                     }else {
                         message.sign = 2
                         message.error = "服务未连通"
-                        message.count +1
+                        message.count = message.count+1
                     }
                 }
                 /** 更改标记 */
@@ -181,7 +181,7 @@ class DataCenterBuilding {
         message.localName = equip.localName
         message.name = equip.localName
         message.objName = "建筑"
-        message.opsName = ParamTools.operationType(message.ops!!)
+        message.opsName = ParamTools.operationType(message.type!!)
     }
 
 }

+ 7 - 7
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterComponent.kt

@@ -88,11 +88,11 @@ class DataCenterComponent {
                                 if (!createRel) {
                                     message.sign = 2
                                     message.error = "设备和部件的关系失败"
-                                    message.count +1
+                                    message.count = message.count+1
                                 }
                             } else {
                                 message.sign = 2
-                                message.count +1
+                                message.count = message.count+1
                             }
                         }
                     }else {
@@ -135,7 +135,7 @@ class DataCenterComponent {
                             /** 失败 */
                             message.error = "服务未连通"
                         }
-                        message.count +1
+                        message.count = message.count+1
                         message.sign = 2
                     }
 
@@ -169,7 +169,7 @@ class DataCenterComponent {
                         }
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count+1
                     }
                 }else {
                     if (query!=null&&query.result == "success"&&query.data.isNullOrEmpty()) {
@@ -177,11 +177,11 @@ class DataCenterComponent {
                     }else if (query!=null){
                         message.sign = 2
                         message.error = query.toJson()
-                        message.count +1
+                        message.count = message.count+1
                     }else {
                         message.sign = 2
                         message.error = "服务未连通"
-                        message.count +1
+                        message.count = message.count+1
                     }
 
                 }
@@ -200,7 +200,7 @@ class DataCenterComponent {
         message.localName = equip.localName
         message.name = equip.localName
         message.objName = "部件"
-        message.opsName = ParamTools.operationType(message.ops!!)
+        message.opsName = ParamTools.operationType(message.type!!)
         val entity =
             DClassDefService.select(SFilter.eq("projectId", equip.projectId!!), SFilter.eq("code", equip.classCode!!))
                 .entity()

+ 5 - 5
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterEquipment.kt

@@ -161,7 +161,7 @@ class DataCenterEquipment {
                                 /** 失败 */
                                 message.error = "服务未连通"
                             }
-                            message.count +1
+                            message.count = message.count +1
                             message.sign = 2
                         }
 
@@ -205,7 +205,7 @@ class DataCenterEquipment {
                             }
                             /** 失败 */
                             message.sign = 2
-                            message.count +1
+                            message.count  = message.count +1
                         }
                     } else {
                         if (query!=null&&query.result == "success"&&query.data.isNullOrEmpty()) {
@@ -213,11 +213,11 @@ class DataCenterEquipment {
                         }else if (query!=null){
                             message.sign = 2
                             message.error = query.toJson()
-                            message.count +1
+                            message.count  = message.count +1
                         }else {
                             message.sign = 2
                             message.error = "服务未连通"
-                            message.count +1
+                            message.count  = message.count +1
                         }
                     }
                 } else {
@@ -304,7 +304,7 @@ class DataCenterEquipment {
         message.localName = equip.localName
         message.name = equip.localName
         message.objName = "设备"
-        message.opsName = ParamTools.operationType(message.ops!!)
+        message.opsName = ParamTools.operationType(message.type!!)
         val entity =
             DClassDefService.select(SFilter.eq("projectId", equip.projectId!!), SFilter.eq("code", equip.classCode!!))
                 .entity()

+ 5 - 5
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterFloor.kt

@@ -81,7 +81,7 @@ class DataCenterFloor {
                                     val createRel = EquipApi.createRel(dictProject.groupCode!!, message.projectId!!, ObjArray)
                                     if (!createRel){
                                         message.sign = 2
-                                        message.count +1
+                                        message.count = message.count+1
                                     }
                                 } catch (e: Exception) {
                                     e.printStackTrace()
@@ -89,7 +89,7 @@ class DataCenterFloor {
                         }else {
                             /** 失败 */
                             message.sign = 2
-                            message.count +1
+                            message.count = message.count+1
                         }
 
                     }else {
@@ -98,7 +98,7 @@ class DataCenterFloor {
                 } else {
                     /** 失败 */
                     message.sign = 2
-                    message.count +1
+                    message.count = message.count+1
                 }
 
                 /** 更改标记 */
@@ -120,7 +120,7 @@ class DataCenterFloor {
                     }else {
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count+1
                     }
 
                 } else {
@@ -138,7 +138,7 @@ class DataCenterFloor {
                 }else {
                     /** 失败 */
                     message.sign = 2
-                    message.count +1
+                    message.count = message.count+1
                 }
                 /** 更改标记 */
                 synchronousMessageObjService.update(message)

+ 5 - 6
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterSpace.kt

@@ -119,7 +119,7 @@ class DataCenterSpace {
                                 if (!createRel){
                                     message.sign = 2
                                     message.error = "空间的建筑楼层关系存储失败"
-                                    message.count +1
+                                    message.count = message.count+1
                                 }
                             }
 
@@ -166,7 +166,7 @@ class DataCenterSpace {
                             /** 失败 */
                             message.error = "服务未连通"
                         }
-                        message.count +1
+                        message.count = message.count+1
                         message.sign = 2
                     }
                 }else {
@@ -199,7 +199,7 @@ class DataCenterSpace {
                         }
                         /** 失败 */
                         message.sign = 2
-                        message.count + 1
+                        message.count = message.count+1
                     }
                 }else {
                     if (query!=null&&query.result == "success"&&query.data.isNullOrEmpty()) {
@@ -207,12 +207,11 @@ class DataCenterSpace {
                     }else if (query!=null){
                         message.sign = 2
                         message.error = query.toJson()
-                        message.count +1
                     }else {
                         message.sign = 2
                         message.error = "服务未连通"
-                        message.count +1
                     }
+                    message.count = message.count+1
                 }
                 /** 更改标记 */
                 synchronousMessageObjService.update(message)
@@ -252,7 +251,7 @@ class DataCenterSpace {
         message.localName = equip.localName
         message.name = equip.localName
         message.objName = "空间"
-        message.opsName = ParamTools.operationType(message.ops!!)
+        message.opsName = ParamTools.operationType(message.type!!)
         val entity =
             DClassDefService.select(SFilter.eq("projectId", equip.projectId!!), SFilter.eq("code", equip.classCode!!))
                 .entity()

+ 3 - 3
datasyn/src/main/kotlin/com/persagy/server/syn/services/jms/DataCenterSystem.kt

@@ -77,7 +77,7 @@ class DataCenterSystem {
                     }else {
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count+1
                     }
 
                 } else {
@@ -103,7 +103,7 @@ class DataCenterSystem {
                     }else {
                         /** 失败 */
                         message.sign = 2
-                        message.count +1
+                        message.count = message.count+1
                     }
                 }else {
                     message.sign = 0
@@ -120,7 +120,7 @@ class DataCenterSystem {
                 }else {
                     /** 失败 */
                     message.sign = 2
-                    message.count +1
+                    message.count = message.count+1
                 }
                 /** 更改标记 */
                 synchronousMessageObjService.update(message)

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

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

+ 13 - 10
datasyn/src/main/resources/application-dev.yml

@@ -2,23 +2,24 @@
 spring:
 
   datasource:
-    #    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
     #    username:                           postgres
     #    password:                           123qwe!@#
     #    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
-    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
+    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
+#    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
     #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
     #配置rabbitMq 服务器
-  rabbitmq:
-    host: 39.102.43.179
-    port: 9936
-    username: admin
-    password: brzj123456
-    #虚拟host 可以不设置,使用server默认host
-    virtual-host: /test
+#  rabbitmq:
+#    host: 39.102.43.179
+#    port: 9936
+#    username: admin
+#    password: brzj123456
+#    #虚拟host 可以不设置,使用server默认host
+#    virtual-host: /test
 
 server:
   port: 8082
@@ -35,6 +36,8 @@ eureka:
 
 saga:
   dataPlatform:                        http://39.102.40.239:9970
+  data_org:                            http://39.102.40.239:9970
+  data_rwd:                            http://39.102.40.239:9970
 
 mqtopid:
   exchange:                           exchange-dmp
@@ -42,7 +45,7 @@ mqtopid:
 
 custom:
   #true 代表eureka  false  代表 http
-  eurekaorhttp:                       false
+  eurekaorhttp:                       true
 
 # 服务名
 servicename:

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

@@ -10,7 +10,6 @@ eureka:
       enable-self-preservation: false # 设为false,关闭自我保护
       eviction-interval-timer-in-ms: 5000 # 清理间隔(单位毫秒,默认是60*1000)启用主动失效,
 
-
 spring:
   datasource:
     url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
@@ -19,7 +18,6 @@ spring:
 
 
 
-
     #配置rabbitMq 服务器
   rabbitmq:
     host: 192.168.64.15

+ 2 - 2
equip-component/src/main/kotlin/com/persagy/server/service/base/Service.kt

@@ -67,7 +67,7 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
             jsonObject.put("projectId",projectId)
             jsonObject.put("id", it.keyValue("id"))
             /** 发送消息 */
-            messageHandler!!.sendMessage(jsonObject.toString())
+//            messageHandler!!.sendMessage(jsonObject.toString())
         }
         logger.debug("创建完成 =******************************************************************")
         return
@@ -92,7 +92,7 @@ open class Service<ENTITY : BaseInfo>(daoClass: SAbstractDao<ENTITY>) : SObjectS
         jsonObject.put("infos", jsonArray)
         logger.debug("修改发送消息$jsonObject")
         /** 发送消息 */
-        messageHandler!!.sendMessage(jsonObject.toString())
+//        messageHandler!!.sendMessage(jsonObject.toString())
 
         return
     } // Function onUpdateSuccess()

+ 9 - 3
equip-component/src/main/kotlin/com/persagy/server/service/labsl/CustomSqlLabslService.kt

@@ -107,9 +107,11 @@ class CustomSqlLabslService {
                     ).exec()
                 /** 系统类型 */
                 val setSystem = HashSet<String>()
-                for (defClass in defClassList){
+                for (defClass in defClassList) {
                     setSystem.add(defClass.systemCode!!)
                 }
+                if (setSystem.size > 0) {
+
                 /** 系统类型列表 */
                 val systemCodeList =
                     defClassService.select(
@@ -117,7 +119,7 @@ class CustomSqlLabslService {
                         SFilter.eq("groupCode", dictProject!!.groupCode!!),
                         SFilter.inList("code", setSystem.toList())
                     ).exec()
-                for(systemCode in systemCodeList) {
+                for (systemCode in systemCodeList) {
                     for (defClass in defClassList) {
                         if (defClass.systemCode == systemCode.code) {
                             if (systemCode.children.isNullOrEmpty()) {
@@ -147,7 +149,7 @@ class CustomSqlLabslService {
                     defClass.aliasCode = majorCode.aliasCode
                     defClass.aliasName = majorCode.aliasName
                     for (systemCode in systemCodeList) {
-                        if (systemCode.majorCode == majorCode.code ) {
+                        if (systemCode.majorCode == majorCode.code) {
                             if (defClass.children.isNullOrEmpty()) {
                                 defClass.children = ArrayList<DefClass>()
                             }
@@ -166,6 +168,10 @@ class CustomSqlLabslService {
                 sQueryResponse.content = majorList
                 /** 总数量 */
                 sQueryResponse.total = majorList.size.toLong()
+            }else {
+                    /** 返回的对象列表 */
+                    sQueryResponse.content = ArrayList()
+               }
             } else {
                 sQueryResponse.result = SResponseType.failure
                 sQueryResponse.message = "项目下没有设备类型"

+ 2 - 5
equip-component/src/main/kotlin/com/persagy/server/service/objects/ShaftService.kt

@@ -113,13 +113,10 @@ object ShaftService : Service<Shaft>(SMybatisDao(Shaft::class.java)) {
             for (exec in execOtherList){
                 list.add(exec.shaftId!!)
             }
-
+            listf.add(SFilter.eq("projectId",projectId!!))
+            listf.add(SFilter.not(SFilter.eq("id",shaftId)))
             if (list.size>0){
-                listf.add(SFilter.eq("projectId",projectId!!))
                 listf.add(SFilter.not(SFilter.inList("id",list)))
-            }else{
-
-                listf.add(SFilter.eq("projectId",projectId!!))
             }
 
             val pageQuery = pageQuery(request, listf)

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

@@ -12,14 +12,16 @@ eureka:
     prefer-ip-address:                      true
 
 server:
-  port: 8080
+  port: 8087
 
 spring:
   datasource:
 #    url:                                jdbc:postgresql://data-center:5432/datacenter
 #    username:                           postgres
 #    password:                           123qwe!@#
-    url:                                jdbc:postgresql://datacenter:5432/datacenter
+#    url:                                jdbc:postgresql://datacenter:5432/datacenter
+    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
+#    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj

+ 3 - 0
gradle.properties

@@ -28,6 +28,9 @@ PERSAGY_URL = http://www.persagy.cn
 PERSAGY_KOTLIN_VERSION = 1.4.121
 PERSAGY_SERVICE_VERSION = 1.4.164
 
+#PERSAGY_KOTLIN_VERSION = 1.4.128
+#PERSAGY_SERVICE_VERSION = 1.4.165
+
 MAVEN_REPO_PUBLIC_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-public/
 MAVEN_REPO_RELEASE_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-releases/
 MAVEN_REPO_SNAPSHOT_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-snapshots/

+ 46 - 0
message-center/src/main/resources/application-test.yml

@@ -0,0 +1,46 @@
+
+# spring-cloud相关配置
+eureka:
+  client:                                   #客户端注册进eureka服务列表内
+    service-url:
+      defaultZone:                          http://eureka-service:8761/eureka
+
+  instance:
+    # 实例ID
+    # instance-id:                            ${spring.application.name}:${server.port}:${project.version}
+    # 优先使用IP地址方式进行注册服务
+    prefer-ip-address:                      true
+
+#启用监控
+management:
+  endpoints:
+    web:
+      exposure:
+        include:
+          - "*"  # 开放所有端点health,info,metrics,通过actuator/+端点名就可以获取相应的信息。默认打开health和info
+  endpoint:
+    health:
+      #未开启actuator/health时,我们获取到的信息是{"status":"UP"},status的值还有可能是 DOWN。开启后打印详细信息
+      show-details:                       always
+
+server:
+  port: 8080
+
+spring:
+
+  datasource:
+#    url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
+#    url:                                jdbc:postgresql://60.205.177.43:5432/
+    url:                                jdbc:postgresql://datacenter:5432/datacenter
+#    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
+    username:                           postgres
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
+
+  activemq:
+#    broker-url:                         tcp://60.205.177.43:61616
+#    broker-url:                         tcp://172.17.100.16:61616
+    broker-url:                         tcp://activemq:61616
+  servlet:
+    multipart:
+      max-request-size:                500MB        # 限制上传的多个文件的总大小
+      max-file-size:                   500MB        # 限制单个文件的最大值

+ 1 - 1
scanbuilding/src/main/kotlin/com/persagy/server/controller/UserController.kt

@@ -167,7 +167,7 @@ open class UserController {
     @PostMapping(value = ["/query"])
     fun query(@RequestBody request: SQueryRequest): SQueryResponse<User> {
         val projectId = SPageContext.getHeader("projectId")
-        return UserService.pageQuery(request, arrayListOf(SFilter.eq("projId",projectId!!)))
+        return UserService.pageQuery(request, arrayListOf(SFilter.eq("projectId",projectId!!)))
     } // Function query()
 
     /**

+ 1 - 0
scanbuilding/src/main/kotlin/com/persagy/server/entities/User.kt

@@ -54,6 +54,7 @@ class User : SBaseEntity() {
     /** 手机号 */
     @Schema(description = "手机号")
     @Pattern(regexp="1[2-8][0-9]{9}", message="手机号格式不正确!")
+    @Id
     @Column(name = "phone")
     var phone: String? = null
 

+ 3 - 1
scanbuilding/src/main/resources/application-dev.yml

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

+ 16 - 0
scanbuilding/src/main/resources/application-test.yml

@@ -0,0 +1,16 @@
+server:
+  port: 8080
+
+spring:
+  datasource:
+    #    url:                                jdbc:postgresql://data-center:5432/datacenter
+    #    username:                           postgres
+    #    password:                           123qwe!@#
+#    url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
+#    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
+    url:                                jdbc:postgresql://datacenter:5432/datacenterlabsl
+    username:                           postgres
+    #    password:                           persagy_2020qwe!@#
+    password:                           cGVyc2FneV8yMDIwcXdlIUAj
+
+