消除报错

This commit is contained in:
joylink_zhangsai 2022-06-02 13:49:39 +08:00
parent 22a85e3293
commit c2239a1a68
2 changed files with 5 additions and 18 deletions

View File

@ -2,13 +2,8 @@ package club.joylink.rtss.simulation.cbtc.CTC.data;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import lombok.Getter; import lombok.Getter;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@Getter @Getter
public class CtcRepository { public class CtcRepository {
@ -50,13 +45,10 @@ public class CtcRepository {
} }
public CtcStationRunPlanLog getRunPlan(String stationCode, String tripNumber) { public CtcStationRunPlanLog getRunPlan(String stationCode, String tripNumber) {
List<CtcStationRunPlanLog> plans = this.getCtcStationRunPlanLogMap().get(stationCode); CtcStationRunPlanLog plan = ctcStationRunPlanLogList.stream()
CtcStationRunPlanLog plan = null; .filter(p -> Objects.equals(p.getStation().getCode(), stationCode) && Objects.equals(p.getTripNumber(), tripNumber))
if (!CollectionUtils.isEmpty(plans)) {
plan = plans.stream().filter(runPlan -> Objects.equals(runPlan.getTripNumber(), tripNumber))
.limit(1).findAny().orElse(null); .limit(1).findAny().orElse(null);
} BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(plan);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(plan, String.format("车站[%s]的车次[%s]计划不存在", stationCode, tripNumber));
return plan; return plan;
} }

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.vo.client.factory; package club.joylink.rtss.vo.client.factory;
import club.joylink.rtss.constants.BusinessConsts.WebSocketSubscribeTopic; import club.joylink.rtss.constants.BusinessConsts.WebSocketSubscribeTopic;
import club.joylink.rtss.simulation.cbtc.CTC.data.BusyBoard;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition; import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition;
@ -392,10 +391,6 @@ public class SocketMessageFactory {
return build(WebSocketMessageType.Simulation_Trip_Plan_Change, simulationId, eChartsDataVO); return build(WebSocketMessageType.Simulation_Trip_Plan_Change, simulationId, eChartsDataVO);
} }
public static SocketMessageVO<List<BusyBoard>> buildRailCtcMessage(String simulationId, List<BusyBoard> list) {
return build(WebSocketMessageType.Simulation_RailCtcStatus, simulationId, list);
}
/** /**
* CTC 列车运行计划初始化消息 * CTC 列车运行计划初始化消息
*/ */