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