diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java index 0522108..0107d84 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java @@ -9,6 +9,9 @@ import java.util.List; @Data public class RealDeviceVo implements Serializable { + @ApiModelProperty("站点编码") + private String stationId; + @ApiModelProperty("设备编号") private String deviceCode; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AbnormalAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AbnormalAlarmService.java index f91b7a7..b75d835 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AbnormalAlarmService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/AbnormalAlarmService.java @@ -7,6 +7,7 @@ import java.util.List; /** * 告警处理接口 + * @author ysj */ public interface AbnormalAlarmService extends BaseService { 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 ab7f643..62dff4b 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 @@ -95,6 +95,8 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl { + // 告警内容站点名称包含处理 + List soeStation = stations.stream().filter(o->o.getCode().equals(item.getStation())).collect(Collectors.toList()); if(!AbnormalAlarmConstant.INTERRUPT_LIST.contains(item.getSoeType())){ return; } @@ -102,9 +104,10 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl stations) { + private void sendAlarmMessage(HistoryAbnormalAlarmEntity entity,List stations,String stationName) { if(StringUtil.isEmpty(entity.getStationId())){ return; } @@ -218,7 +217,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImplString.valueOf(o.getId())).distinct().collect(Collectors.joining(","))); message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); + message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription() + "-[" + stationName + "]"); message.setTaskId(entity.getId()); message.setTenantId("200000"); message.setContent(entity.getSoeExplain()); 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 ecd45f6..411588c 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 @@ -19,18 +19,13 @@ import com.hnac.hzims.operational.config.vo.StationRealVo; import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.main.service.IWeatherService; -import com.hnac.hzims.operational.main.vo.JointRelayVo; -import com.hnac.hzims.operational.main.vo.WaterLevelVo; +import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IRealMonitorService; import com.hnac.hzims.operational.station.service.IStationAttrConfigService; import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationService; -import com.hnac.hzims.operational.main.vo.RealAttributeVo; -import com.hnac.hzims.operational.main.vo.RealDeviceVo; -import com.hnac.hzims.operational.main.vo.RealStationVo; -import com.hnac.hzims.operational.main.vo.WeatherVo; import com.hnac.hzinfo.sdk.v5.redis.RedisClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -50,6 +45,7 @@ import org.springframework.web.socket.TextMessage; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.concurrent.*; import java.util.stream.Collectors; @@ -433,8 +429,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService { RealStationVo station = new RealStationVo(); // 站点编码 station.setStationCode(key); - // 设置站点状态 - this.setStationStatus(alarmList,station,key); // 名称、限制水位、服务类型、机构、排序 this.stationParam(stationEntityList,station,deptAll.getData()); // 根据设备名称分组 @@ -454,6 +448,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService { this.getDeviceParam(emList, deviceClassifyMap, deviceList); // 运行设备状态设置 this.deviceState(deviceList); + // 设置站点状态 + this.setStationStatus(alarmList,station,key,deviceList); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); stationList.add(station); }); @@ -503,8 +499,24 @@ public class RealMonitorServiceImpl implements IRealMonitorService { * @param station * @param key */ - private void setStationStatus(List alarmList, RealStationVo station, String key) { + private void setStationStatus(List alarmList, RealStationVo station, String key,List deviceList) { station.setStatus(0); + // 站点功率大于0为正常上送数据 + double powerSum = deviceList.stream().mapToDouble(o->{ + List attbts = o.getAttbtList(); + if(CollectionUtil.isEmpty(attbts)){ + return 0; + } + // 功率属性记录 + List powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(powers)){ + return 0; + } + return powers.stream().filter(power-> !"0.000000".equals(power.getValue()) && !"-".equals(power.getValue()) && !HomePageConstant.ON.equals(power.getValue())).mapToDouble(value->Double.parseDouble(value.getValue())).sum(); + }).sum(); + if(powerSum > 0){ + return; + } if(alarmList.contains(key)){ station.setStatus(1); } @@ -975,7 +987,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { return; } // 获取设备中属性为P/p的value值总和 - powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue(); } station.setPowerSum(powerSum); }