|
@@ -1,7 +1,10 @@
|
|
|
package com.bizmatics.mhfire.service.listener;
|
|
|
|
|
|
+import com.bizmatics.common.spring.util.JsonUtils;
|
|
|
import com.bizmatics.mhfire.service.api.mhWater.OneCardApi;
|
|
|
import com.bizmatics.mhfire.service.config.mqtt.MqttInConfig;
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
+import com.sun.javafx.collections.MappingChange;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
@@ -9,6 +12,8 @@ import org.springframework.integration.annotation.ServiceActivator;
|
|
|
import org.springframework.messaging.MessageHandler;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* @author yq
|
|
|
* @date 2021/11/3 8:13
|
|
@@ -35,10 +40,11 @@ public class MqttListener {
|
|
|
Object mqttReceivedTopic = message.getHeaders().get("mqtt_receivedTopic");
|
|
|
if (null != mqttReceivedTopic){
|
|
|
String topic = mqttReceivedTopic.toString();
|
|
|
+ Map map = JsonUtils.fromJson(payload, Map.class);
|
|
|
if (topic.equals("mh/water/info")){
|
|
|
- oneCardApi.callInfoApi(payload);
|
|
|
+ oneCardApi.callInfoApi(map);
|
|
|
}else if (topic.equals("mh/water/alert")){
|
|
|
- oneCardApi.callAlarmApi(payload);
|
|
|
+ oneCardApi.callAlarmApi(map);
|
|
|
}
|
|
|
}
|
|
|
};
|