|
@@ -33,7 +33,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService {
|
|
|
Long deviceId=warningRuleService.getDeviceId(meterNo,customerNo);;
|
|
|
List<UseWaterDto> list = meterReadRecordMapper.getRealTimeUseWater(deviceId, startDate, endDate);
|
|
|
//填充缺失月份数据
|
|
|
- fillDataForCertainMonths(period,list,startDateTime,df);
|
|
|
+ fillDataForCertainMonths(period,list,startDateTime,df,0);
|
|
|
|
|
|
|
|
|
//合并
|
|
@@ -42,10 +42,16 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService {
|
|
|
}
|
|
|
//补齐某些月份无数据
|
|
|
private void fillDataForCertainMonths(Integer period,List<UseWaterDto>list,
|
|
|
- LocalDateTime startDateTime, DateTimeFormatter df){
|
|
|
+ LocalDateTime startDateTime, DateTimeFormatter df,Integer type){
|
|
|
List<UseWaterDto> newList = new ArrayList<>();
|
|
|
for (int i = 0; i < period; i++) {
|
|
|
- LocalDateTime nextDateTime = startDateTime.plusDays(i);
|
|
|
+ LocalDateTime nextDateTime = startDateTime.plusMonths(i);
|
|
|
+ if(type==0){
|
|
|
+ nextDateTime = startDateTime.plusDays(i);
|
|
|
+ }else if(type==1){
|
|
|
+ nextDateTime = startDateTime.plusMonths(i);
|
|
|
+ }
|
|
|
+
|
|
|
Integer times = Integer.valueOf(nextDateTime.format(df));
|
|
|
|
|
|
long count = list.stream().filter(ite -> ite.getDate().equals(times)).count();
|
|
@@ -104,7 +110,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService {
|
|
|
Integer endDate = Integer.valueOf(endDateTime.format(df));
|
|
|
List<UseWaterDto> list = meterReadRecordMapper.getUseWaterByMonth(deviceId, startDate, endDate);
|
|
|
//填充缺失月份数据
|
|
|
- fillDataForCertainMonths(12,list,startDateTime,dateTimeFormatter);
|
|
|
+ fillDataForCertainMonths(12,list,startDateTime,dateTimeFormatter,1);
|
|
|
useWaterAnalyze.setList(list);
|
|
|
statisticsOnWaterUsage(useWaterAnalyze,list);
|
|
|
return useWaterAnalyze;
|