From af77249d0675d5d3614a77b5e07713a18f792aba Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Sat, 12 Aug 2023 11:47:01 +0800 Subject: [PATCH] =?UTF-8?q?#=E9=A3=8E=E7=94=B5=E8=AE=A1=E5=88=92=E5=8F=91?= =?UTF-8?q?=E7=94=B5=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/WindSubordinateVo.java | 6 ++++++ .../serviceimpl/MachineryTicketProcessServiceImpl.java | 2 +- .../main/service/impl/WindHomeServiceImpl.java | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java index 68de51f..8bc3ef8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java @@ -27,6 +27,7 @@ public class WindSubordinateVo { @ApiModelProperty(value = "地市名称") private String areaName; + @ApiModelProperty(value = "经度(东经)") @JsonSerialize(nullsUsing = NullSerializer.class) @@ -43,17 +44,22 @@ public class WindSubordinateVo { private List weather; @ApiModelProperty(value = "发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generation; @ApiModelProperty(value = "集团/区域发电占比") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generationRate; @ApiModelProperty(value = "发电完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generationComplete; @ApiModelProperty(value = "风机利用率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double fanUse; @ApiModelProperty(value = "厂用电率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double factoryUse; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java index 48d0154..7748d4f 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java @@ -45,7 +45,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService { @Override public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { log.info("是否执行水力机械工作票流程环节操作~~~~,流程ticket: {}", flowQueue); - String dictValue = processDictService.selectDictValueByKey(MACHINERY_TICKET_KEY); + String dictValue = processDictService.selectDictValueByKey(flowQueue.getProcessDefinitionKey()); if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { log.info("已执行水力机械工作票流程环节操作~~~~"); return true; 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 63ecf54..260894d 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 @@ -201,7 +201,7 @@ public class WindHomeServiceImpl implements WindHomeService { LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); power.setYear(localDate.getYear()); power.setStrMonth(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); - power.setPlanPower((float) plans.stream().filter(o->o.getDateTime().contains(power.getYear() + power.getStrMonth())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); + power.setPlanPower((float) plans.stream().filter(o->o.getDateTime().contains(power.getYear() + "-" + power.getStrMonth())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); power.setPower((float) winds.stream().filter(o->o.getFillDate().contains(localDate.getYear() + "-" + power.getStrMonth())).mapToDouble(WindEntity::getPower).sum()); return power; }).collect(Collectors.toList()); @@ -261,6 +261,8 @@ public class WindHomeServiceImpl implements WindHomeService { // 集团发电占比 if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(winds.stream().mapToDouble(WindEntity::getPower).sum()) > 0){ subordinate.setGenerationRate(BigDecimal.valueOf(subordinate.getGeneration() / winds.stream().mapToDouble(WindEntity::getPower).sum() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setGenerationRate(0.0); } // 计划发电量查询 List plans = planClient.getPlanGenerationByParam(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy")); @@ -268,18 +270,24 @@ public class WindHomeServiceImpl implements WindHomeService { // 发电完成率 if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){ subordinate.setGenerationComplete(BigDecimal.valueOf(subordinate.getGeneration() / plan * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setGenerationComplete(0.0); } // 风机利用率 : (总时间 - 故障时间) / 总时间 double fault = piece.stream().mapToDouble(WindEntity::getFaultHours).sum(); double use = piece.stream().mapToDouble(WindEntity::getAvailable).sum(); if(Math.abs(fault) > 0 ){ subordinate.setFanUse(BigDecimal.valueOf(use / (use + fault) * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setFanUse(0.0); } // 厂用电率 : (发电量-上网电量+下网电量)/发电量 double surf = piece.stream().mapToDouble(WindEntity::getSurfPower).sum(); double below = piece.stream().mapToDouble(WindEntity::getBelowPower).sum(); if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(surf + below) > 0){ subordinate.setFactoryUse(BigDecimal.valueOf((subordinate.getGeneration() - surf + below) / subordinate.getGeneration() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); + }else{ + subordinate.setFactoryUse(0.0); } } return subordinate; @@ -504,7 +512,7 @@ public class WindHomeServiceImpl implements WindHomeService { areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getSpeed).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.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).sum()); 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::getFaultHours).average().orElse(0.0)); @@ -524,7 +532,7 @@ public class WindHomeServiceImpl implements WindHomeService { 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()); + areaDuty.setAvailableMon(windMons.stream().mapToDouble(WindEntity::getAvailable).sum()); } List windYears = windService.list(new LambdaQueryWrapper() {{ in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) @@ -976,11 +984,14 @@ public class WindHomeServiceImpl implements WindHomeService { return new ArrayList<>(); } List monList = this.mons(1,12,false); + // 计划发电量查询 + List plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy")); return monList.stream().map(mon->{ LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); WindGenerationVo generation = new WindGenerationVo(); generation.setYear(localDate.getYear()); generation.setMon(localDate.getMonthValue() > 9 ? String.valueOf(localDate.getMonthValue()) : "0" + localDate.getMonthValue()); + generation.setPlan(plans.stream().filter(o->o.getDateTime().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()); generation.setGeneration(winds.stream().filter(o->o.getFillDate().contains(generation.getYear() + "-" + generation.getMon())).mapToDouble(WindEntity::getPower).sum()); return generation; }).collect(Collectors.toList());