设备审核接口
This commit is contained in:
@ -6,6 +6,7 @@ import com.fastbee.common.constant.FastBeeConstant;
|
||||
import com.fastbee.common.core.mq.DeviceReportBo;
|
||||
import com.fastbee.mq.redischannel.producer.IssueInstructionsProducer;
|
||||
import com.fastbee.mq.service.impl.DeviceOtherMsgHandler;
|
||||
import com.fastbee.mqttclient.PubMqttClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@ -28,6 +29,10 @@ public class DeviceOtherMsgConsumer {
|
||||
@Autowired
|
||||
private IssueInstructionsProducer issueInstructionsProducer;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PubMqttClient pubMqttClient;
|
||||
|
||||
@Async(FastBeeConstant.TASK.DEVICE_OTHER_TASK)
|
||||
public void consume(DeviceReportBo bo){
|
||||
try {
|
||||
@ -58,6 +63,7 @@ public class DeviceOtherMsgConsumer {
|
||||
|
||||
} else if (topic.endsWith("cmd/down")) {
|
||||
platformCmdHandler(new String(data));
|
||||
//回应
|
||||
|
||||
} else if (topic.endsWith("cmd/reply")) {
|
||||
deviceCmdAckHandler(new String(data));
|
||||
@ -74,6 +80,8 @@ public class DeviceOtherMsgConsumer {
|
||||
*/
|
||||
private void deviceDataReportHandler(String data){
|
||||
System.err.println("mqtt接收到设备上报数据:"+ data);
|
||||
//回应
|
||||
|
||||
//解析
|
||||
// String jsonString = "{\"type\": \"waterEleData\", \"pakSn\": 123, \"data\": {\"workState\": 1, \"action\": \"startPump\", \"mcuSn\": \"MCU123456\", \"sumEle\": 5000, \"sumFlow\": 3000, \"insFlow\": 2.5, \"userSumFlow\": 1500, \"areaCode\": \"010\", \"cardId\": \"CARD12345678\", \"userBalance\": 100.0, \"userSumEle\": 3000, \"curEle\": 50, \"curFlow\": 200, \"insPower\": 2300}}";
|
||||
JSONObject entries = JSONUtil.parseObj(data);
|
||||
@ -119,6 +127,7 @@ public class DeviceOtherMsgConsumer {
|
||||
*/
|
||||
private void platformDataReportAckHandler(String data){
|
||||
System.err.println("mqtt回应收到设备上报数据:"+ data);
|
||||
|
||||
//处理
|
||||
|
||||
|
||||
@ -128,7 +137,8 @@ public class DeviceOtherMsgConsumer {
|
||||
*/
|
||||
private void platformCmdHandler(String data){
|
||||
System.err.println("mqtt收到平台给设备下发命令:"+ data);
|
||||
JSONObject obj = JSONUtil.parseObj(data);
|
||||
// JSONObject obj = JSONUtil.parseObj(data);
|
||||
|
||||
}
|
||||
/**
|
||||
* 处理设备收到指令回应
|
||||
|
Reference in New Issue
Block a user