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;
LocalTime lastTripEndTime;//一个车次终点时间
LinkedList<RunPlanTripVO> tempTripList = new LinkedList<>();
String endStation = null;
//根据运行时间判断结束末班车次
do {
RunPlanRoutingVO routing = Objects.equals(running1Routing.getRight(), isRight) ? running1Routing : running2Routing;
@ -133,7 +134,6 @@ public class RunPlanGenerator1 {
int size = routing.getParkSectionCodeList().size();
for (int i = 0; i < size; i++) {
RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
@ -144,6 +144,7 @@ public class RunPlanGenerator1 {
if (!startTBIsFront(routing, mapVO)) {
continue;
}
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
runPlanTripTimeVO.setArrivalTime(
tempTripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
@ -152,14 +153,15 @@ public class RunPlanGenerator1 {
if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
continue;
}
runPlanTripTimeVO.setArrivalTime(
tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList)?tripList.getLast().getEndTime().plusSeconds(45)
: tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront)
? runPlanTripTimeVO.getArrivalTime()
: runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
} else {
Boolean startTBIsFront = startTBIsFront(routing, mapVO);
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.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
}else{
@ -170,7 +172,7 @@ public class RunPlanGenerator1 {
tripTimeList.add(runPlanTripTimeVO);
}
runPlanTripVO.setTimeList(tripTimeList);
setTripTerminalTime(runPlanTripVO, tripTimeList,reentryData);
setTripTerminalTime(runPlanTripVO, routing,tripTimeList,reentryData);
lastTripEndTime = runPlanTripVO.getEndTime();
if(CollectionUtils.isEmpty(tempTripList)){
runPlanTripVO.setIsOutbound(true);
@ -180,14 +182,14 @@ public class RunPlanGenerator1 {
break;
}
isRight = !isRight;
endStation = routing.getEndStationCode();
} while (lastTripEndTime.isBefore(runPlanInput.getOverTime()));
//设置服务号末班车次入库
RunPlanTripVO lastrunPlanTrip = tempTripList.getLast();
lastrunPlanTrip.setIsInbound(true);
lastrunPlanTrip.setIsReentry(false);
LinkedList<RunPlanTripTimeVO> tripTimeList = (LinkedList) lastrunPlanTrip.getTimeList();
setTripEndTime(lastrunPlanTrip, tripTimeList, reentryData);
setTripEndTime(lastrunPlanTrip, endStation, tripTimeList, reentryData);
tripList.addAll(tempTripList);
if (Objects.isNull(serviceTempResult.getFirstRoundTripTime())) {
serviceTempResult.setFirstRoundTripTime(tempTripList.get(0).getEndTime());
@ -475,7 +477,6 @@ public class RunPlanGenerator1 {
int size = routing.getParkSectionCodeList().size();
for (int i = 0; i < size; i++) {
RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
@ -486,6 +487,7 @@ public class RunPlanGenerator1 {
if (!startTBIsFront(routing, mapVO)) {
continue;
}
RunPlanUserConfigVO.ReentryTime reentryTime = reentryData.get(routingSection.getStationCode());
runPlanTripTimeVO.setArrivalTime(
tripList.getLast().getEndTime().plusSeconds(reentryTime.getTbFront() - parkTimeMap.get(runPlanTripTimeVO.getSectionCode()) * 2));
runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
@ -494,14 +496,15 @@ public class RunPlanGenerator1 {
if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
continue;
}
runPlanTripTimeVO.setArrivalTime(
tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setArrivalTime(CollectionUtils.isEmpty(tripTimeList)?tripList.getLast().getEndTime().plusSeconds(45)
: tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
runPlanTripTimeVO.setDepartureTime(Objects.isNull(endTBIsFront)
? runPlanTripTimeVO.getArrivalTime()
: runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
} else {
Boolean startTBIsFront = startTBIsFront(routing, mapVO);
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.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
}else{
@ -512,7 +515,7 @@ public class RunPlanGenerator1 {
tripTimeList.add(runPlanTripTimeVO);
}
tripVO.setTimeList(tripTimeList);
setTripTerminalTime(tripVO, tripTimeList, reentryData);
setTripTerminalTime(tripVO, routing,tripTimeList, reentryData);
tripList.add(tripVO);
return ++tripNumber;
}
@ -533,28 +536,31 @@ public class RunPlanGenerator1 {
}
}
public void setTripTerminalTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
setTripStartTime(runPlanTripVO, tripTimeList, reentryData);
setTripEndTime(runPlanTripVO, tripTimeList, reentryData);
public void setTripTerminalTime(RunPlanTripVO runPlanTripVO, RunPlanRoutingVO routing,LinkedList<RunPlanTripTimeVO> tripTimeList, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
setTripStartTime(runPlanTripVO, routing.getStartStationCode(),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();
if (Objects.equals(runPlanTripVO.getStartSectionCode(), firstTripTime.getSectionCode())) {
runPlanTripVO.setStartTime(tripTimeList.getFirst().getArrivalTime());
} else {
// 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();
if (Objects.equals(runPlanTripVO.getEndSectionCode(), lastTripTime.getSectionCode())) {
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()));
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()));
// 所属车站
// Station station = (Station) elementMap.get(signalVO.getBelongStationCode());
// if (Objects.isNull(station)) {
Station station = (Station) elementMap.get(signalVO.getBelongStationCode());
if (Objects.isNull(station)) {
// errMsgList.add(String.format("信号机[%s(%s)]未设置所属车站或所属车站不存在", signal.getName(), signal.getCode()));
// } else {
// signal.setStation(station);
// }
} else {
signal.setStation(station);
}
// 所属联锁站
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
if (Objects.isNull(interlockStation)) {

View File

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

View File

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