Quellcode durchsuchen

********************WX***********************
平面图接口

zhangweixin vor 4 Jahren
Ursprung
Commit
8c4336f6e5

+ 6 - 9
datacenter/src/main/kotlin/com/persagy/server/controllers/rel/RShContainSpBaseController.kt

@@ -40,10 +40,7 @@ import com.persagy.service.models.responses.SQueryResponse
 import io.swagger.v3.oas.annotations.Operation
 import io.swagger.v3.oas.annotations.tags.Tag
 import org.slf4j.LoggerFactory
-import org.springframework.web.bind.annotation.PostMapping
-import org.springframework.web.bind.annotation.RequestBody
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RestController
+import org.springframework.web.bind.annotation.*
 
 /**
  * 竖井下的业务空间
@@ -82,7 +79,7 @@ class RShContainSpBaseController {
      */
     @Operation(summary = "根据对象删除竖井下的业务空间关系,只针对一个对象", description = "必填项:ShaftID(竖井id)、SpaceID(业务空间id)")
     @PostMapping(value = ["/unlink"])
-    fun delete(type: String,@RequestBody rShContainSpBase: ArrayList<RShContainSpBase>): SBaseResponse {
+    fun delete(@RequestParam type: String, @RequestBody rShContainSpBase: ArrayList<RShContainSpBase>): SBaseResponse {
         return RShContainSpBaseService.deletes(type,rShContainSpBase)
     } // Function delete()
 
@@ -122,7 +119,7 @@ class RShContainSpBaseController {
      */
     @Operation(summary = "竖井下的业务空间,竖井一对多,此方法不会覆盖以前的记录", description = "必填项:SpaceIdList(业务空间id列表)、ShaftID(竖井id),此方法不会覆盖以前的记录")
     @PostMapping(value = ["link-shsps"])
-    fun createShSps(type: String?,@RequestBody rShContainSpBase: RShContainSpBaseList): SCreateResponse<RShContainSpBaseList> {
+    fun createShSps(@RequestParam type: String?,@RequestBody rShContainSpBase: RShContainSpBaseList): SCreateResponse<RShContainSpBaseList> {
         logger.debug("space =${rShContainSpBase.toJson()}")
         return RShContainSpBaseService.createShSps(type,rShContainSpBase)
     } // Function createSp()
@@ -136,7 +133,7 @@ class RShContainSpBaseController {
      */
     @Operation(summary = "竖井下的业务空间,空间一对多,此方法不会覆盖以前的记录", description = "必填项:SpaceId(业务空间id)、ShaftIDList(竖井id列表),此方法不会覆盖以前的记录")
     @PostMapping(value = ["link-spshs"])
-    fun createSpShs(type: String,@RequestBody rSpContainShBase: RSpContainShBaseList): SCreateResponse<RSpContainShBaseList> {
+    fun createSpShs(@RequestParam type: String,@RequestBody rSpContainShBase: RSpContainShBaseList): SCreateResponse<RSpContainShBaseList> {
         logger.debug("space =${rSpContainShBase.toJson()}")
         return RShContainSpBaseService.createSpShs(type,rSpContainShBase)
     } // Function createSp()
@@ -150,7 +147,7 @@ class RShContainSpBaseController {
      */
     @Operation(summary = "竖井下的业务空间,竖井一对多,此方法会覆盖以前的记录", description = "必填项:SpaceIdList(业务空间id列表)、ShaftID(竖井id),此方法会覆盖以前的记录")
     @PostMapping(value = ["link-shsps-replace"])
-    fun createShSpsReplace(Type: String,BuildingId: String,FloorId: String, @RequestBody rShContainSpBase: RShContainSpBaseList): SCreateResponse<RShContainSpBaseList> {
+    fun createShSpsReplace(@RequestParam Type: String,BuildingId: String,FloorId: String, @RequestBody rShContainSpBase: RShContainSpBaseList): SCreateResponse<RShContainSpBaseList> {
         logger.debug("space =${rShContainSpBase.toJson()}")
         return RShContainSpBaseService.createShSpsReplace(Type,BuildingId,FloorId,rShContainSpBase)
     } // Function createSp()
@@ -163,7 +160,7 @@ class RShContainSpBaseController {
      */
     @Operation(summary = "查询空间类型和名称",description = "")
     @PostMapping(value = ["/space-type-query"])
-    fun spaceTypeQuery(shaftId: String): SQueryResponse<SpaceInfoDic> {
+    fun spaceTypeQuery(@RequestParam shaftId: String): SQueryResponse<SpaceInfoDic> {
         val projectId = SPageContext.getHeader("projectId").toString()
         return RShContainSpBaseService.spaceTypeQuery(projectId,shaftId)
     } // Function spaceTypeQuery()

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/services/graphtype/GraphicTypeMapperService.kt

@@ -174,7 +174,7 @@ open class GraphicTypeMapperService {
                                 val exec = rSp2SpService.select(SFilter.eq("projectId", projectId), SFilter.eq("type", relationTypeProject.relationType!!)).exec()
                                 count += exec.size
                             }else if (n == "property_eq"){
-                                val exec = PropertyService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("EquipmentId"))).exec()
+                                val exec = PropertyService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("equipId"))).exec()
                                 count += exec.size
                             }else if (n == "property_fl"){
                                 val exec = PropertyService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("floorId"))).exec()
@@ -193,7 +193,7 @@ open class GraphicTypeMapperService {
                                 val execEquip = PropertyService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("buildingId"))).exec()
                                 count += execEquip.size
                             }else if (n == "floor_bd"){
-                                val execEquip = FloorService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("buildId"))).exec()
+                                val execEquip = FloorService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("buildingId"))).exec()
                                 count += execEquip.size
                             }else if (n == "equipment_fl"){
                                 val execEquip = EquipmentService.select(SFilter.eq("projectId", projectId), SFilter.not(SFilter.isNull("floorId")))

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

@@ -54,6 +54,6 @@ class SchedulerTask {
     @Scheduled(cron = "0 */3 * * * ?")
     fun scheduled() {
         logger.info("同步数据中心任务开始")
-        messageProcessing.syncDataCenter()
+//        messageProcessing.syncDataCenter()
     }
 }

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

@@ -12,13 +12,13 @@ spring:
     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
 
 saga:
   dataPlatform:                        http://39.102.40.239:9970

+ 6 - 0
equip-component/src/main/kotlin/com/persagy/server/controllers/planar/PlanarController.kt

@@ -55,4 +55,10 @@ class PlanarController {
         return EquipmentComService.equipQuery(request)
     }
 
+//    @Operation(summary = "查询设备类型以及数量", description = "")
+//    @PostMapping(value = ["/equip/count"])
+//    fun equipQueryCount(@RequestBody request: PlanarEquipRequests): SQueryResponse<EquipQueryCount> {
+//        return EquipmentComService.equipQueryCount(request)
+//    }
+
 }

+ 8 - 0
equip-component/src/main/kotlin/com/persagy/server/models/mappers/CustomSqlLabsl.kt

@@ -27,9 +27,11 @@
 package com.persagy.server.models.mappers
 
 import com.persagy.server.models.labsl.EquipClassCode
+import com.persagy.server.models.responses.EquipQueryCount
 import org.apache.ibatis.annotations.Mapper
 import org.apache.ibatis.annotations.Param
 import org.apache.ibatis.annotations.Select
+import org.apache.ibatis.annotations.SelectProvider
 import org.springframework.stereotype.Repository
 
 /**
@@ -50,6 +52,12 @@ interface CustomSqlLabsl {
     fun spaceType(@Param("projectId") projectId: String):ArrayList<EquipClassCode>
 
 
+    /** 平面图统计设备类型以及数量 */
+    @Select("SELECT e.class_code AS code , (SELECT name FROM dict.def_class WHERE project_id = #{projectId} AND code = e.class_code ) ,  count('class_code') FROM equipment e WHERE e.project_id = #{projectId} AND e.building_id = #{buildingId} AND e.floor_id = #{floorId} AND e.class_code in ('FFFSSN') GROUP BY e.class_code")
+    fun equipTypeCount(@Param("projectId") projectId: String,@Param("buildingId") buildingId: String,@Param("floorId") floorId: String)
 
+    /** 平面图统计设备类型以及数量 */
+    @SelectProvider(type = StatisticalQuantity::class, method = "equipTypeCount")
+    fun equipTypeCounts(projectId: String, buildingId: String,floorId: String,types: ArrayList<String>): ArrayList<EquipQueryCount>?
 
 }

+ 79 - 0
equip-component/src/main/kotlin/com/persagy/server/models/mappers/StatisticalQuantity.kt

@@ -0,0 +1,79 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.models.mappers
+
+import org.apache.ibatis.jdbc.SQL
+
+/**
+ * 统计
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2020/12/13 16:45
+ */
+class StatisticalQuantity {
+
+
+    /**
+     * 统计设备类型函数
+     *
+     * @param projectId     项目 id
+     * @param buildingId    建筑 id
+     * @param floorId       楼层 id
+     * @param types         类型列表
+     * @return sql 字符串
+     */
+    fun equipTypeCount(projectId: String,buildingId: String,floorId: String,types: ArrayList<String>): String {
+        val type = concateStr(types)
+        val sql = object: SQL() {
+            init {
+                //
+                SELECT("e.class_code AS code , (SELECT name FROM dict.def_class WHERE project_id = 'Pj1101050029' AND code = e.class_code ) ,  count('class_code')")
+                FROM("equipment e")
+                WHERE("e.project_id = '${projectId}' AND e.building_id = '${buildingId}' AND e.floor_id = '${floorId}' AND e.class_code in (${type})")
+                GROUP_BY(" e.class_code")
+            }
+        }.toString()
+        return sql
+    }
+
+
+    /**
+     * in 列表的字符串拼接
+     *
+     * @param arr     集合列表
+     */
+    fun concateStr(arr : Collection<String>) : String{
+        var stringBuilder = StringBuilder()
+        arr.forEach {
+            stringBuilder.append("\'").append(it).append("\',")
+        }
+        if(stringBuilder.endsWith(',')){
+            stringBuilder.deleteCharAt(stringBuilder.length - 1) //.removeSuffix(",")
+        }
+        return stringBuilder.toString()
+    }
+}

+ 45 - 0
equip-component/src/main/kotlin/com/persagy/server/models/responses/EquipQueryCount.kt

@@ -0,0 +1,45 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+package com.persagy.server.models.responses
+
+import io.swagger.v3.oas.annotations.media.Schema
+import java.io.Serializable
+
+/**
+ *
+ * @author wx  <zhangweixin@sagacloud.com>
+ * @date  2020/12/13 16:56
+ */
+@Schema(description = "平面图统计设备类型数量")
+class EquipQueryCount: Serializable {
+    @Schema(description = "类型编码")
+    var code: String? = null
+    @Schema(description = "类型名称")
+    var name: String? = null
+    @Schema(description = "设备数量")
+    var count: Int? = null
+}

+ 71 - 3
equip-component/src/main/kotlin/com/persagy/server/service/EquipmentComService.kt

@@ -41,6 +41,7 @@ import com.persagy.server.datacenter.models.entities.rel.REq2Sp
 import com.persagy.server.models.planar.PlanarEquip
 import com.persagy.server.models.requests.PlanarEquipRequests
 import com.persagy.server.service.base.Service
+import com.persagy.server.service.labsl.CustomSqlLabslService
 import com.persagy.server.service.objects.PropertyService
 import com.persagy.server.utils.IdUtils
 import com.persagy.server.utils.MatchingProperty
@@ -52,6 +53,7 @@ import com.persagy.service.models.requests.SQueryRequest
 import com.persagy.service.models.requests.SUpdateRequest
 import com.persagy.service.models.responses.SBaseResponse
 import com.persagy.service.models.responses.SQueryResponse
+import com.persagy.service.utils.SSpringContextUtil
 import org.slf4j.LoggerFactory
 import java.util.*
 import kotlin.collections.ArrayList
@@ -65,6 +67,12 @@ object EquipmentComService : Service<Equipment>(SMybatisDao(Equipment::class.jav
     /** 日志 */
     private val logger = LoggerFactory.getLogger(EquipmentComService::class.java)
 
+    /** MQ消息对象 */
+    val customSqlLabslService by lazy {
+        SSpringContextUtil.getBean(CustomSqlLabslService::class.java) as CustomSqlLabslService
+    }
+
+
     /** 建筑服务 */
     val buildingService = SObjectService(SMybatisDao(Building::class.java))
 
@@ -77,6 +85,8 @@ object EquipmentComService : Service<Equipment>(SMybatisDao(Equipment::class.jav
     /** 平面图访问设备服务 */
     private val planarEquipService = SObjectService(SMybatisDao(PlanarEquip::class.java))
 
+    /** 空间服务 */
+    val spaceService = SObjectService(SMybatisDao(ZoneSpace::class.java))
 
     /**
      * 查询之前操作
@@ -650,6 +660,15 @@ object EquipmentComService : Service<Equipment>(SMybatisDao(Equipment::class.jav
         try {
             sQueryResponse.result = SResponseType.success
             if (!request.equipTypes.isNullOrEmpty()&&!request.zoneTypes.isNullOrEmpty()&&!request.funcTypes.isNullOrEmpty()) {
+                /** 先查询空间数据 */
+                if (!request.spaceIds.isNullOrEmpty()) {
+
+//                    spaceService.select(SFilter.eq())
+
+                } else {
+
+                }
+
 
             } else if (!request.equipTypes.isNullOrEmpty()&&!request.zoneTypes.isNullOrEmpty()&&!request.funcTypes.isNullOrEmpty()){
 
@@ -665,17 +684,66 @@ object EquipmentComService : Service<Equipment>(SMybatisDao(Equipment::class.jav
                 ).exec()
                 sQueryResponse.content = planarEquipList
             }else {
-
                 sQueryResponse.result = SResponseType.failure
             }
-
             return  sQueryResponse
         } catch (e: Exception) {
            return SQueryResponse(SResponseType.failure,e.message!!)
         }
     }
 
-
+    /**
+     * 查询设备类型统计数量
+     *
+     * @param request     请求条件
+     */
+//    fun equipQueryCount(request: PlanarEquipRequests): SQueryResponse<EquipQueryCount> {
+//
+//        val sQueryResponse = SQueryResponse<EquipQueryCount>()
+//        try {
+//            sQueryResponse.result = SResponseType.success
+//            if (!request.equipTypes.isNullOrEmpty()&&!request.zoneTypes.isNullOrEmpty()&&!request.funcTypes.isNullOrEmpty()) {
+//
+//            } else if (!request.equipTypes.isNullOrEmpty()&&!request.zoneTypes.isNullOrEmpty()&&!request.funcTypes.isNullOrEmpty()){
+//                /** 空间类型 和功能区类型组合查询 */
+//
+//                if (!request.spaceIds.isNullOrEmpty()) {
+//
+//
+//
+//                } else {
+//
+//                }
+//
+//
+//
+//            } else if (!request.equipTypes.isNullOrEmpty()&&!request.zoneTypes.isNullOrEmpty()){
+//
+//            } else if (!request.equipTypes.isNullOrEmpty()&&!request.funcTypes.isNullOrEmpty()){
+//
+//
+//            }else if (!request.equipTypes.isNullOrEmpty()){
+//
+////                val planarEquipList = planarEquipService.select(
+////                    SFilter.eq("buildingId", request.buildingId!!), SFilter.eq("floorId", request.floorId!!),
+////                    SFilter.inList("classCode", request.equipTypes!!)
+////                ).exec()
+//                val equipTypeCounts = customSqlLabslService.equipTypeCounts(
+//                    Opt.projectId!!,
+//                    request.buildingId!!,
+//                    request.floorId!!,
+//                    request.equipTypes!!
+//                )
+//                sQueryResponse.content = equipTypeCounts
+//            }else {
+//
+//                sQueryResponse.result = SResponseType.failure
+//            }
+//            return  sQueryResponse
+//        } catch (e: Exception) {
+//            return SQueryResponse(SResponseType.failure,e.message!!)
+//        }
+//    }
 
 
 } // Object EquipmentService

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

@@ -36,6 +36,7 @@ import com.persagy.server.datacenter.models.entities.dictnew.DictProject
 import com.persagy.server.datacenter.models.entities.objects.Building
 import com.persagy.server.datacenter.models.entities.objects.Floor
 import com.persagy.server.models.mappers.CustomSqlLabsl
+import com.persagy.server.models.responses.EquipQueryCount
 import com.persagy.service.SBaseService
 import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
@@ -289,7 +290,18 @@ class CustomSqlLabslService {
         }
     }
 
-
+    /**
+     * 统计设备类型函数
+     *
+     * @param projectId     项目 id
+     * @param buildingId    建筑 id
+     * @param floorId       楼层 id
+     * @param types         类型列表
+     * @return 对象列表
+     */
+     fun equipTypeCounts(projectId: String, buildingId: String,floorId: String,types: ArrayList<String>): ArrayList<EquipQueryCount>?{
+        return mapper.equipTypeCounts(projectId,buildingId,floorId,types)
+     }