فهرست منبع

修复路牌接口BUG

chenyi406 3 سال پیش
والد
کامیت
01dfdd9ef1

+ 4 - 4
src/main/java/com/zy/omp/config/mqtt/MqttCallbackHandler.java

@@ -187,14 +187,14 @@ public class MqttCallbackHandler {
             String num = topic.split("IMEI")[1];
             DeviceLp deviceLp = new DeviceLp();
             deviceLp.setMode(msg.getInt("mode"));
-            deviceLp.setLng(msg.getString("lng"));
+            deviceLp.setLon(msg.getString("lng"));
             deviceLp.setLat(msg.getString("lat"));
             //转换后的坐标
-            String[] gcj = CoordTransformUtil.wgs84toGcj02(deviceLp.getLng(), deviceLp.getLat());
-            deviceLp.setLngGcj(gcj[0]);
+            String[] gcj = CoordTransformUtil.wgs84toGcj02(deviceLp.getLon(), deviceLp.getLat());
+            deviceLp.setLonGcj(gcj[0]);
             deviceLp.setLatGcj(gcj[1]);
             // 逆地理位置解析
-            deviceLp.setSite(GaoDeApiUtil.regeo(deviceLp.getLngGcj(), deviceLp.getLatGcj()));
+            deviceLp.setSite(GaoDeApiUtil.regeo(deviceLp.getLonGcj(), deviceLp.getLatGcj()));
             // 保存基本信息
             deviceLpService.updateByNum(deviceLp, num);
         } catch (Exception e) {

+ 3 - 2
src/main/java/com/zy/omp/model/DeviceLp.java

@@ -123,7 +123,7 @@ public class DeviceLp implements Serializable {
     /**
      * 上传类型
      */
-    private String  dataType;
+    private String dataType;
 
     /**
      * 数据更新时间
@@ -134,6 +134,7 @@ public class DeviceLp implements Serializable {
      * 获取在线状态
      */
     public Integer getStatus() {
-        return updateTime.compareTo(LocalDateTime.now().minusMinutes(wakeInt * 60 + 5));
+        if (updateTime == null || wakeInt == null) return 0;
+        return updateTime.compareTo(LocalDateTime.now().minusMinutes(wakeInt.divide(new BigDecimal(60), BigDecimal.ROUND_HALF_DOWN).intValue() + 5));
     }
 }

+ 1 - 1
src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: dev
+    active: prod