dengsixing 5 months ago
parent
commit
c7f62ab5ba

+ 5 - 0
src/main/java/com/fdkankan/scene/dto/GeoPoint.java

@@ -2,6 +2,8 @@ package com.fdkankan.scene.dto;
 
 
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.Objects;
+
 /**
 /**
  * @author Xiewj
  * @author Xiewj
  * @date 2021/11/9
  * @date 2021/11/9
@@ -30,6 +32,9 @@ public class GeoPoint {
         }
         }
     }
     }
     public Double[] getCoordinates() {
     public Double[] getCoordinates() {
+        if(Objects.isNull(this.lon) || Objects.isNull(this.lat) || Objects.isNull(this.alt)){
+            return new Double[]{};
+        }
         return new Double[]{this.lon, this.lat, this.alt};
         return new Double[]{this.lon, this.lat, this.alt};
     }
     }
 
 

+ 9 - 13
src/main/java/com/fdkankan/scene/service/impl/VisionServiceImpl.java

@@ -28,7 +28,6 @@ public class VisionServiceImpl implements IVisionService {
 
 
     @Override
     @Override
     public List<GeoPoint> getPointLatAndLon(String num) {
     public List<GeoPoint> getPointLatAndLon(String num) {
-        List<Map<String, Object>> list = Lists.newArrayList();
         String visionTxt = fYunFileService.getFileContent(String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
         String visionTxt = fYunFileService.getFileContent(String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
         JSONObject visionJson = JSON.parseObject(visionTxt);
         JSONObject visionJson = JSON.parseObject(visionTxt);
         if(!visionJson.containsKey("sweepLocations")){
         if(!visionJson.containsKey("sweepLocations")){
@@ -42,26 +41,23 @@ public class VisionServiceImpl implements IVisionService {
             Long uuid = sweepItem.getLong("uuid");
             Long uuid = sweepItem.getLong("uuid");
             JSONObject ggaLocation = sweepItem.getJSONObject("ggaLocation");
             JSONObject ggaLocation = sweepItem.getJSONObject("ggaLocation");
             GeoPoint geoPoint = new GeoPoint();
             GeoPoint geoPoint = new GeoPoint();
+            geoPoint.setId(id);
+            geoPoint.setUuid(uuid);
             if (Objects.nonNull(ggaLocation)
             if (Objects.nonNull(ggaLocation)
                     && StrUtil.isNotEmpty(ggaLocation.getString("lon"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("lon"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("lat"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("lat"))
                     && StrUtil.isNotEmpty(ggaLocation.getString("alt"))) {
                     && StrUtil.isNotEmpty(ggaLocation.getString("alt"))) {
-                Map<String, Object> item = new HashMap<>();
-                item.put("id", id);
-                item.put("uuid", uuid);
-                list.add(item);
                 Double[] ggaLocationGps = new Double[3];
                 Double[] ggaLocationGps = new Double[3];
-                ggaLocationGps[0] = ggaLocation.getDouble("lon");
-                ggaLocationGps[1] = ggaLocation.getDouble("lat");
-                ggaLocationGps[2] = ggaLocation.getDouble("alt");
-
-                geoPoint.setId(id);
-                geoPoint.setUuid(uuid);
+                if(Objects.nonNull(ggaLocation.getDouble("lon"))
+                        && Objects.nonNull(ggaLocation.getDouble("lat"))
+                        && Objects.nonNull(ggaLocation.getDouble("alt"))){
+                    ggaLocationGps[0] = ggaLocation.getDouble("lon");
+                    ggaLocationGps[1] = ggaLocation.getDouble("lat");
+                    ggaLocationGps[2] = ggaLocation.getDouble("alt");
+                }
                 geoPoint.setCoordinates(ggaLocationGps);
                 geoPoint.setCoordinates(ggaLocationGps);
                 geoPoint.setStatusIndicator(ggaLocation.getInteger("StatusIndicator"));
                 geoPoint.setStatusIndicator(ggaLocation.getInteger("StatusIndicator"));
 
 
-
-
             }
             }
             if (sweepItem.containsKey("puck")){
             if (sweepItem.containsKey("puck")){
                 JSONObject puck = sweepItem.getJSONObject("puck");
                 JSONObject puck = sweepItem.getJSONObject("puck");