Browse Source

#光伏数据bug修复

zhongwei
yang_shj 9 months ago
parent
commit
c0ddfbbfa2
  1. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  2. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -447,6 +447,9 @@ public class RealTargetServiceImpl implements RealTargetService {
real.setState(this.getPhotovoltaicState(device, map)); real.setState(this.getPhotovoltaicState(device, map));
// 容量 // 容量
real.setCapacity(device.getInstalledCapacity()); real.setCapacity(device.getInstalledCapacity());
if(MapUtils.isEmpty(device.getPoint())){
return real;
}
// 发电量 // 发电量
real.setGenerate(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY)); real.setGenerate(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY));
// 功率 // 功率
@ -585,6 +588,9 @@ public class RealTargetServiceImpl implements RealTargetService {
// 接入站点设备统计 // 接入站点设备统计
devices.forEach(device -> { devices.forEach(device -> {
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
if(MapUtils.isEmpty(device.getPoint())){
return;
}
target.setDeptId(device.getCreateDept()); target.setDeptId(device.getCreateDept());
target.setDeviceCode(device.getEmCode()); target.setDeviceCode(device.getEmCode());
target.setDeviceName(device.getName()); target.setDeviceName(device.getName());

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -698,7 +698,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 容量 // 容量
kpi.setInstalledCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum()); kpi.setInstalledCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
// 负荷 // 负荷
kpi.setLoad(reals.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum()); kpi.setLoad(reals.stream().filter(o-> !ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicRealVo::getLoad).sum());
} }
} }
// 指标数据 // 指标数据
@ -945,7 +945,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
subordinate.setStationCount((long) entry.getValue().size()); subordinate.setStationCount((long) entry.getValue().size());
subordinate.setStationUseCount(reals.stream().filter(device -> device.getState() == 1).map(PhotovoltaicRealVo::getDeptId).distinct().count()); subordinate.setStationUseCount(reals.stream().filter(device -> device.getState() == 1).map(PhotovoltaicRealVo::getDeptId).distinct().count());
subordinate.setCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum()); subordinate.setCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
subordinate.setLoad(reals.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum()); subordinate.setLoad(reals.stream().filter(o-> !ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicRealVo::getLoad).sum());
} }
// 区域/站点 设备指标数据 // 区域/站点 设备指标数据
if (deviceTargets != null) { if (deviceTargets != null) {
@ -1514,31 +1514,35 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return; return;
} }
// 容量 // 容量
photovoltaic.setCapacity(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getCapacity).sum()); photovoltaic.setCapacity(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getCapacity())).mapToDouble(PhotovoltaicDeviceVo::getCapacity).sum());
// 总发电量 // 总发电量
photovoltaic.setGenerate(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerate).sum()); photovoltaic.setGenerate(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerate())).mapToDouble(PhotovoltaicDeviceVo::getGenerate).sum());
// 收益 // // 收益
photovoltaic.setIncome(photovoltaic.getGenerate() * 0.34); if(ObjectUtil.isEmpty(photovoltaic.getGenerate())){
photovoltaic.setIncome(0.0);
}else{
photovoltaic.setIncome(photovoltaic.getGenerate() * 0.34);
}
// 年发电量 // 年发电量
photovoltaic.setGenerateYear(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateYear).sum()); photovoltaic.setGenerateYear(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateYear())).mapToDouble(PhotovoltaicDeviceVo::getGenerateYear).sum());
// 月发电量 // 月发电量
photovoltaic.setGenerateMon(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateMon).sum()); photovoltaic.setGenerateMon(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateMon())).mapToDouble(PhotovoltaicDeviceVo::getGenerateMon).sum());
// 日发电量 // 日发电量
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum()); photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateDay())).mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum());
// 功率 // 功率
photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum()); photovoltaic.setLoad(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicDeviceVo::getLoad).sum());
double generationDay = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum(); double generationDay = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateDay())).mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum();
double generationYesterday = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum(); double generationYesterday = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerationYesterday())).mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum();
// 环比发电量 // 环比发电量
if (Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) { if (ObjectUtil.isEmpty(generationDay) || ObjectUtil.isEmpty(generationYesterday) || Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) {
photovoltaic.setGenerateDayRatio(0.0); photovoltaic.setGenerateDayRatio(0.0);
} else { } else {
photovoltaic.setGenerateDayRatio(BigDecimal.valueOf((generationDay - generationYesterday) / generationYesterday * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); photovoltaic.setGenerateDayRatio(BigDecimal.valueOf((generationDay - generationYesterday) / generationYesterday * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
} }
double load = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum(); double load = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicDeviceVo::getLoad).sum();
double lastLoad = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum(); double lastLoad = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLastLoad())).mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum();
// 环比功率 // 环比功率
if (Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) { if (ObjectUtil.isEmpty(load) || ObjectUtil.isEmpty(lastLoad) || Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) {
photovoltaic.setLoadRatio(0.0); photovoltaic.setLoadRatio(0.0);
} else { } else {
photovoltaic.setLoadRatio(BigDecimal.valueOf((load - lastLoad) / lastLoad * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); photovoltaic.setLoadRatio(BigDecimal.valueOf((load - lastLoad) / lastLoad * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
@ -1709,7 +1713,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 串流电压12 // 串流电压12
item.setSe_voltage_twelve(mateReals.get(0).getSe_voltage_twelve()); item.setSe_voltage_twelve(mateReals.get(0).getSe_voltage_twelve());
// 环比功率 // 环比功率
if (Math.abs(mateReals.get(0).getLoad()) <= 0 || mateReals.get(0).getLastLoad() <= 0) { if (ObjectUtil.isEmpty(mateReals.get(0).getLoad()) || ObjectUtil.isEmpty(mateReals.get(0).getLastLoad()) || Math.abs(mateReals.get(0).getLoad()) <= 0 || mateReals.get(0).getLastLoad() <= 0) {
item.setLoadRatio(0.0); item.setLoadRatio(0.0);
} else { } else {
item.setLoadRatio(BigDecimal.valueOf((mateReals.get(0).getLoad() - mateReals.get(0).getLastLoad()) / mateReals.get(0).getLastLoad() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); item.setLoadRatio(BigDecimal.valueOf((mateReals.get(0).getLoad() - mateReals.get(0).getLastLoad()) / mateReals.get(0).getLastLoad() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());

Loading…
Cancel
Save