调整设备名称转换的问题

This commit is contained in:
tiger_zhou 2023-09-22 16:56:39 +08:00
parent 660dee541b
commit 244a926fca
2 changed files with 11 additions and 4 deletions

View File

@ -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<String, Builder> allTrainInfoMaper = Maps.newConcurrentMap();
private Map<String, TrainInfo.Builder> allTrainInfoMaper = Maps.newConcurrentMap();
/**
* 增量的设备更新信息
@ -80,6 +86,7 @@ public class TrainDataSource extends AbstractData {
}
}
/**
* 设置列车坐在设备的映射
*

View File

@ -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);