Browse Source

修复BUG

yangxiaokun 3 years ago
parent
commit
c74405b784

+ 2 - 1
src/main/java/com/zy/bms/config/mqtt/MqttConsumerCfg.java

@@ -32,7 +32,8 @@ public class MqttConsumerCfg {
     private MqttPahoClientFactory mqttClientFactory;
 
     //默认监听主题
-    private final String[] defaultTopic = new String[]{"$regdtx2", "$dtx2/#", "$dtxlp/#"};
+//    private final String[] defaultTopic = new String[]{"$regdtx2", "$dtx2/#", "$dtxlp/#"};
+    private final String[] defaultTopic = new String[]{};
 
     /**
      * MQTT 消息订阅绑定(消费者)

+ 3 - 6
src/main/java/com/zy/bms/controller/lp/LpDeviceController.java

@@ -35,12 +35,9 @@ public class LpDeviceController {
     /**
      * 查询所有的设备
      */
-    @GetMapping("list.do")
-    public ServerResponse list(DeviceIO io) {
-        return ServerResponse.success(
-                lpInfoStateService.list(new QueryWrapper<LpInfoState>()
-                .like("open_num", io.getOpenNum())
-                .eq("group_id", io.getGroupId())));
+    @GetMapping("listAll.do")
+    public ServerResponse listAll() {
+        return ServerResponse.success(lpInfoStateService.listAll());
     }
 
     /**

+ 5 - 0
src/main/java/com/zy/bms/mapper/lp/LpInfoStateMapper.java

@@ -30,6 +30,11 @@ public interface LpInfoStateMapper extends BaseMapper<LpInfoState> {
      */
     IPage<LpDeviceListVo> listPage(Page<LpDeviceListVo> page, @Param("io") DeviceIO io);
 
+    /**
+     * 获取所有的设备列表
+     */
+    List<LpDeviceListVo> listAll();
+
     /**
      * 微信端
      * 通过设备组查询设备

+ 0 - 2
src/main/java/com/zy/bms/pojo/io/LogsIO.java

@@ -1,7 +1,6 @@
 package com.zy.bms.pojo.io;
 
 import lombok.Data;
-import lombok.EqualsAndHashCode;
 
 /**
  * mqtt 收发日志查询入参
@@ -10,7 +9,6 @@ import lombok.EqualsAndHashCode;
  * create on 2021/4/23
  */
 @Data
-@EqualsAndHashCode(callSuper = false)
 public class LogsIO extends PageIO {
     /**
      * 0:接收 1:发送

+ 67 - 10
src/main/java/com/zy/bms/pojo/vo/LpDeviceListVo.java

@@ -1,5 +1,6 @@
 package com.zy.bms.pojo.vo;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -19,16 +20,6 @@ public class LpDeviceListVo {
      */
     private String openNum;
 
-    /**
-     * 登录 MQTT 账号
-     */
-    private String username;
-
-    /**
-     * 登录 MQTT 密码
-     */
-    private String password;
-
     /**
      * 设备组
      */
@@ -44,6 +35,11 @@ public class LpDeviceListVo {
      */
     private BigDecimal wakeInt;
 
+    /**
+     * 阈值
+     */
+    private Integer thresh;
+
     /**
      * 电量
      */
@@ -54,6 +50,67 @@ public class LpDeviceListVo {
      */
     private String s4g;
 
+    private String x;
+
+    private String y;
+
+    private String z;
+
+    private String anglex;
+
+    private String angley;
+
+    private String anglez;
+
+    /**
+     * 温度
+     */
+    private String temp;
+
+    /**
+     * 经度
+     */
+    @JSONField(format = "#.######")
+    private Double lon;
+
+    /**
+     * 纬度
+     */
+    @JSONField(format = "#.######")
+    private Double lat;
+
+    /**
+     * 经度(Gcj)
+     */
+    @JSONField(format = "#.######")
+    private Double lonGcj;
+
+    /**
+     * 纬度(Gcj)
+     */
+    @JSONField(format = "#.######")
+    private Double latGcj;
+
+    /**
+     * 格式化位置
+     */
+    private String site;
+
+    /**
+     * 定位模式 1:GPS 2:基站
+     */
+    private Integer mode;
+
+    /**
+     * 状态 0:离线 1:在线
+     */
+    private Integer status;
+
+    /**
+     * 上传类型
+     */
+    private String dataType;
+
     /**
      * 数据更新时间
      */

+ 5 - 0
src/main/java/com/zy/bms/service/lp/ILpInfoStateService.java

@@ -24,6 +24,11 @@ public interface ILpInfoStateService extends IService<LpInfoState> {
      */
     IPage<LpDeviceListVo> listPage(DeviceIO io);
 
+    /**
+     * 获取所有的设备列表
+     */
+    List<LpDeviceListVo> listAll();
+
     /**
      * 微信端
      * 通过设备组查询设备

+ 5 - 0
src/main/java/com/zy/bms/service/lp/impl/LpInfoStateServiceImpl.java

@@ -31,6 +31,11 @@ public class LpInfoStateServiceImpl extends ServiceImpl<LpInfoStateMapper, LpInf
         return baseMapper.listPage(page, io);
     }
 
+    @Override
+    public List<LpDeviceListVo> listAll() {
+        return baseMapper.listAll();
+    }
+
     @Override
     public List<LpInfoState> listByGroupId(String groupId) {
         return baseMapper.listByGroupId(groupId);

+ 2 - 2
src/main/resources/application-dev.yml

@@ -24,5 +24,5 @@ spring:
 mybatis-plus:
   type-aliases-package: com.zy.bms.entity
   mapper-locations: classpath:mapper/*.xml
-  configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 13 - 5
src/main/resources/mapper/LpInfoStateMapper.xml

@@ -5,11 +5,8 @@
     <select id="listPage" resultType="com.zy.bms.pojo.vo.LpDeviceListVo">
         SELECT
         t1.open_num,
-        t1.username,
-        t1.password,
-        t1.sn,
-        t1.create_time,
         t1.group_id,
+        t1.create_time,
         t2.wake_int,
         t2.update_time,
         t2.battery,
@@ -21,11 +18,22 @@
         <if test="io.openNum != null and io.openNum != ''">
             AND t1.open_num LIKE CONCAT('%',#{io.openNum},'%')
         </if>
-        <if test="io.groupId != null">
+        <if test="io.groupId != null and io.groupId != ''">
             AND t1.group_id = #{io.groupId}
         </if>
     </select>
 
+    <select id="listAll" resultType="com.zy.bms.pojo.vo.LpDeviceListVo">
+        SELECT
+            t1.group_id,
+            t1.open_num,
+            t2.*
+        FROM
+        device_base t1
+        LEFT JOIN lp_info_state t2 ON t1.open_num = t2.open_num
+        WHERE t1.type = 'lupai'
+    </select>
+
     <select id="listByUserId" resultType="com.zy.bms.pojo.vo.DeviceWxListVo">
         SELECT
             t1.open_num,