소스 검색

实现空间对空间的关系计算

lijie 3 년 전
부모
커밋
20373d8848
1개의 변경된 파일77개의 추가작업 그리고 2개의 파일을 삭제
  1. 77 2
      src/main/java/com/persagy/proxy/adm/service/impl/AdmRelCalServiceImpl.java

+ 77 - 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,82 @@ 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 null;
+        }
+        return null;
+
+
+    }
+
+
+
+
+
+
+
+
+
+
 }