运行图生成修改

This commit is contained in:
DU 2021-03-19 11:38:31 +08:00
parent 1b72bc695e
commit 6ef313cfa9
3 changed files with 19 additions and 5 deletions

View File

@ -783,6 +783,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
@Override
public List<String> dataCheck(Long planId) {
List<String> errorList = new ArrayList<>();
//运行图验证内容
// 验证是否有时刻数据
// 找到每个服务发车时间查找发车时间不能过早 结束时间不能过晚
// 同一服务 根据发车排序每个车次往后每个时刻应该晚于上个且时刻之间时间应该根据站间运行等级距离计算最小值
// 不同服务发车间隔>=1分45秒
// 同站车次间隔时间不能过小 根据最大最小速度计算 站间距离
// 折返时间
RunPlanVO planVO = getRunPlanById(planId);
if (CollectionUtils.isEmpty(planVO.getTripList())) {
errorList.add("运行图数据为空!");

View File

@ -59,16 +59,16 @@ public class RunPlanGenerator {
List<RunPlanRoutingVO> outboundRoutings = runPlanRoutingService.getUserRoutingByType(userId, mapVO.getId(), RunPlanRoutingVO.UserRoutingType.OUTBOUND);
inboundRoutings = runPlanRoutingService.getUserRoutingByType(userId, mapVO.getId(), RunPlanRoutingVO.UserRoutingType.INBOUND);
outboundRouting1 = outboundRoutings.stream().filter(outRouting ->
Objects.equals(outRouting.getEndSectionCode(), running1Routing.getStartSectionCode()))
Objects.equals(outRouting.getEndSectionCode(), running1Routing.getStartSectionCode()) && !Objects.equals(outRouting.getRight(), running1Routing.getRight()))
.sorted(Comparator.comparingInt(o -> o.getParkSectionCodeList().indexOf(running1Routing.getParkSectionCodeList().get(0))))
.findFirst().orElse(null);
outboundRouting2 = outboundRoutings.stream().filter(outRouting ->
Objects.equals(outRouting.getEndSectionCode(), running2Routing.getStartSectionCode()))
Objects.equals(outRouting.getEndSectionCode(), running2Routing.getStartSectionCode())&& !Objects.equals(outRouting.getRight(), running2Routing.getRight()) )
.sorted(Comparator.comparingInt(o -> o.getParkSectionCodeList().indexOf(running2Routing.getParkSectionCodeList().get(0))))
.findFirst().orElse(null);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(Objects.isNull(outboundRouting1) && Objects.isNull(outboundRouting2), "没有找到对应的出库交路");
if(Objects.equals(outboundRouting1.getRight(),outboundRouting2.getRight()) && Objects.equals(outboundRouting1.getStartStationCode(),outboundRouting2.getStartStationCode()) ){
if((Objects.nonNull(outboundRouting1) && Objects.nonNull(outboundRouting2)) && Objects.equals(outboundRouting1.getRight(),outboundRouting2.getRight()) && Objects.equals(outboundRouting1.getStartStationCode(),outboundRouting2.getStartStationCode()) ){
outboundRouting2 =null;
}
}
@ -276,12 +276,12 @@ public class RunPlanGenerator {
RunPlanRoutingVO inboundRouting;
if (loop) {
inboundRouting = inboundRoutings.stream().filter(inRouting ->
Objects.equals(inRouting.getStartSectionCode(), otherLoop.getStartSectionCode()))
Objects.equals(inRouting.getStartSectionCode(), otherLoop.getStartSectionCode())&& Objects.equals(inRouting.getRight(), otherLoop.getRight()))
.sorted(Comparator.comparingInt(o -> o.getParkSectionCodeList().size()))
.findFirst().orElse(null);
} else {
inboundRouting = inboundRoutings.stream().filter(inRouting ->
Objects.equals(inRouting.getStartSectionCode(), outRefLoop.getStartSectionCode()))
Objects.equals(inRouting.getStartSectionCode(), outRefLoop.getStartSectionCode())&& Objects.equals(inRouting.getRight(), outRefLoop.getRight()))
.sorted(Comparator.comparingInt(o -> o.getParkSectionCodeList().size()))
.findFirst().orElse(null);
}

View File

@ -77,6 +77,9 @@ public class RunPlanEChartsDataVO {
@Getter
@Setter
class TripNumberData {
int startSecondTime;
int endSecondTime;
String tripNumber;
@ -97,6 +100,8 @@ public class RunPlanEChartsDataVO {
List<StationTime> stationTimeList;
TripNumberData(RunPlanTripVO runPlanTripVO) {
this.startSecondTime = runPlanTripVO.getStartTime().toSecondOfDay();
this.endSecondTime = runPlanTripVO.getEndTime().toSecondOfDay();
this.tripNumber = runPlanTripVO.getTripNumber();
this.directionCode = runPlanTripVO.getDirectionCode();
this.destinationCode = runPlanTripVO.getDestinationCode();