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/scheduled/ScheduledCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java index 9da5fac..5a02c6d 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,7 +280,8 @@ public class ScheduledCreateTask { * 水电站-机组实时加载 */ @XxlJob(LOAD_HYDROPOWER_UNIT_REAL) - public ReturnT loadHydropowerReal(String param) { + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadHydropowerUnitReal(String param) throws Exception { 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/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 8373e6d..519f722 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/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 9377586..a8f4274 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 @@ -1547,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.setOrd(real.getOrd()); 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();