diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java index 54ca70e..3ba34f8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java @@ -13,6 +13,38 @@ import lombok.Data; @ApiModel(value = "风电站点app指标数据") public class WindAreaDutyVo { + public WindAreaDutyVo(){ + this.defectSum = 0; + this.unsolvedCount = 0; + this.solvedCount = 0; + this.seriousCount = 0; + this.defectRate = 0.0; + this.inspectionTaskCount = 0; + this.inspectionTaskFinishCount = 0; + this.notInspectionTaskCount = 0; + this.maintenanceTaskCount = 0; + this.maintenanceTaskFinishCount = 0; + this.notMaintenanceTaskCount = 0; + this.overhaulTaskCount = 0; + this.overhaulTaskFinishCount = 0; + this.notOverhaulTaskCount = 0; + this.taskRate = 0.0; + this.plan = 0.0; + this.generate = 0.0; + this.generateComplete = 0.0; + this.speed = 0.0; + this.surfPower = 0.0; + this.belowPower = 0.0; + this.available = 0.0; + this.comprehensivePower = 0.0; + this.peakPower = 0.0; + this.faultHours = 0.0; + this.availableMon = 0.0; + this.completeMonRate = 0.0; + this.planMon = 0.0; + this.generateMon = 0.0; + } + @ApiModelProperty(value = "机构Id") private Long deptId; @@ -152,11 +184,19 @@ public class WindAreaDutyVo { @JsonSerialize(nullsUsing = NullSerializer.class) private Double faultHours; - @ApiModelProperty("短期预测准确率") + @ApiModelProperty(value = "月利用小时") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double availableMon; + + @ApiModelProperty(value = "月发电量完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Double completeMonRate; + + @ApiModelProperty(value = "月计划发电量") @JsonSerialize(nullsUsing = NullSerializer.class) - private Double accuracy; + private Double planMon; - @ApiModelProperty("超短准确率") + @ApiModelProperty(value = "月实际发电量") @JsonSerialize(nullsUsing = NullSerializer.class) - private Double ultraShortAccuracy; + private Double generateMon; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index c40e116..cf2e745 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java @@ -501,24 +501,43 @@ public class WindHomeServiceImpl implements WindHomeService { in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) .like(WindEntity::getFillDate,DateUtil.format(new Date(),DateUtil.PATTERN_DATE)); }}); - if(CollectionUtil.isEmpty(winds)){ + if(CollectionUtil.isNotEmpty(winds)){ + areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getPower).average().orElse(0.0)); + areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum()); + areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); + areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); + areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); + areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); + areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); + } + List windMons = windService.list(new LambdaQueryWrapper() {{ + in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM")); + }}); + if(CollectionUtil.isNotEmpty(windMons)){ + areaDuty.setGenerateMon(windMons.stream().mapToDouble(WindEntity::getPower).sum()); + // 月计划发电量 + areaDuty.setPlanMon(windMons.stream().mapToDouble(WindEntity::getPlan).sum()); + // 月发电量完成率 + if(Math.abs(areaDuty.getGenerateMon()) > 0 && Math.abs(areaDuty.getPlanMon()) > 0){ + areaDuty.setCompleteMonRate(BigDecimal.valueOf(areaDuty.getGenerateMon() / areaDuty.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + } + areaDuty.setAvailable(windMons.stream().mapToDouble(WindEntity::getAvailable).average().getAsDouble()); + } + List windYears = windService.list(new LambdaQueryWrapper() {{ + in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) + .like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy")); + }}); + if(CollectionUtil.isEmpty(windYears)){ return; } - areaDuty.setPlan(winds.stream().mapToDouble(WindEntity::getPlan).sum()); - areaDuty.setGenerate(winds.stream().mapToDouble(WindEntity::getPower).sum()); + areaDuty.setPlan(windYears.stream().mapToDouble(WindEntity::getPlan).sum()); + areaDuty.setGenerate(windYears.stream().mapToDouble(WindEntity::getPower).sum()); // 发电量完成率 if(Math.abs(areaDuty.getPlan()) > 0 && Math.abs(areaDuty.getGenerate()) > 0){ areaDuty.setGenerateComplete(BigDecimal.valueOf(areaDuty.getGenerate() / areaDuty.getPlan() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); } - areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getPower).average().orElse(0.0)); - areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum()); - areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); - areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); - areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); - areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); - areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); - areaDuty.setAccuracy(winds.stream().mapToDouble(WindEntity::getAccuracy).average().orElse(0.0)); - areaDuty.setUltraShortAccuracy(winds.stream().mapToDouble(WindEntity::getUltraShortAccuracy).average().orElse(0.0)); + } /**