问题调整
This commit is contained in:
parent
a6a20e8b49
commit
82557600cb
@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
|
||||
@Order
|
||||
@Component
|
||||
public class AlertListenerJob implements ApplicationRunner {
|
||||
|
||||
private final WsMessageServerManager wsMessageServerManager;
|
||||
private final IAlertRecordRepository alertRecordRepository;
|
||||
|
||||
@ -62,7 +63,9 @@ public class AlertListenerJob implements ApplicationRunner {
|
||||
record.setAlertType(nccAlertInfo.getAlertType().name());
|
||||
record.setAlertObject(nccAlertInfo.getAlertObject());
|
||||
record.setLineId(nccAlertInfo.getLineId());
|
||||
record.setAlertLocation(nccAlertInfo.getAlertLocationName());
|
||||
record.setAlertLocationId(nccAlertInfo.getAlertLocationId());
|
||||
|
||||
// record.setAlertLocation(nccAlertInfo.getAlertLocationName());
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ public class NccAlertInfo implements AlertInfo {
|
||||
Long alertLocationId) {
|
||||
this.alertTime = alertTime;
|
||||
this.alertType = alertType;
|
||||
this.alertTipId = alertTipId;
|
||||
this.lineId = lineId;
|
||||
this.alertObject = alertObject;
|
||||
this.locatorDeviceId = locatorDeviceId;
|
||||
|
@ -31,7 +31,7 @@ public class DeviceChangeStatusConvertor extends DefaultConvertor {
|
||||
|
||||
@Override
|
||||
protected void eventHandle(List<Builder> builders) {
|
||||
AlertManager alertManager = AlertManager.getDefault();
|
||||
/*AlertManager alertManager = AlertManager.getDefault();
|
||||
for (Builder builder : builders) {
|
||||
if (builder instanceof Rtu.Builder rtuBuild) {
|
||||
alertManager.emit(new BlueDisplayAlertEvent(rtuBuild));
|
||||
@ -43,7 +43,6 @@ public class DeviceChangeStatusConvertor extends DefaultConvertor {
|
||||
} else if (builder instanceof Platform.Builder platformBuild) {
|
||||
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
||||
}
|
||||
}
|
||||
// alertManager.emit(new DeviceAlertEvent<List<Builder>>(builders));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class DeviceInitConvertor extends DefaultConvertor {
|
||||
|
||||
@Override
|
||||
protected void eventHandle(List<Builder> builders) {
|
||||
AlertManager alertManager = AlertManager.getDefault();
|
||||
/* AlertManager alertManager = AlertManager.getDefault();
|
||||
for (Builder builder : builders) {
|
||||
if (builder instanceof Rtu.Builder rtuBuild) {
|
||||
alertManager.emit(new BlueDisplayAlertEvent(rtuBuild));
|
||||
@ -44,6 +44,6 @@ public class DeviceInitConvertor extends DefaultConvertor {
|
||||
} else if (builder instanceof Platform.Builder platformBuild) {
|
||||
alertManager.emit(new PlatformAlertEvent(platformBuild));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener
|
||||
|
||||
if (light) {
|
||||
if (alertManager.putAlterDevice(lineId.toString(), ledName, id)) {
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoOptional, alertType, build);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoOptional, alertType, build, section.getCode());
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
if (Objects.nonNull(ledMostName) && alertManager.needMostShow(lineId.toString(), ledMostName, overNums)) {
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(alertInfoOptional, alertType, build);
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(alertInfoOptional, alertType, build, section.getCode());
|
||||
alertManager.emit(alertInfoMost);
|
||||
}
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
if (this.timeOver(build.getReceiveTime(), timeOut)
|
||||
&& alertManager.putAlterDevice(lineId, CUSTOM_NAME, build.getId())) {
|
||||
LayoutGraphicsProto.Platform platform = LineGraphicDataRepository.getDeviceByCode(build.getLineId(), build.getId(), LayoutGraphicsProto.Platform.class);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(alertType, AlertDeviceType.DEVICE_TYPE_PLATFORM, platform.getCommon().getId(), build);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(alertType, AlertDeviceType.DEVICE_TYPE_PLATFORM, platform.getCommon().getId(), build, platform.getCode());
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask {
|
||||
if (saveIsLost && this.timeOver(savedSwitchBuild.getReceiveTime(), guardConfig.getSwitchLostTimes())) {
|
||||
//失表超时
|
||||
if (alertManager.putAlterDevice(lineIdStr, oneName, savedSwitchBuild.getId())) {
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoOpt, AlertType.SWITCH_LOST, savedSwitchBuild);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoOpt, AlertType.SWITCH_LOST, savedSwitchBuild, savedSwitchBuild.getId());
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
Optional<DeviceAreaConfig> alertInfoMostOpt = this.alertInfoService.findAreaDevice(AlertType.SWITCH_LOST_MOST, AlertDeviceType.DEVICE_TYPE_SWITCH, turnout.getCommon().getId(),
|
||||
@ -92,7 +92,7 @@ public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask {
|
||||
//检测大面积失表
|
||||
if (alertInfoMostOpt.isPresent() && alertManager.needMostShow(lineIdStr, alertInfoMostOpt.get().getAreaName(), guardConfig.getSwitchLostMostNums())) {
|
||||
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoMostOpt, AlertType.SWITCH_LOST_MOST, savedSwitchBuild);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoMostOpt, AlertType.SWITCH_LOST_MOST, savedSwitchBuild, savedSwitchBuild.getId());
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class TrainModeAlertListener implements AlertSourceEventListener<TrainAle
|
||||
if (trainMode.getIpModeTrainAtpCut() && trainMode.getIpModeTrainEbAlarm()) {
|
||||
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), trainInfo.getDevName(), Section.class);
|
||||
if (alertManager.putAlterDevice(lineIdStr, CUSTOM_NAME, trainInfo.getGroupId())) {
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_SIGNAL, AlertDeviceType.DEVICE_TYPE_TRAIN, section.getCommon().getId(), trainInfo);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_SIGNAL, AlertDeviceType.DEVICE_TYPE_TRAIN, section.getCommon().getId(), trainInfo, trainInfo.getGroupId());
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ public class AlertRecord {
|
||||
|
||||
private LocalDateTime alertTime;
|
||||
|
||||
private String alertLocation;
|
||||
// private String alertLocation;
|
||||
private Long alertLocationId;
|
||||
private Long alertTipId;
|
||||
|
||||
@ -50,7 +50,7 @@ public class AlertRecord {
|
||||
|
||||
public static final String ALERT_TIME = "alert_time";
|
||||
|
||||
public static final String ALERT_LOCATION = "alert_location";
|
||||
// public static final String ALERT_LOCATION = "alert_location";
|
||||
public static final String ALERT_LOCATION_ID = "alert_location_id";
|
||||
public static final String ALERT_TIP_ID = "alert_tip_id";
|
||||
public static final String ALARM_STATUS = "alarm_status";
|
||||
|
@ -19,7 +19,7 @@ import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Component
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MockLoadData implements ApplicationRunner {
|
||||
|
||||
@ -28,7 +28,7 @@ public class MockLoadData implements ApplicationRunner {
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
this.nccMockDataService.reset(10);
|
||||
this.nccMockDataService.reset(5);
|
||||
CIRCLE_QUERY_THREAD.scheduleAtFixedRate(() -> {
|
||||
// this.nccMockDataService.skip(170L, 1100L, 1180L);
|
||||
loadData();
|
||||
@ -40,9 +40,9 @@ public class MockLoadData implements ApplicationRunner {
|
||||
Wrapper<NccMockData> wrapper = Wrappers.<NccMockData>lambdaQuery()
|
||||
// .in(NccMockData::getMsgId, List.of("DEVICE_STATUS_BITMAP", "TRAIN_INDICATION_INIT", "TRAIN_INDICATION_UPDATE", "TRAIN_INDICATION_REMOVE"))
|
||||
// .eq(NccMockData::getMsgId, "DEVICE_STATUS_BITMAP")
|
||||
.gt(NccMockData::getMockReceiveTime, "2023-08-06 12:20:20")
|
||||
.gt(NccMockData::getMockReceiveTime, "2023-08-06 23:20:20")
|
||||
// .gt(NccMockData::getId, 2598023)
|
||||
.gt(NccMockData::getId, 2933958)
|
||||
// .gt(NccMockData::getId, 2933958)
|
||||
// .ne(NccMockData::getIsDelete, 1)
|
||||
.orderBy(true, true, NccMockData::getId);
|
||||
List<MessageResponse> dataList = this.nccMockDataService.loadALLData(wrapper);
|
||||
|
@ -59,25 +59,26 @@ public class AlertInfoService {
|
||||
return findList;
|
||||
}
|
||||
|
||||
public NccAlertInfo createAlert(AlertType alertType, AlertDeviceType dt, String layoutId, MessageOrBuilder mb) {
|
||||
public NccAlertInfo createAlert(AlertType alertType, AlertDeviceType dt, String layoutId, MessageOrBuilder mb, String targetDeviceCode) {
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(mb, "lineId", Integer.class);
|
||||
Optional<DeviceAreaConfig> areaConfigOptional = this.findAreaDevice(alertType, dt, layoutId, lineId);
|
||||
return this.createAlert2(areaConfigOptional, alertType, mb);
|
||||
return this.createAlert2(areaConfigOptional, alertType, mb, targetDeviceCode);
|
||||
}
|
||||
|
||||
public NccAlertInfo createAlert2(Optional<DeviceAreaConfig> areaConfigOpt, AlertType alertType, MessageOrBuilder mb) {
|
||||
public NccAlertInfo createAlert2(Optional<DeviceAreaConfig> areaConfigOpt, AlertType alertType, MessageOrBuilder mb, String targetDeviceCode) {
|
||||
Long timestamp = DeviceStatusDataOperate.findFieldVal(mb, "timestamp", Long.class);
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(mb, "lineId", Integer.class);
|
||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(mb, "id", String.class);
|
||||
LocalDateTime createTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.of("+8"));
|
||||
DeviceAreaConfig areaConfig = areaConfigOpt.orElse(null);
|
||||
if (Objects.isNull(areaConfig)) {
|
||||
return new NccAlertInfo(createTime, alertType, lineId, deviceCode, deviceCode, null);
|
||||
return new NccAlertInfo(createTime, alertType, lineId, targetDeviceCode, deviceCode, null);
|
||||
}
|
||||
return new NccAlertInfo(createTime, alertType, lineId, String.format("%-设备[%s]", areaConfig.getAreaName(), deviceCode), deviceCode, areaConfig.getId());
|
||||
String alertObject = String.format("%s-设备[%s]", areaConfig.getAreaName(), targetDeviceCode);
|
||||
return new NccAlertInfo(createTime, alertType, lineId, alertObject, deviceCode, areaConfig.getId());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/* @Deprecated
|
||||
public NccAlertInfo createAlert(DeviceAreaConfig areaConfig, AlertType alertType, MessageOrBuilder mb) {
|
||||
Long timestamp = DeviceStatusDataOperate.findFieldVal(mb, "timestamp", Long.class);
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(mb, "lineId", Integer.class);
|
||||
@ -94,7 +95,7 @@ public class AlertInfoService {
|
||||
LocalDateTime createTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.of("+8"));
|
||||
|
||||
return new NccAlertInfo(createTime, alertType, Objects.nonNull(at) ? at.getId() : null, lineId, deviceCode, deviceCode, null);
|
||||
}
|
||||
}*/
|
||||
|
||||
public Optional<DeviceAreaConfig> findAreaDevice(AlertType alertType, AlertDeviceType dt, String layoutId, int lineId) {
|
||||
List<DeviceAreaConfig> areaConfigList = this.findDevice(alertType, dt, lineId);
|
||||
|
Loading…
Reference in New Issue
Block a user