Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-backgroud into develop

yucheng 3 years ago
parent
commit
e6b2c170c8
34 changed files with 579 additions and 154 deletions
  1. 5 0
      .idea/jarRepositories.xml
  2. 6 4
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/ZoneIspace.kt
  3. 3 3
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/task/PropertyScanTask.kt
  4. 2 0
      gradle.properties
  5. 1 1
      labsl/src/main/kotlin/com/persagy/labsl/models/entities/pbs/Building.kt
  6. 1 1
      meiku/src/main/resources/application.yml
  7. 7 6
      message-center/src/main/resources/application-dev.yml
  8. 2 2
      message-center/src/main/resources/application-test.yml
  9. 8 8
      revit-algorithm/src/main/resources-dev/application.yml
  10. 8 8
      revit-algorithm/src/main/resources-prod/application.yml
  11. 8 8
      revit-algorithm/src/main/resources-prod/application14.yml
  12. 8 8
      revit-algorithm/src/main/resources-prod/application239.yml
  13. 8 8
      revit-algorithm/src/main/resources-prod/application60.yml
  14. 3 1
      scanbuilding/build.gradle
  15. 10 0
      scanbuilding/src/main/kotlin/com/persagy/server/client/AdmMiddlewareClient.kt
  16. 5 0
      scanbuilding/src/main/kotlin/com/persagy/server/constant/AdmMiddlewareUrlConstant.java
  17. 8 8
      scanbuilding/src/main/kotlin/com/persagy/server/mappers/StatisticsCountMapper.kt
  18. 19 4
      scanbuilding/src/main/kotlin/com/persagy/server/services/AdmBaseService.kt
  19. 51 0
      scanbuilding/src/main/kotlin/com/persagy/server/services/StatisticsCountService.kt
  20. 46 3
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/EquipScanTaskQueryService.kt
  21. 42 0
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskQueryService.kt
  22. 164 17
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskService.kt
  23. 1 1
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/PropertyScanTaskService.kt
  24. 20 9
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/ScanTaskBaseService.kt
  25. 93 0
      scanbuilding/src/main/kotlin/com/persagy/server/util/GeoToolsUtil.kt
  26. 1 1
      scheduler/build.gradle
  27. 4 2
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/controllers/DownloadController.kt
  28. 0 1
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/ActiveMQConsumer.kt
  29. 2 7
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/JMSProducer.kt
  30. 11 11
      scheduler/src/main/resources-dev/application.yml
  31. 8 8
      scheduler/src/main/resources-prod/application.yml
  32. 8 8
      scheduler/src/main/resources-prod/application60.yml
  33. 8 8
      scheduler/src/main/resources-test/application.yml
  34. 8 8
      scheduler/src/main/resources-test/application60.yml

+ 5 - 0
.idea/jarRepositories.xml

@@ -46,5 +46,10 @@
       <option name="name" value="maven4" />
       <option name="url" value="http://47.93.132.139:8081/nexus/content/groups/public/" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="maven7" />
+      <option name="name" value="maven7" />
+      <option name="url" value="https://repo.osgeo.org/repository/release/" />
+    </remote-repository>
   </component>
 </project>

+ 6 - 4
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/ZoneIspace.kt

@@ -30,7 +30,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
 import com.persagy.server.datacenter.models.entities.assistant.PointPosition
 import com.persagy.server.datacenter.models.entities.base.BaseInfo
 import io.swagger.v3.oas.annotations.media.Schema
-import java.util.*
 import javax.persistence.Column
 import javax.persistence.Id
 import javax.persistence.Table
@@ -155,8 +154,11 @@ open class ZoneIspace : BaseInfo() {
     @Column(name = "model_id")
     var modelId: String? = null
 
-    @Schema(description = "轮廓线")
-    @Column(name = "outline")
-    var outline: ArrayList<ArrayList<PointPosition>>? = null
+   @Schema(description = "轮廓线")
+   @Column(name = "outline")
+   var outline: ArrayList<ArrayList<PointPosition>>? = null
+
+   /* @Schema(description = "轮廓线")
+    val outLine: List<LinkedHashMap<String, Any>>? = null*/
 
 }

+ 3 - 3
data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/task/PropertyScanTask.kt

@@ -57,17 +57,17 @@ open class PropertyScanTask : ScanTaskBase() {
 
     /** 级联-项目   table  对应关系表   idColumn 对应 本类的id    childIdColumn 级联对象的关系id */
     @Schema(description = "级联-项目")
-    @SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="project_id")
+    //@SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="project_id")
     var project: Project? = null
 
     /** 级联-建筑 */
     @Schema(description = "级联-建筑")
-    @SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="building_id")
+   // @SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="building_id")
     var building: Building? = null
 
     /** 级联-楼层 */
     @Schema(description = "级联-楼层")
-    @SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="floor_id")
+    //@SCascade(table="scantask.property_scan_task", idColumn="id", childIdColumn="floor_id")
     var floor: Floor? = null
 
     /** 级联-方案*/

+ 2 - 0
gradle.properties

@@ -28,6 +28,8 @@ 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/
 
+MAVEN_REPO_GEO_SNAPSHOT_URL = https://repo.osgeo.org/repository/release/
+
 NEXUS_USERNAME = admin
 NEXUS_PASSWORD = 123qwe!@#
 

+ 1 - 1
labsl/src/main/kotlin/com/persagy/labsl/models/entities/pbs/Building.kt

@@ -11,7 +11,7 @@ import javax.persistence.Table
  * @date  2020/12/2 19:08
  */
 @Schema(description = "建筑信息实体类")
-@Table(name = "public.building")
+//@Table(name = "public.building")
 class Building {
 
     /** 建筑体ID */

+ 1 - 1
meiku/src/main/resources/application.yml

@@ -20,7 +20,7 @@ spring:
     name: labsl
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://rm-2ze20ntn5y9ljsx147o.mysql.rds.aliyuncs.com:3306/meiku?allowMultiQueries=true&serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=UTF-8
+    url: jdbc:mysql://rm-2ze20ntn5y9ljsx147o.mysql.rds.aliyuncs.com:3306/labsl_meiku?allowMultiQueries=true&serverTimezone=UTC&useUnicode=true&useSSL=false&characterEncoding=UTF-8
     username: root
     password: zVmW58LaAtjIKbb
 

+ 7 - 6
message-center/src/main/resources/application-dev.yml

@@ -38,8 +38,8 @@ spring:
     username:                           postgres
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-  activemq:
-    broker-url:                         tcp://60.205.177.43:61616
+  #activemq:
+   # broker-url:                         tcp://60.205.177.43:61616
 
   servlet:
     multipart:
@@ -47,11 +47,12 @@ spring:
       max-file-size:                   500MB        # 限制单个文件的最大值
   main:
     allow-bean-definition-overriding: true
-  kafka:
-    bootstrap-servers:                      192.168.20.236:9092
+
+  #kafka:
+   # bootstrap-servers:                      192.168.20.236:9092
 #    bootstrap-servers:                      127.0.0.1:9092
 
 #    bootstrap-servers:                      172.16.9.226:9092
 
-    consumer:
-      group-id:                             datacenter-consumer-group
+    #consumer:
+     # group-id:                             datacenter-consumer-group

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

@@ -36,10 +36,10 @@ spring:
     username:                           postgres
     password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
-  activemq:
+ # activemq:
 #    broker-url:                         tcp://60.205.177.43:61616
 #    broker-url:                         tcp://172.17.100.16:61616
-    broker-url:                         tcp://activemq:61616
+  #  broker-url:                         tcp://activemq:61616
   servlet:
     multipart:
       max-request-size:                500MB        # 限制上传的多个文件的总大小

+ 8 - 8
revit-algorithm/src/main/resources-dev/application.yml

@@ -54,14 +54,14 @@ spring:
     multipart:
       max-request-size:                90MB        # 限制上传的多个文件的总大小
       max-file-size:                   90MB        # 限制单个文件的最大值
-  activemq:
-    broker-url: failover:(tcp://192.168.64.15:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+  #activemq:
+   # broker-url: failover:(tcp://192.168.64.15:61616)
+    # in-memory: true
+      #pool:
+      #  enabled: false
+    # user: admin
+    #  password: admin
+    #  non-blocking-redelivery: true
 mybatis:
   typeAliasesPackage:                  cn.sagacloud.server.algorithm.models
 

+ 8 - 8
revit-algorithm/src/main/resources-prod/application.yml

@@ -53,14 +53,14 @@ spring:
     multipart:
       max-request-size:                90MB        # 限制上传的多个文件的总大小
       max-file-size:                   90MB        # 限制单个文件的最大值
-  activemq:
-    broker-url: failover:(tcp://172.17.100.16:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+  #activemq:
+   # broker-url: failover:(tcp://172.17.100.16:61616)
+    #in-memory: true
+    #pool:
+     # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 mybatis:
   typeAliasesPackage:                  cn.sagacloud.server.algorithm.models
 

+ 8 - 8
revit-algorithm/src/main/resources-prod/application14.yml

@@ -48,14 +48,14 @@ spring:
     multipart:
       max-request-size:                90MB        # 限制上传的多个文件的总大小
       max-file-size:                   90MB        # 限制单个文件的最大值
-  activemq:
-    broker-url: failover:(tcp://192.168.64.14:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+    #activemq:
+    # broker-url: failover:(tcp://172.17.100.16:61616)
+    #in-memory: true
+    #pool:
+    # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 mybatis:
   typeAliasesPackage:                  cn.sagacloud.server.algorithm.models
 

+ 8 - 8
revit-algorithm/src/main/resources-prod/application239.yml

@@ -48,14 +48,14 @@ spring:
     multipart:
       max-request-size:                90MB        # 限制上传的多个文件的总大小
       max-file-size:                   90MB        # 限制单个文件的最大值
-  activemq:
-    broker-url: failover:(tcp://172.17.100.16:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://172.17.100.16:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 mybatis:
   typeAliasesPackage:                  cn.sagacloud.server.algorithm.models
 

+ 8 - 8
revit-algorithm/src/main/resources-prod/application60.yml

@@ -48,14 +48,14 @@ spring:
     multipart:
       max-request-size:                90MB        # 限制上传的多个文件的总大小
       max-file-size:                   90MB        # 限制单个文件的最大值
-  activemq:
-    broker-url: failover:(tcp://60.205.177.43:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://172.17.100.16:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 mybatis:
   typeAliasesPackage:                  cn.sagacloud.server.algorithm.models
 

+ 3 - 1
scanbuilding/build.gradle

@@ -44,6 +44,7 @@ compileTestKotlin {
 repositories {
     maven{url MAVEN_REPO_NEXUS_PUBLIC_URL}
     maven{url MAVEN_REPO_NEXUS_RELEASE_URL}
+    maven{url MAVEN_REPO_GEO_SNAPSHOT_URL}
     mavenCentral()
     jcenter()
 }
@@ -60,7 +61,7 @@ dependencies {
     compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION
     compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION
     //消息
-    compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
+    //compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
     providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION
     // spring boot 缓存
     compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION
@@ -110,6 +111,7 @@ dependencies {
     // Log 工具
     compile group: "org.projectlombok", name: "lombok", version: LOMBOK_VERSION
 
+    compile group: "org.geotools", name: "gt-main", version: 25.2
 //    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //    // 二维码与条形码
 //    // https://mvnrepository.com/artifact/com.google.zxing/core

+ 10 - 0
scanbuilding/src/main/kotlin/com/persagy/server/client/AdmMiddlewareClient.kt

@@ -86,4 +86,14 @@ interface AdmMiddlewareClient{
     @PostMapping(AdmMiddlewareUrlConstant.PROPERTY_UPDATE)
     fun updateProperty(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?, @RequestBody criteria: SUpdateRequest<Property>): SUpdateRequest<Property>?
 
+
+    /**
+     * @description: 查询元空间列表
+     * @param: objectUrlParam 对象请求url通用参数
+     * @param: criteria post请求参数
+     * @return: com.persagy.dmp.common.DmpResult
+     */
+    @PostMapping(AdmMiddlewareUrlConstant.ISPACE_QUERY)
+    fun queryIspace(@RequestHeader(defaultValue = "0" ) groupCode: String?, @RequestHeader(defaultValue = "0" ) projectId: String?,@RequestBody criteria: SQueryRequest?): SQueryResponse<JSONObject>?
+
 }

+ 5 - 0
scanbuilding/src/main/kotlin/com/persagy/server/constant/AdmMiddlewareUrlConstant.java

@@ -39,4 +39,9 @@ public class AdmMiddlewareUrlConstant {
      * 资产更新
      */
     public final static String PROPERTY_UPDATE = "/object/property/update";
+
+    /**
+     * 元空间查询
+     */
+    public final static String ISPACE_QUERY = "/object/ispace/query";
 }

File diff suppressed because it is too large
+ 8 - 8
scanbuilding/src/main/kotlin/com/persagy/server/mappers/StatisticsCountMapper.kt


+ 19 - 4
scanbuilding/src/main/kotlin/com/persagy/server/services/AdmBaseService.kt

@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON
 import com.alibaba.fastjson.JSONObject
 import com.persagy.server.Opts
 import com.persagy.server.client.AdmMiddlewareClient
-import com.persagy.server.datacenter.models.entities.objects.Building
-import com.persagy.server.datacenter.models.entities.objects.Component
-import com.persagy.server.datacenter.models.entities.objects.Equipment
-import com.persagy.server.datacenter.models.entities.objects.Property
+import com.persagy.server.datacenter.models.entities.objects.*
 
 import com.persagy.service.models.SCascadeQuery
 import com.persagy.service.models.requests.SQueryRequest
@@ -101,6 +98,24 @@ class AdmBaseService {
 
 
     /**
+     * 查询元空间信息
+     */
+    fun queryIspace(criteria: SQueryRequest?): List<ZoneIspace>? {
+        //查询对象信息
+        val result = admMiddlewareClient!!.queryIspace(Opts.groupCode,Opts.projectId,criteria) ?: return ArrayList()
+        if(CollUtil.isEmpty(result.content)){
+            return ArrayList<ZoneIspace>()
+        }
+        val content = ArrayList<ZoneIspace>()
+        for(obj in result.content!!){
+
+            val ispace = JSON.toJavaObject(obj, ZoneIspace::class.java)
+            content.add(ispace)
+        }
+        return content
+    }
+
+    /**
      * 实体属性转换
      */
     fun entityAttributeConvert(objects:List<JSONObject>): List<Equipment>? {

File diff suppressed because it is too large
+ 51 - 0
scanbuilding/src/main/kotlin/com/persagy/server/services/StatisticsCountService.kt


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

@@ -33,6 +33,7 @@ import com.persagy.database.functions.SLength
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DefClass
 import com.persagy.server.datacenter.models.entities.objects.Equipment
+import com.persagy.server.datacenter.models.entities.task.CategoryStatistics
 import com.persagy.server.datacenter.models.entities.task.EquipScanTaskQuery
 import com.persagy.server.services.AdmBaseService
 import com.persagy.server.services.DmpBaseService
@@ -51,7 +52,7 @@ import java.util.stream.Collectors
  *
  * @author  邓婷婷
  */
-object EquipScanTaskQueryService : SObjectService<EquipScanTaskQuery>(SMybatisDao(EquipScanTaskQuery::class.java))  {
+object EquipScanTaskQueryService : SObjectService<EquipScanTaskQuery>(SMybatisDao(EquipScanTaskQuery::class.java))  { // Class EquipScanTaskService
 
     /** 字典平台对象类型 */
   //  private val defClassService = SBaseService(SMybatisDao(DefClass::class.java))
@@ -188,7 +189,7 @@ object EquipScanTaskQueryService : SObjectService<EquipScanTaskQuery>(SMybatisDa
         }
         val equipIds = equipScanTaskList?.stream()?.map(EquipScanTaskQuery::equipId)?.collect(Collectors.toList<String>())
         var equipRequest = SQueryRequest()
-        equipRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", equipIds) + "\'"
+        equipRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", equipIds) + "\')"
 
         val requestCascade = request.cascade
         //查询级联关系
@@ -207,4 +208,46 @@ object EquipScanTaskQueryService : SObjectService<EquipScanTaskQuery>(SMybatisDa
     }
 
 
-} // Class EquipScanTaskService
+
+    /**
+     * 分类统计
+     */
+    fun categoryStatistics(projectId:String,id: String,equipId: String): ArrayList<CategoryStatistics>{
+        val result = ArrayList<CategoryStatistics>()
+        //查询所有的设备类别
+        val dictTypeList = dmpBaseService?.queryDictType(JSONObject())
+        val dictTypeMap = HashMap<String, String>()
+        if (dictTypeList != null) {
+            for(dictType in dictTypeList){
+                dictType.code?.let { dictType.name?.let { it1 -> dictTypeMap.put(it, it1) } }
+            }
+        }
+
+        //查询设备任务
+        val request = SQueryRequest()
+        val withFilterList = ArrayList<SFilter>()
+        withFilterList.add(SFilter.eq("projectId", projectId))
+        withFilterList.add(SFilter.eq("taskParentId", id))
+        withFilterList.add(SFilter.eq("parentId", equipId))
+        val pageQuery = EquipScanTaskQueryService.pageQuery(request, withFilterList)
+        val equipScanTask = pageQuery.content
+
+        if (!pageQuery.content.isNullOrEmpty()&&pageQuery.content!!.size>0) {
+            val equipScanTaskMap: Map<String?, List<EquipScanTaskQuery>> = equipScanTask?.stream()
+                    ?.collect(Collectors.groupingBy(EquipScanTaskQuery::classCode)) as Map<String?, List<EquipScanTaskQuery>>
+
+            for ((key, value) in equipScanTaskMap.entries) {
+                val categoryStatistics = CategoryStatistics()
+                categoryStatistics.code = key
+                categoryStatistics.name = dictTypeMap.get(key)
+                categoryStatistics.count = value.size
+                result.add(categoryStatistics)
+            }
+
+        }
+        return result
+    }
+
+
+
+}

+ 42 - 0
scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskQueryService.kt

@@ -31,6 +31,8 @@ import com.persagy.database.SFilter
 import com.persagy.database.functions.SLength
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.dictnew.DefClass
+import com.persagy.server.datacenter.models.entities.task.CategoryStatistics
+import com.persagy.server.datacenter.models.entities.task.EquipScanTaskQuery
 import com.persagy.server.datacenter.models.entities.task.ModelScanTaskQuery
 import com.persagy.server.services.DmpBaseService
 import com.persagy.server.services.base.RService
@@ -40,6 +42,7 @@ import com.persagy.service.SPageContext
 import com.persagy.service.models.requests.SQueryRequest
 import com.persagy.service.models.responses.SQueryResponse
 import org.springframework.beans.factory.annotation.Autowired
+import java.util.stream.Collectors
 
 
 /**
@@ -112,4 +115,43 @@ object ModelScanTaskQueryService : RService<ModelScanTaskQuery>(SMybatisDao(Mode
         return pageQuery
     } // Fun
 
+
+    /**
+     * 分类统计
+     */
+    fun categoryStatisticsModel(projectId:String,id: String,equipId: String): ArrayList<CategoryStatistics>{
+        val result = ArrayList<CategoryStatistics>()
+        //查询所有的设备类别
+        val dictTypeList = dmpBaseService?.queryDictType(JSONObject())
+        val dictTypeMap = HashMap<String, String>()
+        if (dictTypeList != null) {
+            for(dictType in dictTypeList){
+                dictType.code?.let { dictType.name?.let { it1 -> dictTypeMap.put(it, it1) } }
+            }
+        }
+        //查询设备任务
+        val request = SQueryRequest()
+        val withFilterList = ArrayList<SFilter>()
+        withFilterList.add(SFilter.eq("projectId", projectId))
+        withFilterList.add(SFilter.eq("taskParentId", id))
+        withFilterList.add(SFilter.eq("parentId", equipId))
+        val pageQuery = ModelScanTaskQueryService.pageQuery(request, withFilterList)
+        val equipScanTask = pageQuery.content
+
+        if (!pageQuery.content.isNullOrEmpty()&&pageQuery.content!!.size>0) {
+            val equipScanTaskMap: Map<String?, List<ModelScanTaskQuery>> = equipScanTask?.stream()
+                    ?.collect(Collectors.groupingBy(ModelScanTaskQuery::classCode)) as Map<String?, List<ModelScanTaskQuery>>
+
+            for ((key, value) in equipScanTaskMap.entries) {
+                val categoryStatistics = CategoryStatistics()
+                categoryStatistics.code = key
+                categoryStatistics.name = dictTypeMap.get(key)
+                categoryStatistics.count = value.size
+                result.add(categoryStatistics)
+            }
+
+        }
+        return result
+    }
+
 } // Class ModelScanTaskService

File diff suppressed because it is too large
+ 164 - 17
scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskService.kt


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

@@ -168,7 +168,7 @@ object PropertyScanTaskService : RService<PropertyScanTask>(SMybatisDao(Property
         }
         val equipIds = equipScanTaskList?.stream()?.map(PropertyScanTask::equipId)?.collect(Collectors.toList<String>())
         var equipRequest = SQueryRequest()
-        equipRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", equipIds) + "\'"
+        equipRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", equipIds) + "\')"
 
         val requestCascade = request.cascade
         //查询级联关系

+ 20 - 9
scanbuilding/src/main/kotlin/com/persagy/server/services/task/ScanTaskBaseService.kt

@@ -36,6 +36,7 @@ import com.persagy.server.datacenter.models.entities.task.base.ScanTaskBase
 import com.persagy.server.mappers.StatisticsCountMapper
 import com.persagy.server.services.AdmBaseService
 import com.persagy.server.services.DmpBaseService
+import com.persagy.server.services.StatisticsCountService
 import com.persagy.server.services.base.RService
 import com.persagy.server.util.AdmEntityTransferUtil
 import com.persagy.service.SPageContext
@@ -64,6 +65,9 @@ object ScanTaskBaseService : RService<ScanTaskBase>(SMybatisDao(ScanTaskBase::cl
     @Autowired
     private val admBaseService: AdmBaseService? = AdmBaseService()
 
+    @Autowired
+    private val statisticsCountService: StatisticsCountService? = StatisticsCountService()
+
     /**
      * 查询所有设备类型或设备族
      */
@@ -97,7 +101,14 @@ object ScanTaskBaseService : RService<ScanTaskBase>(SMybatisDao(ScanTaskBase::cl
              objTypeList.add("equipment")
              objTypeList.add("component")
              objTypes["\$in"] = objTypeList
-        }else{
+         }else if ("model" == type){
+             val objTypes = JSONObject()
+             val objTypeList: MutableList<String> = java.util.ArrayList()
+             objTypeList.add("equipment")
+             objTypeList.add("component")
+             objTypeList.add("model")
+             objTypes["\$in"] = objTypeList
+         }else{
              criteria["objType"] = type
          }
         param["criteria"] = criteria
@@ -178,13 +189,13 @@ object ScanTaskBaseService : RService<ScanTaskBase>(SMybatisDao(ScanTaskBase::cl
                 var buildingRequest = SQueryRequest()
 
                // buildingRequest.filters = "id in (" +builds!!.joinToString(",", ",", "'").substring(1) + ")"
-                buildingRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", builds) + "\'"
+                buildingRequest.filters = "id in "+"(\'" + java.lang.String.join("\',\'", builds) + "\')"
                 buildingRequest.pageSize = 1000
                 buildingRequest.pageNumber = 1
                 var cascade = SCascadeQuery()
                 cascade.name = "floor"
                 //cascade.filters = "id in (" +floors!!.joinToString(",", ",", "'").substring(1) + ")"
-                cascade.filters = "id in "+"(\'" + java.lang.String.join("\',\'", floors) + "\'"
+                cascade.filters = "id in "+"(\'" + java.lang.String.join("\',\'", floors) + "\')"
                 buildingRequest.cascade = arrayListOf(cascade)
                 //调用adm-middleware建筑查询接口
                 val buildingList = admBaseService?.queryBuilding(buildingRequest) as ArrayList<Building>?
@@ -281,9 +292,9 @@ object ScanTaskBaseService : RService<ScanTaskBase>(SMybatisDao(ScanTaskBase::cl
         try {
             val projectId = SPageContext.getHeader("projectId").toString()
             if (!equipScanTask.id.isNullOrEmpty()&&!equipScanTask.equipId.isNullOrEmpty()){
-                val categoryStatistics = mapper.categoryStatistics(projectId,equipScanTask.id!!, equipScanTask.equipId!!)
+                val categoryStatistics = statisticsCountService?.categoryStatistics(projectId,equipScanTask.id!!, equipScanTask.equipId!!)
                 val sQueryResponse = SQueryResponse<CategoryStatistics>()
-                sQueryResponse.total = categoryStatistics.size.toLong()
+                sQueryResponse.total = categoryStatistics?.size?.toLong()
                 sQueryResponse.content = categoryStatistics
                 sQueryResponse.result = SResponseType.success
                 return sQueryResponse
@@ -307,16 +318,16 @@ object ScanTaskBaseService : RService<ScanTaskBase>(SMybatisDao(ScanTaskBase::cl
             val projectId = SPageContext.getHeader("projectId")
             if (!equipScanTask.id.isNullOrEmpty()&&!equipScanTask.equipId.isNullOrEmpty()){
                 if (!type.isNullOrEmpty()&&type == "model"){
-                    val categoryStatistics = ModelScanTaskService.mapper.categoryStatisticsModel(projectId!!,equipScanTask.id!!, equipScanTask.equipId!!)
+                    val categoryStatistics = statisticsCountService?.categoryStatisticsModel(projectId!!,equipScanTask.id!!, equipScanTask.equipId!!)
                     val sQueryResponse = SQueryResponse<CategoryStatistics>()
-                    sQueryResponse.total = categoryStatistics.size.toLong()
+                    sQueryResponse.total = categoryStatistics?.size?.toLong()
                     sQueryResponse.content = categoryStatistics
                     sQueryResponse.result = SResponseType.success
                     return sQueryResponse
                 }else{
-                    val categoryStatistics = mapper.categoryStatistics(projectId!!,equipScanTask.id!!, equipScanTask.equipId!!)
+                    val categoryStatistics = statisticsCountService?.categoryStatistics(projectId!!,equipScanTask.id!!, equipScanTask.equipId!!)
                     val sQueryResponse = SQueryResponse<CategoryStatistics>()
-                    sQueryResponse.total = categoryStatistics.size.toLong()
+                    sQueryResponse.total = categoryStatistics?.size?.toLong()
                     sQueryResponse.content = categoryStatistics
                     sQueryResponse.result = SResponseType.success
                     return sQueryResponse

+ 93 - 0
scanbuilding/src/main/kotlin/com/persagy/server/util/GeoToolsUtil.kt

@@ -0,0 +1,93 @@
+package com.persagy.server.util
+
+import org.geotools.geometry.jts.JTSFactoryFinder
+import org.locationtech.jts.geom.LinearRing
+import cn.hutool.core.collection.CollUtil
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.persagy.server.datacenter.models.entities.assistant.PointPosition
+import org.locationtech.jts.geom.Coordinate
+import org.locationtech.jts.geom.Point
+import org.locationtech.jts.geom.Polygon
+import kotlin.collections.ArrayList
+
+/**
+ * @ClassName GeoToolsUtil
+ * @Description: 点面包含关系分析
+ * @Author linhuili
+ * @Date 2021/9/3 20:31
+ * @Version V1.0
+ */
+object GeoToolsUtil {
+    /**
+     * 创建点
+     * @param pointLocal
+     */
+    private fun createPoint(pointLocal: ObjectNode): Point {
+        var x = 0.0
+        var y = 0.0
+        val z = 0.0
+        if (pointLocal["X"] != null) {
+            x = pointLocal["X"].doubleValue()
+        }
+        if (pointLocal["Y"] != null) {
+            y = pointLocal["Y"].doubleValue()
+        }
+        val geometryFactory = JTSFactoryFinder.getGeometryFactory()
+        val coord = Coordinate(x, y, z)
+        return geometryFactory.createPoint(coord)
+    }
+
+    /**
+     * 创建面
+     * @param outLines
+     */
+    private fun createPolygon(outLines: ArrayList<ArrayList<PointPosition>>?): Polygon {
+        val pointPositions = outLines?.get(0)
+        val geometryFactory = JTSFactoryFinder.getGeometryFactory()
+        val objects: MutableList<Coordinate> = ArrayList()
+        for (outLine in pointPositions!!) {
+            var x = 0.0
+            if(outLine.x != null){
+                x = outLine.x!!
+            }
+            var y = 0.0
+            if(outLine.y != null){
+                y = outLine.y!!
+            }
+
+            var z = 0.0
+            if(outLine.z!= null){
+                z = outLine.z!!
+            }
+            val coordinate = Coordinate(x, y, z)
+            objects.add(coordinate)
+
+
+        }
+        //注意数据的闭合
+        val coordinates = objects.toTypedArray()
+        val ring = geometryFactory.createLinearRing(coordinates)
+        val holes: Array<LinearRing>? = null
+        return geometryFactory.createPolygon(ring, holes)
+    }
+
+    /**
+     * 点面包含关系判断
+     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
+     * @param pointLocal 坐标点
+     * @param outLines 轮廓线
+     * @return
+     */
+    fun isPointInPoly(pointLocal: ObjectNode?, outLines: ArrayList<ArrayList<PointPosition>>?): Boolean {
+        if (null == pointLocal || CollUtil.isEmpty(outLines)) {
+            return false
+        }
+        //创建点
+        val point = createPoint(pointLocal)
+        //创建面
+        val polygon = createPolygon(outLines)
+        //判断点面包含关系
+        return polygon.contains(point)
+    }
+
+}

+ 1 - 1
scheduler/build.gradle

@@ -58,7 +58,7 @@ dependencies {
     compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION
     compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION
     //消息
-    compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
+   // compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
     providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION
     // spring boot 缓存
     compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION

+ 4 - 2
scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/controllers/DownloadController.kt

@@ -33,11 +33,12 @@ open class DownloadController {
         private val logger = LoggerFactory.getLogger(DownloadController::class.java)
     } // Companion object
 
-    @Autowired
-    lateinit var activeMQ : JMSProducer
+   /* @Autowired
+    lateinit var activeMQ : JMSProducer*/
     /**
      * 下载速度
      */
+/*
     @ApiOperation(value = "下载速度", notes = "")
     @PostMapping(value = ["/speed"])
     fun speed(@RequestBody request: DownloadSpeedRequest): SBaseResponse {
@@ -57,6 +58,7 @@ open class DownloadController {
         }catch (ignore : Exception){}
         return SBaseResponse()
     } // Function create()
+*/
 
 //    /**
 //     * 创建Task

+ 0 - 1
scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/ActiveMQConsumer.kt

@@ -1,6 +1,5 @@
 package cn.sagacloud.server.scheduler.service
 
-import org.springframework.jms.annotation.JmsListener
 import org.springframework.stereotype.Component
 import org.springframework.stereotype.Service
 

+ 2 - 7
scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/JMSProducer.kt

@@ -1,17 +1,12 @@
 package cn.sagacloud.server.scheduler.service
 
-import com.alibaba.fastjson.JSON
-import org.apache.activemq.command.ActiveMQTopic
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.jms.core.JmsMessagingTemplate
 import org.springframework.stereotype.Service
-import javax.jms.Destination
 
 
 @Service
 class JMSProducer {
 
-    @Autowired // 也可以注入JmsTemplate,JmsMessagingTemplate对JmsTemplate进行了封装
+    /*@Autowired // 也可以注入JmsTemplate,JmsMessagingTemplate对JmsTemplate进行了封装
     lateinit var jmsTemplate: JmsMessagingTemplate
 
     val destinationTest = ActiveMQTopic("mytest.topic")
@@ -19,7 +14,7 @@ class JMSProducer {
 
     fun sendMessage(message: String?) {
         jmsTemplate.convertAndSend(destination, message?:"")
-    }
+    }*/
 
 //    fun sendMessage(message: JSON) {
 //        jmsTemplate.convertAndSend(destination, message.toJSONString())

+ 11 - 11
scheduler/src/main/resources-dev/application.yml

@@ -62,19 +62,19 @@ spring:
 #    pool.enabled:                       false
 #    user:                               admin
 #    password:                           admin
-  activemq:
-    broker-url: failover:(tcp://192.168.64.15:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+  #activemq:
+   # broker-url: failover:(tcp://192.168.64.15:61616)
+    #in-memory: true
+    #pool:
+     # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 
-  jms:
-    pub-sub-domain: true
+    #jms:
+  #  pub-sub-domain: true
 
-topic:                                 datacenter.broadcast
+#topic:                                 datacenter.broadcast
 
 mybatis:
   typeAliasesPackage:                   cn.sagacloud.server.datacenter.entities

+ 8 - 8
scheduler/src/main/resources-prod/application.yml

@@ -67,14 +67,14 @@ spring:
 #    pool.enabled:                       false
 #    user:                               admin
 #    password:                           admin
-  activemq:
-    broker-url: failover:(tcp://172.17.100.16:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://192.168.64.15:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 
   jms:
     pub-sub-domain: true

+ 8 - 8
scheduler/src/main/resources-prod/application60.yml

@@ -67,14 +67,14 @@ spring:
 #    pool.enabled:                       false
 #    user:                               admin
 #    password:                           admin
-  activemq:
-    broker-url: failover:(tcp://60.205.177.43:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://192.168.64.15:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 
   jms:
     pub-sub-domain: true

+ 8 - 8
scheduler/src/main/resources-test/application.yml

@@ -67,14 +67,14 @@ spring:
 #    pool.enabled:                       false
 #    user:                               admin
 #    password:                           admin
-  activemq:
-    broker-url: failover:(tcp://192.168.64.14:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://192.168.64.15:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 
   jms:
     pub-sub-domain: true

+ 8 - 8
scheduler/src/main/resources-test/application60.yml

@@ -67,14 +67,14 @@ spring:
 #    pool.enabled:                       false
 #    user:                               admin
 #    password:                           admin
-  activemq:
-    broker-url: failover:(tcp://60.205.177.43:61616)
-    in-memory: true
-    pool:
-      enabled: false
-    user: admin
-    password: admin
-    non-blocking-redelivery: true
+      #activemq:
+      # broker-url: failover:(tcp://192.168.64.15:61616)
+      #in-memory: true
+      #pool:
+      # enabled: false
+    #user: admin
+    #password: admin
+    #non-blocking-redelivery: true
 
   jms:
     pub-sub-domain: true