From 244a926fca86df2da694584312047dffc72c2bcf Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Fri, 22 Sep 2023 16:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=BE=E5=A4=87=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E8=BD=AC=E6=8D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/collect/datasource/TrainDataSource.java | 11 +++++++++-- .../ats/message/line3/changer/TrackChanger.java | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java index c28c229..a41a5a0 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/collect/datasource/TrainDataSource.java @@ -3,7 +3,6 @@ package club.joylink.xiannccda.ats.message.collect.datasource; import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate; import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo; import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo.Builder; -import club.joylink.xiannccda.mock.message.Status.Train; import com.google.common.collect.BiMap; import com.google.common.collect.HashBasedTable; import com.google.common.collect.HashBiMap; @@ -14,12 +13,19 @@ import com.google.protobuf.Descriptors.FieldDescriptor; import com.google.protobuf.GeneratedMessageV3; import com.google.protobuf.Message; import com.google.protobuf.MessageOrBuilder; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.TreeMap; +import java.util.TreeSet; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @Slf4j @@ -28,7 +34,7 @@ public class TrainDataSource extends AbstractData { /** * 所有设备状态信息 <列车类型 【这里用的message的类名:TrainInfo等】,<车组号,列车信息>> */ - private Map allTrainInfoMaper = Maps.newConcurrentMap(); + private Map allTrainInfoMaper = Maps.newConcurrentMap(); /** * 增量的设备更新信息 @@ -80,6 +86,7 @@ public class TrainDataSource extends AbstractData { } } + /** * 设置列车坐在设备的映射 * diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/changer/TrackChanger.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/changer/TrackChanger.java index fa8d4f0..d282ad1 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/changer/TrackChanger.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/changer/TrackChanger.java @@ -19,7 +19,7 @@ public class TrackChanger { @Override public String changeDeviceName(String sourceName) { - Pattern regex = Pattern.compile("^([A-Za-z]{1,2})([\\d]{1,2})3(.*?)([A-Z])$"); + Pattern regex = Pattern.compile("^([A-Za-z]{1,2})([\\d]{2})3(.*?)([A-Z])$"); // Pattern regex = Pattern.compile("^([A-Za-z]{1,2})([\\d]{2})3(.*?)([A-Z])$"); Matcher matcher = regex.matcher(sourceName); if (matcher.find()) { @@ -49,7 +49,7 @@ public class TrackChanger { @Override public String changeDeviceName(String sourceName) { - Pattern regex = Pattern.compile("^[A-Za-z]{1,2}([\\d]{1,2})3(.*?)$"); + Pattern regex = Pattern.compile("^[A-Za-z]{1,2}([\\d]{2})3(.*?)$"); Matcher matcher = regex.matcher(sourceName); if (matcher.find()) { String head = matcher.group(1);