Merge branch 'test' into test-training2

This commit is contained in:
weizhihong 2022-08-29 18:15:02 +08:00
commit 9e42a4ce68
9 changed files with 142 additions and 8 deletions

View File

@ -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();

View File

@ -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<String> errorList = new ArrayList<>();
private String tripNum;
public void addErrorMsg(String msg){
this.errorList.add(msg);
}
}

View File

@ -575,6 +575,6 @@ public class CtcEffectRepository {
this.stationTrackSectionMap.clear();
this.doorRepository.clear();
this.regularTrainLineMap.clear();
updateReguarTrainLineMap.clear();
}
}

View File

@ -48,10 +48,12 @@ public class CtcManageRepository {
public void reset() {
this.trackSectionRepository.clear();
this.doorRepository.clear();
this.runPlanRepository.clear();
this.runPlanRepository.clear();
regularTrainLineMap.clear();
}
/**

View File

@ -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();
/**
* 到达方向编码到达口

View File

@ -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<String> setRoute(Simulation simulation, String routeCode, String tripNumber, Boolean force, Integer duration) {
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
Station station = route.getStart().getStation();

View File

@ -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<String> checkCascoControlRoute(CascoControl cc){
Station station = cc.getStation();
Simulation simulation = cc.getSimulation();
String stationCode = station.getCode();
CtcRepository ctcRepository = simulation.getCtcRepository();
CtcEffectRepository effectRepository = ctcRepository.getCtcEffectRepository();
Map<String, CtcStationRunPlanLog> runPlanLogMap = simulation.getCtcRepository().getSimulationRunPlanMap().get(stationCode);
Optional<CtcStationRunPlanLog> runPlanLogOptional = null;
if(Objects.nonNull(runPlanLogMap) && !runPlanLogMap.isEmpty()){
runPlanLogOptional = this.checkForRunPlan(cc);
}
// List<CtcStationRunPlanLog> 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<CtcStationRunPlanLog> checkForRunPlan(/*List<CtcStationRunPlanLog> 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<String,CtcStationRunPlanLog> 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)){
}
}
}

View File

@ -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());

View File

@ -305,7 +305,7 @@
relative_label_enum= #{relativeLabelEnum,jdbcType=VARCHAR},
</if>
<if test="record.ioDirection != null">
io_direction= #{record.ioDirection,jdbcType=VARCHAR},
io_direction= #{ioDirection,jdbcType=VARCHAR},
</if>
</set>
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}
</update>
</mapper>