wenhua.zhou 2 years ago
parent f4a703c190
commit a1269382fc

@ -28,7 +28,7 @@ public interface OperationDB {
List<Map<String, Object>> getData(String sql);
boolean updateSyncRecordsTable(String tableName, int deviceID, String time);
boolean updateSyncRecordsTable(String tableName, String deviceID, String time);
}

@ -55,12 +55,12 @@ public class MqttServiceImpl {
time = "2000-01-01 01:00:00";
operationDBMapper.addEarliestTime("10", tableName, String.valueOf(deviceID), time.toString());
}
publishData(deviceID, time.toString(), sqlExecuting, tableName, fieldMap);
publishData(String.valueOf(deviceID), time.toString(), sqlExecuting, tableName, fieldMap);
}
}
//推送单个设备数据
public void publishData(int deviceID, String time, String sqlExecuting, String tableName, Map<String, String> fieldMap) {
public void publishData(String deviceID, String time, String sqlExecuting, String tableName, Map<String, String> fieldMap) {
String devIdSQL = sqlExecuting.replace("%%DEVID%%", String.valueOf(deviceID));
String newSQL = devIdSQL.replace("%%KEYVALUE%%", "'" + time + "'");
@ -72,7 +72,7 @@ public class MqttServiceImpl {
log.debug("表{}设备{}推送成功:{}", tableName, deviceID, jsonStringData);
}
} catch (Exception e) {
log.error("表{}设备{}推送异常:{}", tableName, deviceID, e.getMessage());
log.error("表{}设备{}推送异常:", tableName, deviceID, e);
}
}

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

Loading…
Cancel
Save