Browse Source

#数据中断告警修改

zhongwei
yang_shj 8 months ago
parent
commit
07d46db333
  1. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java
  2. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java
  3. 26
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  4. 41
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java
  5. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java

@ -13,7 +13,4 @@ public interface AlarmQueryService extends BaseService<AlarmEntity> {
void clear(String param);
List<String> bells(List<String> codes);
List<String> aborts(List<String> codes);
}

4
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<InterruptionEntity> {
List<String> aborts(List<String> codes);
}

26
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<AlarmQueryMapper, Ala
}
return alarms.stream().map(AlarmEntity::getStationId).distinct().collect(Collectors.toList());
}
/**
* 查询站点数据中断
* @param codes
* @return
*/
@Override
public List<String> aborts(List<String> codes) {
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>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());
}
}

41
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<InterruptionAlrmMapper, InterruptionEntity> implements InterruptionAlarmService {
/**
* 查询站点数据中断
* @param codes
* @return
*/
@Override
public List<String> aborts(List<String> codes) {
List<InterruptionEntity> alarms = this.list(Wrappers.<InterruptionEntity>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());
}
}

14
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<String> bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 数据中断
List<String> aborts = alarmQueryService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<String> aborts = interruptionAlarmService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 隐藏设备列表
List<String> hideList = attrConfigService.getHideList();
// 分割,每个map限制10个长度

Loading…
Cancel
Save