diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java index 7953a35fe..cc0a83485 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/data/StationDirection.java @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger; @Setter @Getter @Slf4j -public class StationDirection extends MayOutOfOrderDevice { +public class StationDirection extends MayOutOfOrderDevice implements Cloneable { /** * 发辅助默认倒计时 25s */ @@ -270,7 +270,14 @@ public class StationDirection extends MayOutOfOrderDevice { this.deliverRouteList = new ArrayList<>(); this.routeSettingStatusMap = new HashMap<>(); } - + public StationDirection clone(){ + try { + return (StationDirection)super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + return null; + } @Override public void reset() { this.routeSettingStatusMap.clear(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CascoControl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CascoControl.java new file mode 100644 index 000000000..a9a3de98e --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CascoControl.java @@ -0,0 +1,24 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data; + +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.map.Route; +import club.joylink.rtss.simulation.cbtc.data.map.Station; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +public class CascoControl { + private Simulation simulation; + private Station station; + private Route route; + private List errorList = new ArrayList<>(); + private String tripNum; + + public void addErrorMsg(String msg){ + this.errorList.add(msg); + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java index 1117b5e47..1573177f6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java @@ -575,6 +575,6 @@ public class CtcEffectRepository { this.stationTrackSectionMap.clear(); this.doorRepository.clear(); this.regularTrainLineMap.clear(); - + updateReguarTrainLineMap.clear(); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java index 8c7a82a11..2046dd75f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java @@ -48,10 +48,12 @@ public class CtcManageRepository { public void reset() { + this.trackSectionRepository.clear(); this.doorRepository.clear(); this.runPlanRepository.clear(); - this.runPlanRepository.clear(); + regularTrainLineMap.clear(); + } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/param/CtcRunPlanParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/param/CtcRunPlanParam.java index 507da1472..13eaac5fa 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/param/CtcRunPlanParam.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/param/CtcRunPlanParam.java @@ -245,6 +245,8 @@ public class CtcRunPlanParam implements Cloneable { * private String arriveSectionCode; */ + this.arriveSectionCode = tl.getMasterStand().getCode(); + /** * 到达计划时间 @@ -269,7 +271,7 @@ public class CtcRunPlanParam implements Cloneable { * 到达车站 * private String arriveStationCode; */ - this.arriveStationCode = tl.getFontStation().getCode(); + this.arriveStationCode = tl.getStation().getCode(); /** * 到达方向编码(到达口) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CTCService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CTCService.java index a0adcac7e..7e3960c50 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CTCService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CTCService.java @@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.CTC.service; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CI.CiApiService; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; @@ -160,6 +161,16 @@ public class CTCService { line.setAutoTrigger(trigger); } + + /** + * + * @param simulation + * @param routeCode + * @param tripNumber + * @param force + * @param duration + * @return + */ public List setRoute(Simulation simulation, String routeCode, String tripNumber, Boolean force, Integer duration) { Route route = simulation.getRepository().getByCode(routeCode, Route.class); Station station = route.getStart().getStation(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CascoControlService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CascoControlService.java new file mode 100644 index 000000000..884116f61 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/CascoControlService.java @@ -0,0 +1,87 @@ +package club.joylink.rtss.simulation.cbtc.CTC.service; + +import club.joylink.rtss.simulation.cbtc.CTC.data.CascoControl; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.map.Station; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class CascoControlService { + + /** + * + * @param cc + * @return + */ + public List checkCascoControlRoute(CascoControl cc){ + Station station = cc.getStation(); + Simulation simulation = cc.getSimulation(); + String stationCode = station.getCode(); + CtcRepository ctcRepository = simulation.getCtcRepository(); + CtcEffectRepository effectRepository = ctcRepository.getCtcEffectRepository(); + Map runPlanLogMap = simulation.getCtcRepository().getSimulationRunPlanMap().get(stationCode); + Optional runPlanLogOptional = null; + if(Objects.nonNull(runPlanLogMap) && !runPlanLogMap.isEmpty()){ + runPlanLogOptional = this.checkForRunPlan(cc); + } +// List allRunPlanLogList = runPlanLogMap.values().stream().filter(d->d.getChangeType() == null && d.isSign()).collect(Collectors.toList()); + + CtcEffectRepository.StationDoorRepository doorRepository = effectRepository.getDoorRepository().get(stationCode); + if(Objects.nonNull(doorRepository)){ + if(runPlanLogOptional.isPresent()){ + + } + return cc.getErrorList(); + } + + + CtcEffectRepository.StationTrackSectionRepository stationTrackRepository = effectRepository.getStationTrackSectionMap().get(stationCode); + if(Objects.nonNull(stationTrackRepository)){ + + } + return null; + } + + private Optional checkForRunPlan(/*List allRunPlanLogList,*/CascoControl cc){ + CtcStationRunPlanLog runPlanLog = cc.getSimulation().getCtcRepository().getRunPlan(cc.getStation().getCode(),cc.getTripNum()); + if(Objects.isNull(runPlanLog)){ + cc.addErrorMsg(String.format("未在计划中找到对应的车次[%s]",cc.getTripNum())); + } + if(!Objects.isNull(runPlanLog.getChangeType()) && !runPlanLog.isSign()){ + cc.addErrorMsg(String.format("未在计划中找到对应的车次[%s]",cc.getTripNum())); + } + return Optional.of(runPlanLog); + /*Map tripNumMap = allRunPlanLogList.stream().collect(Collectors.toMap(CtcStationRunPlanLog::getTripNumber, Function.identity(),(v1,v2)->v1)); + CtcStationRunPlanLog runPlanLog = tripNumMap.get(cc.getTripNum()); + if(Objects.isNull(runPlanLog)){ + cc.addErrorMsg(String.format("未在计划中找到对应的车次[%s]",cc.getTripNum())); + }*/ + } + private void checkCascoForStationTrack(CtcEffectRepository.StationTrackSectionRepository stationTrackRepository){ + + } + + private void checkCascoForDoor(CtcEffectRepository.StationDoorRepository doorRepository,CtcStationRunPlanLog runPlanLog){ + CtcStationRunPlanLog.RunPlanItem departPlan = runPlanLog.getDepartRunPlan(); + CtcStationRunPlanLog.RunPlanItem arrivePlan = runPlanLog.getArriveRunPlan(); + if(Objects.nonNull(departPlan)){ + + } + if(Objects.nonNull(arrivePlan)){ + + } + } + +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java index f9ae4b71e..eb34db8eb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java @@ -366,7 +366,8 @@ public class SimulationBuilder { // ioGate.setCode(sd.getCode()); // ioGate.setIoName(sd.getName()); // ioGate.setDirection(sd.getLabelEnum()); - doorRep.save(sd); + + doorRep.save(sd.clone()); } for (Stand stand : station.getAllStandList()) { TrackSection ts = new TrackSection(stand.getSection()); diff --git a/src/main/resources/mybatis/mapper/DraftMapStationDirectionDAO.xml b/src/main/resources/mybatis/mapper/DraftMapStationDirectionDAO.xml index 4f3d22bf5..14f14e97e 100644 --- a/src/main/resources/mybatis/mapper/DraftMapStationDirectionDAO.xml +++ b/src/main/resources/mybatis/mapper/DraftMapStationDirectionDAO.xml @@ -305,7 +305,7 @@ relative_label_enum= #{relativeLabelEnum,jdbcType=VARCHAR}, - io_direction= #{record.ioDirection,jdbcType=VARCHAR}, + io_direction= #{ioDirection,jdbcType=VARCHAR}, where id = #{id,jdbcType=BIGINT} @@ -325,7 +325,7 @@ run_status = #{runStatus,jdbcType=VARCHAR}, relative_station_code= #{relativeStationCode,jdbcType=VARCHAR}, relative_label_enum= #{relativeLabelEnum,jdbcType=VARCHAR}, - io_direction= #{record.ioDirection,jdbcType=VARCHAR}, + io_direction= #{ioDirection,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}