|
|
|
@ -49,11 +49,11 @@ public class MqttService {
|
|
|
|
|
private void processOneTable(SyncTablesInfo table) throws Exception {
|
|
|
|
|
List<SyncFieldsInfo> fieldList = fieldsInfoService.findAll(table.getId().getClientId(), table.getId().getTableName());
|
|
|
|
|
if (!CollectionUtils.isEmpty(fieldList)) {
|
|
|
|
|
List<Integer> eqmidList = dbsqlService.getDistinctEqmids(table.getId().getTableName(), table.getDevidFieldName());
|
|
|
|
|
List<Object> eqmidList = dbsqlService.getDistinctEqmids(table.getId().getTableName(), table.getDevidFieldName());
|
|
|
|
|
log.info("表{},共{}个设备", table.getId().getTableName(), eqmidList.size());
|
|
|
|
|
if (!CollectionUtils.isEmpty(eqmidList)) {
|
|
|
|
|
mqttUtil.connect();
|
|
|
|
|
for (Integer eqmid : eqmidList) {
|
|
|
|
|
for (Object eqmid : eqmidList) {
|
|
|
|
|
this.processOneEqmid(eqmid, table, fieldList);
|
|
|
|
|
}
|
|
|
|
|
mqttUtil.disconnect();
|
|
|
|
@ -64,7 +64,7 @@ public class MqttService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理单个设备
|
|
|
|
|
private void processOneEqmid(Integer eqmid, SyncTablesInfo table, List<SyncFieldsInfo> fieldList) {
|
|
|
|
|
private void processOneEqmid(Object eqmid, SyncTablesInfo table, List<SyncFieldsInfo> fieldList) {
|
|
|
|
|
|
|
|
|
|
List<I2relation> relationList = i2relationService.getList(eqmid);
|
|
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ public class MqttService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查询并上传单个设备的数据
|
|
|
|
|
private int uploadOneBlock(Integer eqmid, SyncRecords record,
|
|
|
|
|
private int uploadOneBlock(Object eqmid, SyncRecords record,
|
|
|
|
|
SyncTablesInfo table, List<SyncFieldsInfo> fieldList, List<I2relation> relationList) throws Exception {
|
|
|
|
|
|
|
|
|
|
if (record == null) {
|
|
|
|
@ -122,7 +122,8 @@ public class MqttService {
|
|
|
|
|
log.debug("表{}设备{}推送成功{}条数据,最后时间{}", table.getId().getTableName(), eqmid, count, DateUtil.format(date));
|
|
|
|
|
|
|
|
|
|
if (count >= 1000) {
|
|
|
|
|
count += uploadOneBlock(eqmid, record, table, fieldList, relationList);
|
|
|
|
|
count += uploadOneBlock(eqmid, record,
|
|
|
|
|
table, fieldList, relationList);
|
|
|
|
|
}
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|