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