From b130f30b4599ad1734ead177240a82a674c9d693 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 29 Aug 2024 08:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8D=E7=94=A8=E5=BE=97?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/controller/HzimsDataController.java | 10 ++---- .../operational/data/service/HzimsDataService.java | 5 --- .../data/service/impl/HzimsDataServiceImpl.java | 39 +--------------------- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java index 2670106..0e16ddf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java @@ -26,13 +26,7 @@ public class HzimsDataController { private final HzimsDataService service; - - @GetMapping("/saveArea") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "获取区域列表数据", notes = "无需传入参数") - public R saveArea() { - return R.data(service.saveArea()); - } + @GetMapping("/stationNumber") @@ -42,7 +36,7 @@ public class HzimsDataController { return R.data(service.stationNumber()); } - + @GetMapping("/station") @ApiOperationSupport(order = 3) @ApiOperation(value = "站点数据获取", notes = "传入站点code") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java index 5974bd1..a10edbb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java @@ -15,11 +15,6 @@ import java.util.List; */ public interface HzimsDataService { - /** - * 获取区域列表数据 - * @return - */ - boolean saveArea(); List stationNumber(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index b239d27..296612c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -85,10 +85,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { private final RedisTemplate redisTemplate; - @Value("${hzims.operation.save.area.url}") - public String AREA_URL; - @Value("${hzims.operation.save.station.url}") - public String STATION_URL; + private final static String charge = "hzims:operation:key:charge"; @@ -105,41 +102,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; - @Override - public boolean saveArea() { - R> result = sysClient.getDeptList(); - if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { - throw new ServiceException("暂无区域数据!"); - } - List types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE); - Map> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE,true); - if (MapUtils.isEmpty(map)) { - throw new ServiceException("暂无区域数据!"); - - } - List deviceList = emService.getEmInfoList(); - // 获取区域列表数据 - List list = map.entrySet().stream().map(entry->{ - AreaVo vo = new AreaVo(); - vo.setDeptId(entry.getKey().getId()); - vo.setDeptName(entry.getKey().getDeptName()); - int hydropowerCount = (int) entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).count(); - vo.setHydropowerStationCount(hydropowerCount); - int waterCount = entry.getValue().size() - hydropowerCount; - vo.setWaterStationCount(waterCount); - List value = entry.getValue().stream().filter(o->HomePageConstant.HYDROPOWER.equals(o.getType())).map(StationEntity::getRefDept).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(value)){ - vo.setInstalledCapacity(0.0); - }else{ - double installedCapacity = deviceList.stream().filter(o-> null != o.getInstalledCapacity() && value.contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum(); - vo.setInstalledCapacity(installedCapacity); - } - return vo; - }).collect(Collectors.toList()); - // 调用Http请求 - return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL); - } /**