Ver código fonte

优化代码结构

yangxiaokun 3 anos atrás
pai
commit
c234b03873

+ 7 - 7
src/main/java/com/zy/bms/common/Constant.java

@@ -41,21 +41,21 @@ public class Constant {
         public static final String REGISTER = "10";
         //服务器响应设备注册请求
         public static final String HANDLE_REGISTER = "11";
-        //普适 - 设备心跳包
+        //普适 - 设备心跳包
         public static final String UBI_HEARTBEAT = "21";
-        //普适 - 远程控制设备报警
+        //普适 - 远程控制设备报警
         public static final String UBI_CONTROL_ALARM = "23";
-        //普适 - ntripServer设置
+        //普适 - ntripServer设置
         public static final String UBI_NTRIP_SERVER = "26";
-        //普适 - ntripClient设置
+        //普适 - ntripClient设置
         public static final String UBI_NTRIP_CLIENT = "27";
-        //普适 - tcp设置
+        //普适 - tcp设置
         public static final String UBI_TCP = "28";
-        //普适 - 获取设备设置 serve -> device
+        //普适 - 获取设备设置 serve -> device
         public static final String UBI_GET_SET_INFO = "29";
         //普适型 - 设备设置信息 device -> serve
         public static final String UBI_SET_INFO = "30";
-        //普适-服务器主动请求获取心跳包
+        //普适-服务器主动请求获取心跳包
         public static final String UBI_REQUEST_HEARTBEAT = "80";
         //路牌 - 设备心跳包
         public static final String LP_HEARTBEAT = "70";

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

@@ -1,8 +1,6 @@
 package com.zy.bms.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zy.bms.common.ServerResponse;
-import com.zy.bms.entity.Instructions;
 import com.zy.bms.pojo.io.LogsIO;
 import com.zy.bms.service.IInstructionsService;
 import com.zy.bms.service.ILogsService;

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

@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 
 /**
- * 普适
+ * 普适
  * 设备静态信息 前端控制器
  *
  * @author yangxiaokun
@@ -27,7 +27,7 @@ public class UbiDeviceController extends BaseController {
     /**
      * 分页查询设备列表
      */
-    @PostMapping("listPage.do")
+    @GetMapping("listPage.do")
     public ServerResponse listPage(DeviceIO io) {
         return ServerResponse.success(ubiInfoStateService.listPage(io));
     }

+ 5 - 0
src/main/java/com/zy/bms/entity/Group.java

@@ -46,6 +46,11 @@ public class Group implements Serializable {
      */
     private String remark;
 
+    /**
+     *  类型 路牌,普适型
+     */
+    private String type;
+
     /**
      * 创建时间
      */

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

@@ -8,9 +8,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 /**
- * <p>
  * 指令表
- * </p>
  *
  * @author chenyi
  * @since 2021-06-22

+ 3 - 3
src/main/java/com/zy/bms/handler/MqttCallbackHandler.java

@@ -55,15 +55,15 @@ public class MqttCallbackHandler {
                 registerHandler(mqttDTO);
                 break;
             }
-            case Constant.M.UBI_HEARTBEAT: {// 心跳
+            case Constant.M.UBI_HEARTBEAT: {// 心跳数据
                 ubiHandler.heartbeatHandler(openNum, mqttDTO);
                 break;
             }
-            case Constant.M.UBI_SET_INFO: {// 获取设备设置信息
+            case Constant.M.UBI_SET_INFO: {// 设备设置信息
                 ubiHandler.deviceSetHandler(openNum, mqttDTO);
                 break;
             }
-            case Constant.M.LP_HEARTBEAT: {// 获取设备设置信息
+            case Constant.M.LP_HEARTBEAT: {// 心跳数据
                 lpHandler.deviceInfoHandler(openNum, mqttDTO);
                 break;
             }

+ 3 - 1
src/main/java/com/zy/bms/handler/TransformEntity.java

@@ -30,7 +30,9 @@ public class TransformEntity {
         result.setOpenNum(openNum);
         result.setFreq(dto.getInt("freq"));
         result.setPowerVolt(dto.getDouble("powervolt"));
-        result.setSatNum(dto.getInt("satnum"));
+        result.setOemType(dto.getString("oemtype"));
+        result.setDeviceId(dto.getString("deviceid"));
+        result.setSatNum(dto.getInt("satsum"));
         result.setSignal4g(dto.getString("signal4g"));
         result.setLat(dto.getDouble("lat"));
         result.setLon(dto.getDouble("lon"));

+ 1 - 1
src/main/java/com/zy/bms/handler/UbiHandler.java

@@ -48,7 +48,7 @@ public class UbiHandler {
         //更新最新的记录
         UbiInfoState ubiInfoState = BeanUtil.cast(record, UbiInfoState.class);
         //设置更新时间
-        ubiInfoState.setUpdateTime(LocalDateTime.now());
+        ubiInfoState.setUpdateTime(record.getUploadTime());
         ubiInfoStateService.saveOrUpdate(ubiInfoState,
                 new QueryWrapper<UbiInfoState>().eq("open_num", ubiInfoState.getOpenNum()));
     }

+ 5 - 0
src/main/java/com/zy/bms/pojo/vo/GroupListVo.java

@@ -38,6 +38,11 @@ public class GroupListVo {
      */
     private String itemId;
 
+    /**
+     * 设备类型,路牌,普适型
+     */
+    private String type;
+
     /**
      * 备注
      */

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

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

+ 2 - 0
src/main/resources/mapper/GroupMapper.xml

@@ -7,6 +7,7 @@
         t1.id,
         t1.code,
         t1.name,
+        t1.type,
         t1.remark,
         t1.status,
         t1.create_time,
@@ -32,6 +33,7 @@
     <select id="getAllList" resultType="com.zy.bms.pojo.vo.GroupListVo">
         SELECT t1.code,
                t1.name,
+               t1.type,
                t2.name AS item
         FROM item_group t1
                  LEFT JOIN item t2 ON t1.item_id = t2.id

+ 18 - 8
src/main/resources/mapper/UbiInfoStateMapper.xml

@@ -4,23 +4,33 @@
 
     <select id="listPage" resultType="com.zy.bms.pojo.vo.UbiDeviceListVo">
         SELECT
-        t1.username,
-        t1.password,
-        t1.sn,
-        t1.create_time,
-        t1.group_id,
-        t2.*
+            t1.open_num,
+            t1.username,
+            t1.password,
+            t1.sn,
+            t1.create_time,
+            t1.group_id,
+            t2.freq,
+            t2.power_volt,
+            t2.sat_num,
+            t2.signal4g,
+            t2.lat,
+            t2.lon,
+            t2.version,
+            t2.oem_type,
+            t2.update_time
         FROM
-        device_base t1
+            device_base t1
         LEFT JOIN ubi_info_state t2 ON t1.open_num = t2.open_num
         WHERE
         t1.type = 'gnss'
         <if test="io.openNum != null and io.openNum != ''">
             AND t1.open_num LIKE CONCAT('%',#{io.openNum},'%')
         </if>
-        <if test="io.groupId != null and io.groupId > -1">
+        <if test="io.groupId != null">
             AND t1.group_id = #{io.groupId}
         </if>
+        ORDER BY t1.create_time DESC
     </select>
 
     <select id="getDetail" resultType="com.zy.bms.pojo.vo.UbiDeviceDetailVo">