Ver código fonte

测试修改

chejianzheng 3 meses atrás
pai
commit
908001e6fd

+ 7 - 2
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/mqtt/MqttSubHandle.java

@@ -19,7 +19,9 @@ import org.springframework.stereotype.Component;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Component
 @Slf4j
@@ -119,9 +121,11 @@ public class MqttSubHandle {
         log.info("mqttsub, topic:{}, clientId:{}", "/das/event", clientId);
         String event = obj.getString("event");
         // 跌倒确认返回
-        if (event.equals("跌倒确认")) {
+        if (event.equals("fall_confirmed")) {
             if (mqttClient != null) {
-                mqttClient.sendMessage("/mps/fall_event/ack", clientId);
+                Map<String, Object> payloadMap = new HashMap<>();
+                payloadMap.put("dev_id", clientId);
+                mqttClient.sendMessage("/mps/fall_event/ack", JSON.toJSONString(payloadMap));
             } else {
                 log.warn("MQTT template is not available, message not sent to topic: /mps/fall_event/ack");
             }
@@ -201,6 +205,7 @@ public class MqttSubHandle {
         msg.put("msg_type", "event");
 
         // todo 发送socket
+        mqttClient.sendMessage(String.format("/mps/%s/event", clientId), msg.toString());
 //        PushMsgWebSocket.sendMessageTo(msg.toString(), dev_id);
 
         // 发送短信

+ 1 - 1
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/po/WxRelation.java

@@ -24,7 +24,7 @@ public class WxRelation extends BasePO {
     /**
      * 小程序unionId
      */
-    @TableField("小程序unionId")
+    @TableField("union_id")
     private String unionId;
 
     /**