Browse Source

#首页优化

zhongwei
yang_shj 2 years ago
parent
commit
a1f4f41102
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/LevelAlarmService.java
  6. 48
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java
  7. 63
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java
  8. 124
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmWebSocket.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java
  10. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  11. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java
  12. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java
  13. 126
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  14. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java
  15. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

2
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<String> TYPE_LIST = Arrays.asList("3","2","5","10","13","14"); List<String> TYPE_LIST = Arrays.asList("3","2","5","10","13","14");
String LEVEL_TYPE_LIST = "3,2,5,10,13,14";
/**通讯恢复*/ /**通讯恢复*/
String ABNORMAL_STATUS = "1"; String ABNORMAL_STATUS = "1";

6
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<Integer> waterList = Arrays.asList(HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE); List<Integer> waterList = Arrays.asList(HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE);
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.ENERGY_STORAGE, List<Integer> 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.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE, HomePageConstant.PUMPING,
HomePageConstant.GATE); HomePageConstant.GATE);
List<Integer> 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; Integer HYDROPOWER_SERVETYPE = 2;
List<String> SERVETYPE_LIST = Arrays.asList("1","2");
/** /**
* 站点类型 云服务 * 站点类型 云服务

2
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_WATER_PUMP_TARGET = "loadWaterPumpTarget";
String LOAD_HOME_TARGET = "loadHomeTarget";
// 水利-泵站实时数据 // 水利-泵站实时数据
String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal"; String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal";

2
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; private String typeName;
@ApiModelProperty(value = "统计") @ApiModelProperty(value = "统计")
private int count; private Long count;
} }

2
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 { public interface LevelAlarmService {
String sendMessage();
void receiveMessage(String message);
} }

48
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; 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.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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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 org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/** /**
* 等级告警实现类 * 等级告警实现类
* @author ysj * @author ysj
@ -14,5 +27,40 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor @RequiredArgsConstructor
public class LevelAlarmServiceImpl implements LevelAlarmService { public class LevelAlarmServiceImpl implements LevelAlarmService {
private final IStationService stationService;
/**
* 定时发送消息内容
* @return String
*/
@Override
public String sendMessage() {
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE));
if(CollectionUtil.isEmpty(stations)){
throw new ServiceException("level send message is null");
}
Map<String,String> 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分钟记录告警
// 保存
}
} }

63
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;
}
}

124
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;
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java

@ -40,7 +40,7 @@ public class HomeController extends BladeController {
@ApiOperation("首页关键指标") @ApiOperation("首页关键指标")
@GetMapping("/target") @GetMapping("/target")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<TargetVo> target(@ApiParam(value = "指标类型",required = true) Integer type) { public R<List<TargetVo>> target(@ApiParam(value = "指标类型",required = true) Integer type) {
return R.data(service.target(type)); return R.data(service.target(type));
} }
} }

40
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 @Slf4j
@Component @Component
public class ScheduledCreateTask { public class ScheduledCreateTask {
@Autowired @Autowired
private IRunMonthReportService runMonthReportService; private HomeService homeService;
@Autowired
private IWaterService waterService;
@Autowired @Autowired
private IStationService stationService; private IStationService stationService;
@Autowired @Autowired
private IMainSystemMonitoringService mainSystemMonitoringService; private HydropowerService hydropowerService;
@Autowired @Autowired
private IUnitRunningTimeService unitRunningTimeService; private IAreaMonthReportService reportService;
@Autowired @Autowired
private IWaterService waterService; private PhotovoltaicService photovoltaicService;
@Autowired @Autowired
private IAreaMonthReportService reportService; private IRunMonthReportService runMonthReportService;
@Autowired @Autowired
private HydropowerService hydropowerService; private IUnitRunningTimeService unitRunningTimeService;
@Autowired @Autowired
private PhotovoltaicService photovoltaicService; private IMainSystemMonitoringService mainSystemMonitoringService;
@Autowired @Autowired
BladeLogger logger; BladeLogger logger;
@ -219,6 +231,20 @@ public class ScheduledCreateTask {
} }
/** /**
* 首页-指标数据加载
* @return ReturnT<String>
*/
@XxlJob(LOAD_HOME_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> 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<String> * @return ReturnT<String>
*/ */

4
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 { public interface HomeService {
void loadHomeTarget(String param);
List<StationCountVo> count(); List<StationCountVo> count();
TargetVo target(Integer type); List<TargetVo> target(Integer type);
} }

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IPlatformService.java

@ -16,14 +16,6 @@ public interface IPlatformService {
*/ */
List<StationCountVo> doStationCount(Integer serveType); List<StationCountVo> doStationCount(Integer serveType);
/**
* 根据权限统计
* 根据服务类型及站点类型进行站点统计
*
* @return
*/
List<StationCountVo> doStationAuthCount(Integer serveType);
CloudKeyIndexVo doCloudKeyIndex(Integer stationType, Integer serveType); CloudKeyIndexVo doCloudKeyIndex(Integer stationType, Integer serveType);
List<SoeDataVo> doCloudAlarmInfo(Integer serveType); List<SoeDataVo> doCloudAlarmInfo(Integer serveType);

126
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}") @Value("${hzims.operation.homePage.charge.url}")
public String 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_real_key = "hzims:operation:loadhydropowerunit:real:key";
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target: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; private static final int NETWORK_POOL_QUANTITY = 3;
@Override
public void loadHomeTarget(String param) {
List<TargetVo> 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 * @return
@ -102,23 +135,21 @@ public class HomeServiceImpl implements HomeService {
// 查询全部站点 // 查询全部站点
List<StationEntity> stations = stationService.list(); List<StationEntity> stations = stationService.list();
List<StationCountVo> counts = new ArrayList<>(); List<StationCountVo> counts = new ArrayList<>();
stations.stream().collect(Collectors.groupingBy(StationEntity::getServeType)) HomePageConstant.SERVETYPE_LIST.forEach(serve ->counts.addAll(HomePageConstant.HOME_TYPES.stream().map(type -> {
.forEach((key, value) -> counts.addAll(value.stream().collect(Collectors.groupingBy(StationEntity::getType)).entrySet().stream(). StationCountVo count = new StationCountVo();
map(station -> { count.setServeType(serve);
StationCountVo count = new StationCountVo(); if(HomePageConstant.CHARGE.equals(type) && "2".equals(serve)){
count.setServeType(key); TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(HomePageConstant.CHARGE.equals(station.getKey()) && "2".equals(key)){ if(ObjectUtil.isNotEmpty(target)){
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge); count.setCount(Long.valueOf(Optional.ofNullable(target.getCharge()).orElse(0)));
if(ObjectUtil.isNotEmpty(target)){ }
count.setCount(Optional.ofNullable(target.getCharge()).orElse(0)); }else{
} count.setCount(stations.stream().filter(station->serve.equals(station.getServeType()) && type.equals(station.getType())).count());
}else{ }
count.setCount(station.getValue().size()); count.setType(String.valueOf(type));
} count.setTypeName(DictCache.getValue("stationType", type));
count.setType(String.valueOf(station.getKey())); return count;
count.setTypeName(DictCache.getValue("stationType", station.getKey())); }).collect(Collectors.toList())));
return count;
}).collect(Collectors.toList())));
return counts.stream().sorted(Comparator.comparing(StationCountVo::getServeType)).collect(Collectors.toList()); return counts.stream().sorted(Comparator.comparing(StationCountVo::getServeType)).collect(Collectors.toList());
} }
@ -128,34 +159,12 @@ public class HomeServiceImpl implements HomeService {
* @return * @return
*/ */
@Override @Override
public TargetVo target(Integer type) { public List<TargetVo> target(Integer type) {
switch (type){ List<TargetVo> targets = (List<TargetVo>) redisTemplate.opsForValue().get(load_home_target_key);
// 水电站 if(CollectionUtil.isEmpty(targets)){
case 0: return new ArrayList<>();
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();
} }
return targets;
} }
@ -193,7 +202,7 @@ public class HomeServiceImpl implements HomeService {
} }
} }
// 双票合格率 // 双票合格率
R<List<Dept>> result = sysClient.getDeptByCurrentUser(); R<List<Dept>> result = sysClient.getDeptList();
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); List<Long> 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)){ if(CollectionUtil.isNotEmpty(areas)){
@ -296,33 +305,32 @@ public class HomeServiceImpl implements HomeService {
/** /**
* 储能指标 * 储能指标
* @param flag : false - 水利 true - 储能 * @param flag : true - 水利 false - 储能
* @return * @return
*/ */
private TargetVo waterStorageTaget(boolean flag) { private TargetVo waterStorageTaget(boolean flag) {
TargetVo target = new TargetVo(); TargetVo target = new TargetVo();
if(flag){ if(flag){
target.setType(HomePageConstant.ENERGY_STORAGE);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.ENERGY_STORAGE));
}else{
target.setType(HomePageConstant.WATER_CONSERVANCY); target.setType(HomePageConstant.WATER_CONSERVANCY);
target.setTypeName(DictCache.getValue("stationType", 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<StationEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE); wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
if(flag){ if(flag){
wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE);
}else{
wrapper.eq(StationEntity::getType,HomePageConstant.WATER_CONSERVANCY); wrapper.eq(StationEntity::getType,HomePageConstant.WATER_CONSERVANCY);
}else{
wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE);
} }
List<StationEntity> stations = stationService.list(wrapper); List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return target; return target;
} }
// 获取储能区域级别机构 // 获取储能区域级别机构
R<List<Dept>> result = sysClient.getDeptByCurrentUser(); R<List<Dept>> result = sysClient.getDeptList();
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); List<Long> 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)){ 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 * @return
*/ */

30
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 list;
} }
/**
* 根据权限统计
* 根据服务类型及站点类型进行站点统计
*
* @return
*/
@Override
public List<StationCountVo> doStationAuthCount(Integer serveType) {
List<StationCountVo> voList = new ArrayList<>();
// 查询服务类型站点数据
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getServeType, serveType);
}});
List<Dict> dictList =DictCache.getList("stationType");
//key 站点类型 value 站点
Map<Integer, List<StationEntity>> 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<StationEntity> stationEntityList = map.get(type);
if(CollectionUtil.isNotEmpty(stationEntityList)) {
stationCountVo.setCount(stationEntityList.size());
}
voList.add(stationCountVo);
});
return voList;
}
/** /**
* 云服务-关键指标 * 云服务-关键指标

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -637,7 +637,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
public List<StationEntity> select(Integer type, Integer serveType) { public List<StationEntity> select(Integer type, Integer serveType) {
List<Integer> types; List<Integer> types;
if (ObjectUtil.isEmpty(type)) { if (ObjectUtil.isEmpty(type)) {
types = HomePageConstant.types; types = HomePageConstant.TYPES;
} else if (HomePageConstant.WATER_CONSERVANCY.equals(type)) { } else if (HomePageConstant.WATER_CONSERVANCY.equals(type)) {
types = HomePageConstant.waterList; types = HomePageConstant.waterList;
} else { } else {

Loading…
Cancel
Save