Explorar el Código

修改文件配置

yangxiaokun hace 4 años
padre
commit
2874823472

+ 1 - 1
src/main/java/com/zy/bms/common/io/pc/MqttLogsIO.java

@@ -25,5 +25,5 @@ public class MqttLogsIO extends PageIO {
     /**
      * 指令
      */
-    private Integer instruction;
+    private String instruction;
 }

+ 2 - 0
src/main/java/com/zy/bms/config/InterceptorConfig.java

@@ -3,6 +3,7 @@ package com.zy.bms.config;
 import com.zy.bms.common.interceptor.AuthInterceptor;
 import com.zy.bms.common.interceptor.VerifyInterceptor;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@@ -16,6 +17,7 @@ import java.util.List;
  * @author chenyi
  * Create on 2019/10/10
  */
+@Profile("prod")
 @Configuration
 public class InterceptorConfig implements WebMvcConfigurer {
     /**

+ 2 - 0
src/main/java/com/zy/bms/config/WebMvcConfig.java

@@ -1,12 +1,14 @@
 package com.zy.bms.config;
 
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
 import org.springframework.web.servlet.config.annotation.CorsRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 /**
  * 解决测试时的跨域,开发环境关掉
  */
+@Profile("dev")
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
     @Override

+ 1 - 1
src/main/java/com/zy/bms/model/MqttLog.java

@@ -41,7 +41,7 @@ public class MqttLog {
     /**
      * 指令
      */
-    private Integer instruction;
+    private String instruction;
 
     /**
      * 创建时间

+ 1 - 1
src/main/java/com/zy/bms/service/MqttLogService.java

@@ -38,7 +38,7 @@ public class MqttLogService extends ServiceImpl<MqttLogMapper, MqttLog> {
         mqttLog.setDeviceId(topic.equals(regTopic) ?
                 mqttMsgDto.getString("regnum") : mqttMsgDto.getDeviceId());
         //mqtt 指令
-        mqttLog.setInstruction(mqttMsgDto.getInt("m"));
+        mqttLog.setInstruction(mqttMsgDto.getM());
         mqttLog.setContent(payload);
         baseMapper.insert(mqttLog);
     }

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

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

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

@@ -16,7 +16,7 @@
             <if test="io.tag != null and io.tag >-1">
                 AND tag = #{io.tag}
             </if>
-            <if test="io.instruction != null and io.instruction >-1">
+            <if test="io.instruction != null and io.instruction !=''">
                 AND instruction = #{io.instruction}
             </if>
         </where>