wenhua.zhou 2 years ago
parent 3b57322ef5
commit c50afa36b0

@ -27,7 +27,7 @@ public class MqttServiceImpl {
try {
processOneTable(tableName);
} catch (Exception e) {
throw new RuntimeException(e);
log.error("processOneTable exception:",e);
}
}
}
@ -69,6 +69,7 @@ public class MqttServiceImpl {
String devIdSQL = sqlExecuting.replace("%%DEVID%%", String.valueOf(deviceID));
String newSQL = devIdSQL.replace("%%KEYVALUE%%", "'" + time + "'");
List<Map<String, Object>> dataOfoneDeviceID = operationDBMapper.getData(newSQL);
if(!dataOfoneDeviceID.isEmpty()){
String jsonStringData = FormatUtil.mqttFormatTransform(dataOfoneDeviceID, fieldMap);
try {
if (mqttUtil.publish2MQTT(jsonStringData)) {
@ -86,6 +87,8 @@ public class MqttServiceImpl {
}
}
}
}

@ -25,7 +25,7 @@ mqtt:
clientid: publish_client
subscribe:
clientid: subscribe_client
broker: tcp://192.168.50.115:1883
broker: tcp://192.168.50.200:1883
topic: mqtt/test
username: test
password: AliOS%1688

Loading…
Cancel
Save