|
|
|
@ -167,8 +167,10 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode())); |
|
|
|
|
// 年计划发电量
|
|
|
|
|
response.setPlanPowerYear(this.getPlanPowerYear(station.getCode())); |
|
|
|
|
// 月发电量、年发电量、年发电完成率
|
|
|
|
|
// 年发电量、年发电完成率
|
|
|
|
|
this.handleStationInfo(station.getRefDept(),response); |
|
|
|
|
// 月发电量
|
|
|
|
|
this.stationMonthPower(station.getId(),map,response); |
|
|
|
|
// 水位、水位曲线
|
|
|
|
|
this.handleWaterLeve(station.getCode(),response); |
|
|
|
|
// 年发电量完成百分比
|
|
|
|
@ -178,7 +180,6 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
return response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 水电站-机组列表 |
|
|
|
|
* @param deptId |
|
|
|
@ -396,16 +397,12 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
* @param response |
|
|
|
|
*/ |
|
|
|
|
private void handleStationInfo(Long deptId, HydropowerStationVo response) { |
|
|
|
|
response.setPowerMon(0f); |
|
|
|
|
response.setPowerYear(0f); |
|
|
|
|
response.setPowerRateYear(0.0); |
|
|
|
|
List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); |
|
|
|
|
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); |
|
|
|
@ -420,6 +417,22 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 月发电量 |
|
|
|
|
* @param id |
|
|
|
|
* @param map |
|
|
|
|
* @param response |
|
|
|
|
*/ |
|
|
|
|
private void stationMonthPower(Long id, Map<Long, Map<String, Float>> map, HydropowerStationVo response) { |
|
|
|
|
if(MapUtils.isEmpty(map) || !map.containsKey(id)){ |
|
|
|
|
response.setPowerMon(0f); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
String month = DateUtil.format(new Date(),"yyyy-MM") + "-01"; |
|
|
|
|
response.setPowerMon(map.get(id).getOrDefault(month, 0f)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 站点水位数据处理 |
|
|
|
|
* @param code |
|
|
|
|
* @param response |
|
|
|
@ -637,6 +650,14 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
if (MapUtils.isEmpty(map)) { |
|
|
|
|
return kpi; |
|
|
|
|
} |
|
|
|
|
String month = DateUtil.format(new Date(),"yyyy-MM") + "-01"; |
|
|
|
|
// 当月发电量
|
|
|
|
|
kpi.setGenerateMon(map.entrySet().stream().filter(o->stations.stream().map(StationEntity::getId).collect(Collectors.toList()).contains(o.getKey())).mapToDouble(entry->{ |
|
|
|
|
if(entry.getValue().containsKey(month)){ |
|
|
|
|
return Double.valueOf(entry.getValue().get(month)); |
|
|
|
|
} |
|
|
|
|
return 0.0; |
|
|
|
|
}).sum()); |
|
|
|
|
// 今年发电趋势
|
|
|
|
|
kpi.setPowerMonthVoList(this.handlePowerFinish(stations,map)); |
|
|
|
|
// 近3年发电量
|
|
|
|
|