From 51471bec619d614a12bd2b2a367d9fb7c0e8a62b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 8 Sep 2023 11:54:32 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E3=80=81=E7=8F=AD=E7=BB=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AEbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/business/impl/DutyServiceImpl.java | 14 ++++++ .../operation/home/impl/ShowServiceImpl.java | 4 +- .../service/operation/monitor/MonitorService.java | 4 -- .../operation/monitor/impl/MonitorServiceImpl.java | 27 ++++++++++- .../main/resources/mapper/operation/DutyMapper.xml | 2 +- .../impl/HistoryAbnormalAlarmServiceImpl.java | 54 +++++++++++++--------- 6 files changed, 76 insertions(+), 29 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java index 7fe1682..0a2983c 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java @@ -171,6 +171,20 @@ public class DutyServiceImpl extends BaseServiceImpl 0) { return o.getEmCode(); } return "0"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java index f99ee9e..dcfaae7 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java @@ -1,9 +1,5 @@ package com.hnac.hzims.scheduled.service.operation.monitor; -import org.springblade.core.tool.api.R; - -import java.util.Map; - /** * WEB水电站首页接口 * @author ysj diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index f50b250..bef56af 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -149,7 +149,7 @@ public class MonitorServiceImpl implements MonitorService { @Override public void loadRealData(String param) { // 获取设备 - List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference>() {});; + List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference>() {}); // 设备开关机集合监测点 List switchOnOff = devices.stream().map(o->{ Map points = o.getPoint(); @@ -328,6 +328,8 @@ public class MonitorServiceImpl implements MonitorService { }); // 设备状态 this.getDeviceParam(devices, deviceClassifyMap, deviceList); + // 运行设备状态设置 + this.deviceState(deviceList); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); stationList.add(station); }); @@ -384,6 +386,29 @@ public class MonitorServiceImpl implements MonitorService { } /** + * 设备状态 + * @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 stationEntityList * @param item diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml index 6efe983..e93f2cc 100644 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml @@ -23,7 +23,7 @@ limit 1;