diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index d8edc2f..f0b3863 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -40,7 +40,6 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; import com.hnac.hzinfo.sdk.core.response.Result; -import com.sun.org.apache.xpath.internal.operations.NotEquals; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; @@ -597,17 +596,33 @@ public class HydropowerServiceImpl implements HydropowerService { response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode())); // 年计划发电量 response.setPlanPowerYear(this.getPlanPowerYear(station.getCode())); - // 月发电量、年发电量、年发电完成率 + // 年发电量、年发电完成率 this.handleStationInfo(station.getRefDept(),response); // 水位、水位曲线 this.handleWaterLeve(station.getCode(),response); + List powerMonths = this.handlePowerFinish(Collections.singletonList(station),map); // 年发电量完成百分比 - response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map)); + response.setPowerYearMap(powerMonths); + // 月发电量 + response.setPowerMon(this.powerMon(powerMonths)); // 设备信息 response.setDeviceList(this.getDevices(station,realList,targetList)); return response; } + /** + * 月发电量 + * @param powerMonths + * @return + */ + private float powerMon(List powerMonths) { + if(CollectionUtil.isEmpty(powerMonths)){ + return 0.0f; + } + String mon = DateUtil.format(new Date(), "yyyy-MM-01"); + return (float) powerMonths.stream().filter(o->mon.equals(o.getStrMonth())).mapToDouble(PowerMonthVo::getPower).sum(); + } + /** * 水电站-机组列表 @@ -833,9 +848,6 @@ public class HydropowerServiceImpl implements HydropowerService { if(CollectionUtil.isEmpty(targetList)){ return; } - // 月发电量 - float powerMont = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum(); - response.setPowerMon(powerMont); // 年发电量 float powerYear = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum(); response.setPowerYear(powerYear); @@ -1047,8 +1059,6 @@ public class HydropowerServiceImpl implements HydropowerService { if (CollectionUtil.isNotEmpty(targets)) { // 年发电量 kpi.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); - // 月发电量 - kpi.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum()); // 日发电量 kpi.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum()); // 年计划发电量 @@ -1067,10 +1077,13 @@ public class HydropowerServiceImpl implements HydropowerService { if (MapUtils.isEmpty(map)) { return kpi; } + List powerMonths = this.handlePowerFinish(stations,map); // 今年发电趋势 - kpi.setPowerMonthVoList(this.handlePowerFinish(stations,map)); + kpi.setPowerMonthVoList(powerMonths); // 近3年发电量 kpi.setPowerYearVoList(this.generateThreeYear(stations.stream().map(StationEntity::getId).collect(Collectors.toList()),map)); + // 月发电量 + kpi.setGenerateMon(Double.valueOf(this.powerMon(powerMonths))); return kpi; } @@ -1388,6 +1401,7 @@ public class HydropowerServiceImpl implements HydropowerService { countDownLatch.countDown(); }); + // 消缺 exe.execute(()->{ ShortagesVo shortagesVo = mainTaskStatisticService.getShortage(start,end,Collections.singletonList(area.getDeptId())); @@ -1431,6 +1445,7 @@ public class HydropowerServiceImpl implements HydropowerService { } + /** * 站点指标数据 * @param stations