Browse Source

#站点页面修改

zhongwei
yang_shj 5 months ago
parent
commit
791cfbf76f
  1. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -147,8 +147,7 @@ public class HydropowerServiceImpl implements HydropowerService {
response.setDeptName(station.getName());
response.setStationCode(station.getCode());
// 站点状态
List<SoeData> soeDataList = soeClient.getByLastLimitTime(null, station.getCode(), 1).getData();
response.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
response.setStationStatus(true);
// 站点实时天气
response.setTemp(this.getTemp(weather,station.getCode()));
// 站点七天天气
@ -167,9 +166,7 @@ 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);
@ -391,33 +388,6 @@ public class HydropowerServiceImpl implements HydropowerService {
return R.getData();
}
/**
* 站点信息处理
* @param deptId
* @param response
*/
private void handleStationInfo(Long deptId, HydropowerStationVo response) {
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 powerMon = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum();
response.setPowerYear(powerMon);
// 年发电量
float powerYear = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
response.setPowerYear(powerYear);
// 年发电完成率
float planPowerYear = response.getPlanPowerYear();
if(Math.abs(planPowerYear) <= 0){
response.setPowerRateYear(0.0);
} else {
double powerRateYear = BigDecimal.valueOf(powerYear / planPowerYear * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
response.setPowerRateYear(powerRateYear);
}
}
/**
* 月发电量
@ -430,11 +400,24 @@ public class HydropowerServiceImpl implements HydropowerService {
response.setPowerMon(0f);
return;
}
// 月发电量
String month = DateUtil.format(new Date(),"yyyy-MM") + "-01";
float powerMon = map.get(id).getOrDefault(month, 0f);
if(powerMon > 0){
response.setPowerMon(powerMon);
}
String year = DateUtil.format(new Date(),"yyyy");
// 年发电量
float powerYear = (float) map.get(id).entrySet().stream().filter(o->o.getKey().contains(year)).mapToDouble(Map.Entry::getValue).sum();
response.setPowerYear(powerYear);
// 年发电完成率
float planPowerYear = response.getPlanPowerYear();
if(Math.abs(planPowerYear) <= 0){
response.setPowerRateYear(0.0);
} else {
double powerRateYear = BigDecimal.valueOf(powerYear / planPowerYear * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
response.setPowerRateYear(powerRateYear);
}
}
@ -559,8 +542,7 @@ public class HydropowerServiceImpl implements HydropowerService {
hydropower.setDeptName(station.getName());
hydropower.setStationCode(station.getCode());
// 站点状态
List<SoeData> soeDataList = soeClient.getByLastLimitTime(null, station.getCode(), 1).getData();
hydropower.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
hydropower.setStationStatus(true);
// 站点实时天气
hydropower.setTemp(this.getTemp(weather,station.getCode()));
// 站点七天天气
@ -580,7 +562,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 年计划发电量
hydropower.setPlanPowerYear(this.getPlanPowerYear(station.getCode()));
// 月发电量、年发电量、年发电完成率
this.handleStationInfo(station.getRefDept(),hydropower);
this.stationMonthPower(station.getId(),map,hydropower);
// 水位、水位曲线
this.handleWaterLeve(station.getCode(),hydropower);
// 年发电量完成百分比

Loading…
Cancel
Save