Forráskód Böngészése

优化代码结构

yangxiaokun 2 éve
szülő
commit
a45f24b4a1

+ 2 - 2
src/main/java/com/zy/bms/controller/LogsController.java

@@ -37,7 +37,7 @@ public class LogsController {
      * 获取全部的指令
      */
     @GetMapping("instruction.do")
-    public ServerResponse getAllInstruction(@RequestParam(required = false) Integer type) {
-        return ServerResponse.success(instructionsService.list(new QueryWrapper<Instructions>().in("type", 0, type)));
+    public ServerResponse getAllInstruction() {
+        return ServerResponse.success(instructionsService.list());
     }
 }

+ 0 - 1
src/main/java/com/zy/bms/entity/Instructions.java

@@ -39,5 +39,4 @@ public class Instructions implements Serializable {
      */
     private LocalDateTime createTime;
 
-
 }

+ 15 - 11
src/main/java/com/zy/bms/handler/TransformEntity.java

@@ -23,7 +23,7 @@ import java.util.Map;
 public class TransformEntity {
 
     /**
-     * 普适 - 心跳包记录
+     * 普适 - 心跳包记录
      */
     public static UbiInfoRecord tsf2UbiInfoRecord(String openNum, MqttDTO dto) {
         UbiInfoRecord result = new UbiInfoRecord();
@@ -36,10 +36,12 @@ public class TransformEntity {
         result.setLon(dto.getDouble("lon"));
         result.setVersion(dto.getString("version"));
         result.setUploadTime(dto.getDate("timee"));
-        //转换后的坐标
-        double[] gcj = CoordTransformUtil.wgs84toGcj02(result.getLon(), result.getLat());
-        result.setLonGcj(gcj[0]);
-        result.setLatGcj(gcj[1]);
+        if (result.getLat() != null && result.getLon() != null) {
+            //转换后的坐标
+            double[] gcj = CoordTransformUtil.wgs84toGcj02(result.getLon(), result.getLat());
+            result.setLonGcj(gcj[0]);
+            result.setLatGcj(gcj[1]);
+        }
         return result;
     }
 
@@ -104,12 +106,14 @@ public class TransformEntity {
         result.setMode(dto.getInt("mode"));
         result.setLon(lon);
         result.setLat(lat);
-        //转换后的坐标
-        double[] gcj = CoordTransformUtil.wgs84toGcj02(lon, lat);
-        result.setLonGcj(gcj[0]);
-        result.setLatGcj(gcj[1]);
-        // 逆地理位置解析
-        result.setSite(GaoDeApiUtil.regeo(lon.toString(), lat.toString()));
+        if (lon != null && lat != null) {
+            //转换后的坐标
+            double[] gcj = CoordTransformUtil.wgs84toGcj02(lon, lat);
+            result.setLonGcj(gcj[0]);
+            result.setLatGcj(gcj[1]);
+            // 逆地理位置解析
+            result.setSite(GaoDeApiUtil.regeo(result.getLonGcj().toString(), result.getLatGcj().toString()));
+        }
         result.setUpdateTime(LocalDateTime.now());
         return result;
     }