代码调整
This commit is contained in:
parent
d41a47bf4c
commit
7ba60f1863
@ -1,28 +1,11 @@
|
|||||||
package club.joylink.xiannccda.alert;
|
package club.joylink.xiannccda.alert;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener;
|
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener.SwitchAndTrackLedAlertEvent;
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener;
|
import club.joylink.xiannccda.constants.SystemContext;
|
||||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener.SwitchAndTrackLedMostAlertEvent;
|
import java.util.Map;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.PlatformAlertMonitoringTask;
|
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertListener;
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertListener.SwitchLostAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertMonitoringTask;
|
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostMostAlertListener;
|
|
||||||
import club.joylink.xiannccda.ats.warn.SwitchLostMostAlertListener.SwitchLostMostEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainAtpCutAlertMonitoringTask;
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener;
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener.TrainAlertEvent;
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainReacrdAlertListener;
|
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainReacrdAlertListener.TrainRecordAlertEvent;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
@ -30,52 +13,23 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Order(1)
|
@Order(1)
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
public class AlertEmitJob implements ApplicationRunner {
|
public class AlertEmitJob implements ApplicationRunner {
|
||||||
|
|
||||||
@Autowired
|
private final AlertManager alertManager = AlertManager.getDefault();
|
||||||
private SwitchLostAlertMonitoringTask lostAlertMonitoringTask2;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AxleSwitchTrackLedAlertListener axleSwitchTrackLedAlertListener2;
|
|
||||||
@Autowired
|
|
||||||
private BlueAlertListener blueAlertListener2;
|
|
||||||
@Autowired
|
|
||||||
private SwitchLostAlertListener switchLostAlertListener;
|
|
||||||
@Autowired
|
|
||||||
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TrainModeAlertListener trainModeAlertListener;
|
|
||||||
@Autowired
|
|
||||||
private TrainAtpCutAlertMonitoringTask trainAtpCutAlertMonitoringTask;
|
|
||||||
@Autowired
|
|
||||||
private TrainReacrdAlertListener trainReacrdAlertListener;
|
|
||||||
@Autowired
|
|
||||||
private AxleSwitchTrackLedMostAlertListener mostAlertListener;
|
|
||||||
@Autowired
|
|
||||||
private SwitchLostMostAlertListener lostMostAlertListener;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
AlertManager alertManager = AlertManager.getDefault();
|
Map<String, AlertMonitoringTask> monitoringTaskMap = SystemContext.getAppContext().getBeansOfType(AlertMonitoringTask.class);
|
||||||
//道岔失表任务
|
monitoringTaskMap.forEach((k, v) -> {
|
||||||
alertManager.addTask(this.lostAlertMonitoringTask2);
|
log.info("加载告警定时任务 key[{}] val[{}]", k, v.getClass().getName());
|
||||||
//站台屏蔽门任务
|
alertManager.addTask(v);
|
||||||
alertManager.addTask(this.platformAlertMonitoringTask);
|
});
|
||||||
//列车atp切除任务
|
Map<String, AlertSourceEventListener> eventListenerMap = SystemContext.getAppContext().getBeansOfType(AlertSourceEventListener.class);
|
||||||
alertManager.addTask(this.trainAtpCutAlertMonitoringTask);
|
eventListenerMap.forEach((k, v) -> {
|
||||||
//光带检查监听
|
log.info("加载告警监听 key[{}] val[{}]", k, v.getClass().getName());
|
||||||
alertManager.on(this.axleSwitchTrackLedAlertListener2, SwitchAndTrackLedAlertEvent.class);
|
alertManager.on(v);
|
||||||
//蓝显检测
|
});
|
||||||
alertManager.on(this.blueAlertListener2, BlueDisplayAlertEvent.class);
|
|
||||||
// 道岔失表监听
|
|
||||||
alertManager.on(this.switchLostAlertListener, SwitchLostAlertEvent.class);
|
|
||||||
// 列车制动监听
|
|
||||||
alertManager.on(this.trainModeAlertListener, TrainAlertEvent.class);
|
|
||||||
//列车报点监听
|
|
||||||
alertManager.on(this.trainReacrdAlertListener, TrainRecordAlertEvent.class);
|
|
||||||
alertManager.on(this.mostAlertListener, SwitchAndTrackLedMostAlertEvent.class);
|
|
||||||
alertManager.on(this.lostMostAlertListener, SwitchLostMostEvent.class);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,17 +44,20 @@ public class AlertListenerJob implements ApplicationRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(NccAlertInfo alertInfo) {
|
public void accept(NccAlertInfo alertInfo) {
|
||||||
if (!alertInfo.isMock()) {
|
/*if (!alertInfo.isMock()) {
|
||||||
AlertRecord record = convertToRecord(alertInfo);
|
AlertRecord record = convertToRecord(alertInfo);
|
||||||
alertRecordRepository.save(record);
|
alertRecordRepository.save(record);
|
||||||
alertInfo.setId(record.getId());
|
alertInfo.setId(record.getId());
|
||||||
} else {
|
} else {
|
||||||
alertInfo.setId(idGenerator.decrementAndGet());
|
alertInfo.setId(idGenerator.decrementAndGet());
|
||||||
}
|
}*/
|
||||||
|
//不论是否mock 都保存数据库
|
||||||
|
AlertRecord record = convertToRecord(alertInfo);
|
||||||
|
alertRecordRepository.save(record);
|
||||||
|
alertInfo.setId(record.getId());
|
||||||
nccAlertMessageServer.addMsg(alertInfo);
|
nccAlertMessageServer.addMsg(alertInfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AlertRecord convertToRecord(NccAlertInfo nccAlertInfo) {
|
private AlertRecord convertToRecord(NccAlertInfo nccAlertInfo) {
|
||||||
@ -66,6 +69,7 @@ public class AlertListenerJob implements ApplicationRunner {
|
|||||||
record.setAlertLocationId(nccAlertInfo.getAlertLocationId());
|
record.setAlertLocationId(nccAlertInfo.getAlertLocationId());
|
||||||
record.setAlertDeviceType(nccAlertInfo.getAlertDeviceType().name());
|
record.setAlertDeviceType(nccAlertInfo.getAlertDeviceType().name());
|
||||||
record.setAlertDeviceId(nccAlertInfo.getLocatorDeviceId());
|
record.setAlertDeviceId(nccAlertInfo.getLocatorDeviceId());
|
||||||
|
record.setMock(nccAlertInfo.isMock());
|
||||||
// record.setAlertLocation(nccAlertInfo.getAlertLocationName());
|
// record.setAlertLocation(nccAlertInfo.getAlertLocationName());
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
|||||||
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
//@Component
|
||||||
public class PlatformDoorAlertMonitoringTask implements AlertMonitoringTask {
|
public class PlatformDoorAlertMonitoringTask implements AlertMonitoringTask {
|
||||||
|
|
||||||
private IAlertTipRepository alertTipRepository;
|
private IAlertTipRepository alertTipRepository;
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
|||||||
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
//@Component
|
||||||
public class TrainDelayAlertMonitoringTask implements AlertMonitoringTask {
|
public class TrainDelayAlertMonitoringTask implements AlertMonitoringTask {
|
||||||
|
|
||||||
private IAlertTipRepository alertTipRepository;
|
private IAlertTipRepository alertTipRepository;
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package club.joylink.xiannccda.ats.warn;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||||
|
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||||
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.warn.AllLineBlueAlertListener.AllLineBlueDisplayAlertEvent;
|
||||||
|
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||||
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||||
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||||
|
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||||
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class AllLineBlueAlertListener implements AlertSourceEventListener<AllLineBlueDisplayAlertEvent> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AlertInfoService alertInfoService;
|
||||||
|
private final static AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(AllLineBlueDisplayAlertEvent event) {
|
||||||
|
Rtu.Builder rtu = event.getSource();
|
||||||
|
if (alertManager.needMostShow(rtu.getLineId(), BlueAlertListener.BLUE_DISPLAY_NAME, event.allControlStationSize)
|
||||||
|
&& alertManager.putAlterDevice(rtu.getLineId(), BlueAlertListener.BLUE_DISPLAY_NAME, BlueAlertListener.ALL_BLUE_DISPLAY_VAL_FLAG)) {
|
||||||
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.ALL_LINE_BLUE_DISPLAY, rtu, BlueAlertListener.ALL_BLUE_DISPLAY_VAL_FLAG,
|
||||||
|
event.station.getCommon().getId(),
|
||||||
|
AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||||
|
alertManager.emit(alertInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AllLineBlueDisplayAlertEvent extends DeviceAlertEvent<Builder> {
|
||||||
|
|
||||||
|
private Station station;
|
||||||
|
private Integer allControlStationSize;
|
||||||
|
|
||||||
|
public AllLineBlueDisplayAlertEvent(Builder source, Station station, Integer allControlStationSize) {
|
||||||
|
super(source);
|
||||||
|
this.station = station;
|
||||||
|
this.allControlStationSize = allControlStationSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -40,7 +40,6 @@ public class AxleSwitchTrackLedMostAlertListener implements AlertSourceEventList
|
|||||||
private final AlertManager alertManager = AlertManager.getDefault();
|
private final AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
public AxleSwitchTrackLedMostAlertListener(DeviceGuardConfigService configService, AlertInfoService alertInfoService) {
|
public AxleSwitchTrackLedMostAlertListener(DeviceGuardConfigService configService, AlertInfoService alertInfoService) {
|
||||||
|
|
||||||
this.configService = configService;
|
this.configService = configService;
|
||||||
this.alertInfoService = alertInfoService;
|
this.alertInfoService = alertInfoService;
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
|||||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.warn.AllLineBlueAlertListener.AllLineBlueDisplayAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
|
||||||
import club.joylink.xiannccda.service.AlertInfoService;
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
@ -26,7 +26,6 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -38,11 +37,10 @@ public class BlueAlertListener implements AlertSourceEventListener<BlueDisplayAl
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AlertInfoService alertInfoService;
|
private AlertInfoService alertInfoService;
|
||||||
private final static String BLUE_DISPLAY_NAME = Rtu.getDescriptor().getName();
|
protected final static String BLUE_DISPLAY_NAME = Rtu.getDescriptor().getName();
|
||||||
private final static String ALL_BLUE_DISPLAY_VAL = "全线蓝显";
|
protected final static String ALL_BLUE_DISPLAY_VAL_FLAG = "全线蓝显";
|
||||||
private final static AlertManager alertManager = AlertManager.getDefault();
|
private final static AlertManager alertManager = AlertManager.getDefault();
|
||||||
|
|
||||||
private final static String COLL_RTU_NAME = "COLL_RTU_NAMES";
|
|
||||||
/**
|
/**
|
||||||
* 集中站集合
|
* 集中站集合
|
||||||
* <p>
|
* <p>
|
||||||
@ -59,36 +57,19 @@ public class BlueAlertListener implements AlertSourceEventListener<BlueDisplayAl
|
|||||||
log.error("rtuId[{}] 未找到对应的集中站数据", rtu.getId());
|
log.error("rtuId[{}] 未找到对应的集中站数据", rtu.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Optional<DeviceAreaConfig> alertInfoOpt = this.alertInfoService.findAreaDevice(AlertType.BLUE_DISPLAY, AlertDeviceType.DEVICE_TYPE_RTU, station.getCommon().getId(),
|
|
||||||
rtu.getLineId());
|
|
||||||
|
|
||||||
if (alertInfoOpt.isEmpty()) {
|
|
||||||
log.error("线路[{}] rtu[{}] 地图车站id[{}] 线路Id[{}]未找到对应的区域配置,无法蓝显", rtu.getLineId(), rtu.getId(), station.getCommon().getId(), rtu.getLineId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DeviceAreaConfig areaConfig = alertInfoOpt.get();
|
|
||||||
if (rtu.getIpRtuStusDown()) {
|
if (rtu.getIpRtuStusDown()) {
|
||||||
log.info("线路[{}] 车站[{}] rtu[{}] 通信中断", rtu.getLineId(), station.getName(), rtu.getId());
|
log.info("线路[{}] 车站[{}] rtu[{}] 通信中断", rtu.getLineId(), station.getName(), rtu.getId());
|
||||||
//保存出现蓝显的集中站
|
|
||||||
alertManager.putAlterDevice(rtu.getLineId(), COLL_RTU_NAME, rtu.getId());
|
|
||||||
//保存蓝显联锁id
|
//保存蓝显联锁id
|
||||||
if (alertManager.putAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, areaConfig.getId().toString())) {
|
if (alertManager.putAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, rtu.getId())) {
|
||||||
String alertMsg = String.format("%s 蓝显", areaConfig.getAreaName());
|
int allControlStationSize = CONTROL_STATION_MAPER.get(rtu.getLineId()).size();
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoOpt, AlertType.BLUE_DISPLAY, rtu, alertMsg, station.getCommon().getId(), AlertDeviceType.DEVICE_TYPE_RTU, false);
|
String alertMsg = String.format("%s 集中站中断连接 `", station.getName());
|
||||||
alertManager.emit(alertInfo);
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.BLUE_DISPLAY, rtu, alertMsg, station.getCommon().getId(), AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||||
}
|
|
||||||
int allControlStationSize = CONTROL_STATION_MAPER.get(rtu.getLineId()).size();
|
|
||||||
//查看是否全部的集中站已经蓝显
|
|
||||||
if (alertManager.needMostShow(rtu.getLineId(), COLL_RTU_NAME, allControlStationSize)
|
|
||||||
&& alertManager.putAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, ALL_BLUE_DISPLAY_VAL)) {
|
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.ALL_LINE_BLUE_DISPLAY, rtu, ALL_BLUE_DISPLAY_VAL, station.getCommon().getId(),
|
|
||||||
AlertDeviceType.DEVICE_TYPE_RTU, false);
|
|
||||||
alertManager.emit(alertInfo);
|
alertManager.emit(alertInfo);
|
||||||
|
alertManager.emit(new AllLineBlueDisplayAlertEvent(rtu, station, allControlStationSize));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, areaConfig.getId().toString());
|
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, rtu.getId());
|
||||||
alertManager.removeAlterDevice(rtu.getLineId(), COLL_RTU_NAME, rtu.getId());
|
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, ALL_BLUE_DISPLAY_VAL_FLAG);
|
||||||
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, ALL_BLUE_DISPLAY_VAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class AlertRecord {
|
|||||||
|
|
||||||
private String alertDeviceType;
|
private String alertDeviceType;
|
||||||
private String alertDeviceId;
|
private String alertDeviceId;
|
||||||
|
private Boolean mock;
|
||||||
public static final String ID = "id";
|
public static final String ID = "id";
|
||||||
|
|
||||||
public static final String ALERT_TYPE = "alert_type";
|
public static final String ALERT_TYPE = "alert_type";
|
||||||
@ -61,4 +61,5 @@ public class AlertRecord {
|
|||||||
|
|
||||||
public static final String ALERT_DEVICE_TYPE = "alert_device_type";
|
public static final String ALERT_DEVICE_TYPE = "alert_device_type";
|
||||||
public static final String ALERT_DEVICE_ID = "alert_device_id";
|
public static final String ALERT_DEVICE_ID = "alert_device_id";
|
||||||
|
public static final String MOCK = "mock";
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class AlertRecordService {
|
|||||||
}
|
}
|
||||||
AlertType alertType = AlertType.valueOf(tipType);
|
AlertType alertType = AlertType.valueOf(tipType);
|
||||||
switch (alertType) {
|
switch (alertType) {
|
||||||
case AXLE_LED_RED, AXLE_LED_ORANGE, SWITCH_All_LOST, SWITCH_DW_LOST, SWITCH_FW_LOST -> {
|
case BLUE_DISPLAY, AXLE_LED_RED, AXLE_LED_ORANGE, SWITCH_All_LOST, SWITCH_DW_LOST, SWITCH_FW_LOST -> {
|
||||||
List<DeviceAreaConfig> areaConfigList = this.areaConfigService.getCache(ar.getLineId(), AlertDeviceType.valueOf(ar.getAlertDeviceType()));
|
List<DeviceAreaConfig> areaConfigList = this.areaConfigService.getCache(ar.getLineId(), AlertDeviceType.valueOf(ar.getAlertDeviceType()));
|
||||||
List<DeviceAreaConfig> findList = areaConfigList.stream().filter(d -> StringUtils.contains(d.getAlertTypes(), tipType)).filter(d -> {
|
List<DeviceAreaConfig> findList = areaConfigList.stream().filter(d -> StringUtils.contains(d.getAlertTypes(), tipType)).filter(d -> {
|
||||||
String[] datas = d.getData().split(",");
|
String[] datas = d.getData().split(",");
|
||||||
@ -83,6 +83,7 @@ public class AlertRecordService {
|
|||||||
|
|
||||||
AlertTip tip = alertTipRepository.getOne(qw, false);
|
AlertTip tip = alertTipRepository.getOne(qw, false);
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(tip), "未找到对应的决策辅助信息");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(tip), "未找到对应的决策辅助信息");
|
||||||
|
|
||||||
this.alertRecordRepository.update(Wrappers.lambdaUpdate(AlertRecord.class)
|
this.alertRecordRepository.update(Wrappers.lambdaUpdate(AlertRecord.class)
|
||||||
.set(AlertRecord::getAlertTipId, tip.getId()).set(AlertRecord::getAlarmStatus, 1)
|
.set(AlertRecord::getAlertTipId, tip.getId()).set(AlertRecord::getAlarmStatus, 1)
|
||||||
.set(hasAreaConfigId, AlertRecord::getAlertLocationId, newAreaConfigId)
|
.set(hasAreaConfigId, AlertRecord::getAlertLocationId, newAreaConfigId)
|
||||||
|
@ -57,17 +57,6 @@ public class AlertTipService {
|
|||||||
alertTipRepository.saveOrUpdate(saveEntity, updateWrapper);
|
alertTipRepository.saveOrUpdate(saveEntity, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<AlertTip> queryOne2(String alertType, Long areaConfigId) {
|
|
||||||
if (alertType == null) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
LambdaQueryWrapper<AlertTip> queryWrapper = Wrappers.lambdaQuery(AlertTip.class)
|
|
||||||
.eq(AlertTip::getAlertType, alertType);
|
|
||||||
if (Objects.nonNull(areaConfigId)) {
|
|
||||||
queryWrapper.eq(AlertTip::getAreaConfigId, areaConfigId);
|
|
||||||
}
|
|
||||||
return Optional.ofNullable(alertTipRepository.getOne(queryWrapper, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Optional<AlertTip> queryOne(String alertType, String alertLocation) {
|
public Optional<AlertTip> queryOne(String alertType, String alertLocation) {
|
||||||
if (alertType == null) {
|
if (alertType == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user