Commit 74a32d0b by 毛树良

<fix>:优化推送

1 parent 44712769
......@@ -59,12 +59,21 @@ public class DeviceSyncScheduled {
return;
}
//查询
int offset = 0;
int limit = 20;
int selectSize = 0;
int num = 0;
do {
DeviceModel deviceQry = new DeviceModel();
deviceQry.setModifyTime_gte(lastTimeUtc);
deviceQry.setModifyTime_lte(currentTimeUtc);
deviceQry.setOffset(0);
deviceQry.setLimit(20);
deviceQry.setOffset(offset);
deviceQry.setLimit(limit);
List<DeviceModel> deviceModels = trafficEventService.selectDeviceDatas(deviceQry);
selectSize = deviceModels.size();
num = num + 1;
offset = limit*num;
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次设备待同步数据总{}条。", lastTimeUtc, currentTimeUtc, deviceModels.size());
if (!CollectionUtils.isEmpty(deviceModels)) {
//List<DeviceModel> 转 SubscribeNotificationsObj
......@@ -73,12 +82,16 @@ public class DeviceSyncScheduled {
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_DEVICE_LASTTIME, DateUtil.formatDate(deviceModels.get(deviceModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
Date lastDataUtc = DateUtil.addHours(deviceModels.get(deviceModels.size() - 1).getModifyTime(), -8);
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_DEVICE_LASTTIME, DateUtil.formatDate(lastDataUtc, DateUtil.TIMESTAMP_FORMAT));
} else {
log.error("trafficDataConvertHandler.deviceToSubscribeNotifications.failed=(offset,limit)=({},{})", offset, limit);
}
} else {
log.error("trafficDataConvertHandler.deviceToSubscribeNotifications is null");
}
}
} while (selectSize >= limit);
log.info("结束处理设备数据");
}
}
......@@ -59,12 +59,20 @@ public class LaneSyncScheduled {
return;
}
//查询
int offset = 0;
int limit = 20;
int selectSize = 0;
int num = 0;
do {
LaneModel laneQry = new LaneModel();
laneQry.setModifyTime_gte(lastTimeUtc);
laneQry.setModifyTime_lte(currentTimeUtc);
laneQry.setOffset(0);
laneQry.setLimit(20);
laneQry.setOffset(offset);
laneQry.setLimit(limit);
List<LaneModel> laneModels = trafficEventService.selectLaneDatas(laneQry);
selectSize = laneModels.size();
num = num + 1;
offset = limit*num;
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次车道待同步数据总{}条。", lastTimeUtc, currentTimeUtc, laneModels.size());
if (!CollectionUtils.isEmpty(laneModels)) {
//List<LaneModel> 转 SubscribeNotificationsObj
......@@ -73,12 +81,16 @@ public class LaneSyncScheduled {
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_LANE_LASTTIME, DateUtil.formatDate(laneModels.get(laneModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
Date lastDataUtc = DateUtil.addHours(laneModels.get(laneModels.size() - 1).getModifyTime(), -8);
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_LANE_LASTTIME, DateUtil.formatDate(lastDataUtc, DateUtil.TIMESTAMP_FORMAT));
} else {
log.error("trafficDataConvertHandler.laneToSubscribeNotifications.failed=(offset,limit)=({},{})", offset, limit);
}
} else {
log.error("trafficDataConvertHandler.laneToSubscribeNotifications is null");
}
}
} while (selectSize >= limit);
log.info("结束处理车道数据");
}
}
......@@ -60,12 +60,20 @@ public class TollgateSyncScheduled {
return;
}
//查询
int offset = 0;
int limit = 20;
int selectSize = 0;
int num = 0;
do {
TollgateModel tollgateQry = new TollgateModel();
tollgateQry.setModifyTime_gte(lastTimeUtc);
tollgateQry.setModifyTime_lte(currentTimeUtc);
tollgateQry.setOffset(0);
tollgateQry.setLimit(20);
tollgateQry.setOffset(offset);
tollgateQry.setLimit(limit);
List<TollgateModel> tollgateModels = trafficEventService.selectTollgateDatas(tollgateQry);
selectSize = tollgateModels.size();
num = num + 1;
offset = limit*num;
log.info("查询范围(lastTimeUtc,currentTimeUtc]=({},{}],本批次卡口待同步数据总{}条。", lastTimeUtc, currentTimeUtc, tollgateModels.size());
if (!CollectionUtils.isEmpty(tollgateModels)) {
//List<TollgateModel> 转 SubscribeNotificationsObj
......@@ -74,12 +82,16 @@ public class TollgateSyncScheduled {
if (subscribeNotificationsObj != null) {
JsonMessage resultVo = gb1400Service.subscribeNotifications(subscribeNotificationsObj);
if (SystemConstants.APP_CODE_SUCCESS == resultVo.getCode()) {
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_KAKOU_LASTTIME, DateUtil.formatDate(tollgateModels.get(tollgateModels.size() - 1).getModifyTime(), DateUtil.TIMESTAMP_FORMAT));
Date lastDataUtc = DateUtil.addHours(tollgateModels.get(tollgateModels.size() - 1).getModifyTime(), -8);
redisTemplate.opsForValue().set(RedisConstants.FANXING_TO_GB1400_KAKOU_LASTTIME, DateUtil.formatDate(lastDataUtc, DateUtil.TIMESTAMP_FORMAT));
} else {
log.error("trafficDataConvertHandler.tollgateToSubscribeNotifications.failed=(offset,limit)=({},{})", offset, limit);
}
} else {
log.error("trafficDataConvertHandler.tollgateToSubscribeNotifications is null");
}
}
} while (selectSize >= limit);
log.info("结束处理卡口数据");
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!