From 581def3bb3095f6970ff60b345aa9612268f2f58 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 2 Feb 2023 14:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A4=A7=E9=93=81=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E5=88=A4=E6=96=AD=E8=BF=9B=E8=B7=AF=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/CI/device/CiService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiService.java index e9af22e76..cfe5dd7b1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiService.java @@ -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() - .filter(stationDirection -> !CollectionUtils.isEmpty(stationDirection.getCurrentRouteList())) - .anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route)) - ); + .anyMatch(station -> { + Map 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)); + }); if (!isCanHandle) { return level; }