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;