Browse Source

修复路牌接口BUG

chenyi406 3 years ago
parent
commit
fb3bfbb1d0

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

@@ -186,7 +186,7 @@ public class MqttCallbackHandler {
             String num = topic.split("IMEI")[1];
             DeviceLp deviceLp = new DeviceLp();
             deviceLp.setMode(msg.getInt("mode"));
-            deviceLp.setLon(msg.getString("lng"));
+            deviceLp.setLon(msg.getString("lon"));
             deviceLp.setLat(msg.getString("lat"));
             //转换后的坐标
             String[] gcj = CoordTransformUtil.wgs84toGcj02(deviceLp.getLon(), deviceLp.getLat());
@@ -239,9 +239,9 @@ public class MqttCallbackHandler {
             deviceLp.setTemp(msg.getString("temp"));
             deviceLp.setUpdateTime(LocalDateTime.now());
             //临时解决方案
-            if (msg.getString("lng")!=null){
+            if (msg.getString("lon")!=null){
                 deviceLp.setMode(msg.getInt("mode"));
-                deviceLp.setLon(msg.getString("lng"));
+                deviceLp.setLon(msg.getString("lon"));
                 deviceLp.setLat(msg.getString("lat"));
                 //转换后的坐标
                 String[] gcj = CoordTransformUtil.wgs84toGcj02(deviceLp.getLon(), deviceLp.getLat());

+ 2 - 0
src/main/java/com/zy/omp/model/Device.java

@@ -1,5 +1,6 @@
 package com.zy.omp.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -33,6 +34,7 @@ public class Device {
     /**
      * 设备组
      */
+    @TableField("`group`")
     private String group;
 
     /**

+ 0 - 1
src/main/java/com/zy/omp/model/DeviceLp.java

@@ -1,7 +1,6 @@
 package com.zy.omp.model;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 import com.baomidou.mybatisplus.annotation.TableField;

+ 6 - 3
src/main/java/com/zy/omp/schedule/DeviceStatusSchedule.java

@@ -4,7 +4,10 @@ import com.zy.omp.model.Device;
 import com.zy.omp.service.DeviceService;
 import com.zy.omp.service.RabbitMQApi;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import java.time.LocalDateTime;
@@ -17,9 +20,9 @@ import java.util.Set;
  * @author yang xiao kun
  * create on 2021/5/14
  */
-//@EnableAsync
-//@Configuration
-//@EnableScheduling
+@EnableAsync
+@Configuration
+@EnableScheduling
 public class DeviceStatusSchedule {
 
     @Autowired

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

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

+ 1 - 1
src/main/resources/mapper/DeviceMapping.xml

@@ -38,7 +38,7 @@
 
     <update id="updateDeviceStatus">
         UPDATE
-            zy_device
+            device
         SET
             `status` = CASE clientId
         <foreach collection="devices" item="device">