调整,添加4号线设备名称处理
All checks were successful
local-test分支构建docker并发布运行 / Docker-Build (push) Successful in 1m16s
All checks were successful
local-test分支构建docker并发布运行 / Docker-Build (push) Successful in 1m16s
This commit is contained in:
parent
1155aa023a
commit
5790fd2cfb
@ -30,7 +30,7 @@ public class LineGraphicDataManage implements ApplicationRunner {
|
|||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
LineGraphicDataRepository.putLineGraph(d);
|
LineGraphicDataRepository.putLineGraph(d);
|
||||||
if (!SystemContext.getMasterEnv()) {
|
if (!SystemContext.getMasterEnv()) {
|
||||||
LineGraphicDataRepository.initDeviceStationCenter();
|
LineGraphicDataRepository.initDeviceStationCenter(d.getLineId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,12 @@ import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
|||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.DeviceKilometer;
|
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.DeviceKilometer;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.Turnout;
|
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.Turnout;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.AxleCounting;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.LogicSection;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.LogicSection;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Platform;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Platform;
|
||||||
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RtssGraphicStorage;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RtssGraphicStorage;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||||
@ -24,6 +26,7 @@ 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;
|
||||||
@ -56,7 +59,7 @@ public class LineGraphicDataRepository {
|
|||||||
*/
|
*/
|
||||||
private static final Map<Integer, Map<String, Map<Integer, Builder>>> lineGraphMap =
|
private static final Map<Integer, Map<String, Map<Integer, Builder>>> lineGraphMap =
|
||||||
new ConcurrentHashMap<>();
|
new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 线路各坐标系转换关系
|
* 线路各坐标系转换关系
|
||||||
*/
|
*/
|
||||||
@ -146,45 +149,43 @@ public class LineGraphicDataRepository {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initDeviceStationCenter() {
|
public static void initDeviceStationCenter(Integer lineId) {
|
||||||
log.info("开始初始化地图中设备集中站的归属。。。");
|
log.info("开始初始化地图中设备集中站的归属。。。");
|
||||||
|
|
||||||
for (Integer lineId : line_code_table.rowKeySet()) {
|
DeviceStatusData dsd = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.DEVICE);
|
||||||
DeviceStatusData dsd = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.DEVICE);
|
InterLockData interLock = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.INTER_LOCK);
|
||||||
InterLockData interLock = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.INTER_LOCK);
|
;
|
||||||
;
|
|
||||||
// for (MessageOrBuilder mb : line_code_table.values()) {
|
// for (MessageOrBuilder mb : line_code_table.values()) {
|
||||||
for (MessageOrBuilder mb : line_code_table.row(lineId).values()) {
|
for (MessageOrBuilder mb : line_code_table.row(lineId).values()) {
|
||||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(mb, "code", String.class);
|
String deviceCode = DeviceStatusDataOperate.findFieldVal(mb, "code", String.class);
|
||||||
Integer deviceId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
|
Integer deviceId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
|
||||||
if (Objects.isNull(deviceId) || deviceId == 0) {
|
if (Objects.isNull(deviceId) || deviceId == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Integer rtuId = getStationCenterById(lineId, deviceId.toString());
|
Integer rtuId = getStationCenterById(lineId, deviceId.toString());
|
||||||
if (Objects.isNull(rtuId)) {
|
if (Objects.isNull(rtuId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
// List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
||||||
if (mb instanceof LayoutGraphicsProto.Turnout) {
|
if (mb instanceof LayoutGraphicsProto.Turnout) {
|
||||||
List<GeneratedMessageV3.Builder> sl = createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SWITCH, deviceCode, rtuId.shortValue());
|
List<GeneratedMessageV3.Builder> sl = createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SWITCH, deviceCode, rtuId.shortValue());
|
||||||
List<GeneratedMessageV3.Builder> tl = createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode, rtuId.shortValue());
|
List<GeneratedMessageV3.Builder> tl = createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode, rtuId.shortValue());
|
||||||
dsd.addDevice(sl);
|
dsd.addDevice(sl);
|
||||||
dsd.addDevice(tl);
|
dsd.addDevice(tl);
|
||||||
interLock.addDevice(sl);
|
interLock.addDevice(sl);
|
||||||
}/* else if (mb instanceof LogicSection logicSection) {
|
}/* else if (mb instanceof LogicSection logicSection) {
|
||||||
builders.addAll(this.createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode, rtuId.shortValue()));
|
builders.addAll(this.createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode, rtuId.shortValue()));
|
||||||
}*/ else if (mb instanceof LayoutGraphicsProto.Section section) {
|
}*/ else if (mb instanceof LayoutGraphicsProto.Section section) {
|
||||||
if (section.getSectionType() == SectionType.Physical) {
|
if (section.getSectionType() == SectionType.Physical) {
|
||||||
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) {
|
|
||||||
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SIGNAL, deviceCode, rtuId.shortValue()));
|
|
||||||
}
|
}
|
||||||
|
} else if (mb instanceof LayoutGraphicsProto.Signal) {
|
||||||
|
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_SIGNAL, deviceCode, rtuId.shortValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,7 +414,17 @@ public class LineGraphicDataRepository {
|
|||||||
Map<String, CoordinateConvertor> convertorMap =
|
Map<String, CoordinateConvertor> convertorMap =
|
||||||
lineCoordinateMain.computeIfAbsent(lineId, id -> new HashMap<>());
|
lineCoordinateMain.computeIfAbsent(lineId, id -> new HashMap<>());
|
||||||
Map<Integer, Builder> cacheSwitchMap = new HashMap<>(storage.getTurnoutsList().size());
|
Map<Integer, Builder> cacheSwitchMap = new HashMap<>(storage.getTurnoutsList().size());
|
||||||
storage.getTurnoutsList().stream()
|
for (LayoutGraphicsProto.Turnout t : storage.getTurnoutsList()) {
|
||||||
|
List<KilometerSystem> systemList = t.getKilometerSystemList().stream().filter(k -> StringUtils.isNotEmpty(k.getCoordinateSystem())).toList();
|
||||||
|
DeviceInfoProto.Turnout.Builder turnoutBuilder = DeviceInfoProto.Turnout.newBuilder();
|
||||||
|
turnoutBuilder.setId(t.getCommon().getId());
|
||||||
|
turnoutBuilder.setCode(t.getCode());
|
||||||
|
turnoutBuilder.setKilometer(initKilometer(systemList));
|
||||||
|
cacheSwitchMap.put(t.getCommon().getId(), turnoutBuilder);
|
||||||
|
convertorCoordinateByTurnoutKM(convertorMap, systemList);
|
||||||
|
}
|
||||||
|
dataMap.put(DeviceType.Turnout.name(), cacheSwitchMap);
|
||||||
|
/* storage.getTurnoutsList().stream()
|
||||||
.forEach(
|
.forEach(
|
||||||
t -> {
|
t -> {
|
||||||
List<KilometerSystem> systemList =
|
List<KilometerSystem> systemList =
|
||||||
@ -427,7 +438,7 @@ public class LineGraphicDataRepository {
|
|||||||
cacheSwitchMap.put(t.getCommon().getId(), turnoutBuilder);
|
cacheSwitchMap.put(t.getCommon().getId(), turnoutBuilder);
|
||||||
convertorCoordinateByTurnoutKM(convertorMap, systemList);
|
convertorCoordinateByTurnoutKM(convertorMap, systemList);
|
||||||
});
|
});
|
||||||
dataMap.put(DeviceType.Turnout.name(), cacheSwitchMap);
|
dataMap.put(DeviceType.Turnout.name(), cacheSwitchMap);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -484,7 +495,40 @@ public class LineGraphicDataRepository {
|
|||||||
initConvertorCoordinate(lineId, dataMap, storage);
|
initConvertorCoordinate(lineId, dataMap, storage);
|
||||||
Map<Integer, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
Map<Integer, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||||
Map<Integer, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
Map<Integer, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
||||||
storage.getAxleCountingsList().stream()
|
for (AxleCounting ac : storage.getAxleCountingsList()) {
|
||||||
|
if (StringUtils.isNotEmpty(ac.getKilometerSystem().getCoordinateSystem())) {
|
||||||
|
long mainLineCoordinate = doConvertorCoordinate(lineId, ac.getKilometerSystem());
|
||||||
|
for (RelatedRef ref : ac.getAxleCountingRefList()) {
|
||||||
|
if (Objects.equals(DeviceType.Section, ref.getDeviceType())) {
|
||||||
|
DeviceInfoProto.Section.Builder b = findSection(sectionMap, ref.getId());
|
||||||
|
if (b != null) {
|
||||||
|
DeviceInfoProto.DeviceKilometer.Builder k = b.getKilometerBuilder();
|
||||||
|
updateKilometer(k, ac.getKilometerSystem(), mainLineCoordinate);
|
||||||
|
}
|
||||||
|
} else if (Objects.equals(DeviceType.Turnout, ref.getDeviceType())) {
|
||||||
|
DeviceInfoProto.Turnout.Builder b = findTurnout(turnoutMap, ref.getId());
|
||||||
|
if (b != null) {
|
||||||
|
DeviceInfoProto.DeviceKilometer.Builder k = b.getKilometerBuilder();
|
||||||
|
// 更新道岔自身的公里标数据
|
||||||
|
for (KilometerSystem s : k.getKilometerSystemList()) {
|
||||||
|
long mc = doConvertorCoordinate(lineId, s);
|
||||||
|
updateMinAndMaxKilometer(k, mc);
|
||||||
|
}
|
||||||
|
// 放入当前计轴信息
|
||||||
|
/* updateKilometer(k, ac.getKilometerSystem(), mainLineCoordinate);
|
||||||
|
k.getKilometerSystemList()
|
||||||
|
.forEach(
|
||||||
|
s ->
|
||||||
|
updateMinAndMaxKilometer(
|
||||||
|
k, doConvertorCoordinate(lineId, s)));
|
||||||
|
// 放入当前计轴信息
|
||||||
|
updateKilometer(k, ac.getKilometerSystem(), mainLineCoordinate);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* storage.getAxleCountingsList().stream()
|
||||||
.filter(ac -> StringUtils.isNotEmpty(ac.getKilometerSystem().getCoordinateSystem()))
|
.filter(ac -> StringUtils.isNotEmpty(ac.getKilometerSystem().getCoordinateSystem()))
|
||||||
.forEach(
|
.forEach(
|
||||||
ac -> {
|
ac -> {
|
||||||
@ -513,7 +557,7 @@ public class LineGraphicDataRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -523,19 +567,76 @@ public class LineGraphicDataRepository {
|
|||||||
* @param dataMap 设备集合
|
* @param dataMap 设备集合
|
||||||
* @param storage 地图信息
|
* @param storage 地图信息
|
||||||
*/
|
*/
|
||||||
private static void initConvertorCoordinate(
|
private static void initConvertorCoordinate(Integer lineId, Map<String, Map<Integer, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||||
Integer lineId,
|
|
||||||
Map<String, Map<Integer, Builder>> dataMap,
|
|
||||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
|
||||||
// 强制转换道岔
|
// 强制转换道岔
|
||||||
Map<Integer, Builder> turnoutMap = dataMap.get(DeviceType.Turnout.name());
|
Map<Integer, Builder> turnoutMap = dataMap.get(DeviceType.Turnout.name());
|
||||||
if (CollectionUtils.isEmpty(turnoutMap)) {
|
if (CollectionUtils.isEmpty(turnoutMap)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, CoordinateConvertor> convertorMap =
|
|
||||||
lineCoordinateMain.computeIfAbsent(lineId, id -> new HashMap<>());
|
Map<String, CoordinateConvertor> convertorMap = lineCoordinateMain.computeIfAbsent(lineId, id -> new HashMap<>());
|
||||||
// 从计轴中转换信息
|
// 从计轴中转换信息
|
||||||
storage
|
for (AxleCounting axle : storage.getAxleCountingsList()) {
|
||||||
|
|
||||||
|
// 筛选出道岔的公里标坐标系
|
||||||
|
List<KilometerSystem> kilometerSystemList = Lists.newArrayList();
|
||||||
|
for (RelatedRef ref : axle.getAxleCountingRefList()) {
|
||||||
|
if (DeviceType.Turnout.equals(ref.getDeviceType()) && turnoutMap.containsKey(ref.getId())) {
|
||||||
|
DeviceInfoProto.Turnout.Builder t = (DeviceInfoProto.Turnout.Builder) turnoutMap.get(ref.getId());
|
||||||
|
if (t.getKilometer().getKilometerSystemCount() > 0) {
|
||||||
|
kilometerSystemList.add(t.getKilometer().getKilometerSystemList().get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* List<KilometerSystem> kilometerSystemList =
|
||||||
|
axle.getAxleCountingRefList().stream()
|
||||||
|
.filter(
|
||||||
|
ref ->
|
||||||
|
DeviceType.Turnout.equals(ref.getDeviceType())
|
||||||
|
&& turnoutMap.containsKey(ref.getId()))
|
||||||
|
.map(ref -> (DeviceInfoProto.Turnout.Builder) turnoutMap.get(ref.getId()))
|
||||||
|
.filter(t -> t.getKilometer().getKilometerSystemCount() > 0)
|
||||||
|
.map(t -> t.getKilometer().getKilometerSystemList().get(0))
|
||||||
|
.toList();*/
|
||||||
|
// 如果关联多个道岔
|
||||||
|
if (kilometerSystemList.size() > 1) {
|
||||||
|
KilometerSystem axleSystem = axle.getKilometerSystem();
|
||||||
|
KilometerSystem sameSystem =
|
||||||
|
kilometerSystemList.stream()
|
||||||
|
.filter(
|
||||||
|
k ->
|
||||||
|
Objects.equals(
|
||||||
|
k.getCoordinateSystem(), axleSystem.getCoordinateSystem()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
KilometerSystem diffSystem =
|
||||||
|
kilometerSystemList.stream()
|
||||||
|
.filter(
|
||||||
|
k ->
|
||||||
|
!Objects.equals(
|
||||||
|
k.getCoordinateSystem(), axleSystem.getCoordinateSystem()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
// 存在不同的坐标系再做处理
|
||||||
|
if (sameSystem != null && diffSystem != null) {
|
||||||
|
String convertorKey =
|
||||||
|
CoordinateConvertor.generateConvertorKey(
|
||||||
|
axleSystem.getCoordinateSystem(), diffSystem.getCoordinateSystem());
|
||||||
|
if (!convertorMap.containsKey(convertorKey)) {
|
||||||
|
// 计轴与相同坐标系岔心之间差值
|
||||||
|
long diffValue = axleSystem.getKilometer() - sameSystem.getKilometer();
|
||||||
|
// 俩岔心到计轴的距离相同,所以另一坐标系的公里标相减差值就是计轴在另一个坐标系的位置
|
||||||
|
// a - x = y - b (x,y为计轴在两坐标系上的坐标)
|
||||||
|
long convertKilometer = diffSystem.getKilometer() - diffValue;
|
||||||
|
// 求出坐标系0点位置
|
||||||
|
CoordinateConvertor convertor =
|
||||||
|
CoordinateConvertor.generate(axleSystem, diffSystem.getCoordinateSystem(), convertKilometer);
|
||||||
|
convertorMap.put(convertorKey, convertor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* storage
|
||||||
.getAxleCountingsList()
|
.getAxleCountingsList()
|
||||||
.forEach(
|
.forEach(
|
||||||
axle -> {
|
axle -> {
|
||||||
@ -582,13 +683,12 @@ public class LineGraphicDataRepository {
|
|||||||
long convertKilometer = diffSystem.getKilometer() - diffValue;
|
long convertKilometer = diffSystem.getKilometer() - diffValue;
|
||||||
// 求出坐标系0点位置
|
// 求出坐标系0点位置
|
||||||
CoordinateConvertor convertor =
|
CoordinateConvertor convertor =
|
||||||
CoordinateConvertor.generate(
|
CoordinateConvertor.generate(axleSystem, diffSystem.getCoordinateSystem(), convertKilometer);
|
||||||
axleSystem, diffSystem.getCoordinateSystem(), convertKilometer);
|
|
||||||
convertorMap.put(convertorKey, convertor);
|
convertorMap.put(convertorKey, convertor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -645,11 +745,9 @@ public class LineGraphicDataRepository {
|
|||||||
return kilometer.getKilometer();
|
return kilometer.getKilometer();
|
||||||
}
|
}
|
||||||
Map<String, CoordinateConvertor> convertorMap = lineCoordinateMain.get(lineId);
|
Map<String, CoordinateConvertor> convertorMap = lineCoordinateMain.get(lineId);
|
||||||
String convertorKey =
|
String convertorKey = CoordinateConvertor.generateConvertorKey(kilometer.getCoordinateSystem(), CoordinateEnum.MAIN_LINE);
|
||||||
CoordinateConvertor.generateConvertorKey(
|
|
||||||
kilometer.getCoordinateSystem(), CoordinateEnum.MAIN_LINE);
|
|
||||||
if (CollectionUtils.isEmpty(convertorMap) || !convertorMap.containsKey(convertorKey)) {
|
if (CollectionUtils.isEmpty(convertorMap) || !convertorMap.containsKey(convertorKey)) {
|
||||||
log.error("无坐标转换规则" + convertorKey);
|
log.error("无坐标转换规则 lineId:{},规则:{}", lineId, convertorKey);
|
||||||
return kilometer.getKilometer();
|
return kilometer.getKilometer();
|
||||||
}
|
}
|
||||||
return convertorMap.get(convertorKey).convertorKilometer(kilometer, CoordinateEnum.MAIN_LINE);
|
return convertorMap.get(convertorKey).convertorKilometer(kilometer, CoordinateEnum.MAIN_LINE);
|
||||||
|
@ -16,6 +16,7 @@ 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.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,6 +25,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@Setter
|
@Setter
|
||||||
|
@Order(1)
|
||||||
public class OccMessageManage implements ApplicationRunner {
|
public class OccMessageManage implements ApplicationRunner {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -90,17 +91,55 @@ public class DeviceNameChangerManage {
|
|||||||
|
|
||||||
|
|
||||||
public static void init() throws Exception {
|
public static void init() throws Exception {
|
||||||
List<Class> classes = getClassFQName("club.joylink.xiannccda.ats.message.changer.universal", NameChangerFilter.class);
|
List<Class> classes = getClassFQName("club.joylink.xiannccda.ats.message.changer", NameChangerFilter.class);
|
||||||
List<NameChangerFilter> filters = Lists.newArrayList();
|
// List<Class> classes = getClassFQName("club.joylink.xiannccda.ats.message.changer.universal", NameChangerFilter.class);
|
||||||
|
Map<NameChangerEnum, List<NameChangerFilter>> nameChnageFilterMapList = Maps.newHashMap();
|
||||||
|
|
||||||
|
for (Class clazz : classes) {
|
||||||
|
NameChanger nc = (NameChanger) clazz.getDeclaredAnnotation(NameChanger.class);
|
||||||
|
if (Objects.nonNull(nc)) {
|
||||||
|
for (NameChangerEnum ncVal : nc.value()) {
|
||||||
|
List<NameChangerFilter> filterList = nameChnageFilterMapList.computeIfAbsent(ncVal, d -> Lists.newArrayList());
|
||||||
|
Object obj = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
filterList.add((NameChangerFilter) obj);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("没有找到对应的配置信息 class:{}", clazz.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Entry<NameChangerEnum, List<NameChangerFilter>> entry : nameChnageFilterMapList.entrySet()) {
|
||||||
|
Map<DeviceType, List<NameChangerFilter>> deviceTypeListMap = entry.getValue().stream().collect(Collectors.groupingBy(NameChangerFilter::deviceType));
|
||||||
|
deviceTypeListMap.forEach((k, v) -> {
|
||||||
|
Collections.sort(v, Comparator.comparingInt(NameChangerFilter::filterIndex));
|
||||||
|
CHANGER_TABLE2.put(entry.getKey(), k, v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* List<NameChangerFilter> filters = Lists.newArrayList();
|
||||||
for (Class clazz : classes) {
|
for (Class clazz : classes) {
|
||||||
Object obj = clazz.getDeclaredConstructor().newInstance();
|
Object obj = clazz.getDeclaredConstructor().newInstance();
|
||||||
filters.add((NameChangerFilter) obj);
|
filters.add((NameChangerFilter) obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<DeviceType, List<NameChangerFilter>> filteMaper = filters.stream().collect(Collectors.groupingBy(NameChangerFilter::deviceType));
|
Map<DeviceType, List<NameChangerFilter>> filteMaper = filters.stream().collect(Collectors.groupingBy(NameChangerFilter::deviceType));
|
||||||
filteMaper.forEach((k, v) -> {
|
filteMaper.forEach((k, v) -> {
|
||||||
Collections.sort(v, Comparator.comparingInt(NameChangerFilter::filterIndex));
|
Collections.sort(v, Comparator.comparingInt(NameChangerFilter::filterIndex));
|
||||||
CHANGER_TABLE2.put(NameChangerEnum.UNIVERSAL, k, v);
|
for (NameChangerFilter ncf : v) {
|
||||||
});
|
NameChanger nc = ncf.getClass().getDeclaredAnnotation(NameChanger.class);
|
||||||
|
if (Objects.isNull(nc)) {
|
||||||
|
log.error("class:{} 没有找到对应的名称处理注解", ncf.getClass().getName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (NameChangerEnum nameChangerEnum : nc.value()) {
|
||||||
|
List<NameChangerFilter> tmpList = CHANGER_TABLE2.get(nameChangerEnum, k);
|
||||||
|
if (Objects.isNull(tmpList)) {
|
||||||
|
tmpList = Lists.newArrayList();
|
||||||
|
CHANGER_TABLE2.put(nameChangerEnum, k, tmpList);
|
||||||
|
}
|
||||||
|
tmpList.add(ncf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initLineIdNameCHanger(Integer lineId, NameChangerEnum nameChanger) {
|
public static void initLineIdNameCHanger(Integer lineId, NameChangerEnum nameChanger) {
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
public @interface NameChanger {
|
||||||
|
|
||||||
|
NameChangerEnum[] value() default {};
|
||||||
|
}
|
@ -4,5 +4,5 @@ public enum NameChangerEnum {
|
|||||||
NONE,
|
NONE,
|
||||||
//通用
|
//通用
|
||||||
UNIVERSAL,
|
UNIVERSAL,
|
||||||
;
|
LINE_4
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer.line4;
|
||||||
|
|
||||||
|
public class Line4NameUtil {
|
||||||
|
|
||||||
|
public static String convertLine4Name(String line4Name) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
byte[] bb = line4Name.getBytes("ISO-8859-1");
|
||||||
|
for (int i = 0; i < bb.length; i++) {
|
||||||
|
byte b = bb[i];
|
||||||
|
if (i + 1 < bb.length) {
|
||||||
|
if (b == 0 && bb[i + 1] == 63) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append((char) b);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return line4Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer.line4;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
public class SignalChanger {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* X10301 /XR
|
||||||
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.LINE_4})
|
||||||
|
public static class Signal1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType deviceType() {
|
||||||
|
return DeviceType.DEVICE_TYPE_SIGNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String changeDeviceName(String sourceName) {
|
||||||
|
return Line4NameUtil.convertLine4Name(sourceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer.line4;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* P09301
|
||||||
|
*/
|
||||||
|
public class SwitchChanger {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道岔物理区段转换
|
||||||
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.LINE_4})
|
||||||
|
public static class SwitchDGChanger implements NameChangerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType deviceType() {
|
||||||
|
return DeviceType.DEVICE_TYPE_SWITCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String changeDeviceName(String sourceName) {
|
||||||
|
return Line4NameUtil.convertLine4Name(sourceName);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
|
|
||||||
|
public static class Switch1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int filterIndex() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType deviceType() {
|
||||||
|
return DeviceType.DEVICE_TYPE_SWITCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String changeDeviceName(String sourceName) {
|
||||||
|
Pattern regex = Pattern.compile("^([A-Za-z]{1,2})(\\d{2})3(.*?)$");
|
||||||
|
Matcher matcher = regex.matcher(sourceName);
|
||||||
|
if (matcher.find()) {
|
||||||
|
String head = matcher.group(2);
|
||||||
|
String tail = matcher.group(3);
|
||||||
|
return "P" + tail + head;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer.line4;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class TrackChanger {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理 3号线 区段位 T06301A 这样类似的格式
|
||||||
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.LINE_4})
|
||||||
|
public static class Track1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType deviceType() {
|
||||||
|
return DeviceType.DEVICE_TYPE_TRACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String changeDeviceName(String sourceName) {
|
||||||
|
return Line4NameUtil.convertLine4Name(sourceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.message.changer.universal;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -11,6 +13,7 @@ public class SignalChanger {
|
|||||||
/**
|
/**
|
||||||
* X10301 /XR
|
* X10301 /XR
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class Signal1Changer implements NameChangerFilter {
|
public static class Signal1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,6 +41,7 @@ public class SignalChanger {
|
|||||||
/**
|
/**
|
||||||
* X1506_L2
|
* X1506_L2
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class Signal2Changer implements NameChangerFilter {
|
public static class Signal2Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.message.changer.universal;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -14,6 +16,7 @@ public class SwitchChanger {
|
|||||||
/**
|
/**
|
||||||
* 道岔物理区段转换
|
* 道岔物理区段转换
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class SwitchDGChanger implements NameChangerFilter {
|
public static class SwitchDGChanger implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,6 +38,8 @@ public class SwitchChanger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
|
|
||||||
public static class Switch1Changer implements NameChangerFilter {
|
public static class Switch1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.message.changer.universal;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChanger;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -11,6 +13,7 @@ public class TrackChanger {
|
|||||||
/**
|
/**
|
||||||
* 处理 3号线 区段位 T06301A 这样类似的格式
|
* 处理 3号线 区段位 T06301A 这样类似的格式
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class Track1Changer implements NameChangerFilter {
|
public static class Track1Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,6 +36,7 @@ public class TrackChanger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
/**
|
/**
|
||||||
* 处理区段 T11301 这样类似的格式
|
* 处理区段 T11301 这样类似的格式
|
||||||
*/
|
*/
|
||||||
@ -64,6 +68,7 @@ public class TrackChanger {
|
|||||||
/**
|
/**
|
||||||
* 处理区段 TP_D33G 这样类似的格式
|
* 处理区段 TP_D33G 这样类似的格式
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class Track2Changer implements NameChangerFilter {
|
public static class Track2Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,6 +90,7 @@ public class TrackChanger {
|
|||||||
/**
|
/**
|
||||||
* 处理区段 T150406 这样类似的格式
|
* 处理区段 T150406 这样类似的格式
|
||||||
*/
|
*/
|
||||||
|
@NameChanger(value = {NameChangerEnum.UNIVERSAL})
|
||||||
public static class Track3Changer implements NameChangerFilter {
|
public static class Track3Changer implements NameChangerFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -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.atp.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.train.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;
|
||||||
|
@ -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.atp.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.train.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.atp.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.train.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;
|
||||||
|
@ -108,7 +108,7 @@ public class DeviceStatusChangeResponse extends MessageResponse {
|
|||||||
DeviceStatusConvertor.convertForTrack(this.deviceStatus, builder);
|
DeviceStatusConvertor.convertForTrack(this.deviceStatus, builder);
|
||||||
DeviceStatusConvertor.convertForPlatform(this.deviceStatus, Objects.isNull(this.spare) ? 0 : this.spare, builder);
|
DeviceStatusConvertor.convertForPlatform(this.deviceStatus, Objects.isNull(this.spare) ? 0 : this.spare, builder);
|
||||||
DeviceStatusConvertor.convertForSwitch(Objects.isNull(this.spare) ? 0 : this.spare, builder);
|
DeviceStatusConvertor.convertForSwitch(Objects.isNull(this.spare) ? 0 : this.spare, builder);
|
||||||
log.info("接受设备状态设备类型[{}] 对应状态[{}]", this.type.name(), builder);
|
// log.info("接受设备状态设备类型[{}] 对应状态[{}]", this.type.name(), builder);
|
||||||
return List.of(builder);
|
return List.of(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.xiannccda.ats.warn.atp;
|
package club.joylink.xiannccda.ats.warn.train;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||||
import club.joylink.xiannccda.alert.core.AlertDeviceStatusRepository;
|
import club.joylink.xiannccda.alert.core.AlertDeviceStatusRepository;
|
||||||
@ -19,9 +19,11 @@ 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;
|
||||||
import club.joylink.xiannccda.service.AlertInfoService;
|
import club.joylink.xiannccda.service.AlertInfoService;
|
||||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||||
|
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||||
import com.google.protobuf.MessageOrBuilder;
|
import com.google.protobuf.MessageOrBuilder;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -62,6 +64,35 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static String TRAIN_INTEGRITY_NAME = "TRAIN_INTEGRITY";
|
||||||
|
|
||||||
|
public void trainIntegrityAlarm(TrainInfo.Builder trainInfo) {
|
||||||
|
if (trainInfo.getMode().getIpModeTrainIntegrityAlarm()) {
|
||||||
|
if (alertDataSource.putAlterDevice(trainInfo.getLineId(), TRAIN_INTEGRITY_NAME, trainInfo.getGroupId())) {
|
||||||
|
|
||||||
|
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCodeNotException(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
|
// CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(mb, "common", CommonInfo.class);
|
||||||
|
String layoutDeviceId = null;
|
||||||
|
if (mb instanceof LogicSection) {
|
||||||
|
String axleCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), axleCode, Section.class);
|
||||||
|
layoutDeviceId = String.valueOf(section.getCommon().getId());
|
||||||
|
} else if (mb instanceof Turnout) {
|
||||||
|
String turnoutCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(trainInfo.getLineId(), trainInfo.getDevName());
|
||||||
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), turnoutCode, Section.class);
|
||||||
|
layoutDeviceId = String.valueOf(section.getCommon().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
String alertMsg = String.format("列车[%s] 丢失完整性所在区段[%s]", trainInfo.getGroupId(), trainInfo.getDevName());
|
||||||
|
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.TRAIN_INTEGRITY_ALARM, trainInfo, alertMsg, layoutDeviceId,
|
||||||
|
AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||||
|
alertManager.emit(alertInfo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alertDataSource.removeAlterDevice(trainInfo.getLineId(), TRAIN_INTEGRITY_NAME, trainInfo.getGroupId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断紧致后发生atp切除并恢复
|
* 判断紧致后发生atp切除并恢复
|
||||||
* <p>
|
* <p>
|
||||||
@ -116,13 +147,6 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
|||||||
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), turnoutCode, Section.class);
|
Section section = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), turnoutCode, Section.class);
|
||||||
layoutDeviceId = section.getCommon().getId();
|
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());
|
@ -1,8 +1,8 @@
|
|||||||
package club.joylink.xiannccda.ats.warn.atp;
|
package club.joylink.xiannccda.ats.warn.train;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||||
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.atp.TrainModeAlertListener.TrainAlertEvent;
|
import club.joylink.xiannccda.ats.warn.train.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;
|
||||||
@ -20,7 +20,6 @@ public class TrainModeAlertListener implements AlertSourceEventListener<TrainAle
|
|||||||
private final TrainAtpCutAlertMonitoringTask atpCutAlertMonitoringTask;
|
private final TrainAtpCutAlertMonitoringTask atpCutAlertMonitoringTask;
|
||||||
|
|
||||||
public TrainModeAlertListener(TrainAtpCutAlertMonitoringTask atpCutAlertMonitoringTask) {
|
public TrainModeAlertListener(TrainAtpCutAlertMonitoringTask atpCutAlertMonitoringTask) {
|
||||||
|
|
||||||
this.atpCutAlertMonitoringTask = atpCutAlertMonitoringTask;
|
this.atpCutAlertMonitoringTask = atpCutAlertMonitoringTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +28,8 @@ public class TrainModeAlertListener implements AlertSourceEventListener<TrainAle
|
|||||||
GeneratedMessageV3.Builder trainMsgBuild = event.getSource();
|
GeneratedMessageV3.Builder trainMsgBuild = event.getSource();
|
||||||
if (trainMsgBuild instanceof TrainInfo.Builder trainInfo) {
|
if (trainMsgBuild instanceof TrainInfo.Builder trainInfo) {
|
||||||
TrainMode trainMode = trainInfo.getMode();
|
TrainMode trainMode = trainInfo.getMode();
|
||||||
|
//列车不完整直接报警
|
||||||
|
this.atpCutAlertMonitoringTask.trainIntegrityAlarm(trainInfo);
|
||||||
if (trainMode.getIpModeTrainEbAlarm()) {
|
if (trainMode.getIpModeTrainEbAlarm()) {
|
||||||
//列车紧急制动
|
//列车紧急制动
|
||||||
log.info("列车紧制ATP检测 线路[{}] 列车车组号[{}] 所在设备[{}] 是否ATP切除[{}] 是否紧制[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName(),
|
log.info("列车紧制ATP检测 线路[{}] 列车车组号[{}] 所在设备[{}] 是否ATP切除[{}] 是否紧制[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName(),
|
@ -10,6 +10,8 @@ import lombok.Data;
|
|||||||
public class EventLogPageDTO {
|
public class EventLogPageDTO {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@Schema(description = "线路id")
|
||||||
|
private Integer lineId;
|
||||||
@Schema(description = "接口名称")
|
@Schema(description = "接口名称")
|
||||||
private String faceName;
|
private String faceName;
|
||||||
@Schema(description = "接口请求大类")
|
@Schema(description = "接口请求大类")
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package club.joylink.xiannccda.dto.mock.show;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SwitchJammedMockDTO extends NewAlertMockDTO {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer deviceStatus(AlertMockStatus status) {
|
||||||
|
switch (status) {
|
||||||
|
case NORMAL -> {
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
case ALERT -> {
|
||||||
|
return 261;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -391,6 +391,46 @@ public final class AlertConstProto {
|
|||||||
* <code>SWITCH_JAMMED = 25;</code>
|
* <code>SWITCH_JAMMED = 25;</code>
|
||||||
*/
|
*/
|
||||||
SWITCH_JAMMED(25),
|
SWITCH_JAMMED(25),
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*zc联锁故障
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>INTERLOCKED_ZC_FAULT = 26;</code>
|
||||||
|
*/
|
||||||
|
INTERLOCKED_ZC_FAULT(26),
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车定位丢失
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_LOST_LOCATION = 27;</code>
|
||||||
|
*/
|
||||||
|
TRAIN_LOST_LOCATION(27),
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车完整性
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_INTEGRITY_ALARM = 28;</code>
|
||||||
|
*/
|
||||||
|
TRAIN_INTEGRITY_ALARM(28),
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车故障救援
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_FAULT_HELP = 29;</code>
|
||||||
|
*/
|
||||||
|
TRAIN_FAULT_HELP(29),
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*ats卡滞
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>INTERLOCKED_ATS_STUCK = 30;</code>
|
||||||
|
*/
|
||||||
|
INTERLOCKED_ATS_STUCK(30),
|
||||||
UNRECOGNIZED(-1),
|
UNRECOGNIZED(-1),
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -582,6 +622,46 @@ public final class AlertConstProto {
|
|||||||
* <code>SWITCH_JAMMED = 25;</code>
|
* <code>SWITCH_JAMMED = 25;</code>
|
||||||
*/
|
*/
|
||||||
public static final int SWITCH_JAMMED_VALUE = 25;
|
public static final int SWITCH_JAMMED_VALUE = 25;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*zc联锁故障
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>INTERLOCKED_ZC_FAULT = 26;</code>
|
||||||
|
*/
|
||||||
|
public static final int INTERLOCKED_ZC_FAULT_VALUE = 26;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车定位丢失
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_LOST_LOCATION = 27;</code>
|
||||||
|
*/
|
||||||
|
public static final int TRAIN_LOST_LOCATION_VALUE = 27;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车完整性
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_INTEGRITY_ALARM = 28;</code>
|
||||||
|
*/
|
||||||
|
public static final int TRAIN_INTEGRITY_ALARM_VALUE = 28;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*列车故障救援
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>TRAIN_FAULT_HELP = 29;</code>
|
||||||
|
*/
|
||||||
|
public static final int TRAIN_FAULT_HELP_VALUE = 29;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
*ats卡滞
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>INTERLOCKED_ATS_STUCK = 30;</code>
|
||||||
|
*/
|
||||||
|
public static final int INTERLOCKED_ATS_STUCK_VALUE = 30;
|
||||||
|
|
||||||
|
|
||||||
public final int getNumber() {
|
public final int getNumber() {
|
||||||
@ -632,6 +712,11 @@ public final class AlertConstProto {
|
|||||||
case 23: return INTERLOCK_LEVEL_ONE;
|
case 23: return INTERLOCK_LEVEL_ONE;
|
||||||
case 24: return PLATFORM_EMERG_STOP;
|
case 24: return PLATFORM_EMERG_STOP;
|
||||||
case 25: return SWITCH_JAMMED;
|
case 25: return SWITCH_JAMMED;
|
||||||
|
case 26: return INTERLOCKED_ZC_FAULT;
|
||||||
|
case 27: return TRAIN_LOST_LOCATION;
|
||||||
|
case 28: return TRAIN_INTEGRITY_ALARM;
|
||||||
|
case 29: return TRAIN_FAULT_HELP;
|
||||||
|
case 30: return INTERLOCKED_ATS_STUCK;
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,7 +960,7 @@ public final class AlertConstProto {
|
|||||||
"\n\020alertConst.proto\022\005alert*g\n\rAlertLocati" +
|
"\n\020alertConst.proto\022\005alert*g\n\rAlertLocati" +
|
||||||
"on\022\032\n\026ALERT_LOCATION_UNKNOWN\020\000\022\006\n\002QX\020\001\022\013" +
|
"on\022\032\n\026ALERT_LOCATION_UNKNOWN\020\000\022\006\n\002QX\020\001\022\013" +
|
||||||
"\n\007YHZ_LSQ\020\002\022\013\n\007HJM_LSQ\020\003\022\013\n\007BCT_LSQ\020\004\022\013\n" +
|
"\n\007YHZ_LSQ\020\002\022\013\n\007HJM_LSQ\020\003\022\013\n\007BCT_LSQ\020\004\022\013\n" +
|
||||||
"\007BSQ_LSQ\020\005*\327\004\n\tAlertType\022\026\n\022ALERT_TYPE_U" +
|
"\007BSQ_LSQ\020\005*\326\005\n\tAlertType\022\026\n\022ALERT_TYPE_U" +
|
||||||
"NKNOWN\020\000\022\020\n\014BLUE_DISPLAY\020\001\022\021\n\rTRAIN_DELA" +
|
"NKNOWN\020\000\022\020\n\014BLUE_DISPLAY\020\001\022\021\n\rTRAIN_DELA" +
|
||||||
"Y_2\020\002\022\022\n\016TRAIN_DELAY_10\020\003\022\'\n#PLATFORM_DO" +
|
"Y_2\020\002\022\022\n\016TRAIN_DELAY_10\020\003\022\'\n#PLATFORM_DO" +
|
||||||
"OR_WITHOUT_LOCKED_SIGNAL\020\004\022\035\n\031PLATFORM_D" +
|
"OR_WITHOUT_LOCKED_SIGNAL\020\004\022\035\n\031PLATFORM_D" +
|
||||||
@ -890,11 +975,15 @@ public final class AlertConstProto {
|
|||||||
"XLE_LED_ORANGE_INTERLOCK_AREA\020\025\022\036\n\032SWITC" +
|
"XLE_LED_ORANGE_INTERLOCK_AREA\020\025\022\036\n\032SWITC" +
|
||||||
"H_LOST_INTERLOCK_AREA\020\026\022\027\n\023INTERLOCK_LEV" +
|
"H_LOST_INTERLOCK_AREA\020\026\022\027\n\023INTERLOCK_LEV" +
|
||||||
"EL_ONE\020\027\022\027\n\023PLATFORM_EMERG_STOP\020\030\022\021\n\rSWI" +
|
"EL_ONE\020\027\022\027\n\023PLATFORM_EMERG_STOP\020\030\022\021\n\rSWI" +
|
||||||
"TCH_JAMMED\020\031*x\n\rTipTimeConfig\022\026\n\022HOLIDAY" +
|
"TCH_JAMMED\020\031\022\030\n\024INTERLOCKED_ZC_FAULT\020\032\022\027" +
|
||||||
"S_MORN_PEAK\020\000\022\031\n\025HOLIDAYS_EVENING_PEAK\020\001" +
|
"\n\023TRAIN_LOST_LOCATION\020\033\022\031\n\025TRAIN_INTEGRI" +
|
||||||
"\022\r\n\tMORN_PEAK\020\002\022\021\n\rEVENING_PEARK\020\003\022\022\n\016NO" +
|
"TY_ALARM\020\034\022\024\n\020TRAIN_FAULT_HELP\020\035\022\031\n\025INTE" +
|
||||||
"RMAL_UNPEARK\020\004B4\n!club.joylink.xiannccda" +
|
"RLOCKED_ATS_STUCK\020\036*x\n\rTipTimeConfig\022\026\n\022" +
|
||||||
".dto.protosB\017AlertConstProtob\006proto3"
|
"HOLIDAYS_MORN_PEAK\020\000\022\031\n\025HOLIDAYS_EVENING" +
|
||||||
|
"_PEAK\020\001\022\r\n\tMORN_PEAK\020\002\022\021\n\rEVENING_PEARK\020" +
|
||||||
|
"\003\022\022\n\016NORMAL_UNPEARK\020\004B4\n!club.joylink.xi" +
|
||||||
|
"annccda.dto.protosB\017AlertConstProtob\006pro" +
|
||||||
|
"to3"
|
||||||
};
|
};
|
||||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||||
.internalBuildGeneratedFileFrom(descriptorData,
|
.internalBuildGeneratedFileFrom(descriptorData,
|
||||||
|
@ -32,6 +32,8 @@ public class EventLog {
|
|||||||
private CommonLogTypeEnum eventType;
|
private CommonLogTypeEnum eventType;
|
||||||
private CommonLogTypeEnum.SubEventType subEventType;
|
private CommonLogTypeEnum.SubEventType subEventType;
|
||||||
private String faceName;
|
private String faceName;
|
||||||
|
private Integer lineId;
|
||||||
|
|
||||||
private String uri;
|
private String uri;
|
||||||
private String method;
|
private String method;
|
||||||
private String parameters;
|
private String parameters;
|
||||||
|
@ -189,6 +189,11 @@ public class MockOccServer {
|
|||||||
System.out.println(mb);
|
System.out.println(mb);
|
||||||
Integer stationId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
|
Integer stationId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
|
||||||
return this.findRtuStation(lineId, stationId);
|
return this.findRtuStation(lineId, stationId);
|
||||||
|
} else if (alertType == AlertType.SWITCH_JAMMED) {
|
||||||
|
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineId, deviceName);
|
||||||
|
System.out.println(mb);
|
||||||
|
Integer stationId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
|
||||||
|
return this.findRtuStation(lineId, stationId);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import club.joylink.xiannccda.constants.SystemContext;
|
|||||||
import club.joylink.xiannccda.dto.mock.show.BlueAlertMockDTO;
|
import club.joylink.xiannccda.dto.mock.show.BlueAlertMockDTO;
|
||||||
import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO.DeviceNameInfo;
|
import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO.DeviceNameInfo;
|
||||||
import club.joylink.xiannccda.dto.mock.show.PlatformEBDTO;
|
import club.joylink.xiannccda.dto.mock.show.PlatformEBDTO;
|
||||||
|
import club.joylink.xiannccda.dto.mock.show.SwitchJammedMockDTO;
|
||||||
import club.joylink.xiannccda.dto.mock.test.AlertMockDTO;
|
import club.joylink.xiannccda.dto.mock.test.AlertMockDTO;
|
||||||
import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO;
|
import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO;
|
||||||
import club.joylink.xiannccda.dto.mock.show.OrangeAlertMockDTO;
|
import club.joylink.xiannccda.dto.mock.show.OrangeAlertMockDTO;
|
||||||
@ -148,6 +149,9 @@ public class AlertMockService {
|
|||||||
case PLATFORM_EMERG_STOP -> {
|
case PLATFORM_EMERG_STOP -> {
|
||||||
return PlatformEBDTO.class;
|
return PlatformEBDTO.class;
|
||||||
}
|
}
|
||||||
|
case SWITCH_JAMMED -> {
|
||||||
|
return SwitchJammedMockDTO.class;
|
||||||
|
}
|
||||||
default -> throw new IllegalStateException("Unexpected value: " + alertType);
|
default -> throw new IllegalStateException("Unexpected value: " + alertType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
package club.joylink.xiannccda.ws.msg;
|
package club.joylink.xiannccda.ws.msg;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.OccTcpClientConnection;
|
import club.joylink.xiannccda.ats.message.OccTcpClientConnection;
|
||||||
|
import club.joylink.xiannccda.constants.common.CommonLogTypeEnum;
|
||||||
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto;
|
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto;
|
||||||
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto.WarnMessage;
|
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto.WarnMessage;
|
||||||
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto.WarnMessage.Builder;
|
import club.joylink.xiannccda.dto.protos.SystemWarnMsgProto.WarnMessage.Builder;
|
||||||
|
import club.joylink.xiannccda.entity.EventLog;
|
||||||
|
import club.joylink.xiannccda.repository.IEventLogRepository;
|
||||||
import club.joylink.xiannccda.ws.msg.SystemWarnEvent.SystemWarnConnStateEvent;
|
import club.joylink.xiannccda.ws.msg.SystemWarnEvent.SystemWarnConnStateEvent;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -15,6 +21,9 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class SystemWarnListener implements ApplicationListener<SystemWarnEvent> {
|
public class SystemWarnListener implements ApplicationListener<SystemWarnEvent> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IEventLogRepository eventLogRepository;
|
||||||
|
|
||||||
private final static Map<Integer, Builder> SYSTEM_MSG_MAP = new ConcurrentHashMap<>();
|
private final static Map<Integer, Builder> SYSTEM_MSG_MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -25,9 +34,32 @@ public class SystemWarnListener implements ApplicationListener<SystemWarnEvent>
|
|||||||
builder.setLineId(k);
|
builder.setLineId(k);
|
||||||
return builder;
|
return builder;
|
||||||
});
|
});
|
||||||
|
List<EventLog> events = new ArrayList<>();
|
||||||
|
if (!build.getOccRealConned()) {
|
||||||
|
events.add(this.createLogObj(lineId, true));
|
||||||
|
}
|
||||||
|
if (!build.getOccUnrealConned()) {
|
||||||
|
events.add(this.createLogObj(lineId, false));
|
||||||
|
}
|
||||||
|
this.eventLogRepository.saveBatch(events);
|
||||||
this.connedHandle(event, build);
|
this.connedHandle(event, build);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private EventLog createLogObj(Integer lineId, boolean real) {
|
||||||
|
EventLog eventLog = new EventLog();
|
||||||
|
eventLog.setLineId(lineId);
|
||||||
|
eventLog.setEventType(CommonLogTypeEnum.WARN);
|
||||||
|
eventLog.setFaceName("实时接口");
|
||||||
|
eventLog.setCreateDateTime(LocalDateTime.now());
|
||||||
|
eventLog.setMethod("tcp");
|
||||||
|
if (!real) {
|
||||||
|
eventLog.setFaceName("非实时接口");
|
||||||
|
}
|
||||||
|
eventLog.setRequestSuccess(0);
|
||||||
|
return eventLog;
|
||||||
|
}
|
||||||
|
|
||||||
private void connedHandle(SystemWarnEvent event, SystemWarnMsgProto.WarnMessage.Builder build) {
|
private void connedHandle(SystemWarnEvent event, SystemWarnMsgProto.WarnMessage.Builder build) {
|
||||||
if (event instanceof SystemWarnConnStateEvent) {
|
if (event instanceof SystemWarnConnStateEvent) {
|
||||||
OccTcpClientConnection clientConnection = (OccTcpClientConnection) event.getSource();
|
OccTcpClientConnection clientConnection = (OccTcpClientConnection) event.getSource();
|
||||||
|
@ -32,11 +32,11 @@ occ-client:
|
|||||||
- OCC
|
- OCC
|
||||||
- NCC
|
- NCC
|
||||||
4:
|
4:
|
||||||
nameChanger: NONE
|
nameChanger: LINE_4
|
||||||
server-host: 10.254.12.45
|
server-host: 127.0.0.1
|
||||||
real-port: 3604
|
real-port: 2603
|
||||||
un-real-port: 3704
|
un-real-port: 3704
|
||||||
collector-data: true
|
collector-data: false
|
||||||
monitor-handware-change: false
|
monitor-handware-change: false
|
||||||
receiveMsgTimeout: 6
|
receiveMsgTimeout: 6
|
||||||
filterRtuIds:
|
filterRtuIds:
|
||||||
|
@ -32,7 +32,7 @@ occ-client:
|
|||||||
- OCC
|
- OCC
|
||||||
- NCC
|
- NCC
|
||||||
4:
|
4:
|
||||||
nameChanger: NONE
|
nameChanger: LINE_4
|
||||||
server-host: 10.254.12.45
|
server-host: 10.254.12.45
|
||||||
real-port: 3604
|
real-port: 3604
|
||||||
un-real-port: 3704
|
un-real-port: 3704
|
||||||
|
@ -39,7 +39,7 @@ occ-client:
|
|||||||
- OCC
|
- OCC
|
||||||
- NCC
|
- NCC
|
||||||
4:
|
4:
|
||||||
nameChanger: NONE
|
nameChanger: LINE_4
|
||||||
server-host: 10.254.12.45
|
server-host: 10.254.12.45
|
||||||
real-port: 3604
|
real-port: 3604
|
||||||
un-real-port: 3704
|
un-real-port: 3704
|
||||||
|
@ -33,7 +33,7 @@ occ-client:
|
|||||||
- OCC
|
- OCC
|
||||||
- NCC
|
- NCC
|
||||||
4:
|
4:
|
||||||
nameChanger: NONE
|
nameChanger: LINE_4
|
||||||
server-host: 10.254.12.45
|
server-host: 10.254.12.45
|
||||||
real-port: 3604
|
real-port: 3604
|
||||||
un-real-port: 3704
|
un-real-port: 3704
|
||||||
|
@ -6,16 +6,15 @@ import club.joylink.xiannccda.constants.common.LineTypeEnum;
|
|||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class LineConfigGenerateUtil {
|
public class LineRoleConfigGenerateUtil {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void genJson4() {
|
public void genJson4() {
|
||||||
LineConfig lc = new LineConfig();
|
LineConfig lc = new LineConfig();
|
||||||
WarnConfig nccWc = new WarnConfig(LineTypeEnum.NCC, List.of(AlertType.INTERLOCK_LEVEL_ONE));
|
WarnConfig nccWc = new WarnConfig(LineTypeEnum.NCC, List.of(AlertType.INTERLOCK_LEVEL_ONE, AlertType.TRAIN_INTEGRITY_ALARM));
|
||||||
WarnConfig occWc = new WarnConfig(LineTypeEnum.OCC, List.of(AlertType.INTERLOCK_LEVEL_ONE));
|
WarnConfig occWc = new WarnConfig(LineTypeEnum.OCC, List.of(AlertType.INTERLOCK_LEVEL_ONE, AlertType.TRAIN_INTEGRITY_ALARM));
|
||||||
lc.setWarnConfig(List.of(nccWc, occWc));
|
lc.setWarnConfig(List.of(nccWc, occWc));
|
||||||
String json = JSON.toJSONString(lc);
|
String json = JSON.toJSONString(lc);
|
||||||
|
|
||||||
@ -28,8 +27,8 @@ public class LineConfigGenerateUtil {
|
|||||||
@Test
|
@Test
|
||||||
public void genJson3() {
|
public void genJson3() {
|
||||||
LineConfig lc = new LineConfig();
|
LineConfig lc = new LineConfig();
|
||||||
WarnConfig nccWc = new WarnConfig(LineTypeEnum.NCC, List.of(AlertType.SWITCH_JAMMED, AlertType.PLATFORM_EMERG_STOP));
|
WarnConfig nccWc = new WarnConfig(LineTypeEnum.NCC, List.of(AlertType.PLATFORM_EMERG_STOP));
|
||||||
WarnConfig occWc = new WarnConfig(LineTypeEnum.OCC, List.of(AlertType.SWITCH_JAMMED));
|
WarnConfig occWc = new WarnConfig(LineTypeEnum.OCC, List.of(AlertType.SWITCH_JAMMED, AlertType.TRAIN_INTEGRITY_ALARM));
|
||||||
lc.setWarnConfig(List.of(nccWc, occWc));
|
lc.setWarnConfig(List.of(nccWc, occWc));
|
||||||
String json = JSON.toJSONString(lc);
|
String json = JSON.toJSONString(lc);
|
||||||
|
|
@ -9,6 +9,7 @@ import club.joylink.xiannccda.ats.warn.bule.BuleDisplayMonitoringTask.RtuWarnVO;
|
|||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||||
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
@ -101,6 +102,17 @@ public class DeviceStatusCheckTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void switchJammed() {
|
||||||
|
for (int i = 0; i < 999999999; i++) {
|
||||||
|
Switch.Builder p1 = DeviceStatusConvertor.convert(DeviceStatus.SWITCH.class, i);
|
||||||
|
if (p1.getIpSingleSwitchStusJammed()) {
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void platformTest() {
|
public void platformTest() {
|
||||||
|
|
||||||
|
@ -2,25 +2,53 @@ package club.joylink.xiannccda.protocal.x;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Map;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
public class TestUtil {
|
public class TestUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将src通过charset编码后填充到to
|
* 将src通过charset编码后填充到to
|
||||||
*/
|
*/
|
||||||
public static void fill(final String src, final Charset charset, final byte[] to) {
|
public static void fill(final String src, final Charset charset, final byte[] to) {
|
||||||
final byte[] srcBuf = src.getBytes(charset);
|
final byte[] srcBuf = src.getBytes(charset);
|
||||||
if (to.length < srcBuf.length) throw new RuntimeException("to.length<srcBuf.length");
|
if (to.length < srcBuf.length) {
|
||||||
for (int i = 0; i < srcBuf.length; i++) {
|
throw new RuntimeException("to.length<srcBuf.length");
|
||||||
to[i] = srcBuf[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < srcBuf.length; i++) {
|
||||||
|
to[i] = srcBuf[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将src通过charset编码后填充到to
|
* 将src通过charset编码后填充到to
|
||||||
*/
|
*/
|
||||||
public static void fill(final String src, final byte[] to) {
|
public static void fill(final String src, final byte[] to) {
|
||||||
fill(src, MessageCons.STRING_CHARSET, to);
|
fill(src, MessageCons.STRING_CHARSET, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static void main(String[] args) {
|
||||||
|
byte[] b = new byte[]{80, 48, 48, 49, 49, 50, 0, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52};
|
||||||
|
byte[] b1 = new byte[]{80, 48, 49, 49, 50};
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < b.length; i++) {
|
||||||
|
byte bb = b[i];
|
||||||
|
if (i + 1 < b.length) {
|
||||||
|
if (bb == 0 && b[i + 1] == -52) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append((char) bb);
|
||||||
}
|
}
|
||||||
|
for (byte aByte : new String(b).getBytes("ISO-8859-1")) {
|
||||||
|
// for (byte aByte : new String(b).getBytes("utf-8")) {
|
||||||
|
System.out.println(aByte);
|
||||||
|
}
|
||||||
|
System.out.println(sb.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user