From b1c16c577c47326b93bb717edd97012218d70aab Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 2 Aug 2023 14:47:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#=E5=A4=A9=E6=B0=94=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java | 3 +++ .../src/main/java/com/hnac/hzims/weather/mapper/StationMapper.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java index da37623..112dc6a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java @@ -175,7 +175,10 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl { +public interface StationMapper extends BaseMapper { } From 21828d9bbeaaff3da68565fe2672a99ed47947be Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 3 Aug 2023 08:28:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecology/controller/EcologyController.java | 2 +- .../ecology/mapper/EcologyFlowStationMapper.java | 4 ++-- .../impl/EcologyFlowStationServiceImpl.java | 6 ++++-- .../service/impl/RealMonitorServiceImpl.java | 25 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java index 3973568..8fcf2aa 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java @@ -51,7 +51,7 @@ public class EcologyController extends BladeController { * 站点数据排行 * @return */ - @PostMapping("/station_top") + @PostMapping("/station_top") @ApiOperationSupport(order = 1) @ApiOperation(value = "站点数据及达标率排行", notes = "站点数据及达标率排行") public R station_top() { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/mapper/EcologyFlowStationMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/mapper/EcologyFlowStationMapper.java index 69b6e46..cb03f96 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/mapper/EcologyFlowStationMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/mapper/EcologyFlowStationMapper.java @@ -1,11 +1,11 @@ package com.hnac.hzims.operational.ecology.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.operational.ecology.entity.EcologyFlowStationEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** * @author YSJ */ -public interface EcologyFlowStationMapper extends BaseMapper { +public interface EcologyFlowStationMapper extends UserDataScopeBaseMapper { } 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 585f897..ae38832 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 @@ -110,8 +110,10 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl o.getIsTimely().equals(1L)).count() / (double) stations.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); station.setCount(stations.size()); - List datas = dataService.list(Wrappers.lambdaQuery(). - like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM"))); + List datas = dataService.list(Wrappers.lambdaQuery() + .like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM")) + .in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList())) + ); if(CollectionUtil.isEmpty(datas)){ return station; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index 9cd48e0..ecd45f6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -452,6 +452,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService { }); // 设备状态 this.getDeviceParam(emList, deviceClassifyMap, deviceList); + // 运行设备状态设置 + this.deviceState(deviceList); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); stationList.add(station); }); @@ -473,6 +475,29 @@ public class RealMonitorServiceImpl implements IRealMonitorService { } /** + * 设备状态 + * @param deviceList + */ + private void deviceState(List deviceList) { + deviceList.forEach(device->{ + // 设备属性列表 + List attbts = device.getAttbtList(); + if(CollectionUtil.isEmpty(attbts)){ + return; + } + // 功率属性记录 + List powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(powers)){ + return; + } + if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ + return; + } + device.setState(1); + }); + } + + /** * 设置站点状态 * @param alarmList * @param station