diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java index 99cd174..24834f6 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java @@ -19,6 +19,9 @@ public class DeviceVo { @ApiModelProperty(value = "设备状态") private Boolean state; + @ApiModelProperty(value = "容量") + private Double capacity; + @ApiModelProperty(value = "有功功率") private Double active; @@ -31,9 +34,12 @@ public class DeviceVo { @ApiModelProperty(value = "下泄流量") private Double discharge; - @ApiModelProperty(value = "发电流量") - private Double generate; + @ApiModelProperty(value = "发电效率") + private Double generateRate; @ApiModelProperty(value = "建议有功调整") private Double adjust; + + @ApiModelProperty(value = "排序") + private Integer ord; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java index da88113..0fd6dfd 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java @@ -27,9 +27,15 @@ public class StationVo { @ApiModelProperty(value = "下泄流量") private Double dischargeFlow; + @ApiModelProperty(value = "平均效率") + private Double generateRate; + @ApiModelProperty(value = "设备集合") private List devices; - @ApiModelProperty(value = "设备集合") + @ApiModelProperty(value = "水位曲线集合") private List waters; + + @ApiModelProperty(value = "下泄流量集合") + List discharges; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/WaterVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/WaterVo.java index f112b59..5e348a4 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/WaterVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/WaterVo.java @@ -15,4 +15,7 @@ public class WaterVo { @ApiModelProperty(value = "水位") private Double water; + + @ApiModelProperty(value = "下泄流量") + private Double discharge; } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java index 3f26f45..585f897 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java @@ -196,19 +196,43 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl() {{ eq(HzimsAnalyzeModelStationEntity::getStationId, item.getCode()); }}); // 水位曲线 if(ObjectUtil.isNotEmpty(model)){ - station.setWaters(this.water(model.getInstanceCode())); + List waters = this.water(model.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); + List discharges = this.water(model.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW); + station.setWaters(waters.stream().peek(water->{ + water.setDischarge(0.0); + List filter = discharges.stream().filter(discharge->water.getTime().equals(discharge.getTime())).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(filter)){ + water.setDischarge(filter.get(0).getWater()); + } + }).collect(Collectors.toList())); + station.setDischarges(discharges); } return station; }).collect(Collectors.toList()); } /** + * 站点平均发电效率 + */ + private void generateRate(StationVo station) { + double capacitySum = station.getDevices().stream().mapToDouble(DeviceVo::getCapacity).sum(); + double activeSum = station.getDevices().stream().mapToDouble(DeviceVo::getActive).sum(); + if(Math.abs(capacitySum) <=0 || Math.abs(activeSum) <= 0){ + station.setGenerateRate(0.0); + }else{ + station.setGenerateRate(BigDecimal.valueOf(activeSum / capacitySum * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + } + + /** * 获取站点设备信息 * @param station * @return @@ -225,18 +249,24 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl water(String code) { + private List water(String code,String signages) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH,-7); calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); @@ -274,8 +304,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl records = analyseDataService.periodTargetData(start,end,3,3,code,HomePageConstant.FRONT_WATER_LEVEL); - Random random = new Random(); + List records = analyseDataService.periodTargetData(start,end,3,3,code,signages); if(CollectionUtil.isEmpty(records)){ return new ArrayList<>(); }