|
|
|
@ -721,7 +721,9 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
private List<HydroelectricPowerRainVo> stationPowerRains(List<HydroelectricDeviceVo> devices, List<Map<String, Object>> rains) { |
|
|
|
|
List<HydroelectricDeviceGenerateVo> generates = new ArrayList<>(); |
|
|
|
|
devices.forEach(device->{ |
|
|
|
|
generates.addAll(device.getGenerates()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(device.getGenerates())){ |
|
|
|
|
generates.addAll(device.getGenerates()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
@ -737,7 +739,12 @@ public class HydroelectricServiceImpl implements HydroelectricService {
|
|
|
|
|
// 日期
|
|
|
|
|
powerRain.setDate(DateUtil.format(calendar.getTime(),"yyyy-MM-dd")); |
|
|
|
|
// 发电量
|
|
|
|
|
powerRain.setGenerate(generates.stream().filter(o-> powerRain.getDate().equals(o.getDate())).mapToDouble(HydroelectricDeviceGenerateVo::getGenerate).sum()); |
|
|
|
|
if(CollectionUtil.isEmpty(generates)){ |
|
|
|
|
powerRain.setGenerate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
powerRain.setGenerate(generates.stream().filter(o-> powerRain.getDate().equals(o.getDate())).mapToDouble(HydroelectricDeviceGenerateVo::getGenerate).sum()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 降雨量
|
|
|
|
|
if(CollectionUtil.isNotEmpty(rains)){ |
|
|
|
|
powerRain.setRain(rains.stream().mapToDouble(map->{ |
|
|
|
|