diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index 4061c7c..2446e96 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java @@ -10,6 +10,8 @@ public interface AbnormalAlarmConstant { List TYPE_LIST = Arrays.asList("3","2","5","10","13","14"); + String LEVEL_TYPE_LIST = "3,2,5,10,13,14"; + /**通讯恢复*/ String ABNORMAL_STATUS = "1"; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index 2b4339b..b492f7e 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java @@ -55,10 +55,13 @@ public interface HomePageConstant { */ List waterList = Arrays.asList(HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE); - List types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.ENERGY_STORAGE, + List TYPES = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.ENERGY_STORAGE, HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE, HomePageConstant.PUMPING, HomePageConstant.GATE); + List HOME_TYPES = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.ENERGY_STORAGE, + HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE); + /** * 实时指标 */ @@ -85,6 +88,7 @@ public interface HomePageConstant { */ Integer HYDROPOWER_SERVETYPE = 2; + List SERVETYPE_LIST = Arrays.asList("1","2"); /** * 站点类型 : 云服务 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index e6033b2..34d5a16 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -32,6 +32,8 @@ public interface MainConstants { // 水利-泵站指标数据 String LOAD_WATER_PUMP_TARGET = "loadWaterPumpTarget"; + String LOAD_HOME_TARGET = "loadHomeTarget"; + // 水利-泵站实时数据 String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal"; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java index 30109f8..79c2383 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java @@ -19,6 +19,6 @@ public class StationCountVo { private String typeName; @ApiModelProperty(value = "统计") - private int count; + private Long count; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java index 0c6c0be..885ab64 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java @@ -6,5 +6,7 @@ package com.hnac.hzims.operational.alert.service; */ public interface LevelAlarmService { + String sendMessage(); + void receiveMessage(String message); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java index 1883ff4..6b5b225 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java @@ -1,10 +1,23 @@ package com.hnac.hzims.operational.alert.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.service.IStationService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.stereotype.Service; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + /** * 等级告警实现类 * @author ysj @@ -14,5 +27,40 @@ import org.springframework.stereotype.Service; @RequiredArgsConstructor public class LevelAlarmServiceImpl implements LevelAlarmService { + private final IStationService stationService; + + + /** + * 定时发送消息内容 + * @return String + */ + @Override + public String sendMessage() { + // 站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)); + if(CollectionUtil.isEmpty(stations)){ + throw new ServiceException("level send message is null"); + } + Map map = new ConcurrentHashMap<>(); + map.put("projectIds",stations.stream().map(StationEntity::getCode).collect(Collectors.joining(","))); + map.put("type", AbnormalAlarmConstant.LEVEL_TYPE_LIST); + map.put("startTime", DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + return JSONObject.toJSONString(map); + } + + + /** + * 接收服务推送消息 + * @param message + */ + @Override + public void receiveMessage(String message) { + // 对象转换 + + // 查询近10分钟记录告警 + + // 保存 + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java new file mode 100644 index 0000000..3eafc53 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.operational.config.ws; + +import com.alibaba.fastjson.JSONObject; +import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.config.service.StFocusPropertiesService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.net.URI; +import java.net.URISyntaxException; + +/** + * 等级告警获取数据长链接 + * @author ysj + */ +@Slf4j +@Component +@EnableScheduling +public class LevelAlarmRegular{ + + @Value("${hzims.level.ws-url}") + private String level_wss_url; + + private LevelAlarmWebSocket client; + + @Autowired + private LevelAlarmService levelAlarmService; + + // 定时发送消息 + @Scheduled(cron = "0/30 * * * * ?") + private void regular(){ + // 检查链接存活状态 + if(this.block()){ + client.send(levelAlarmService.sendMessage()); + } + client = this.createClient(); + } + + // 创建websocket链接 + private LevelAlarmWebSocket createClient() { + try{ + return new LevelAlarmWebSocket(new URI(level_wss_url)); + }catch (Exception e){ + log.error("level create error : {}",e.getMessage()); + } + return null; + } + + // 检查链接存活状态 + private boolean block() { + try{ + return client.connectBlocking(); + } catch (Exception e){ + log.error("level block error : {}",e.getMessage()); + } + return false; + } + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java new file mode 100644 index 0000000..54a129c --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java @@ -0,0 +1,124 @@ +package com.hnac.hzims.operational.config.ws; + +import com.alibaba.fastjson.JSONObject; +import com.hnac.hzims.operational.alert.service.LevelAlarmService; +import com.hnac.hzims.operational.config.service.StAlamRecordService; +import jodd.util.StringUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.java_websocket.client.WebSocketClient; +import org.java_websocket.handshake.ServerHandshake; +import org.springblade.core.tool.utils.SpringUtil; +import org.springframework.scheduling.annotation.EnableScheduling; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.net.Socket; +import java.net.URI; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.Optional; + +/** + * 等级告警获取数据长链接 + * @author ysj + */ +@Slf4j +public class LevelAlarmWebSocket extends WebSocketClient { + + private final LevelAlarmService levelAlarmService; + + /** + * 构造等级告警websocket + * @param uri + */ + public LevelAlarmWebSocket(URI uri) { + super(uri); + levelAlarmService = SpringUtil.getBean(LevelAlarmService.class); + connection(this); + } + + // 链接到服务器回调接口 + @Override + public void onOpen(ServerHandshake handshakedata) { + log.error("levl websocket open"); + } + + // 接收到服务器消息回调接口 + @Override + public void onMessage(String message) { + levelAlarmService.receiveMessage(message); + } + + // 与服务器链接中断回调接口 + @Override + public void onClose(int code, String reason, boolean remote) { + log.error("levl websocket close"); + } + + // 与服务器通讯异常触发 + @Override + public void onError(Exception e) { + log.error("levl websocket error : {}",e.getMessage()); + } + + /** + * 建立链接 + * @param webSocket + */ + private void connection(LevelAlarmWebSocket webSocket) { + SSLContext context = init(); + if(Optional.ofNullable(context).isPresent()){ + Socket socket = create(context); + if(Optional.ofNullable(socket).isPresent()){ + webSocket.setSocket(socket); + } + } + } + + /** + * 创建Socket + * @param context + * @return + */ + private Socket create(SSLContext context) { + Socket socket = null; + try{ + socket = context.getSocketFactory().createSocket(); + }catch (Exception e){ + log.error("leve socket create error : {}",e.getMessage()); + } + return socket; + } + + /** + * 协议初始化 + * @return SSLContext + */ + private SSLContext init() { + SSLContext SSL = null; + try{ + SSL = SSLContext.getInstance("TLS"); + SSL.init(null, new TrustManager[]{new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, + String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + }}, new SecureRandom()); + }catch (Exception e){ + log.error("leve SSL init error : {}",e.getMessage()); + } + return SSL; + } + +} \ No newline at end of file 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 df7f4fe..2ac6bb5 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 @@ -40,7 +40,7 @@ public class HomeController extends BladeController { @ApiOperation("首页关键指标") @GetMapping("/target") @ApiOperationSupport(order = 2) - public R target(@ApiParam(value = "指标类型",required = true) Integer type) { + public R> target(@ApiParam(value = "指标类型",required = true) Integer type) { return R.data(service.target(type)); } } \ 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 6d51538..48b9975 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 @@ -27,22 +27,34 @@ import static com.hnac.hzims.operational.station.RunReportConstant.TASK_VALUE_RU @Slf4j @Component public class ScheduledCreateTask { + @Autowired - private IRunMonthReportService runMonthReportService; + private HomeService homeService; + + @Autowired + private IWaterService waterService; + @Autowired private IStationService stationService; + @Autowired - private IMainSystemMonitoringService mainSystemMonitoringService; + private HydropowerService hydropowerService; + @Autowired - private IUnitRunningTimeService unitRunningTimeService; + private IAreaMonthReportService reportService; + @Autowired - private IWaterService waterService; + private PhotovoltaicService photovoltaicService; + @Autowired - private IAreaMonthReportService reportService; + private IRunMonthReportService runMonthReportService; + @Autowired - private HydropowerService hydropowerService; + private IUnitRunningTimeService unitRunningTimeService; + @Autowired - private PhotovoltaicService photovoltaicService; + private IMainSystemMonitoringService mainSystemMonitoringService; + @Autowired BladeLogger logger; @@ -219,6 +231,20 @@ public class ScheduledCreateTask { } /** + * 首页-指标数据加载 + * @return ReturnT + */ + @XxlJob(LOAD_HOME_TARGET) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadHomeTarget(String param) throws Exception { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + homeService.loadHomeTarget(param); + return new ReturnT<>("SUCCESS"); + } + + /** * 水利-泵组指标加载 * @return ReturnT */ 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 5d2499d..d594c11 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 @@ -11,7 +11,9 @@ import java.util.List; */ public interface HomeService { + void loadHomeTarget(String param); + List count(); - TargetVo target(Integer type); + List target(Integer type); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java index 2855ef2..39a501f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java @@ -16,14 +16,6 @@ public interface IPlatformService { */ List doStationCount(Integer serveType); - /** - * 根据权限统计 - * 根据服务类型及站点类型进行站点统计 - * - * @return - */ - List doStationAuthCount(Integer serveType); - CloudKeyIndexVo doCloudKeyIndex(Integer stationType, Integer serveType); List doCloudAlarmInfo(Integer serveType); 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 e6bade3..0aca6ba 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 @@ -82,6 +82,7 @@ public class HomeServiceImpl implements HomeService { @Value("${hzims.operation.homePage.charge.url}") public String charge_url; + private final static String load_home_target_key = "load:operation:home:target:key"; private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; @@ -93,6 +94,38 @@ public class HomeServiceImpl implements HomeService { private static final int NETWORK_POOL_QUANTITY = 3; + @Override + public void loadHomeTarget(String param) { + List targets = HomePageConstant.HOME_TYPES.stream().map(type->{ + if(type == 0) { + return this.hydropowerTaget(); + } + if (type == 1) { + return this.windTaget(); + } + if (type == 2) { + return this.waterStorageTaget(true); + } + if (type == 3) { + return this.waterStorageTaget(false); + } + if (type == 4) { + return this.networkTaget(); + } + if (type == 5) { + return this.photovoltaicTaget(); + } + if (type == 6) { + return this.affairsTaget(); + } + if(type == 7) { + return this.chargeTarget(); + } + return new TargetVo(); + }).collect(Collectors.toList()); + redisTemplate.opsForValue().set(load_home_target_key,targets.stream().filter(( target -> ObjectUtil.isNotEmpty(target.getType()))).collect(Collectors.toList())); + } + /** * 首页站点数量 * @return @@ -102,23 +135,21 @@ public class HomeServiceImpl implements HomeService { // 查询全部站点 List stations = stationService.list(); List counts = new ArrayList<>(); - stations.stream().collect(Collectors.groupingBy(StationEntity::getServeType)) - .forEach((key, value) -> counts.addAll(value.stream().collect(Collectors.groupingBy(StationEntity::getType)).entrySet().stream(). - map(station -> { - StationCountVo count = new StationCountVo(); - count.setServeType(key); - if(HomePageConstant.CHARGE.equals(station.getKey()) && "2".equals(key)){ - TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge); - if(ObjectUtil.isNotEmpty(target)){ - count.setCount(Optional.ofNullable(target.getCharge()).orElse(0)); - } - }else{ - count.setCount(station.getValue().size()); - } - count.setType(String.valueOf(station.getKey())); - count.setTypeName(DictCache.getValue("stationType", station.getKey())); - return count; - }).collect(Collectors.toList()))); + HomePageConstant.SERVETYPE_LIST.forEach(serve ->counts.addAll(HomePageConstant.HOME_TYPES.stream().map(type -> { + StationCountVo count = new StationCountVo(); + count.setServeType(serve); + if(HomePageConstant.CHARGE.equals(type) && "2".equals(serve)){ + TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge); + if(ObjectUtil.isNotEmpty(target)){ + count.setCount(Long.valueOf(Optional.ofNullable(target.getCharge()).orElse(0))); + } + }else{ + count.setCount(stations.stream().filter(station->serve.equals(station.getServeType()) && type.equals(station.getType())).count()); + } + count.setType(String.valueOf(type)); + count.setTypeName(DictCache.getValue("stationType", type)); + return count; + }).collect(Collectors.toList()))); return counts.stream().sorted(Comparator.comparing(StationCountVo::getServeType)).collect(Collectors.toList()); } @@ -128,34 +159,12 @@ public class HomeServiceImpl implements HomeService { * @return */ @Override - public TargetVo target(Integer type) { - switch (type){ - // 水电站 - case 0: - return this.hydropowerTaget(); - // 风电站 - case 1: - return this.windTaget(); - // 水利 - case 2: - return this.waterStorageTaget(false); - // 储能站 - case 3: - return this.waterStorageTaget(true); - // 配网 - case 4: - return this.networkTaget(); - // 光伏站 - case 5: - return this.photovoltaicTaget(); - // 充电桩 - case 7: - return this.chargeTarget(); - // 水务 - case 6: - default: - return new TargetVo(); + public List target(Integer type) { + List targets = (List) redisTemplate.opsForValue().get(load_home_target_key); + if(CollectionUtil.isEmpty(targets)){ + return new ArrayList<>(); } + return targets; } @@ -193,7 +202,7 @@ public class HomeServiceImpl implements HomeService { } } // 双票合格率 - R> result = sysClient.getDeptByCurrentUser(); + 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)){ @@ -296,33 +305,32 @@ public class HomeServiceImpl implements HomeService { /** * 储能指标 - * @param flag : false - 水利 true - 储能 + * @param flag : true - 水利 false - 储能 * @return */ private TargetVo waterStorageTaget(boolean flag) { TargetVo target = new TargetVo(); if(flag){ - target.setType(HomePageConstant.ENERGY_STORAGE); - target.setTypeName(DictCache.getValue("stationType", HomePageConstant.ENERGY_STORAGE)); - }else{ target.setType(HomePageConstant.WATER_CONSERVANCY); target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WATER_CONSERVANCY)); + }else{ + target.setType(HomePageConstant.ENERGY_STORAGE); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.ENERGY_STORAGE)); } - // 查询储能站点 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE); if(flag){ - wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE); - }else{ wrapper.eq(StationEntity::getType,HomePageConstant.WATER_CONSERVANCY); + }else{ + wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE); } List stations = stationService.list(wrapper); if(CollectionUtil.isEmpty(stations)){ return target; } // 获取储能区域级别机构 - R> result = sysClient.getDeptByCurrentUser(); + 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)){ @@ -446,6 +454,18 @@ public class HomeServiceImpl implements HomeService { } /** + * 水务指标 + * @return + */ + private TargetVo affairsTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.WATER_AFFAIRS); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WATER_AFFAIRS)); + // TODO 统计业务数据 + return target; + } + + /** * 充电桩 * @return */ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java index 2b6b1f1..e470d45 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java @@ -102,36 +102,6 @@ public class PlatformServiceImpl implements IPlatformService { return list; } - /** - * 根据权限统计 - * 根据服务类型及站点类型进行站点统计 - * - * @return - */ - @Override - public List doStationAuthCount(Integer serveType) { - List voList = new ArrayList<>(); - // 查询服务类型站点数据 - List list = stationService.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getServeType, serveType); - }}); - List dictList =DictCache.getList("stationType"); - //key 站点类型 value 站点 - Map> map = list.stream().filter(o -> null != o.getType()).collect(Collectors.groupingBy(StationEntity::getType)); - dictList.forEach(o->{ - StationCountVo stationCountVo = new StationCountVo(); - stationCountVo.setType(o.getDictKey()); - stationCountVo.setTypeName(o.getDictValue()); - stationCountVo.setCount(0); - Integer type = Integer.valueOf(o.getDictKey()); - List stationEntityList = map.get(type); - if(CollectionUtil.isNotEmpty(stationEntityList)) { - stationCountVo.setCount(stationEntityList.size()); - } - voList.add(stationCountVo); - }); - return voList; - } /** * 云服务-关键指标 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 1c45efa..b6d843a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -637,7 +637,7 @@ public class StationServiceImpl extends BaseServiceImpl select(Integer type, Integer serveType) { List types; if (ObjectUtil.isEmpty(type)) { - types = HomePageConstant.types; + types = HomePageConstant.TYPES; } else if (HomePageConstant.WATER_CONSERVANCY.equals(type)) { types = HomePageConstant.waterList; } else {