Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2021-03-09 17:25:16 +08:00
commit cf6cc759e9
4 changed files with 55 additions and 49 deletions

View File

@ -118,6 +118,7 @@ public class RunPlanGenerator1 {
int initTripNumber = isRight ? 0 : 1; int initTripNumber = isRight ? 0 : 1;
LocalTime lastTripEndTime;//一个车次终点时间 LocalTime lastTripEndTime;//一个车次终点时间
LinkedList<RunPlanTripVO> tempTripList = new LinkedList<>(); LinkedList<RunPlanTripVO> tempTripList = new LinkedList<>();
String endStation = null;
//根据运行时间判断结束末班车次 //根据运行时间判断结束末班车次
do { do {
RunPlanRoutingVO routing = Objects.equals(running1Routing.getRight(), isRight) ? running1Routing : running2Routing; RunPlanRoutingVO routing = Objects.equals(running1Routing.getRight(), isRight) ? running1Routing : running2Routing;
@ -133,7 +134,6 @@ public class RunPlanGenerator1 {
int size = routing.getParkSectionCodeList().size(); int size = routing.getParkSectionCodeList().size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i); RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO(); RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
runPlanTripTimeVO.setStationCode(routingSection.getStationCode()); runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode()); runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
@ -144,6 +144,7 @@ public class RunPlanGenerator1 {
if (!startTBIsFront(routing, mapVO)) { if (!startTBIsFront(routing, mapVO)) {
continue; continue;
} }
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
runPlanTripTimeVO.setArrivalTime( runPlanTripTimeVO.setArrivalTime(
tempTripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2)); tempTripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode()))); runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
@ -152,14 +153,15 @@ public class RunPlanGenerator1 {
if (Objects.nonNull(endTBIsFront) && !endTBIsFront) { if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
continue; continue;
} }
runPlanTripTimeVO.setArrivalTime( runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList)?tripList.getLast().getEndTime().plusSeconds(45)
tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode()))); : tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront) runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront)
? runPlanTripTimeVO.getArrivalTime() ? runPlanTripTimeVO.getArrivalTime()
: runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode()))); : runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
} else { } else {
Boolean startTBIsFront = startTBIsFront(routing, mapVO); Boolean startTBIsFront = startTBIsFront(routing, mapVO);
if (i == 1 && Objects.nonNull(startTBIsFront) && !startTBIsFront) { if (i == 1 && Objects.nonNull(startTBIsFront) && !startTBIsFront) {
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get( routing.getStartStationCode());
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tempTripList)?serviceTempResult.getPreServiceDepartTime():tempTripList.getLast().getEndTime().plusSeconds(reentryTime.getTbBack() - reentryTime.getTbFrom())); runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tempTripList)?serviceTempResult.getPreServiceDepartTime():tempTripList.getLast().getEndTime().plusSeconds(reentryTime.getTbBack() - reentryTime.getTbFrom()));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime()); runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
}else{ }else{
@ -170,7 +172,7 @@ public class RunPlanGenerator1 {
tripTimeList.add(runPlanTripTimeVO); tripTimeList.add(runPlanTripTimeVO);
} }
runPlanTripVO.setTimeList(tripTimeList); runPlanTripVO.setTimeList(tripTimeList);
setTripTerminalTime(runPlanTripVO, tripTimeList,reentryData); setTripTerminalTime(runPlanTripVO, routing,tripTimeList,reentryData);
lastTripEndTime = runPlanTripVO.getEndTime(); lastTripEndTime = runPlanTripVO.getEndTime();
if(CollectionUtils.isEmpty(tempTripList)){ if(CollectionUtils.isEmpty(tempTripList)){
runPlanTripVO.setIsOutbound(true); runPlanTripVO.setIsOutbound(true);
@ -180,14 +182,14 @@ public class RunPlanGenerator1 {
break; break;
} }
isRight = !isRight; isRight = !isRight;
endStation = routing.getEndStationCode();
} while (lastTripEndTime.isBefore(runPlanInput.getOverTime())); } while (lastTripEndTime.isBefore(runPlanInput.getOverTime()));
//设置服务号末班车次入库 //设置服务号末班车次入库
RunPlanTripVO lastrunPlanTrip = tempTripList.getLast(); RunPlanTripVO lastrunPlanTrip = tempTripList.getLast();
lastrunPlanTrip.setIsInbound(true); lastrunPlanTrip.setIsInbound(true);
lastrunPlanTrip.setIsReentry(false); lastrunPlanTrip.setIsReentry(false);
LinkedList<RunPlanTripTimeVO> tripTimeList = (LinkedList) lastrunPlanTrip.getTimeList(); LinkedList<RunPlanTripTimeVO> tripTimeList = (LinkedList) lastrunPlanTrip.getTimeList();
setTripEndTime(lastrunPlanTrip, tripTimeList, reentryData); setTripEndTime(lastrunPlanTrip, endStation, tripTimeList, reentryData);
tripList.addAll(tempTripList); tripList.addAll(tempTripList);
if (Objects.isNull(serviceTempResult.getFirstRoundTripTime())) { if (Objects.isNull(serviceTempResult.getFirstRoundTripTime())) {
serviceTempResult.setFirstRoundTripTime(tempTripList.get(0).getEndTime()); serviceTempResult.setFirstRoundTripTime(tempTripList.get(0).getEndTime());
@ -475,7 +477,6 @@ public class RunPlanGenerator1 {
int size = routing.getParkSectionCodeList().size(); int size = routing.getParkSectionCodeList().size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i); RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO(); RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
runPlanTripTimeVO.setStationCode(routingSection.getStationCode()); runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode()); runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
@ -486,6 +487,7 @@ public class RunPlanGenerator1 {
if (!startTBIsFront(routing, mapVO)) { if (!startTBIsFront(routing, mapVO)) {
continue; continue;
} }
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
runPlanTripTimeVO.setArrivalTime( runPlanTripTimeVO.setArrivalTime(
tripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2)); tripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode()))); runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
@ -494,14 +496,15 @@ public class RunPlanGenerator1 {
if (Objects.nonNull(endTBIsFront) && !endTBIsFront) { if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
continue; continue;
} }
runPlanTripTimeVO.setArrivalTime( runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList)?tripList.getLast().getEndTime().plusSeconds(45)
tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode()))); : tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront) runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront)
? runPlanTripTimeVO.getArrivalTime() ? runPlanTripTimeVO.getArrivalTime()
: runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode()))); : runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
} else { } else {
Boolean startTBIsFront = startTBIsFront(routing, mapVO); Boolean startTBIsFront = startTBIsFront(routing, mapVO);
if (i == 1 && Objects.nonNull(startTBIsFront) && !startTBIsFront) { if (i == 1 && Objects.nonNull(startTBIsFront) && !startTBIsFront) {
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routing.getStartStationCode());
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripList)?inputData.getBeginTime():tripList.getLast().getEndTime().plusSeconds(reentryTime.getTbBack() - reentryTime.getTbFrom())); runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripList)?inputData.getBeginTime():tripList.getLast().getEndTime().plusSeconds(reentryTime.getTbBack() - reentryTime.getTbFrom()));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime()); runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
}else{ }else{
@ -512,7 +515,7 @@ public class RunPlanGenerator1 {
tripTimeList.add(runPlanTripTimeVO); tripTimeList.add(runPlanTripTimeVO);
} }
tripVO.setTimeList(tripTimeList); tripVO.setTimeList(tripTimeList);
setTripTerminalTime(tripVO, tripTimeList, reentryData); setTripTerminalTime(tripVO, routing,tripTimeList, reentryData);
tripList.add(tripVO); tripList.add(tripVO);
return ++tripNumber; return ++tripNumber;
} }
@ -533,28 +536,31 @@ public class RunPlanGenerator1 {
} }
} }
public void setTripTerminalTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) { public void setTripTerminalTime(RunPlanTripVO runPlanTripVO, RunPlanRoutingVO routing,LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
setTripStartTime(runPlanTripVO, tripTimeList, reentryData); setTripStartTime(runPlanTripVO, routing.getStartStationCode(),tripTimeList, reentryData);
setTripEndTime(runPlanTripVO, tripTimeList, reentryData); setTripEndTime(runPlanTripVO, routing.getEndStationCode(),tripTimeList, reentryData);
} }
private void setTripStartTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) { private void setTripStartTime(RunPlanTripVO runPlanTripVO, String startStation,LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
RunPlanTripTimeVO firstTripTime = tripTimeList.getFirst(); RunPlanTripTimeVO firstTripTime = tripTimeList.getFirst();
if (Objects.equals(runPlanTripVO.getStartSectionCode(), firstTripTime.getSectionCode())) { if (Objects.equals(runPlanTripVO.getStartSectionCode(), firstTripTime.getSectionCode())) {
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime()); runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime());
} else { } else {
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(firstTripTime.getStationCode()).getTbTo()), String.format("车站[%s]折返数据请配置折返轨至起始股道",firstTripTime.getStationCode())); // BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(firstTripTime.getStationCode()).getTbTo()), String.format("车站[%s]折返数据请配置折返轨至起始股道",firstTripTime.getStationCode()));
runPlanTripVO.setStartTime(firstTripTime.getArrivalTime().minusSeconds(reentryData.get(firstTripTime.getStationCode()).getTbTo())); runPlanTripVO.setStartTime(firstTripTime.getArrivalTime().minusSeconds(reentryData.get(startStation).getTbTo()));
} }
} }
private void setTripEndTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) { private void setTripEndTime(RunPlanTripVO runPlanTripVO, String endStation,LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
RunPlanTripTimeVO lastTripTime = tripTimeList.getLast(); RunPlanTripTimeVO lastTripTime = tripTimeList.getLast();
if (Objects.equals(runPlanTripVO.getEndSectionCode(), lastTripTime.getSectionCode())) { if (Objects.equals(runPlanTripVO.getEndSectionCode(), lastTripTime.getSectionCode())) {
runPlanTripVO.setEndTime(lastTripTime.getDepartureTime()); runPlanTripVO.setEndTime(lastTripTime.getDepartureTime());
} else { } else if(Objects.equals(runPlanTripVO.getStartSectionCode(), lastTripTime.getSectionCode())){
runPlanTripVO.setEndTime(lastTripTime.getDepartureTime().plusSeconds(45));//转换轨直接到折返轨的交路
} else{
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(lastTripTime.getStationCode()).getTbFrom()), String.format("车站[%s]折返数据请配置轨道至折返轨",lastTripTime.getStationCode())); // BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(lastTripTime.getStationCode()).getTbFrom()), String.format("车站[%s]折返数据请配置轨道至折返轨",lastTripTime.getStationCode()));
runPlanTripVO.setEndTime(lastTripTime.getDepartureTime().plusSeconds(reentryData.get(lastTripTime.getStationCode()).getTbFrom()));
runPlanTripVO.setEndTime(lastTripTime.getDepartureTime().plusSeconds(reentryData.get(endStation).getTbFrom()));
} }
} }

View File

@ -869,12 +869,12 @@ public class MapDeviceBuilder {
signal.setStation((Station) elementMap.get(signalVO.getBelongStationCode())); signal.setStation((Station) elementMap.get(signalVO.getBelongStationCode()));
// 所属车站 // 所属车站
// Station station = (Station) elementMap.get(signalVO.getBelongStationCode()); Station station = (Station) elementMap.get(signalVO.getBelongStationCode());
// if (Objects.isNull(station)) { if (Objects.isNull(station)) {
// errMsgList.add(String.format("信号机[%s(%s)]未设置所属车站或所属车站不存在", signal.getName(), signal.getCode())); // errMsgList.add(String.format("信号机[%s(%s)]未设置所属车站或所属车站不存在", signal.getName(), signal.getCode()));
// } else { } else {
// signal.setStation(station); signal.setStation(station);
// } }
// 所属联锁站 // 所属联锁站
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode())); Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
if (Objects.isNull(interlockStation)) { if (Objects.isNull(interlockStation)) {

View File

@ -379,7 +379,7 @@ public class CalculateService {
if (frequency > 50 || frequency < 0) {//防止寻找过大的站间轨迹 if (frequency > 50 || frequency < 0) {//防止寻找过大的站间轨迹
return null; return null;
} }
boolean isPathSection = false; boolean isPathSection;
Float distance = startSection.getLen(); Float distance = startSection.getLen();
//获取左/右侧区段 //获取左/右侧区段
Section nextSection = isRight ? startSection.getRightSection() : startSection.getLeftSection(); Section nextSection = isRight ? startSection.getRightSection() : startSection.getLeftSection();
@ -395,12 +395,12 @@ public class CalculateService {
isPathSection = nextSection.getStandList().stream().anyMatch(stand -> isPathSection = nextSection.getStandList().stream().anyMatch(stand ->
(!stand.isSmall()) && ((opposite ? !isRight : isRight) == stand.isRight())); (!stand.isSmall()) && ((opposite ? !isRight : isRight) == stand.isRight()));
if (opposite // if (opposite
&& !Objects.equals(nextSection, endSection) // && !Objects.equals(nextSection, endSection)
&& isPathSection // && isPathSection
&& Objects.equals(nextSection.getStation(), endSection.getStation())) { // && Objects.equals(nextSection.getStation(), endSection.getStation())) {
return null; // return null;
} // }
//必经之路 //必经之路
if (isPathSection) { if (isPathSection) {
list.addLast(nextSection); list.addLast(nextSection);

View File

@ -118,25 +118,25 @@ public class RunPlanTripVO {
this.timeList = new ArrayList<>(); this.timeList = new ArrayList<>();
} }
public RunPlanTripVO(RunPlanTripConfigVO tripConfigVO, MapRoutingVO routingVO) { // public RunPlanTripVO(RunPlanTripConfigVO tripConfigVO, MapRoutingVO routingVO) {
this.directionCode = routingVO.getDirectionCode(); // this.directionCode = routingVO.getDirectionCode();
this.destinationCode = routingVO.getDestinationCode(); // this.destinationCode = routingVO.getDestinationCode();
this.startSectionCode = routingVO.getStartSectionCode(); // this.startSectionCode = routingVO.getStartSectionCode();
this.endSectionCode = routingVO.getEndSectionCode(); // this.endSectionCode = routingVO.getEndSectionCode();
this.startTime = tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME); // this.startTime = tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME);
this.endTime = tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME); // this.endTime = tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME);
this.timeList = new ArrayList<>(); // this.timeList = new ArrayList<>();
} // }
//
public RunPlanTripVO(RunPlanTripConfigVO tripConfigVO, MapRoutingDataVO routingVO) { // public RunPlanTripVO(RunPlanTripConfigVO tripConfigVO, MapRoutingDataVO routingVO) {
this.right = routingVO.getRight(); // this.right = routingVO.getRight();
this.destinationCode = routingVO.getDestinationCode(); // this.destinationCode = routingVO.getDestinationCode();
this.startSectionCode = routingVO.getStartSectionCode(); // this.startSectionCode = routingVO.getStartSectionCode();
this.endSectionCode = routingVO.getEndSectionCode(); // this.endSectionCode = routingVO.getEndSectionCode();
this.startTime = tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME); // this.startTime = tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME);
this.endTime = tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME); // this.endTime = tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME);
this.timeList = new ArrayList<>(); // this.timeList = new ArrayList<>();
} // }
public RunPlanTripVO(RunPlanRoutingVO routingVO) { public RunPlanTripVO(RunPlanRoutingVO routingVO) {
this.right = routingVO.getRight(); this.right = routingVO.getRight();