删除文件
This commit is contained in:
parent
72a6546297
commit
d1b8fcea3d
@ -1,598 +0,0 @@
|
||||
//package club.joylink.rtss.services.runplan;
|
||||
//
|
||||
//import club.joylink.rtss.constants.BusinessConsts;
|
||||
//import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
//import club.joylink.rtss.vo.client.map.MapVO;
|
||||
//import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
|
||||
//import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||
//import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
//import club.joylink.rtss.vo.client.runplan.user.*;
|
||||
//import club.joylink.rtss.vo.runplan.RunPlanInput;
|
||||
//import club.joylink.rtss.vo.runplan.RunPlanInputData;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Getter;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//import lombok.Setter;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.time.LocalTime;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * 通用运行图生成
|
||||
// */
|
||||
//@Component
|
||||
//public class RunPlanGenerator1 {
|
||||
//
|
||||
// private static final int OFFSET_TIME_HOURS = 2; //时间偏移早两小时
|
||||
//
|
||||
// @Autowired
|
||||
// private IRunPlanRoutingService runPlanRoutingService;
|
||||
// @Autowired
|
||||
// private IRunPlanRunlevelService runPlanRunlevelService;
|
||||
// @Autowired
|
||||
// private IRunPlanParktimeService runPlanParktimeService;
|
||||
// @Autowired
|
||||
// private IRunPlanUserConfigService runPlanUserConfigService;
|
||||
//
|
||||
//
|
||||
// public List<RunPlanTripVO> generatorTrips(Long userId, RunPlanInput runPlanInput, MapVO mapVO) {
|
||||
//
|
||||
// //校验发车停运时间
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getOverTime().isAfter(runPlanInput.getBeginTime()));
|
||||
// //校验车站
|
||||
//
|
||||
// LocalTime beginTimeOffset = runPlanInput.getBeginTime().minusHours(OFFSET_TIME_HOURS);
|
||||
// //向前推两小时,如果到前一天,则时间不合理
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(runPlanInput.getBeginTime().isAfter(beginTimeOffset), "发车时间过早,建议晚于上午两点");
|
||||
// runPlanInput.setBeginTime(beginTimeOffset);
|
||||
// runPlanInput.setOverTime(runPlanInput.getOverTime().minusHours(OFFSET_TIME_HOURS));
|
||||
//
|
||||
// //检查环路
|
||||
// RunPlanRoutingVO running1Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), runPlanInput.getRunningRouting1());
|
||||
// RunPlanRoutingVO running2Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), runPlanInput.getRunningRouting2());
|
||||
// boolean isLoop = running1Routing.getParkSectionCodeList().get(0).getStationCode().equals(running2Routing.getParkSectionCodeList().get(running2Routing.getParkSectionCodeList().size() - 1).getStationCode())
|
||||
// && running2Routing.getParkSectionCodeList().get(0).getStationCode().equals(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode());
|
||||
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isLoop, "运行两交路无法构成环路数据");
|
||||
// //查站间运行等级
|
||||
// List<RunPlanRunlevelVO> levels = runPlanRunlevelService.queryUserRunLevels(userId, mapVO.getId());
|
||||
// Map<String, Integer> runLevelTime = levels.stream().collect(Collectors.toMap(runLevelVO -> String.format("%s-%s", runLevelVO.getStartSectionCode(), runLevelVO.getEndSectionCode()), runLevelVO -> runLevelVO.getLevelTime(runPlanInput.getRunLevel())));
|
||||
// //查停站时间
|
||||
// List<RunPlanParkingTimeVO> parkTimes = runPlanParktimeService.queryUserParktimes(userId, mapVO.getId());
|
||||
// Map<String, Integer> parkTime = parkTimes.stream().collect(Collectors.toMap(RunPlanParkingTimeVO::getSectionCode, RunPlanParkingTimeVO::getParkingTime));
|
||||
// //查折返
|
||||
// RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userId, mapVO.getId());
|
||||
// Map<String, RunPlanUserConfigVO.ReentryTime> userReentryData = checkStationReentry(mapVO, running1Routing, config);
|
||||
// //生成车次
|
||||
// LinkedList<RunPlanTripVO> tripList = new LinkedList<>();
|
||||
// //是否同时相向发车
|
||||
// boolean opposite = Objects.isNull(runPlanInput.getRight());
|
||||
// if (opposite) {
|
||||
// //相向发车
|
||||
// int initialServiceNum = 1;
|
||||
// /*分别先发一辆车,计算控制左右发车服务号*/
|
||||
// //上个服务号发车时刻
|
||||
// //首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
// ServiceTempResult tempResultLeft = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
// serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultLeft, false, runLevelTime, parkTime, userReentryData);
|
||||
//
|
||||
// //上个服务号发车时刻
|
||||
// //首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
// ServiceTempResult tempResultRight = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
// serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultRight, true, runLevelTime, parkTime, userReentryData);
|
||||
//
|
||||
// LocalTime firstRoundTripTimeLeft = tempResultLeft.getFirstRoundTripTime();
|
||||
// LocalTime firstRoundTripTimeRight = tempResultRight.getFirstRoundTripTime();
|
||||
// tempResultRight.setFirstRoundTripTime(firstRoundTripTimeLeft);
|
||||
// tempResultLeft.setFirstRoundTripTime(firstRoundTripTimeRight);
|
||||
//
|
||||
// //暂时先定义发完左行,再发右行..
|
||||
// do {
|
||||
// tempResultLeft.setPreServiceDepartTime(tempResultLeft.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
// serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultLeft, false, runLevelTime, parkTime, userReentryData);
|
||||
// } while (tempResultLeft.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()*2).compareTo(tempResultLeft.getFirstRoundTripTime()) <= 0);
|
||||
// //发完左行,再发右行
|
||||
// do {
|
||||
// tempResultRight.setPreServiceDepartTime(tempResultRight.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
// serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, tempResultRight, true, runLevelTime, parkTime, userReentryData);
|
||||
// } while (tempResultRight.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()*2).compareTo(tempResultRight.getFirstRoundTripTime()) <= 0);
|
||||
//
|
||||
// } else {
|
||||
// //单向发车
|
||||
// allServiceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, tripList, runLevelTime, parkTime, userReentryData);
|
||||
//
|
||||
// }
|
||||
// return tripList;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 服务号发车
|
||||
// */
|
||||
// private void serviceNumberDepart(MapVO mapVO, RunPlanInput runPlanInput, RunPlanRoutingVO running1Routing, RunPlanRoutingVO running2Routing, int initialServiceNum, LinkedList<RunPlanTripVO> tripList, ServiceTempResult serviceTempResult, boolean isRight, Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData) {
|
||||
// String serviceNumber = String.format("%03d", initialServiceNum);
|
||||
// //初始化车次号,右行偶数,左行奇数
|
||||
// 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;
|
||||
// RunPlanTripVO runPlanTripVO = new RunPlanTripVO(routing);
|
||||
// runPlanTripVO.setServiceNumber(serviceNumber);
|
||||
// setDirectionCode(mapVO, runPlanTripVO);
|
||||
// runPlanTripVO.setIsReentry(true);
|
||||
// //车次号
|
||||
// String tripNumber = String.format("%03d", initTripNumber++);
|
||||
// runPlanTripVO.setTripNumber(runPlanTripVO.getDirectionCode() + tripNumber);
|
||||
// //首班右行方向
|
||||
// LinkedList<RunPlanTripTimeVO> tripTimeList = new LinkedList<>();//车次时刻表
|
||||
// int size = routing.getParkSectionCodeList().size();
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
|
||||
// RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
|
||||
// runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
|
||||
// runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
|
||||
// if (CollectionUtils.isEmpty(tempTripList) && i == 0) {//首发车次
|
||||
// runPlanTripTimeVO.setArrivalTime(serviceTempResult.getPreServiceDepartTime());
|
||||
// runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
|
||||
// } else if (i == 0) { //其它车次发车
|
||||
// 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())));
|
||||
// } else if (i == size - 1) {
|
||||
// Boolean endTBIsFront = endTBIsFront(routing, mapVO);
|
||||
// if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
|
||||
// continue;
|
||||
// }
|
||||
// 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().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
|
||||
// }else{
|
||||
// runPlanTripTimeVO.setArrivalTime(tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
|
||||
// runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
|
||||
// }
|
||||
// }
|
||||
// tripTimeList.add(runPlanTripTimeVO);
|
||||
// }
|
||||
// runPlanTripVO.setTimeList(tripTimeList);
|
||||
// setTripTerminalTime(runPlanTripVO, routing,tripTimeList,reentryData);
|
||||
// lastTripEndTime = runPlanTripVO.getEndTime();
|
||||
// if(CollectionUtils.isEmpty(tempTripList)){
|
||||
// runPlanTripVO.setIsOutbound(true);
|
||||
// }
|
||||
// tempTripList.add(runPlanTripVO);
|
||||
// if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
||||
// 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, endStation, tripTimeList, reentryData);
|
||||
// tripList.addAll(tempTripList);
|
||||
// if (Objects.isNull(serviceTempResult.getFirstRoundTripTime())) {
|
||||
// serviceTempResult.setFirstRoundTripTime(tempTripList.get(0).getEndTime());
|
||||
// }
|
||||
// serviceTempResult.setPreServiceDepartTime(tempTripList.getFirst().getStartTime());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 单向发车
|
||||
// */
|
||||
// private void allServiceNumberDepart(MapVO mapVO, RunPlanInput runPlanInput, RunPlanRoutingVO running1Routing, RunPlanRoutingVO running2Routing, LinkedList<RunPlanTripVO> tripList, Map<String, Integer> runLevelTime, Map<String, Integer> parkTime, Map<String, RunPlanUserConfigVO.ReentryTime> userReentryData) {
|
||||
//
|
||||
//
|
||||
// //设置初始服务号
|
||||
// int initialServiceNum = 1;
|
||||
// //上个服务号发车时刻
|
||||
// //首班发车时间,首班车往返回来时间 来限定发车服务数量
|
||||
// ServiceTempResult serviceTempResult = new ServiceTempResult(runPlanInput.getBeginTime(), null);
|
||||
// do {
|
||||
// if (initialServiceNum != 1) {
|
||||
// if(initialServiceNum==2){
|
||||
// serviceTempResult.setFirstRoundTripTime(tripList.get(1).getEndTime());
|
||||
// }
|
||||
// serviceTempResult.setPreServiceDepartTime(serviceTempResult.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()));
|
||||
// }
|
||||
// serviceNumberDepart(mapVO, runPlanInput, running1Routing, running2Routing, initialServiceNum++, tripList, serviceTempResult, runPlanInput.getRight(), runLevelTime, parkTime, userReentryData);
|
||||
//
|
||||
// } while (serviceTempResult.getPreServiceDepartTime().plusSeconds(runPlanInput.getDepartureTimeInterval()).compareTo(serviceTempResult.getFirstRoundTripTime()) <= 0);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public List<RunPlanTripVO> generatorTrips(Long userId, RunPlanInputData inputData, MapVO mapVO) {
|
||||
// //校验时间
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getOverTime().isAfter(inputData.getBeginTime()),"输入参数错误:发车时间应早于结束时间");
|
||||
// LocalTime beginTimeOffset = inputData.getBeginTime().minusHours(OFFSET_TIME_HOURS);
|
||||
// //向前推两小时,如果到前一天,则时间不合理
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getBeginTime().isAfter(beginTimeOffset), "发车时间过早,建议晚于上午两点");
|
||||
// inputData.setBeginTime(beginTimeOffset);
|
||||
// inputData.setOverTime(inputData.getOverTime().minusHours(OFFSET_TIME_HOURS));
|
||||
//
|
||||
// //查交路
|
||||
// RunPlanRoutingVO outboundRouting = null;
|
||||
// if (inputData.hasOutbound()) {
|
||||
// outboundRouting = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getOutboundRouting());
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(outboundRouting.isOutBoundRoute(), "出库交路选择错误");
|
||||
// }
|
||||
// RunPlanRoutingVO inboundRouting = null;
|
||||
// if (inputData.hasInbound()) {
|
||||
// inboundRouting = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getInboundRouting());
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(inboundRouting.isInBoundRoute(), "入库交路选择错误");
|
||||
// }
|
||||
// RunPlanRoutingVO running1Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getRunningRouting1());
|
||||
// RunPlanRoutingVO running2Routing = runPlanRoutingService.queryUserRoutingByCode(userId, mapVO.getId(), inputData.getRunningRouting2());
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(running1Routing.isLoopRoute() && running2Routing.isLoopRoute(), "环线交路选择错误");
|
||||
//
|
||||
// //构建环路 和 出入库关系
|
||||
//
|
||||
// //验证 出库和入库 一端折返轨 一段转换轨,验证环路 两端折返轨 ,环路是否闭环 或出入库跟环路是否衔接
|
||||
// boolean isLoop = running1Routing.getParkSectionCodeList().get(0).getSectionCode().equals(running2Routing.getParkSectionCodeList().get(running2Routing.getParkSectionCodeList().size() - 1).getSectionCode())
|
||||
// && running2Routing.getParkSectionCodeList().get(0).getSectionCode().equals(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getSectionCode());
|
||||
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isLoop, "运行两交路无法构成环路数据");
|
||||
//
|
||||
// boolean outToRun1 = outboundRouting.getParkSectionCodeList().get(outboundRouting.getParkSectionCodeList().size() - 1).getSectionCode().equals(running1Routing.getParkSectionCodeList().get(0).getSectionCode());
|
||||
// boolean outToRun2 = outboundRouting.getParkSectionCodeList().get(outboundRouting.getParkSectionCodeList().size() - 1).getSectionCode().equals(running2Routing.getParkSectionCodeList().get(0).getSectionCode());
|
||||
//
|
||||
// boolean inToRun1 = inboundRouting.getParkSectionCodeList().get(0).getSectionCode().equals(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getSectionCode());
|
||||
// boolean inToRun2 = inboundRouting.getParkSectionCodeList().get(0).getSectionCode().equals(running2Routing.getParkSectionCodeList().get(running2Routing.getParkSectionCodeList().size() - 1).getSectionCode());
|
||||
//
|
||||
// //出库的衔接环路
|
||||
// RunPlanRoutingVO outRefLoop;
|
||||
// //另一个交路
|
||||
// RunPlanRoutingVO otherLoop;
|
||||
// boolean same = false;
|
||||
// if (outToRun1 && inToRun1) {
|
||||
// same = true;
|
||||
// outRefLoop = running1Routing;
|
||||
// otherLoop = running2Routing;
|
||||
// } else if (outToRun2 && inToRun2) {
|
||||
// same = true;
|
||||
// outRefLoop = running2Routing;
|
||||
// otherLoop = running1Routing;
|
||||
// } else if (outToRun1 && inToRun2) {
|
||||
// outRefLoop = running1Routing;
|
||||
// otherLoop = running2Routing;
|
||||
// } else if (outToRun2 && inToRun1) {
|
||||
// outRefLoop = running2Routing;
|
||||
// otherLoop = running1Routing;
|
||||
// } else {
|
||||
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("出入库交路与运行环路无法衔接匹配");
|
||||
// }
|
||||
// //查站间运行等级
|
||||
// List<RunPlanRunlevelVO> levels = runPlanRunlevelService.queryUserRunLevels(userId, mapVO.getId());
|
||||
// Map<String, Integer> runLevelMap = levels.stream().collect(Collectors.toMap(runLevelVO -> String.format("%s-%s", runLevelVO.getStartSectionCode(), runLevelVO.getEndSectionCode()), runLevelVO -> runLevelVO.getLevelTime(inputData.getRunLevel())));
|
||||
// //查停站时间
|
||||
// List<RunPlanParkingTimeVO> parktimes = runPlanParktimeService.queryUserParktimes(userId, mapVO.getId());
|
||||
// Map<String, Integer> parkTimeMap = parktimes.stream().collect(Collectors.toMap(RunPlanParkingTimeVO::getSectionCode, RunPlanParkingTimeVO::getParkingTime));
|
||||
// //查折返
|
||||
// RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userId, mapVO.getId());
|
||||
// Map<String, RunPlanUserConfigVO.ReentryTime> reentryData = checkStationReentry(mapVO, running1Routing, config);
|
||||
// List<RunPlanTripVO> tripList = new ArrayList<>(100);
|
||||
// ServiceTempResult serviceResult = new ServiceTempResult();
|
||||
// //单个服务号还是多个
|
||||
// if (Objects.nonNull(inputData.getDepartureInterval())) {
|
||||
// do {
|
||||
// generateService(inputData, mapVO, outboundRouting, inboundRouting, outRefLoop, same, otherLoop, runLevelMap, parkTimeMap, reentryData, tripList, serviceResult);
|
||||
// inputData.setServiceNumber(String.format("%03d", Integer.parseInt(inputData.getServiceNumber()) + 1));
|
||||
// inputData.setBeginTime(inputData.getBeginTime().plusSeconds(inputData.getDepartureInterval()));
|
||||
// } while (serviceResult.preServiceDepartTime.plusSeconds(inputData.getDepartureInterval()).compareTo(serviceResult.firstRoundTripTime) <= 0);
|
||||
//
|
||||
// } else {
|
||||
// generateService(inputData, mapVO, outboundRouting, inboundRouting, outRefLoop, same, otherLoop, runLevelMap, parkTimeMap, reentryData, tripList, serviceResult);
|
||||
// }
|
||||
// return tripList;
|
||||
// }
|
||||
//
|
||||
// private Map<String, RunPlanUserConfigVO.ReentryTime> checkStationReentry(MapVO mapVO, RunPlanRoutingVO running1Routing, RunPlanUserConfigVO config) {
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "请配置所选运行线路折返数据");
|
||||
// Map<String, RunPlanUserConfigVO.ReentryTime> reentryData = config.getConfig().getReentryData();
|
||||
// // 检测折返站配置
|
||||
// String startStationCode = running1Routing.getParkSectionCodeList().get(0).getStationCode();
|
||||
// String endStationCode = running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode();
|
||||
// if (Objects.isNull(reentryData.get(startStationCode))) {
|
||||
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("车站[%s]缺少折返数据", mapVO.findStation(startStationCode).getName()));
|
||||
// }
|
||||
// if(Objects.isNull(reentryData.get(endStationCode))){
|
||||
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("车站[%s]缺少折返数据", mapVO.findStation(endStationCode).getName()));
|
||||
// }
|
||||
// Boolean startTBIsFront = startTBIsFront(running1Routing, mapVO);
|
||||
// if(Objects.nonNull(startTBIsFront) ){
|
||||
// if (startTBIsFront) {
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(startStationCode).getTbFront()), String.format("车站[%s]请配置站前折返数据", mapVO.findStation(startStationCode).getName()));
|
||||
// } else {
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(startStationCode).getTbBack()), String.format("车站[%s]请配置站后折返数据", mapVO.findStation(startStationCode).getName()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Boolean endTBIsFront = endTBIsFront(running1Routing, mapVO);
|
||||
// if(Objects.nonNull(endTBIsFront) ){
|
||||
// if (endTBIsFront) {
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(endStationCode).getTbFront()), String.format("车站[%s]请配置站前折返数据", mapVO.findStation(endStationCode).getName()));
|
||||
// } else {
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(reentryData.get(endStationCode).getTbBack()), String.format("车站[%s]请配置站后折返数据", mapVO.findStation(endStationCode).getName()));
|
||||
// }
|
||||
// }
|
||||
// return reentryData;
|
||||
// }
|
||||
//
|
||||
// private void generateService(RunPlanInputData inputData, MapVO mapVO, RunPlanRoutingVO outboundRouting, RunPlanRoutingVO inboundRouting, RunPlanRoutingVO outRefLoop, final boolean same, RunPlanRoutingVO otherLoop, Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData, List<RunPlanTripVO> tripList, ServiceTempResult serviceResult) {
|
||||
// LinkedList<RunPlanTripVO> serviceTripList = new LinkedList<>();
|
||||
// int nextTripNumber = 1;
|
||||
// //构建出库车次
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, outboundRouting, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
//
|
||||
// //计算入库车次运行所需时间
|
||||
// int num = inboundRouting.getParkSectionCodeList().size() - 1;
|
||||
// int inboundTripRunTime = 0;
|
||||
// int parkTime=0;
|
||||
// int runTime;
|
||||
// for (int i = 0; i < num - 1; i++) {
|
||||
// RunPlanRoutingSection routingSection = inboundRouting.getParkSectionCodeList().get(i);
|
||||
// RunPlanRoutingSection nextRoutingSection = inboundRouting.getParkSectionCodeList().get(i + 1);
|
||||
// if (i == 0) {
|
||||
// if (startTBIsFront(inboundRouting, mapVO)) {
|
||||
// parkTime = reentryData.get(routingSection.getStationCode()).getTbFront() - parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// } else {
|
||||
// runTime = reentryData.get(routingSection.getStationCode()).getTbBack() - reentryData.get(routingSection.getStationCode()).getTbFrom();
|
||||
// }
|
||||
// } else {
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }
|
||||
// inboundTripRunTime = inboundTripRunTime + parkTime + runTime;
|
||||
// parkTime = 0;
|
||||
// }
|
||||
//
|
||||
// //计算出库对接环路运行所需时间
|
||||
// int oNum = outRefLoop.getParkSectionCodeList().size() - 1;
|
||||
// int outRefTripRunTime = 0;
|
||||
// for (int i = 0; i < oNum; i++) {
|
||||
// RunPlanRoutingSection routingSection = outRefLoop.getParkSectionCodeList().get(i);
|
||||
// RunPlanRoutingSection nextRoutingSection = outRefLoop.getParkSectionCodeList().get(i + 1);
|
||||
// if(i==0){
|
||||
// if(startTBIsFront(outRefLoop, mapVO)){
|
||||
// parkTime = reentryData.get(routingSection.getStationCode()).getTbFront()- parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }else {
|
||||
// runTime = reentryData.get(routingSection.getStationCode()).getTbBack()-reentryData.get(routingSection.getStationCode()).getTbFrom();
|
||||
// }
|
||||
// }else if(i == oNum-1){
|
||||
// if(endTBIsFront(outRefLoop,mapVO )){
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode())+parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }else{
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = reentryData.get(nextRoutingSection.getStationCode()).getTbFrom();
|
||||
// }
|
||||
// }else{
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }
|
||||
// outRefTripRunTime = outRefTripRunTime + parkTime + runTime;
|
||||
// parkTime = 0;
|
||||
// }
|
||||
//
|
||||
// //计算另一环路运行所需时间
|
||||
// int iNum = otherLoop.getParkSectionCodeList().size()-1;
|
||||
// int otherTripRunTime = 0;
|
||||
// for (int i = 0; i < iNum; i++) {
|
||||
// RunPlanRoutingSection routingSection = otherLoop.getParkSectionCodeList().get(i);
|
||||
// RunPlanRoutingSection nextRoutingSection = otherLoop.getParkSectionCodeList().get(i + 1);
|
||||
// if(i==0){
|
||||
// if(startTBIsFront(otherLoop, mapVO)){
|
||||
// parkTime = reentryData.get(routingSection.getStationCode()).getTbFront()- parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }else {
|
||||
// runTime = reentryData.get(routingSection.getStationCode()).getTbBack()-reentryData.get(routingSection.getStationCode()).getTbFrom();
|
||||
// }
|
||||
// }else if(i == iNum-1){
|
||||
// if(endTBIsFront(otherLoop,mapVO )){
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode())+parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }else{
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = reentryData.get(nextRoutingSection.getStationCode()).getTbFrom();
|
||||
// }
|
||||
// }else{
|
||||
// parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||
// runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||
// }
|
||||
// otherTripRunTime = otherTripRunTime + parkTime + runTime;
|
||||
// parkTime = 0;
|
||||
// }
|
||||
// if (same ? true :
|
||||
// (serviceTripList.getLast().getEndTime().plusSeconds(inboundTripRunTime).isBefore(inputData.getOverTime()) &&
|
||||
// (serviceTripList.getLast().getEndTime().getHour()<3
|
||||
// || serviceTripList.getLast().getEndTime().plusSeconds(outRefTripRunTime + otherTripRunTime + inboundTripRunTime).getHour() > 3))
|
||||
// ) {
|
||||
// //构建环路车次
|
||||
// boolean loop = false;
|
||||
// do {
|
||||
// if (same) {
|
||||
// if (!loop) {
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, outRefLoop, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
// loop = true;
|
||||
// } else {
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, otherLoop, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, outRefLoop, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
// }
|
||||
// } else {
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, outRefLoop, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
// nextTripNumber = buildServiceTrip(inputData, mapVO, otherLoop, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
// }
|
||||
// }
|
||||
// while (serviceTripList.getLast().getEndTime().plusSeconds(inboundTripRunTime).isBefore(inputData.getOverTime())
|
||||
// &&
|
||||
// (serviceTripList.getLast().getEndTime().getHour() < 3 || serviceTripList.getLast().getEndTime().plusSeconds(outRefTripRunTime + otherTripRunTime + inboundTripRunTime).getHour() > 3));
|
||||
// }
|
||||
// //构建回库计划
|
||||
// buildServiceTrip(inputData, mapVO, inboundRouting, runLevelMap, parkTimeMap, reentryData, serviceTripList, nextTripNumber);
|
||||
//
|
||||
// if (Objects.isNull(serviceResult.getFirstRoundTripTime())) {
|
||||
// serviceResult.setFirstRoundTripTime(serviceTripList.get(1).getEndTime());
|
||||
// }
|
||||
// serviceResult.setPreServiceDepartTime(serviceTripList.getFirst().getStartTime());
|
||||
// tripList.addAll(serviceTripList);
|
||||
// }
|
||||
//
|
||||
// private int buildServiceTrip(RunPlanInputData inputData, MapVO mapVO, RunPlanRoutingVO routing,
|
||||
// Map<String, Integer> runLevelMap, Map<String, Integer> parkTimeMap, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData,
|
||||
// LinkedList<RunPlanTripVO> tripList, int tripNumber) {
|
||||
// RunPlanTripVO tripVO = new RunPlanTripVO(routing);
|
||||
// setDirectionCode(mapVO, tripVO);
|
||||
// tripVO.setServiceNumber(inputData.getServiceNumber());
|
||||
// tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", tripNumber));
|
||||
// tripVO.setIsReentry(true);
|
||||
// if (routing.isOutBoundRoute()) {
|
||||
// tripVO.setIsOutbound(true);
|
||||
// }
|
||||
// if (routing.isInBoundRoute()) {
|
||||
// tripVO.setIsInbound(true);
|
||||
// tripVO.setIsReentry(false);
|
||||
// }
|
||||
// LinkedList<RunPlanTripTimeVO> tripTimeList = new LinkedList<>();
|
||||
// int size = routing.getParkSectionCodeList().size();
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// RunPlanRoutingSection routingSection = routing.getParkSectionCodeList().get(i);
|
||||
// RunPlanTripTimeVO runPlanTripTimeVO = new RunPlanTripTimeVO();
|
||||
// runPlanTripTimeVO.setStationCode(routingSection.getStationCode());
|
||||
// runPlanTripTimeVO.setSectionCode(routingSection.getSectionCode());
|
||||
// if (CollectionUtils.isEmpty(tripList) && i == 0) {//首发车次
|
||||
// runPlanTripTimeVO.setArrivalTime(inputData.getBeginTime());
|
||||
// runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime());
|
||||
// } else if (i == 0) { //其它车次发车
|
||||
// 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())));
|
||||
// } else if (i == size - 1) {
|
||||
// Boolean endTBIsFront = endTBIsFront(routing, mapVO);
|
||||
// if (Objects.nonNull(endTBIsFront) && !endTBIsFront) {
|
||||
// continue;
|
||||
// }
|
||||
// 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().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
|
||||
// } else {
|
||||
// runPlanTripTimeVO.setArrivalTime(tripTimeList.getLast().getDepartureTime().plusSeconds(runLevelMap.get(tripTimeList.getLast().getSectionCode() + "-" + runPlanTripTimeVO.getSectionCode())));
|
||||
// runPlanTripTimeVO.setDepartureTime(runPlanTripTimeVO.getArrivalTime().plusSeconds(parkTimeMap.get(runPlanTripTimeVO.getSectionCode())));
|
||||
// }
|
||||
// }
|
||||
// tripTimeList.add(runPlanTripTimeVO);
|
||||
// }
|
||||
// tripVO.setTimeList(tripTimeList);
|
||||
// setTripTerminalTime(tripVO, routing,tripTimeList, reentryData);
|
||||
// tripList.add(tripVO);
|
||||
// return ++tripNumber;
|
||||
// }
|
||||
//
|
||||
// private void setDirectionCode(MapVO mapVO, RunPlanTripVO tripVO) {
|
||||
// if (mapVO.getConfigVO().getUpRight()) {
|
||||
// if (tripVO.getRight()) {
|
||||
// tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
|
||||
// } else {
|
||||
// tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
|
||||
// }
|
||||
// } else {
|
||||
// if (tripVO.getRight()) {
|
||||
// tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type01);
|
||||
// } else {
|
||||
// tripVO.setDirectionCode(BusinessConsts.RunPlan.DirectionType.Type02);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 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, 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(startStation).getTbTo()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 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 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(endStation).getTbFrom()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Boolean startTBIsFront(RunPlanRoutingVO runningRouting, MapVO mapVO) {
|
||||
// MapSectionNewVO startReentrySection = mapVO.findSection(runningRouting.getStartSectionCode());
|
||||
// if (startReentrySection.isReentryTrack()) {
|
||||
// if (startReentrySection.isStandTrack()) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public Boolean endTBIsFront(RunPlanRoutingVO runningRouting, MapVO mapVO) {
|
||||
// MapSectionNewVO endReentrySection = mapVO.findSection(runningRouting.getEndSectionCode());
|
||||
// if (endReentrySection.isReentryTrack()) {
|
||||
// if (endReentrySection.isStandTrack()) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Getter
|
||||
// @Setter
|
||||
// @AllArgsConstructor
|
||||
// @NoArgsConstructor
|
||||
// private class ServiceTempResult {
|
||||
// private LocalTime preServiceDepartTime;
|
||||
// private LocalTime firstRoundTripTime;
|
||||
// }
|
||||
//
|
||||
//}
|
Loading…
Reference in New Issue
Block a user