Browse Source

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

 Conflicts:
	revit-algorithm/src/main/resources-dev/application.yml
lijie 3 years ago
parent
commit
f7bc35ab34
32 changed files with 283 additions and 240 deletions
  1. 5 5
      data-core/src/main/kotlin/com/persagy/server/datacenter/models/entities/objects/ZoneIspace.kt
  2. 1 1
      meiku/src/main/resources/application.yml
  3. 7 6
      message-center/src/main/resources/application-dev.yml
  4. 2 2
      message-center/src/main/resources/application-test.yml
  5. 3 0
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/model/datacenter/DCISpace.kt
  6. 4 0
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/state/DataCheckState_10.kt
  7. 4 1
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/state/DataExportState_20.kt
  8. 4 3
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/common/utils/SpaceAffectUtil.kt
  9. 1 0
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/config/DataCenterConfig.kt
  10. 1 1
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/modelFile/ModelFile.kt
  11. 3 1
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/CommonService.kt
  12. 13 0
      revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/datacenter/DataCenterRequest.kt
  13. 16 14
      revit-algorithm/src/main/resources-dev/application.yml
  14. 8 8
      revit-algorithm/src/main/resources-prod/application.yml
  15. 8 8
      revit-algorithm/src/main/resources-prod/application14.yml
  16. 8 8
      revit-algorithm/src/main/resources-prod/application239.yml
  17. 8 8
      revit-algorithm/src/main/resources-prod/application60.yml
  18. 1 1
      scanbuilding/build.gradle
  19. 1 0
      scanbuilding/src/main/kotlin/com/persagy/server/services/AdmBaseService.kt
  20. 34 14
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/ModelScanTaskService.kt
  21. 8 1
      scanbuilding/src/main/kotlin/com/persagy/server/services/task/ScanTaskBaseService.kt
  22. 0 104
      scanbuilding/src/main/kotlin/com/persagy/server/util/GeoToolsUtil.java
  23. 93 0
      scanbuilding/src/main/kotlin/com/persagy/server/util/GeoToolsUtil.kt
  24. 1 1
      scheduler/build.gradle
  25. 4 2
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/controllers/DownloadController.kt
  26. 0 1
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/ActiveMQConsumer.kt
  27. 2 7
      scheduler/src/main/kotlin/cn/sagacloud/server/scheduler/service/JMSProducer.kt
  28. 11 11
      scheduler/src/main/resources-dev/application.yml
  29. 8 8
      scheduler/src/main/resources-prod/application.yml
  30. 8 8
      scheduler/src/main/resources-prod/application60.yml
  31. 8 8
      scheduler/src/main/resources-test/application.yml
  32. 8 8
      scheduler/src/main/resources-test/application60.yml

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

@@ -154,11 +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
+   /* @Schema(description = "轮廓线")
+    val outLine: List<LinkedHashMap<String, Any>>? = null*/
 
 }

+ 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        # 限制上传的多个文件的总大小

+ 3 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/model/datacenter/DCISpace.kt

@@ -41,6 +41,9 @@ class DCISpace : DCDataBase(){
     @JSONField(name = "modelId")
     var modelId: String? = null
 
+    @JSONField(name = "state")
+    var state: Int? = null
+
     /** 建筑id */
     @JSONField(name = "buildingId")
     var buildingId: String? = null

+ 4 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/state/DataCheckState_10.kt

@@ -205,12 +205,16 @@ class DataCheckState_10 : ModelState {
                             message = messageService.buildCheckErrorMessage(it.projectId, it.userId
                                     ?: "", "${folderFloorName.first}的${folderFloorName.second}未通过模型检查, 请修改后重新上传", "平面图命名和项目长度检查未通过", excelService.getDownloadUrl(it.id!!), folderFloorName)
                         }
+                        // 20211030 mysql的json内"转义是\\",由于现有驱动bug,先不要resultjson了
+                        it.taskInfo!!.checkTask!!.resultJson = null
                         dataService.modelFileService.update(it, UploadedState_1.projection)
                         monitorService.endCheck(it.id!!, checkTime)
                         monitorService.modelCheck(it.id!!, noReportMsg, true)
                         messageService.sendMessage(message)
                     } else if (it.status == 2) {
                         message = messageService.buildRefreshMessage(it.projectId, it.userId ?: "")
+                        // 20211030 mysql的json内"转义是\\",由于现有驱动bug,先不要resultjson了
+                        it.taskInfo!!.checkTask!!.resultJson = null
                         dataService.modelFileService.update(it, UploadedState_1.projection)
                         monitorService.endCheck(it.id!!, checkTime)
                         monitorService.modelCheck(it.id!!, singleModelCheckBegin!!, singleModelCheckEnd!!)

+ 4 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/backstage/state/DataExportState_20.kt

@@ -115,7 +115,6 @@ class DataExportState_20 : ModelState {
                             } else {
                                 if ("success".equals(json["Result"] as String?, ignoreCase = true)) {
                                     it.status = 3
-                                    task.resultJson = null
                                 } else {
                                     it.status = 21
                                 }
@@ -132,12 +131,16 @@ class DataExportState_20 : ModelState {
                         // 发送检查通过通知
                         message = messageService.buildExportErrorMessage(it.projectId, it.userId ?: "",
                                 "${folderFloorName.first}的${folderFloorName.second}模型上传失败,请重新上传", "模型导出数据失败: ${it.taskInfo!!.exportTask!!.resultJson}, 请联系开发人员")
+                        // 20211030 mysql的json内"转义是\\",由于现有驱动bug,先不要resultjson了
+                        it.taskInfo!!.exportTask!!.resultJson = null
                         dataService.modelFileService.update(it, UploadedState_1.projection)
                         monitorService.endExport(it.id!!, exportTime)
                         monitorService.modelExport(it.id!!, it.taskInfo!!.exportTask!!.resultJson, true)
                         messageService.sendMessage(message)
                     } else if (it.status == 3) {
                         message = messageService.buildRefreshMessage(it.projectId, it.userId ?: "")
+                        // 20211030 mysql的json内"转义是\\",由于现有驱动bug,先不要resultjson了
+                        it.taskInfo!!.exportTask!!.resultJson = null
                         dataService.modelFileService.update(it, UploadedState_1.projection)
                         monitorService.endExport(it.id!!, exportTime)
                         monitorService.modelExport(it.id!!)

+ 4 - 3
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/common/utils/SpaceAffectUtil.kt

@@ -111,7 +111,8 @@ class SpaceAffectUtil {
             // 有交集则加入有变化的空间列表
             for(affect in affectList) {
                 if (isGeoContains(polygon, affect!!)) {
-                    // TODO state设置为1
+                    // state设置为1
+                    space.state = 1
                     rsList.add(space)
                     break;
                 }
@@ -164,7 +165,7 @@ class SpaceAffectUtil {
     private fun updateSpaceList(projectId: String, spaces: List<DCISpace?>?) {
         val request = UpdateRequest<DCISpace>()
         request.content = spaces as ArrayList<DCISpace>
-        service!!.iSpaceUpdate(request, projectId)
+        service!!.spaceUpdate(request, projectId)
     }
 
     /**
@@ -187,7 +188,7 @@ class SpaceAffectUtil {
             return null
         }
         val floors = response.content
-        val spaceList: MutableList<DCISpace> = ArrayList<DCISpace>()
+        val spaceList: MutableList<DCISpace> = ArrayList()
         for (floor in floors!!) {
             val spaces: List<DCISpace>? = floor!!.spaceList
             if (CollectionUtils.isEmpty(spaces)) {

+ 1 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/config/DataCenterConfig.kt

@@ -18,6 +18,7 @@ class DataCenterConfig {
     lateinit var ispaceDelete: String
     lateinit var ispaceQuery: String
     lateinit var ispaceUpdate: String
+    lateinit var spaceUpdate: String
     lateinit var componentCreate: String
     lateinit var componentDelete: String
     lateinit var componentQuery: String

+ 1 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/models/modelFile/ModelFile.kt

@@ -134,7 +134,7 @@ class ModelFile : SBaseEntity() {
     /** 标记模型文件是否已被删除, true是已删除 */
     @ApiModelProperty(value = "标记模型文件是否已被删除, true是已删除")
     @Column(name = "removed")
-    var removed: Boolean? = null
+    var removed: Boolean? = false
 
     // new
 

+ 3 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/CommonService.kt

@@ -185,6 +185,8 @@ object CommonService {
      * 获取异常的堆栈信息
      */
     fun getStackTrace(e : Throwable): String? {
-        return org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e)
+//        return org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e)
+        // 20211101 由于mysql驱动,处理json有问题,因此在此先简化处理,不返详情了
+        return org.apache.commons.lang3.exception.ExceptionUtils.getMessage(e)
     }
 }

+ 13 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/services/datacenter/DataCenterRequest.kt

@@ -198,6 +198,19 @@ class DataCenterRequest{
     }
 
     /**
+     * 空间更新
+     */
+    fun spaceUpdate(request : UpdateRequest<DCISpace>, projectId : String) : BaseResponse?{
+        try {
+            val postBody = JSON.toJSONString(request)
+            val resultStr = HttpService.sendPostDataCenter(properties.datacenter.spaceUpdate, postBody, projectId)
+            return JSON.parseObject(resultStr, object : TypeReference<BaseResponse>() { })
+        } catch (e: Exception) {
+        }
+        return null
+    }
+
+    /**
      * 楼层查询
      */
     fun floorQuery(request : QueryRequest, projectId : String) : QueryResponse<DCFloor>?{

+ 16 - 14
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
 
@@ -82,12 +82,12 @@ properties:
     # 基本属性
     url:                               http://api.sagacloud.cn/dp-auxiliary/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
     #url:                               http://image-service:8080/
-    systemId:                          revit
-    secret:                            63afbef6906c342b
-    dir:                               model
-    baseGraph:                         base
-    report:                            report
-    export:                            export
+    systemId: revit
+    secret: 63afbef6906c342b
+    dir: model
+    baseGraph: base
+    report: report
+    export: export
     # 配置文件引用的属性
     suffixWithSecret:                  ?systemId=${properties.fileService.systemId}&secret=${properties.fileService.secret}
     suffix:                            ?systemId=${properties.fileService.systemId}
@@ -124,6 +124,8 @@ properties:
     ispaceDelete: ${properties.datacenter.url}object/ispace/delete
     ispaceQuery: ${properties.datacenter.url}object/ispace/query
     ispaceUpdate: ${properties.datacenter.url}object/ispace/update
+    # 空间相关接口
+    spaceUpdate: ${properties.datacenter.url}object/zone/update
     # 部件相关接口
     componentCreate: ${properties.datacenter.url}object/component/create
     componentDelete: ${properties.datacenter.url}object/component/delete

+ 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
 

+ 1 - 1
scanbuilding/build.gradle

@@ -61,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

+ 1 - 0
scanbuilding/src/main/kotlin/com/persagy/server/services/AdmBaseService.kt

@@ -108,6 +108,7 @@ class AdmBaseService {
         }
         val content = ArrayList<ZoneIspace>()
         for(obj in result.content!!){
+
             val ispace = JSON.toJavaObject(obj, ZoneIspace::class.java)
             content.add(ispace)
         }

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


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

@@ -101,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

+ 0 - 104
scanbuilding/src/main/kotlin/com/persagy/server/util/GeoToolsUtil.java

@@ -1,104 +0,0 @@
-package com.persagy.server.util;
-
-import cn.hutool.core.collection.CollUtil;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.geotools.geometry.jts.JTSFactoryFinder;
-import org.locationtech.jts.geom.*;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-
-/**
- * @ClassName GeoToolsUtil
- * @Description: 点面包含关系分析
- * @Author linhuili
- * @Date 2021/9/3 20:31
- * @Version V1.0
- **/
-public class GeoToolsUtil {
-    /**
-     * 创建点
-     * @param pointLocal
-     */
-    private static Point createPoint(ObjectNode pointLocal){
-        double x =0L;
-        double y =0L;
-        double z =0L;
-        if(pointLocal.get("X") != null){
-            x =pointLocal.get("X").doubleValue();
-        }
-        if(pointLocal.get("Y") != null){
-            y = pointLocal.get("Y").doubleValue();
-        }
-        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
-        Coordinate coord = new Coordinate(x, y,z);
-        Point point = geometryFactory.createPoint(coord);
-        return point;
-    }
-
-    /**
-     * 创建面
-     * @param outLines
-     */
-    private static Polygon createPolygon(List<LinkedHashMap<String,Object>> outLines){
-        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
-        List<Coordinate> objects = new ArrayList<>();
-        for (LinkedHashMap<String,Object> outLine : outLines) {
-            double x = Double.parseDouble(outLine.getOrDefault("X",0.0D).toString());
-            double y = Double.parseDouble(outLine.getOrDefault("Y",0.0D).toString());
-            double z = 0L;
-            Coordinate coordinate = new Coordinate(x, y, z);
-            objects.add(coordinate);
-        }
-        //注意数据的闭合
-        Coordinate[] coordinates = objects.toArray(new Coordinate[0]);
-        LinearRing ring = geometryFactory.createLinearRing(coordinates);
-        LinearRing holes[] = null;
-        Polygon polygon = geometryFactory.createPolygon(ring, holes);
-
-        return polygon;
-    }
-
-    /**
-     * 点面包含关系判断
-     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
-     * @param pointLocal 坐标点
-     * @param outLines 轮廓线
-     * @return
-     */
-    public static Boolean isPointInPoly(ObjectNode pointLocal, List<LinkedHashMap<String,Object>> outLines) {
-        if (null==pointLocal || CollUtil.isEmpty(outLines)){
-            return false;
-        }
-        //创建点
-        Point point = createPoint(pointLocal);
-        //创建面
-        Polygon polygon = createPolygon(outLines);
-        //判断点面包含关系
-        return polygon.contains(point);
-    }
-    /**
-     * 点面包含关系判断
-     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
-     * @param fromOutLines: 轮廓坐标
-     * @param toOutLines: 轮廓坐标
-     * @return
-     */
-    public static Boolean isPolyInPoly(List<LinkedHashMap<String,Object>> fromOutLines,
-                                       List<LinkedHashMap<String,Object>> toOutLines) {
-        if (CollUtil.isEmpty(fromOutLines) || CollUtil.isEmpty(toOutLines)){
-            return false;
-        }
-        //创建点
-        Polygon fromPolygon = createPolygon(fromOutLines);
-        //创建面
-        Polygon toPolygon = createPolygon(toOutLines);
-        //判断面-面包含关系
-        return fromPolygon.contains(toPolygon)
-                || fromPolygon.equalsTopo(toPolygon)
-                || fromPolygon.overlaps(toPolygon)
-                || toPolygon.contains(fromPolygon);
-    }
-}

+ 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