瀏覽代碼

Merge remote-tracking branch 'origin/develop' into develop

lvxianyun 3 年之前
父節點
當前提交
2a392dc16b

+ 1 - 1
docker/dockerfiles/adm-middleware/entrypoint.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 echo "entrypoint run..."
-java -jar $JAVA_OPTS -DCONFIG_FILE_PATH=/data/SpringCloud app.jar
+java -jar $JAVA_OPTS -Dserver.port=$SERVER_PORT -Deureka.client.service-url.defaultZone=$EUREKA_CLIENT_DEFAULT_ZONE -Dspring.cloud.config.profile=$SPRING_CLOUD_CONFIG_PROFILE -Dspring.cloud.config.uri=$SPRING_CLOUD_CONFIG_URI app.jar

+ 4 - 4
docker/k8sfiles/adm-middleware.yml

@@ -9,8 +9,8 @@ spec:
   selector:
     app: adm-middleware
   ports:
-  - port: 8876
-    targetPort: 8876
+  - port: 8080
+    targetPort: 8080
     name: server-port
 
 ---
@@ -33,13 +33,13 @@ spec:
         image: labisenlin.persagy.com/library/adm-middleware:latest
         imagePullPolicy: Always
         ports:
-        - containerPort: 9986
+        - containerPort: 8080
           name: server-port
         env:
         - name: TZ
           value: Asia/Shanghai
         - name: SERVER_PORT
-          value: "8876"
+          value: "8080"
         - name: SPRING_CLOUD_CONFIG_URI
           valueFrom:
             configMapKeyRef:

+ 78 - 2
src/main/java/com/persagy/proxy/adm/service/impl/AdmRelCalServiceImpl.java

@@ -2,10 +2,15 @@ package com.persagy.proxy.adm.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.QueryCriteriaHelper;
 import com.persagy.dmp.common.constant.CommonConstant;
+import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationCaclFacade;
@@ -152,12 +157,83 @@ public class AdmRelCalServiceImpl implements AdmRelCalService {
      */
     private List<TwicePointDTO> queryAllDoorByFloorModelId(String floorModelId, InstanceUrlParam context) {
         // 门的classCode:CFBEDR,obj_type为equipment
-        //new QueryCriteria();
-        //DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(),context.getAppId(),context.getUserId(),)
+        QueryCriteria queryCriteria = new QueryCriteria();
+        queryCriteria.getCriteria().put("classCode","CFBEDR")
+                .put("objType",AdmObjectType.EQUIPMENT.getIndex())
+                .put("modelId",floorModelId);
+        List<ObjectNode> objectNodes = DigitalObjectFacade
+                .query(context.getGroupCode(), context.getProjectId(), context.getAppId(),
+                        context.getUserId(), queryCriteria);
+        if (CollUtil.isEmpty(objectNodes)){
+            return new ArrayList<>();
+        }
+        List<TwicePointDTO> result = new ArrayList<>();
+        for (ObjectNode objectNode : objectNodes) {
+            // 1.获得outline
+            if (!objectNode.has("outline")
+                    || !objectNode.get("outline").isArray()
+                    || !(objectNode.get("outline").size()>2)){
+                continue;
+            }
+            if (!objectNode.has("location")
+                    || !objectNode.get("location").isObject()
+                    || !objectNode.get("location").has("points")
+                    || !objectNode.get("location").get("points").isArray()
+                    || !(objectNode.get("location").get("points").size()>=1)){
+                continue;
+            }
+            JsonNode point = objectNode.get("location").get("points").get(0);
+            ArrayNode points = (ArrayNode) objectNode.get("outline").get(0);
+            JsonNode firstPoint = points.get(0);
+            JsonNode secondPoint = points.get(1);
+
+
+
+
+
+        }
+
 
         return null;
 
 
 
     }
+    /***
+     * Description: 计算两点之间的距离(我不太明白这个算法是怎么算的)
+     * @param x1 : 坐标点1的x值
+     * @param y1 : 坐标点1的y值
+     * @param x2 : 坐标点2的x值
+     * @param y2 : 坐标点2的y值
+     * @return : java.lang.Double  
+     * @author : lijie
+     * @date :2021/10/8 11:31
+     * Update By lijie 2021/10/8 11:31
+     */
+    private Double getPoints(Double x1,Double y1,Double x2,Double y2){
+        if (x1.equals(x2) && y1.equals(y2)){
+            return null;
+        }
+        Double k=null;
+        if (!x1.equals(x2)){
+            k=(y2-y1)/(x2-x1);
+        }
+        if (null==k){
+            return 0.00;
+        }
+        if (0.00 == k){
+            return null;
+        }
+        return 1/k;
+    }
+
+
+
+
+
+
+
+
+
+
 }