Browse Source

#首页接口优化

zhongwei
yang_shj 3 months ago
parent
commit
a5fa8b3b27
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDeviceVo.java
  2. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricPowerRainVo.java
  3. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricDeviceVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo; package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricPowerRainVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.homePage.Hydroelectric.vo; package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

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

Loading…
Cancel
Save