修改配置和协议解析
This commit is contained in:
@@ -32,9 +32,9 @@ public class subscribeCallback implements IMqttMessageListener {
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
|
||||
String message = new String(mqttMessage.getPayload());
|
||||
log.info("接收消息主题 : " + topic);
|
||||
log.info("接收消息Qos : " + mqttMessage.getQos());
|
||||
log.info("接收消息内容 : " + message);
|
||||
// log.info("接收消息主题 : " + topic);
|
||||
// log.info("接收消息Qos : " + mqttMessage.getQos());
|
||||
// log.info("接收消息内容 : " + message);
|
||||
|
||||
//这里默认设备编号长度超过9位
|
||||
String[] split = topic.split("/");
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi
|
||||
String serialNumber = bo.getSerialNumber();
|
||||
switch (bo.getServerType()) {
|
||||
case MQTT:
|
||||
log.debug("=>MQ*收到设备主题[{}],消息:[{}]", bo.getTopicName(), bo.getData());
|
||||
// log.debug("=>MQ*收到设备主题[{}],消息:[{}]", bo.getTopicName(), bo.getData());
|
||||
//构建消息
|
||||
DeviceStatusVO deviceStatusVO = buildReport(bo);
|
||||
Long productId = bo.getProductId();
|
||||
@@ -117,7 +117,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi
|
||||
processNoSub(reportMessage, bo.getTopicName());
|
||||
break;
|
||||
case TCP:
|
||||
log.debug("*MQ收到TCP推送消息[{}]", JSON.toJSON(bo.getThingsModelSimpleItem()));
|
||||
// log.debug("*MQ收到TCP推送消息[{}]", JSON.toJSON(bo.getThingsModelSimpleItem()));
|
||||
DeviceStatusVO deviceStatusVO1 = deviceService.selectDeviceStatusAndTransportStatus(serialNumber);
|
||||
Optional.ofNullable(deviceStatusVO1).orElseThrow(() -> new ServiceException("设备不存在"));
|
||||
//同步设备状态
|
||||
@@ -144,7 +144,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi
|
||||
*/
|
||||
@Override
|
||||
public void parseReplyMsg(DeviceReportBo bo) {
|
||||
log.debug("=>MQ*收到设备回调消息,[{}]", bo);
|
||||
//log.debug("=>MQ*收到设备回调消息,[{}]", bo);
|
||||
buildReport(bo);
|
||||
//获取解析协议
|
||||
IProtocol protocol = selectedProtocol(bo.getProductId());
|
||||
|
||||
Reference in New Issue
Block a user