From 75f744ee1c95a6d9a5e0260c29dd6b59e3073cfc Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 19 Jun 2023 15:56:09 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=BD?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecology/entity/EcologyFlowStationEntity.java | 2 ++ .../operational/main/vo/AppHydropowerDeviceVo.java | 4 ++++ .../operational/main/vo/HydropowerUnitRealVo.java | 3 +++ .../operation/impl/RealTargetServiceImpl.java | 2 +- .../ecology/controller/EcologyController.java | 10 +++++----- .../ecology/service/EcologyFlowStationService.java | 4 ++-- .../service/impl/EcologyFlowStationServiceImpl.java | 20 ++++++++++++++------ .../main/scheduled/ScheduledCreateTask.java | 7 ++----- .../main/service/impl/HomeServiceImpl.java | 4 ++-- .../main/service/impl/HydropowerServiceImpl.java | 4 +++- 10 files changed, 38 insertions(+), 22 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java index ce4d7e8..48ee5b1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java @@ -19,6 +19,8 @@ public class EcologyFlowStationEntity extends TenantEntity { private String stationName; + private String city; + private Long isOnLine; private Long isDemonstrate; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java index 604bd60..20a1cd1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java @@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; import lombok.Data; /** @@ -28,4 +29,7 @@ public class AppHydropowerDeviceVo { @ApiModelProperty(value = "负荷单位") private String loadUnit; + + @ApiModelProperty(value = "排序") + private Integer ord; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java index f4cf2f8..9784d6c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java @@ -61,4 +61,7 @@ public class HydropowerUnitRealVo { @ApiModelProperty(value = "电流单位") private String currentUnit; + + @ApiModelProperty(value = "排序") + private Integer ord; } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java index 55fb6d7..a008be8 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java @@ -1186,7 +1186,7 @@ public class RealTargetServiceImpl implements RealTargetService { */ private int getPhotovoltaicState(EminfoAndEmParamVo device, Map map) { // 获取开关机监测点实时数据 - Double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); + double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); // 开机状态 if (Math.abs(value) <= 0) { return 0; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java index 3973568..f9f2e35 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java @@ -51,11 +51,11 @@ public class EcologyController extends BladeController { * 站点数据排行 * @return */ - @PostMapping("/station_top") + @PostMapping("/station_top") @ApiOperationSupport(order = 1) @ApiOperation(value = "站点数据及达标率排行", notes = "站点数据及达标率排行") - public R station_top() { - return R.data(stationService.station_top()); + public R station_top(@RequestParam String city) { + return R.data(stationService.station_top(city)); } /** @@ -65,8 +65,8 @@ public class EcologyController extends BladeController { @PostMapping("/trend_chart") @ApiOperationSupport(order = 1) @ApiOperation(value = "指标趋势图", notes = "指标趋势图") - public R trend_chart(@RequestParam String type) { - return R.data(stationService.trend_chart(type)); + public R trend_chart(@RequestParam String city,@RequestParam String type) { + return R.data(stationService.trend_chart(city,type)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java index ba6ba2a..d129ab9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java @@ -14,12 +14,12 @@ import java.util.List; */ public interface EcologyFlowStationService extends BaseService { - EcologFlowStationVo station_top(); + EcologFlowStationVo station_top(String city); Boolean generate(Long mon,String year); - List trend_chart(String type); + List trend_chart(String city,String type); List station(); } 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 bf9dbc4..fbbcda1 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 @@ -98,8 +98,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl stations = this.list(); + public EcologFlowStationVo station_top(String city) { + List stations = this.list(Wrappers.lambdaQuery() + .eq(EcologyFlowStationEntity::getCity,city)); if(CollectionUtil.isEmpty(stations)){ return new EcologFlowStationVo(); } @@ -110,8 +111,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl o.getIsTimely().equals(1L)).count() / (double) stations.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); station.setCount(stations.size()); - List datas = dataService.list(Wrappers.lambdaQuery(). - like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM"))); + List datas = dataService.list(Wrappers.lambdaQuery() + .like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM")) + .in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList()))); if(CollectionUtil.isEmpty(datas)){ return station; } @@ -132,8 +134,14 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl trend_chart(String type) { + public List trend_chart(String city,String type) { + List stations = this.list(Wrappers.lambdaQuery() + .eq(EcologyFlowStationEntity::getCity,city)); + if(CollectionUtil.isEmpty(stations)){ + return new ArrayList<>(); + } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList())); if("0".equals(type)){ wrapper.like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy")); } @@ -179,7 +187,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl station() { List stations = stationService.list(Wrappers.lambdaQuery() - .in(StationEntity::getCode,Arrays.asList("902400000054","902400052664"))); + .in(StationEntity::getCode,Arrays.asList("902400000054","902400052664","902400056791"))); if(CollectionUtil.isEmpty(stations)){ return new ArrayList<>(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java index f7c04b5..9da5fac 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java @@ -278,12 +278,9 @@ public class ScheduledCreateTask { /** * 水电站-机组实时加载 - * @return ReturnT */ - //@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) - @Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadHydropowerUnitReal() throws Exception { - String param = ""; + @XxlJob(LOAD_HYDROPOWER_UNIT_REAL) + public ReturnT loadHydropowerReal(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index c2a247a..8373e6d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java @@ -246,7 +246,7 @@ public class HomeServiceImpl implements HomeService { double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); // 装机容量 - target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); + target.setTaget_one(list.get(0).getInstalledCapacity()); // 发电量 target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); if(Math.abs(plan) > 0){ @@ -254,7 +254,7 @@ public class HomeServiceImpl implements HomeService { target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); } // 双票合格率 - target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); return target; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 876c9e4..9377586 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -153,6 +153,7 @@ public class HydropowerServiceImpl implements HydropowerService { HydropowerUnitRealVo real = new HydropowerUnitRealVo(); real.setDeptId(device.getCreateDept()); real.setDeviceCode(device.getEmCode()); + real.setOrd(device.getOrd()); real.setDeptName(device.getName()); real.setDeviceName(device.getName()); // 装机容量 @@ -1548,12 +1549,13 @@ public class HydropowerServiceImpl implements HydropowerService { AppHydropowerDeviceVo device = new AppHydropowerDeviceVo(); device.setDeviceCode(real.getDeviceCode()); device.setDeviceName(real.getDeviceName()); + device.setOrd(real.getOrd()); device.setState(real.getState()); device.setLoadUnit(Optional.ofNullable(real.getPowerUnit()).orElse("kW")); device.setCapacity(real.getInstalledCapacity()); device.setLoad(real.getActivePower()); return device; - }).collect(Collectors.toList())); + }).sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList())); hydropower.setLoadUnit(hydropower.getDevices().get(0).getLoadUnit()); } return hydropower;