From 6ef313cfa9afc0e54e1cad726c7b0fc4dbf8a423 Mon Sep 17 00:00:00 2001 From: DU Date: Fri, 19 Mar 2021 11:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/services/RunPlanDraftService.java | 9 +++++++++ .../rtss/services/runplan/RunPlanGenerator.java | 10 +++++----- .../rtss/vo/client/runplan/RunPlanEChartsDataVO.java | 5 +++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/RunPlanDraftService.java b/src/main/java/club/joylink/rtss/services/RunPlanDraftService.java index b6dd6ed67..07c66fb90 100644 --- a/src/main/java/club/joylink/rtss/services/RunPlanDraftService.java +++ b/src/main/java/club/joylink/rtss/services/RunPlanDraftService.java @@ -783,6 +783,15 @@ public class RunPlanDraftService implements IRunPlanDraftService { @Override public List dataCheck(Long planId) { List errorList = new ArrayList<>(); + + //运行图验证内容: + // • 验证是否有时刻数据 + // • 找到每个服务发车时间,查找发车时间不能过早 结束时间不能过晚 + // • 同一服务 根据发车排序每个车次,往后每个时刻应该晚于上个且时刻之间时间应该根据站间运行等级距离计算最小值。 + // • 不同服务发车间隔>=1分45秒 + // • 同站车次间隔时间:不能过小 根据最大最小速度计算 站间距离 + // • 折返时间 + RunPlanVO planVO = getRunPlanById(planId); if (CollectionUtils.isEmpty(planVO.getTripList())) { errorList.add("运行图数据为空!"); diff --git a/src/main/java/club/joylink/rtss/services/runplan/RunPlanGenerator.java b/src/main/java/club/joylink/rtss/services/runplan/RunPlanGenerator.java index 92f21bc8a..1352cf3d5 100644 --- a/src/main/java/club/joylink/rtss/services/runplan/RunPlanGenerator.java +++ b/src/main/java/club/joylink/rtss/services/runplan/RunPlanGenerator.java @@ -59,16 +59,16 @@ public class RunPlanGenerator { List 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); } diff --git a/src/main/java/club/joylink/rtss/vo/client/runplan/RunPlanEChartsDataVO.java b/src/main/java/club/joylink/rtss/vo/client/runplan/RunPlanEChartsDataVO.java index 74da182b2..8dd3ed0cf 100644 --- a/src/main/java/club/joylink/rtss/vo/client/runplan/RunPlanEChartsDataVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/runplan/RunPlanEChartsDataVO.java @@ -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 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();