|
@@ -174,23 +174,21 @@ public class MonitorDataServiceImpl implements MonitorDataService , Initializing
|
|
|
dateTime = dateTime.plusHours(-1);
|
|
|
//设备id
|
|
|
deviceIds = lastHourDataMap.values().stream().map(d -> d.getDeviceId().intValue()).distinct().collect(Collectors.toList());
|
|
|
- if(deviceIds.size()>0){
|
|
|
+ if(deviceIds.size() ==0){break;}
|
|
|
|
|
|
- //前几小时有统计数据的设备id
|
|
|
- List<Integer> deviceIdsIsExit = monitorDataMapper.checkReportDataExit(dateTime.getYear(),dateTime.getMonthValue(),dateTime.getDayOfMonth(),dateTime.getHour(),deviceIds);
|
|
|
- //需要补充数据的设备
|
|
|
- deviceIds = deviceIds.stream().filter(deviceId -> !deviceIdsIsExit.contains(deviceId)).collect(Collectors.toList());
|
|
|
- if(deviceIds.size()>0) {
|
|
|
+ //前几小时有统计数据的设备id
|
|
|
+ List<Integer> deviceIdsIsExit = monitorDataMapper.checkReportDataExit(dateTime.getYear(),dateTime.getMonthValue(),dateTime.getDayOfMonth(),dateTime.getHour(),deviceIds);
|
|
|
+ //需要补充数据的设备
|
|
|
+ deviceIds = deviceIds.stream().filter(deviceId -> !deviceIdsIsExit.contains(deviceId)).collect(Collectors.toList());
|
|
|
+ if(deviceIds.size() ==0){break;}
|
|
|
|
|
|
- //查询需要补充数据的设备数据信息
|
|
|
- hourDatas = new ArrayList<>(lastHourDataMap.values());
|
|
|
+ //查询需要补充数据的设备数据信息
|
|
|
+ hourDatas = lastHourDataMap.values().stream().filter(d -> !deviceIdsIsExit.contains(d.getDeviceId())).collect(Collectors.toList());
|
|
|
|
|
|
- lastHourDatas = getMonitorDataGroupByHour(dateTime.plusHours(-1), deviceIds);
|
|
|
- lastHourDataMap = lastHourDatas.stream().collect(Collectors.toMap(DayReportEntity::getMapkey, a -> a, (k1, k2) -> k1));
|
|
|
- //保存日报表数据
|
|
|
- saveReportDataByHour(hourDatas, lastHourDataMap);
|
|
|
- }
|
|
|
- }
|
|
|
+ lastHourDatas = getMonitorDataGroupByHour(dateTime.plusHours(-1), deviceIds);
|
|
|
+ lastHourDataMap = lastHourDatas.stream().collect(Collectors.toMap(DayReportEntity::getMapkey, a -> a, (k1, k2) -> k1));
|
|
|
+ //保存日报表数据
|
|
|
+ saveReportDataByHour(hourDatas, lastHourDataMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -233,11 +231,4 @@ public class MonitorDataServiceImpl implements MonitorDataService , Initializing
|
|
|
monitorDataMapper.batchInsertYearReport(dateTime.getYear(),dateTime.getMonthValue());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|