【对车次号的上下行字符进行数字校验】

This commit is contained in:
weizhihong 2023-08-02 10:31:32 +08:00
parent 66e4b67375
commit ebf9c8e1a3
2 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import java.util.Optional;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
/** 线网的列车数据,一些公共方法 */
@Slf4j
@ -93,7 +94,10 @@ public abstract class LineNetTrainComMethod {
}
// 如果目的码都没有确定方向则使用车次确定方向
if (direction == null && StringUtils.isNoneEmpty(globalId)) {
direction = TrainRunDirection.match(Integer.parseInt(globalId.substring(0, 1)));
String dirStr = globalId.substring(0, 1);
if (NumberUtils.isCreatable(dirStr)) {
direction = TrainRunDirection.match(Integer.parseInt(dirStr));
}
}
if (direction != null) {
obj.setDir(direction.getDir());

@ -1 +1 @@
Subproject commit ec5889fd030d15bc93efdaf8f73d62039bde31a9
Subproject commit c9a07e75f06e8247d33f9e08c52d5045f1db2bc2