Bläddra i källkod

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-middleware.git into develop

zhangqiankun 3 år sedan
förälder
incheckning
bf8e84cfc5

+ 10 - 10
src/main/java/com/persagy/proxy/adm/service/impl/AdmModelRelServiceImpl.java

@@ -125,8 +125,8 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
 
         //查询模型下的设备信息
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("bimId = "+modelRel.getBimId());
-        criteria.setFilters("floorId = "+modelRel.getFloorId());
+        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
+        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
         AdmResponse admResponse = equipmentService.doQuery(context, criteria, AdmEquipment.class);
         List<AdmEquipment> content = (List<AdmEquipment>) admResponse.getContent();
         if(CollUtil.isEmpty(content)){
@@ -149,8 +149,8 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
 
         //查询模型下的元空间信息
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("bimId = "+modelRel.getBimId());
-        criteria.setFilters("floorId = "+modelRel.getFloorId());
+        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
+        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
         AdmResponse admResponse = iSpaceService.doQuery(context, criteria, AdmISpace.class);
         List<AdmISpace> content = (List<AdmISpace>) admResponse.getContent();
         if(CollUtil.isEmpty(content)){
@@ -186,9 +186,9 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
             }
             String[] split = bimLocation.split(",");
             ObjectNode node = JsonNodeFactory.instance.objectNode();
-            node.put("X",split[0]);
-            node.put("Y",split[1]);
-            node.put("Z",split[2]);
+            node.put("x",Double.valueOf(split[0]));
+            node.put("y",Double.valueOf(split[1]));
+            node.put("z",Double.valueOf(split[2]));
             flag = GeoToolsUtil.isPointInPoly(node,outline);
             if(!flag){
                 return flag;
@@ -230,7 +230,7 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
         if(floorMap.containsKey(AdmCommonConstant.FLOOR_ELEVATION)){
             Object object = floorMap.get(AdmCommonConstant.FLOOR_ELEVATION);
             if(object != null){
-                double floorElevation = (Double) object / 1000;
+                double floorElevation = Double.valueOf(object.toString()) / 1000;
                 infos.put(AdmCommonConstant.FLOOR_ELEVATION,floorElevation);
             }
         }
@@ -273,8 +273,8 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
     private List<AdmEquipment> queryModelEquip(InstanceUrlParam context, AdmModelRel modelRel){
         //查询模型下的设备信息
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
-        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
+        criteria.setFilters("bimId = '"+modelRel.getBimId()+"' and floorId = '"+modelRel.getFloorId()+"'");
+       // criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
         AdmResponse admResponse = equipmentService.doQuery(context, criteria, AdmEquipment.class);
         if(CollUtil.isEmpty(admResponse.getContent())){
             return new ArrayList<>();

+ 20 - 18
src/main/java/com/persagy/proxy/adm/utils/GeoToolsUtil.java

@@ -21,17 +21,17 @@ public class GeoToolsUtil {
      * @param pointLocal
      */
     private static Point createPoint(ObjectNode pointLocal){
-        Long x = 0L;
-        Long y = 0L;
-        Long z = 0L;
-        if(pointLocal.get("X") != null){
-            x = Long.valueOf(pointLocal.get("X").textValue());
+        Long x =0L;
+        Long y =0L;
+        Long z =0L;
+        if(pointLocal.get("x") != null){
+            x = pointLocal.get("x").longValue();
         }
-        if(pointLocal.get("Y") != null){
-            y = Long.valueOf(pointLocal.get("Y").textValue());
+        if(pointLocal.get("y") != null){
+            y = pointLocal.get("y").longValue();
         }
-        if(pointLocal.get("Z") !=null){
-            z = Long.valueOf(pointLocal.get("Z").textValue());
+        if(pointLocal.get("z") !=null){
+            z = pointLocal.get("z").longValue();
         }
         GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
         Coordinate coord = new Coordinate(x, y,z);
@@ -50,22 +50,24 @@ public class GeoToolsUtil {
             Long x = 0L;
             Long y = 0L;
             Long z = 0L;
-            if(outLine.get("X") != null){
-                x = Long.valueOf(outLine.get("X").textValue());
+            if(outLine.get("x") != null){
+                x =outLine.get("x").longValue();
             }
-            if(outLine.get("Y") != null){
-                y = Long.valueOf(outLine.get("Y").textValue());
+            if(outLine.get("y") != null){
+                y = outLine.get("y").longValue();
             }
-            if(outLine.get("Z") !=null){
-                z = Long.valueOf(outLine.get("Z").textValue());
+            if(outLine.get("z") !=null){
+                z = outLine.get("z").longValue();
             }
             Coordinate coordinate = new Coordinate(x, y, z);
             objects.add(coordinate);
         }
+        //注意数据的闭合
         Coordinate[] coordinates = objects.toArray(new Coordinate[0]);
-        LinearRing ring = geometryFactory.createLinearRing(objects.toArray(new Coordinate[0]));
-        LinearRing holes[] = null; // use LinearRing[] to represent holes
+        LinearRing ring = geometryFactory.createLinearRing(coordinates);
+        LinearRing holes[] = null;
         Polygon polygon = geometryFactory.createPolygon(ring, holes);
+
         return polygon;
    }
 
@@ -76,7 +78,7 @@ public class GeoToolsUtil {
      * @param outLines 轮廓线
      * @return
      */
-   public static Boolean isPointInPoly(ObjectNode pointLocal, List<ObjectNode> outLines){
+   public static Boolean isPointInPoly(ObjectNode pointLocal, List<ObjectNode> outLines) {
        //创建点
        Point point = createPoint(pointLocal);
        //创建面