Commit de233333 by 杨林龙

优化设备停驶状态消费逻辑

1 parent afd5262d
......@@ -52,6 +52,10 @@ public class TransitHandleService {
public void handleGpsAndBsData(DeviceLocationDto deviceLocationDto, Integer topicId) {
DeviceLocationDto deviceLocationCache = (DeviceLocationDto) redisUtils.get(setKey(deviceLocationDto.getSn()));
if (ObjectUtil.isNull(deviceLocationCache)) {
if (TopicsEnum.DEVICE_STATE.getId().equals(topicId)) {
log.error("该设备{}消费行驶状态前没有消费Gps或基站数据", deviceLocationDto.getSn());
return;
}
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
deviceLocationDto.setCreatedTime(new Date());
log.info("报警消费数据===sn:" + deviceLocationDto.getSn() + "Gps时间:" + DateUtil.formatDateTime(deviceLocationDto.getLastGpsTime()) + "基站时间:" + DateUtil.formatDateTime(deviceLocationDto.getLastBsTime()));
......@@ -75,9 +79,11 @@ public class TransitHandleService {
flag = true;
}
// 停驶状态更新 同步设置flag为true
if (TopicsEnum.DEVICE_STATE.getId().equals(topicId)) {
deviceLocationCache.setStayStatus(deviceLocationDto.getStayStatus());
deviceLocationCache.setStayStatusUpdatetime(deviceLocationDto.getStayStatusUpdatetime());
flag = true;
}
// 判断是否有数据更新 有数据更新重新设置回缓存
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!