From 1ab2452c707f4508232b311342387c00379da020 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 15 Sep 2022 10:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=8A=B6=E6=80=81=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E6=9E=9A=E4=B8=BE=E6=97=B6=EF=BC=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=81=9A=E5=A4=84=E7=90=86=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java | 8 +++++++- .../rtss/simulation/cbtc/training2/StatusValue.java | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java index f64193c90..570f698f9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java @@ -412,7 +412,7 @@ public class TrainInfo extends MapElement { this.runLevel = config.getRunMode(); } - public void tracking(VirtualRealityTrain train) { + public TrainInfo tracking(VirtualRealityTrain train) { this.runLevel = train.getRunLevel(); SectionPosition headPosition = train.getHeadPosition(); this.physicalSection = headPosition.getSection().getCode(); @@ -450,6 +450,12 @@ public class TrainInfo extends MapElement { } this.preselectionMode = train.getPreselectionMode(); this.beAbout2Arrival = train.isBeAbout2Arrive(); + return this; + } + + public static TrainInfo virtualTrainTracking(VirtualRealityTrain train) { + TrainInfo trainInfo = new TrainInfo(train.getGroupNumber()); + return trainInfo.tracking(train); } public boolean isCtcLevel() { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/StatusValue.java b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/StatusValue.java index 24368dad9..347ceb22f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/training2/StatusValue.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/training2/StatusValue.java @@ -43,14 +43,14 @@ public class StatusValue implements Valuable { try { MapElement mapElement; if (element instanceof VirtualRealityTrain) { - VirtualRealityTrain virtualRealityTrain = (VirtualRealityTrain) element; - TrainInfo trainInfo = new TrainInfo(virtualRealityTrain.getGroupNumber()); - trainInfo.tracking(virtualRealityTrain); - mapElement = trainInfo; + mapElement = TrainInfo.virtualTrainTracking((VirtualRealityTrain) element); } else { mapElement = element; } Object o = field.get(mapElement); + if (o.getClass().isEnum()) { // 枚举类型转为字符串 + o = o.toString(); + } return (T) o; } catch (Exception e) { throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(e);