顶带调整,因为道岔全段没有关联对应的集中站,导致数据收集的时候道岔区段没有收集到;调整列车禁止ATP切除逻辑
This commit is contained in:
parent
9f2a751231
commit
72c163b9a0
@ -23,7 +23,6 @@ import club.joylink.xiannccda.entity.PublishedGi;
|
|||||||
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
import com.google.protobuf.Descriptors.FieldDescriptor;
|
import com.google.protobuf.Descriptors.FieldDescriptor;
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
@ -75,12 +74,10 @@ public class LineGraphicDataRepository {
|
|||||||
private static final HashBasedTable<Integer, String, MessageOrBuilder> line_id_table =
|
private static final HashBasedTable<Integer, String, MessageOrBuilder> line_id_table =
|
||||||
HashBasedTable.create();
|
HashBasedTable.create();
|
||||||
/**
|
/**
|
||||||
* 线路id 逻辑 对物理区段的map
|
* 线路id 道岔code 对应的道岔区段
|
||||||
* <p>
|
|
||||||
* 如果区段是道岔物理区段,那么key 就是对应的道岔code
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
private static final Table<Integer, String, String> LOGIC_SECTION_TO_SECTION_TABLE = HashBasedTable.create();
|
private static final Table<Integer, String, String> TURNOUT_TO_TURNOUT_TRACK = HashBasedTable.create();
|
||||||
private static final Table<Integer, String, String> LOGIC_SECTION_TO_AXLE_TABLE = HashBasedTable.create();
|
private static final Table<Integer, String, String> LOGIC_SECTION_TO_AXLE_TABLE = HashBasedTable.create();
|
||||||
|
|
||||||
|
|
||||||
@ -127,15 +124,15 @@ public class LineGraphicDataRepository {
|
|||||||
for (Integer childId : section.getChildrenList()) {
|
for (Integer childId : section.getChildrenList()) {
|
||||||
Builder b = turnoutMap.get(childId);
|
Builder b = turnoutMap.get(childId);
|
||||||
if (b instanceof DeviceInfoProto.Turnout.Builder logicSection) {
|
if (b instanceof DeviceInfoProto.Turnout.Builder logicSection) {
|
||||||
LOGIC_SECTION_TO_SECTION_TABLE.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
TURNOUT_TO_TURNOUT_TRACK.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
||||||
LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), section.getCode(), logicSection.getCode());
|
// LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), section.getCode(), logicSection.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Integer childId : section.getChildrenList()) {
|
for (Integer childId : section.getChildrenList()) {
|
||||||
Builder b = builderMap.get(childId);
|
Builder b = builderMap.get(childId);
|
||||||
if (b instanceof DeviceInfoProto.Section.Builder logicSection) {
|
if (b instanceof DeviceInfoProto.Section.Builder logicSection) {
|
||||||
LOGIC_SECTION_TO_SECTION_TABLE.put(publishGi.getLineId(), logicSection.getCode(), logicSection.getCode());
|
// LOGIC_SECTION_TO_SECTION_TABLE.put(publishGi.getLineId(), logicSection.getCode(), logicSection.getCode());
|
||||||
LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,17 +175,13 @@ public class LineGraphicDataRepository {
|
|||||||
for (Integer childId : section.getChildrenList()) {
|
for (Integer childId : section.getChildrenList()) {
|
||||||
MessageOrBuilder childMB = getDeviceByCode(lineId, childId.toString());
|
MessageOrBuilder childMB = getDeviceByCode(lineId, childId.toString());
|
||||||
String deviceCode_ = DeviceStatusDataOperate.findFieldVal(childMB, "code", String.class);
|
String deviceCode_ = DeviceStatusDataOperate.findFieldVal(childMB, "code", String.class);
|
||||||
|
|
||||||
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
||||||
interLock.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
interLock.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb instanceof LayoutGraphicsProto.Signal) {
|
} else if (mb instanceof LayoutGraphicsProto.Signal) {
|
||||||
|
|
||||||
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SIGNAL, deviceCode, rtuId.shortValue()));
|
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SIGNAL, deviceCode, rtuId.shortValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,8 +274,8 @@ public class LineGraphicDataRepository {
|
|||||||
return mob;
|
return mob;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String findSectionFromLogicCode(int lineId, String code) {
|
public static String findTurnoutSectionFromTurnoutCode(int lineId, String code) {
|
||||||
return LOGIC_SECTION_TO_SECTION_TABLE.get(lineId, code);
|
return TURNOUT_TO_TURNOUT_TRACK.get(lineId, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Optional<T> getDeviceOptByCode(int lineId, String code, Class<T> cls) {
|
public static <T> Optional<T> getDeviceOptByCode(int lineId, String code, Class<T> cls) {
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertManager;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.atp.TrainModeAlertListener.TrainAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,7 +28,7 @@ public class TrainInitConvertor extends DefaultConvertor {
|
|||||||
AlertManager alertManager = AlertManager.getDefault();
|
AlertManager alertManager = AlertManager.getDefault();
|
||||||
for (Builder builder : builders) {
|
for (Builder builder : builders) {
|
||||||
if (builder instanceof TrainInfo.Builder trainBuild) {
|
if (builder instanceof TrainInfo.Builder trainBuild) {
|
||||||
|
|
||||||
alertManager.emit(new TrainAlertEvent(trainBuild));
|
alertManager.emit(new TrainAlertEvent(trainBuild));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertManager;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.atp.TrainModeAlertListener.TrainAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertManager;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.atp.TrainModeAlertListener.TrainAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -94,14 +94,14 @@ public class InterLockData extends AbstractData {
|
|||||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode);
|
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode);
|
||||||
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||||
} else if (builder instanceof Switch.Builder switchs) {
|
} else if (builder instanceof Switch.Builder switchs) {
|
||||||
// MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
||||||
// this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
||||||
//获取对应的道岔物理区段
|
//获取对应的道岔物理区段
|
||||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, switchs.getId());
|
// String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, switchs.getId());
|
||||||
if (StringUtils.isNotEmpty(sectionCode)) {
|
// if (StringUtils.isNotEmpty(sectionCode)) {
|
||||||
MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
// MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||||
this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
// this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.xiannccda.ats.warn;
|
package club.joylink.xiannccda.ats.warn.atp;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||||
@ -11,6 +11,10 @@ import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
|||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.LogicSection;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Turnout;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
||||||
@ -96,17 +100,35 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
|
|
||||||
|
|
||||||
protected void trainAlert(TrainInfo.Builder trainInfo) {
|
protected void trainAlert(TrainInfo.Builder trainInfo) {
|
||||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(trainInfo.getLineId(), trainInfo.getDevName());
|
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCodeNotException(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
if (StringUtils.isEmpty(sectionCode)) {
|
if (!(mb instanceof LogicSection) && !(mb instanceof Turnout) && !(mb instanceof Section)) {
|
||||||
|
log.error("线路[{}]列车[{}]所在未知设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
||||||
|
this.trainInfoMap.remove(trainInfo.getGroupId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageOrBuilder turnoutOrLogicSection = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), sectionCode);
|
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(mb, "common", CommonInfo.class);
|
||||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
|
||||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
|
||||||
Integer layoutDeviceId = commonInfo.getId();
|
Integer layoutDeviceId = commonInfo.getId();
|
||||||
|
if (mb instanceof LogicSection) {
|
||||||
|
String axleCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), axleCode, Section.class);
|
||||||
|
layoutDeviceId = section.getCommon().getId();
|
||||||
|
}
|
||||||
|
if (mb instanceof Turnout) {
|
||||||
|
String turnoutCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), turnoutCode, Section.class);
|
||||||
|
layoutDeviceId = section.getCommon().getId();
|
||||||
|
}
|
||||||
|
/* if (mb instanceof Section section) {
|
||||||
|
if (section.getSectionType() == SectionType.Physical) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
if (alertDataSource.putAlterDevice(trainInfo.getLineId(), this.getName(), trainInfo.getGroupId())) {
|
if (alertDataSource.putAlterDevice(trainInfo.getLineId(), this.getName(), trainInfo.getGroupId())) {
|
||||||
log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
||||||
String alertMsg = String.format("列车[%s] 紧制导致ATP切除所在区段[%s]", trainInfo.getGroupId(), deviceCode);
|
String alertMsg = String.format("列车[%s] 紧制导致ATP切除所在区段[%s]", trainInfo.getGroupId(), trainInfo.getDevName());
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRACK, layoutDeviceId, trainInfo, alertMsg,
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRACK, layoutDeviceId, trainInfo, alertMsg,
|
||||||
AlertDeviceType.DEVICE_TYPE_TRAIN, false);
|
AlertDeviceType.DEVICE_TYPE_TRAIN, false);
|
||||||
alertManager.emit(alertInfo);
|
alertManager.emit(alertInfo);
|
@ -1,11 +1,13 @@
|
|||||||
package club.joylink.xiannccda.ats.warn;
|
package club.joylink.xiannccda.ats.warn.atp;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
import club.joylink.xiannccda.ats.warn.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
||||||
|
import club.joylink.xiannccda.ats.warn.atp.TrainModeAlertListener.TrainAlertEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.TrainMode;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRemove;
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -44,7 +46,7 @@ public class TrainModeAlertListener implements AlertSourceEventListener<TrainAle
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TrainAlertEvent extends DeviceAlertEvent<GeneratedMessageV3.Builder> {
|
public static class TrainAlertEvent extends DeviceAlertEvent<Builder> {
|
||||||
|
|
||||||
public TrainAlertEvent(GeneratedMessageV3.Builder source) {
|
public TrainAlertEvent(GeneratedMessageV3.Builder source) {
|
||||||
super(source);
|
super(source);
|
@ -13,6 +13,8 @@ import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
|||||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData;
|
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData;
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData.InterLockDetail;
|
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData.InterLockDetail;
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.ats.warn.axle.event.LedMostEvent;
|
import club.joylink.xiannccda.ats.warn.axle.event.LedMostEvent;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||||
@ -62,8 +64,8 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
|||||||
}
|
}
|
||||||
for (String lineId : lineCollSet) {
|
for (String lineId : lineCollSet) {
|
||||||
InterLockData interLockData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.INTER_LOCK);
|
InterLockData interLockData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.INTER_LOCK);
|
||||||
List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name())
|
List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name());
|
||||||
.stream().filter(d -> StringUtils.endsWith(d, AlertDeviceType.DEVICE_TYPE_TRACK.name())).toList();
|
// .stream().filter(d -> StringUtils.endsWith(d, AlertDeviceType.DEVICE_TYPE_TRACK.name())).toList();
|
||||||
for (String lockLevel : interlockOneList) {
|
for (String lockLevel : interlockOneList) {
|
||||||
Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(lockLevel);
|
Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(lockLevel);
|
||||||
for (Entry<String, InterLockDetail> interLockDetail : detailMap.entrySet()) {
|
for (Entry<String, InterLockDetail> interLockDetail : detailMap.entrySet()) {
|
||||||
@ -114,13 +116,84 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
|||||||
for (Integer deviceLayoutId : deviceLayoutIds) {
|
for (Integer deviceLayoutId : deviceLayoutIds) {
|
||||||
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString());
|
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString());
|
||||||
if (mb instanceof Section section) {
|
if (mb instanceof Section section) {
|
||||||
|
boolean result = this.checkTrackOccupiedSectionStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
||||||
|
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
||||||
|
} else if (mb instanceof Turnout turnout) {
|
||||||
|
String dgCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineIdInt, turnout.getCode());
|
||||||
|
boolean result = this.checkTrackOccupiedTurnoutStatus(alertType, turnout, deviceStatusData, trainDataSource);
|
||||||
|
warnResultList.add(new TrackOccupiedStatus(dgCode, result, turnout.getCommon().getId()));
|
||||||
|
}
|
||||||
|
/*if (mb instanceof Section section) {
|
||||||
boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
||||||
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
return warnResultList;
|
return warnResultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkTrackOccupiedTurnoutStatus(AlertType alertType, Turnout turnout, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||||
|
|
||||||
|
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||||
|
String trackCode = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SWITCH, turnout.getCode());
|
||||||
|
String trainGroupId = trainDataSource.findTrainForDeviceName(trackCode);
|
||||||
|
if (deviceStatus instanceof Switch.Builder switchBuild) {
|
||||||
|
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||||
|
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
|
||||||
|
if (alertType == AlertType.AXLE_LED_RED) {
|
||||||
|
return ledRed;
|
||||||
|
} else {
|
||||||
|
return orange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkTrackOccupiedSectionStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||||
|
List<Boolean> alertList = Lists.newArrayList();
|
||||||
|
if (section.getSectionType() == SectionType.Physical) {
|
||||||
|
for (Integer childId : section.getChildrenList()) {
|
||||||
|
MessageOrBuilder childMB = LineGraphicDataRepository.getDeviceByCode(lineId, childId.toString());
|
||||||
|
String deviceCode = DeviceStatusDataOperate.findFieldVal(childMB, "code", String.class);
|
||||||
|
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Track.getDescriptor().getName(), deviceCode);
|
||||||
|
String trainGroupId = trainDataSource.findTrainForDeviceName(deviceCode);
|
||||||
|
if (StringUtils.isNotEmpty(trainGroupId)) {
|
||||||
|
//车辆占用区段
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (deviceStatus instanceof Track.Builder track) {
|
||||||
|
if (alertType == AlertType.AXLE_LED_RED) {
|
||||||
|
boolean red = track.getCiOccupied() && !track.getCbtcOccupied();
|
||||||
|
alertList.add(red);
|
||||||
|
} else {
|
||||||
|
boolean orange = track.getAtcInvalid();
|
||||||
|
alertList.add(orange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}/* else if (section.getSectionType() == SectionType.TurnoutPhysical) {
|
||||||
|
Integer turnoutId = section.getChildren(0);
|
||||||
|
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, turnoutId.toString(), Turnout.class);
|
||||||
|
|
||||||
|
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||||
|
|
||||||
|
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
|
||||||
|
if (deviceStatus instanceof Switch.Builder switchBuild) {
|
||||||
|
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||||
|
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
|
||||||
|
if (alertType == AlertType.AXLE_LED_RED) {
|
||||||
|
alertList.add(ledRed);
|
||||||
|
} else {
|
||||||
|
alertList.add(orange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if (CollectionUtils.isEmpty(alertList)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return alertList.stream().allMatch(d -> d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Deprecated
|
||||||
private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||||
List<Boolean> alertList = Lists.newArrayList();
|
List<Boolean> alertList = Lists.newArrayList();
|
||||||
if (section.getSectionType() == SectionType.Physical) {
|
if (section.getSectionType() == SectionType.Physical) {
|
||||||
@ -164,7 +237,7 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return alertList.stream().allMatch(d -> d);
|
return alertList.stream().allMatch(d -> d);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -68,6 +68,19 @@ public class AxleLedMostMonitorListener implements AlertSourceEventListener<LedM
|
|||||||
}
|
}
|
||||||
String ledName = lockSource.alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
String ledName = lockSource.alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||||
List<String> warnDeviceList = alertDataSource.findAllWarnDeviceForList(lineIdInt, customName);
|
List<String> warnDeviceList = alertDataSource.findAllWarnDeviceForList(lineIdInt, customName);
|
||||||
|
/*deviceStatusList.stream().filter(d -> d.saveAlertDataSouce).forEach(d -> {
|
||||||
|
String alertMsg = String.format("出现%s设备[%s]", ledName, d.deviceCode);
|
||||||
|
|
||||||
|
if (Objects.nonNull(areaConfigVO) && warnDeviceList.size() >= ledThreshold) {
|
||||||
|
String warnDevices = String.join(",", warnDeviceList);
|
||||||
|
alertMsg = String.format("%s-出现大面积%s设备[%s]", areaConfigVO.getAreaName(), ledName, warnDevices);
|
||||||
|
}
|
||||||
|
String alertMsg = String.format("出现%s设备[%s]", ledName, d.deviceCode);
|
||||||
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(null, lockSource.alertType, lineIdInt, LocalDateTime.now(), alertMsg, String.valueOf(d.layoutId),
|
||||||
|
AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||||
|
alertManager.emit(alertInfo);
|
||||||
|
});*/
|
||||||
|
|
||||||
if (Objects.nonNull(areaConfigVO) && deviceStatusList.stream().anyMatch(d -> d.saveAlertDataSouce) && warnDeviceList.size() >= ledThreshold) {
|
if (Objects.nonNull(areaConfigVO) && deviceStatusList.stream().anyMatch(d -> d.saveAlertDataSouce) && warnDeviceList.size() >= ledThreshold) {
|
||||||
//发布大面积
|
//发布大面积
|
||||||
String warnDevices = String.join(",", warnDeviceList);
|
String warnDevices = String.join(",", warnDeviceList);
|
||||||
@ -76,6 +89,7 @@ public class AxleLedMostMonitorListener implements AlertSourceEventListener<LedM
|
|||||||
alertManager.emit(alertInfoMost);
|
alertManager.emit(alertInfoMost);
|
||||||
} else {
|
} else {
|
||||||
deviceStatusList.stream().filter(d -> d.saveAlertDataSouce).forEach(d -> {
|
deviceStatusList.stream().filter(d -> d.saveAlertDataSouce).forEach(d -> {
|
||||||
|
log.error("---------------" + d.deviceCode);
|
||||||
String alertMsg = String.format("出现%s设备[%s]", ledName, d.deviceCode);
|
String alertMsg = String.format("出现%s设备[%s]", ledName, d.deviceCode);
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(null, lockSource.alertType, lineIdInt, LocalDateTime.now(), alertMsg, String.valueOf(d.layoutId),
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(null, lockSource.alertType, lineIdInt, LocalDateTime.now(), alertMsg, String.valueOf(d.layoutId),
|
||||||
AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||||
|
@ -146,6 +146,10 @@ public class MockOccServer {
|
|||||||
mockDeviceStatusReq.setTime(Instant.ofEpochMilli(System.currentTimeMillis()).getEpochSecond());
|
mockDeviceStatusReq.setTime(Instant.ofEpochMilli(System.currentTimeMillis()).getEpochSecond());
|
||||||
list.add(mockDeviceStatusReq);
|
list.add(mockDeviceStatusReq);
|
||||||
} else if (messageId == MessageId.TRAIN_INDICATION_UPDATE) {
|
} else if (messageId == MessageId.TRAIN_INDICATION_UPDATE) {
|
||||||
|
if (di.getDeviceType() == DeviceType.DEVICE_TYPE_SWITCH) {
|
||||||
|
String turnoutCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineId, di.getDeviceName());
|
||||||
|
di.setDeviceName(turnoutCode);
|
||||||
|
}
|
||||||
MockTrainUpdateReq req = new MockTrainUpdateReq(messageId, lineId, rtuId_.shortValue(), di.getDeviceType(), di.getDeviceName(), md.deviceStatus(di.getStatus()));
|
MockTrainUpdateReq req = new MockTrainUpdateReq(messageId, lineId, rtuId_.shortValue(), di.getDeviceType(), di.getDeviceName(), md.deviceStatus(di.getStatus()));
|
||||||
req.setTime(Instant.ofEpochMilli(System.currentTimeMillis()).getEpochSecond());
|
req.setTime(Instant.ofEpochMilli(System.currentTimeMillis()).getEpochSecond());
|
||||||
req.setGroup_id(di.getGroupId());
|
req.setGroup_id(di.getGroupId());
|
||||||
|
@ -38,7 +38,6 @@ import club.joylink.xiannccda.mock.message.occ.MockOccServer;
|
|||||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
|
||||||
import com.google.protobuf.MessageOrBuilder;
|
import com.google.protobuf.MessageOrBuilder;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -53,7 +52,6 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -380,7 +378,7 @@ public class AlertMockService {
|
|||||||
track.setRtuId(1);
|
track.setRtuId(1);
|
||||||
track.setId("G0202-A");
|
track.setId("G0202-A");
|
||||||
track.setLineId(lineId);
|
track.setLineId(lineId);
|
||||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, "G0202-A");
|
String sectionCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineId, "G0202-A");
|
||||||
Section section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode, Section.class);
|
Section section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode, Section.class);
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.SWITCH_LOST, AlertDeviceType.DEVICE_TYPE_SWITCH, section.getCommon().getId(), track, track.getId(),
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.SWITCH_LOST, AlertDeviceType.DEVICE_TYPE_SWITCH, section.getCommon().getId(), track, track.getId(),
|
||||||
AlertDeviceType.DEVICE_TYPE_TRACK, true);
|
AlertDeviceType.DEVICE_TYPE_TRACK, true);
|
||||||
@ -394,7 +392,7 @@ public class AlertMockService {
|
|||||||
track.setRtuId(1);
|
track.setRtuId(1);
|
||||||
track.setId("G0202-A");
|
track.setId("G0202-A");
|
||||||
track.setLineId(lineId);
|
track.setLineId(lineId);
|
||||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, "G0202-A");
|
String sectionCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineId, "G0202-A");
|
||||||
Section section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode, Section.class);
|
Section section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode, Section.class);
|
||||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.AXLE_LED_ORANGE, AlertDeviceType.DEVICE_TYPE_TRACK, section.getCommon().getId(), track, track.getId(),
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.AXLE_LED_ORANGE, AlertDeviceType.DEVICE_TYPE_TRACK, section.getCommon().getId(), track, track.getId(),
|
||||||
AlertDeviceType.DEVICE_TYPE_TRACK, true);
|
AlertDeviceType.DEVICE_TYPE_TRACK, true);
|
||||||
|
@ -159,7 +159,7 @@ public class AlertRecordService {
|
|||||||
.set(AlertRecord::getAlertTipId, tip.getId()).set(AlertRecord::getAlarmStatus, AlertStatus.CONFIRM_DO)
|
.set(AlertRecord::getAlertTipId, tip.getId()).set(AlertRecord::getAlarmStatus, AlertStatus.CONFIRM_DO)
|
||||||
.set(hasAreaConfigId, AlertRecord::getAlertLocationId, newAreaConfigId)
|
.set(hasAreaConfigId, AlertRecord::getAlertLocationId, newAreaConfigId)
|
||||||
.set(AlertRecord::getAlertType, tipType)
|
.set(AlertRecord::getAlertType, tipType)
|
||||||
.eq(AlertRecord::getId, recordId).isNull(AlertRecord::getAlarmStatus));
|
.eq(AlertRecord::getId, recordId).eq(AlertRecord::getAlarmStatus, AlertStatus.NOT_DO));
|
||||||
}
|
}
|
||||||
return tip;
|
return tip;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user