diff --git a/zc-business/src/main/java/com/zc/business/task/DeviceOnlineTask.java b/zc-business/src/main/java/com/zc/business/task/DeviceOnlineTask.java index f8b35257..ea98f764 100644 --- a/zc-business/src/main/java/com/zc/business/task/DeviceOnlineTask.java +++ b/zc-business/src/main/java/com/zc/business/task/DeviceOnlineTask.java @@ -230,20 +230,17 @@ public class DeviceOnlineTask { private void incrementSummary(OnlineLog onlineLog) { // 获取当天日期 String date = DateUtils.format(new Date(), "yyyy-MM-dd"); - if(ObjectUtils.isEmpty(onlineLog) || ObjectUtils.isEmpty(onlineLog.getDeviceId())){ - System.out.println("数据为空"); - } long deviceId = onlineLog.getDeviceId(); OnlineSum onlineSum = redisCache.getCacheMapValue(RedisKeyConstants.DEVICE_ONLINE , date+":"+deviceId); if (ObjectUtils.isEmpty(onlineSum)){ onlineSum = new OnlineSum().copyFromLog(onlineLog); - redisCache.setCacheMapValue(RedisKeyConstants.DEVICE_ONLINE, date+onlineLog.getDeviceId(), onlineSum); + redisCache.setCacheMapValue(RedisKeyConstants.DEVICE_ONLINE, date+":"+deviceId, onlineSum); Long ttl = redisCache.getExpire(RedisKeyConstants.DEVICE_ONLINE); if(ttl == -1) redisCache.expire(RedisKeyConstants.DEVICE_ONLINE,getTimeout()); }else { //增量计算 onlineSum.incrementSummary(onlineLog); - redisCache.setCacheMapValue(RedisKeyConstants.DEVICE_ONLINE, date+onlineLog.getDeviceId(), onlineSum); + redisCache.setCacheMapValue(RedisKeyConstants.DEVICE_ONLINE, date+":"+deviceId, onlineSum); } }