【状态类型为枚举时,判断做处理】
This commit is contained in:
parent
48a28cb7c4
commit
1ab2452c70
@ -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() {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user