From 07d46db333bcdec4e0efcb05f3c317768d51f464 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 1 Apr 2024 11:29:13 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=96=AD=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled/service/alarm/AlarmQueryService.java | 3 -- .../service/alarm/InterruptionAlarmService.java | 4 +++ .../service/alarm/impl/AlarmQueryServiceImpl.java | 26 -------------- .../alarm/impl/InterruptionAlarmServiceImpl.java | 41 ++++++++++++++-------- .../operation/monitor/impl/MonitorServiceImpl.java | 14 +++++++- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java index 40766e9..9fe12cc 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java @@ -13,7 +13,4 @@ public interface AlarmQueryService extends BaseService { void clear(String param); List bells(List codes); - - List aborts(List codes); - } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java index 2222d1f..8579c3d 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java @@ -3,10 +3,14 @@ package com.hnac.hzims.scheduled.service.alarm; import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import org.springblade.core.mp.base.BaseService; +import java.util.List; + /** * @author ysj */ public interface InterruptionAlarmService extends BaseService { + List aborts(List codes); + } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java index 4f5dc86..41790e9 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java @@ -56,30 +56,4 @@ public class AlarmQueryServiceImpl extends BaseServiceImpl aborts(List codes) { - List alarms = this.list(Wrappers.lambdaQuery() - .in(AlarmEntity::getStationId,codes) - .eq(AlarmEntity::getAlarmSource, AlarmConstants.HZ3000_ALARM) - .in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL)) - ); - if(CollectionUtil.isEmpty(alarms)){ - return new ArrayList<>(); - } - return alarms.stream().collect(Collectors.groupingBy(AlarmEntity::getStationId)).values().stream().map(alarmEntities -> { - // 站点最近的一条数据中断、数据异常告警 - AlarmEntity alarm = alarmEntities.stream().sorted(Comparator.comparing(AlarmEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0); - // 状态为中断 - if (alarm.getAlarmStatus().equals(0)) { - return alarm.getStationId(); - } - return ""; - }).filter(StringUtil::isNotBlank).distinct().collect(Collectors.toList()); - } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java index ab32080..31b900e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java @@ -2,28 +2,19 @@ package com.hnac.hzims.scheduled.service.alarm.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.business.interruption.constants.InterruptionConstants; +import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.business.interruption.entity.InterruptionEntity; -import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.scheduled.mapper.alarm.InterruptionAlrmMapper; import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService; -import com.hnac.hzims.scheduled.service.operation.station.StationService; -import com.hnac.hzinfo.datasearch.soe.ISoeClient; -import com.hnac.hzinfo.datasearch.soe.domian.SoeData; -import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; -import com.hnac.hzinfo.sdk.core.response.HzPage; -import com.hnac.hzinfo.sdk.core.response.Result; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; -import java.util.Calendar; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -36,5 +27,27 @@ import java.util.stream.Collectors; @DS("alarm") public class InterruptionAlarmServiceImpl extends BaseServiceImpl implements InterruptionAlarmService { - + /** + * 查询站点数据中断 + * @param codes + * @return + */ + @Override + public List aborts(List codes) { + List alarms = this.list(Wrappers.lambdaQuery() + .in(InterruptionEntity::getStationId,codes) + ); + if(CollectionUtil.isEmpty(alarms)){ + return new ArrayList<>(); + } + return alarms.stream().collect(Collectors.groupingBy(InterruptionEntity::getStationId)).values().stream().map(alarmEntities -> { + // 站点最近的一条数据中断、数据异常告警 + InterruptionEntity alarm = alarmEntities.stream().sorted(Comparator.comparing(InterruptionEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0); + // 状态为中断 + if (alarm.getStatus().equals(0)) { + return alarm.getStationId(); + } + return ""; + }).filter(StringUtil::isNotBlank).distinct().collect(Collectors.toList()); + } } \ No newline at end of file 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 92c5a8c..37611ed 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 @@ -19,6 +19,7 @@ import com.hnac.hzims.operational.main.vo.RealStationVo; import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; +import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService; import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService; import com.hnac.hzims.scheduled.service.operation.alarm.RecordService; import com.hnac.hzims.scheduled.service.operation.monitor.MonitorService; @@ -56,14 +57,25 @@ import java.util.stream.Stream; public class MonitorServiceImpl implements MonitorService { private final RecordService alertService; + private final StationService stationService; + private final AlarmQueryService alarmQueryService; + private final StationAttributeService attbtService; + private final WorkshopInfoService workshopInfoService; + private final StationAttrConfigService attrConfigService; + + private final InterruptionAlarmService interruptionAlarmService; + private final RedisTemplate redisTemplate; + private final ISysClient sysClient; + private final RedisClient redisClient; + private final IAnalyseDataSearchClient analyseDataSearchClient; @Value("${hzims.equipment.emInfo.emInfoList}") @@ -294,7 +306,7 @@ public class MonitorServiceImpl implements MonitorService { // 铃铛 List bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 数据中断 - List aborts = alarmQueryService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); + List aborts = interruptionAlarmService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 隐藏设备列表 List hideList = attrConfigService.getHideList(); // 分割,每个map限制10个长度