【大铁出入口判断进路开放逻辑修改】

This commit is contained in:
weizhihong 2023-02-02 14:05:24 +08:00
parent a3d245346f
commit 581def3bb3

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.cbtc.CI.device;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.simulation.cbtc.CI.data.StationDirection;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import lombok.extern.slf4j.Slf4j;
@ -7,6 +9,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
@ -178,11 +181,15 @@ public class CiService {
boolean isCanHandle = simulation.getRepository().getStationList().stream()
.filter(station -> station.getCode().equals(route.getStart().getStation().getCode())
|| station.getCode().equals(route.getDestination().getStation().getCode()))
.anyMatch(station ->
station.getStationDirectionMap().values().stream()
.anyMatch(station -> {
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = station.getStationDirectionMap();
if (CollectionUtils.isEmpty(stationDirectionMap)) {
return true;
}
return stationDirectionMap.values().stream()
.filter(stationDirection -> !CollectionUtils.isEmpty(stationDirection.getCurrentRouteList()))
.anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route))
);
.anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route));
});
if (!isCanHandle) {
return level;
}