From a4d22de1d54eb6649d957d95b11f83727aadd92d Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 28 Jun 2023 10:45:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?#=E6=A3=80=E4=BF=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java | 3 +++ .../java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java | 3 +++ .../ecology/service/impl/EcologyFlowStationServiceImpl.java | 2 +- .../hzims/operational/main/service/impl/HydropowerServiceImpl.java | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) 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..f650ba6 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 @@ -28,4 +28,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/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..8efdbc9 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 @@ -179,7 +179,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/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 876c9e4..0c6eaf0 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()); // 装机容量 @@ -1546,6 +1547,7 @@ public class HydropowerServiceImpl implements HydropowerService { // 设备 hydropower.setDevices(devices.stream().map(real->{ AppHydropowerDeviceVo device = new AppHydropowerDeviceVo(); + device.setOrd(real.getOrd()); device.setDeviceCode(real.getDeviceCode()); device.setDeviceName(real.getDeviceName()); device.setState(real.getState()); @@ -1553,7 +1555,7 @@ public class HydropowerServiceImpl implements HydropowerService { 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; From f39f4844f319ba969c8e13052e434e78f0c01263 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Jun 2023 09:44:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?#=E6=A3=80=E4=BF=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/MapMarkerVo.java | 3 ++ .../main/controller/HomeController.java | 8 ++++ .../operational/main/service/HomeService.java | 2 + .../main/service/impl/HomeServiceImpl.java | 49 ++++++++++++++++++++++ .../main/service/impl/SideHustleServiceImpl.java | 4 ++ 5 files changed, 66 insertions(+) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java index e08996a..b80c630 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java @@ -33,4 +33,7 @@ public class MapMarkerVo { @ApiModelProperty(value = "区域名称") private String areaName; + + @ApiModelProperty(value = "数据采集方式: 数据采集、数据填报") + private String dataOrigin; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java index 99eb136..d09afd5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java @@ -43,4 +43,12 @@ public class HomeController extends BladeController { public R> target(@ApiParam(value = "指标类型",required = true) Integer type) { return R.data(service.target(type)); } + + @ApiLog + @ApiOperation("黔东南指标") + @GetMapping("/blackTarget") + @ApiOperationSupport(order = 2) + public R blackTarget() { + return R.data(service.blackTarget()); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java index d594c11..bf42f29 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java @@ -16,4 +16,6 @@ public interface HomeService { List count(); List target(Integer type); + + TargetVo blackTarget(); } 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..38fa882 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 @@ -537,4 +537,53 @@ public class HomeServiceImpl implements HomeService { } return stringBuilder.toString(); } + + /** + * 黔东南指标 + * @return + */ + @Override + public TargetVo blackTarget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.HYDROPOWER); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.HYDROPOWER)); + // 计划发电量 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)); + // 实时数据 + List reals = (List) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); + // 指标数据 + List targets = (List) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); + if(CollectionUtil.isNotEmpty(reals)){ + // 装机容量 + target.setTaget_one(reals.stream().filter(real->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); + } + if(CollectionUtil.isNotEmpty(targets)){ + // 发电量 + target.setTaget_two(targets.stream().filter(tar->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(tar.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); + } + if(CollectionUtil.isNotEmpty(stations)){ + List plans = planService.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); + if(CollectionUtil.isNotEmpty(plans)){ + double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); + if(Math.abs(plan) > 0){ + target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + } + } + // 双票合格率 + R> result = sysClient.getDeptList(); + if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ + List areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(areas)){ + LocalDateTime firstDateTime = LocalDateTime.of(LocalDate.now().withDayOfYear(1), LocalTime.MIN); + DoublePassRateVO pass = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now()); + if(ObjectUtil.isNotEmpty(pass)){ + target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); + } + } + } + return target; + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java index 84a660b..f89bd74 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java @@ -129,6 +129,9 @@ public class SideHustleServiceImpl implements ISideHustleService { @Value("${hzims.operation.realIdKey}") public String real_id_key; + @Value("${hzims.equipment.emInfo.emInfoList}") + public String device_cache_cofig_final; + // 存储近年发电量Redis的key值 private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; @@ -952,6 +955,7 @@ public class SideHustleServiceImpl implements ISideHustleService { if(ObjectUtil.isEmpty(station)){ return; } + vo.setDataOrigin(station.getDataOrigin()); vo.setLttd(station.getLttd()); vo.setLgtd(station.getLgtd()); String areaCode = station.getAreaCode(); From 990edb29c724708a06132748f9cde7ebb99316d8 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Jun 2023 14:18:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?#=E6=A3=80=E4=BF=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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..b66f01f 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 @@ -280,10 +280,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) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadHydropowerUnitReal(String param) throws Exception { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); }