Commit 9deae92eda184fabcf177ed119a063d05fc5b247
Merge branch 'minhang' into qingpu
Showing
4 changed files
with
46 additions
and
10 deletions
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
| @@ -61,7 +61,7 @@ public class ForecastRealServer implements CommandLineRunner { | @@ -61,7 +61,7 @@ public class ForecastRealServer implements CommandLineRunner { | ||
| 61 | @Override | 61 | @Override |
| 62 | public void run(String... arg0) throws Exception { | 62 | public void run(String... arg0) throws Exception { |
| 63 | //2小时更新一次站点间耗时数据 | 63 | //2小时更新一次站点间耗时数据 |
| 64 | - Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); | 64 | + //Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| @@ -73,6 +73,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -73,6 +73,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 73 | 73 | ||
| 74 | @Override | 74 | @Override |
| 75 | public void run() { | 75 | public void run() { |
| 76 | + | ||
| 76 | //班次列表 | 77 | //班次列表 |
| 77 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); | 78 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); |
| 78 | //进出起终点数据 | 79 | //进出起终点数据 |
| @@ -231,11 +232,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -231,11 +232,7 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 231 | //车辆当前执行班次 | 232 | //车辆当前执行班次 |
| 232 | dayOfSchedule.addExecPlan(sch); | 233 | dayOfSchedule.addExecPlan(sch); |
| 233 | //期望车辆到达的终点 | 234 | //期望车辆到达的终点 |
| 234 | - ExpectArrivalEnd ead = new ExpectArrivalEnd(); | ||
| 235 | - ead.setNbbm(sch.getClZbh()); | ||
| 236 | - ead.setEndStation(sch.getZdzCode()); | ||
| 237 | - ead.setEndTime(sch.getZdsjT()); | ||
| 238 | - expectMap.put(ead.getNbbm(), ead); | 235 | + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); |
| 239 | } | 236 | } |
| 240 | 237 | ||
| 241 | /** | 238 | /** |
| @@ -255,8 +252,15 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -255,8 +252,15 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 255 | else | 252 | else |
| 256 | expectMap.remove(nbbm); | 253 | expectMap.remove(nbbm); |
| 257 | } | 254 | } |
| 258 | - sch.setZdsjActualAll(mr.ts); | ||
| 259 | 255 | ||
| 256 | + //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。 | ||
| 257 | + if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){ | ||
| 258 | + int prve_nen = dayOfSchedule.prveNotExecNum(sch); | ||
| 259 | + if(prve_nen > 0) | ||
| 260 | + return; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + sch.setZdsjActualAll(mr.ts); | ||
| 260 | int doneSum = dayOfSchedule.doneSum(nbbm); | 264 | int doneSum = dayOfSchedule.doneSum(nbbm); |
| 261 | ScheduleRealInfo next = dayOfSchedule.next(sch); | 265 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| 262 | if(null != next){ | 266 | if(null != next){ |
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
| 1 | package com.bsth.data.match; | 1 | package com.bsth.data.match; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * | 6 | * |
| 5 | * @ClassName: ExpectArrivalEnd | 7 | * @ClassName: ExpectArrivalEnd |
| @@ -15,6 +17,18 @@ public class ExpectArrivalEnd { | @@ -15,6 +17,18 @@ public class ExpectArrivalEnd { | ||
| 15 | private String endStation; | 17 | private String endStation; |
| 16 | 18 | ||
| 17 | private Long endTime; | 19 | private Long endTime; |
| 20 | + | ||
| 21 | + public static ExpectArrivalEnd getEndInstance(ScheduleRealInfo sch, long t){ | ||
| 22 | + ExpectArrivalEnd ead = new ExpectArrivalEnd(); | ||
| 23 | + ead.setNbbm(sch.getClZbh()); | ||
| 24 | + ead.setEndStation(sch.getZdzCode()); | ||
| 25 | + if(sch.getBcType().equals("out")) | ||
| 26 | + ead.setEndTime(sch.getZdsjT()); | ||
| 27 | + else{ | ||
| 28 | + ead.setEndTime(sch.getZdsjT() - (sch.getDfsjT() - t)); | ||
| 29 | + } | ||
| 30 | + return ead; | ||
| 31 | + } | ||
| 18 | 32 | ||
| 19 | public String getNbbm() { | 33 | public String getNbbm() { |
| 20 | return nbbm; | 34 | return nbbm; |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -120,9 +120,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -120,9 +120,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 120 | //翻班线程 | 120 | //翻班线程 |
| 121 | Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 240, TimeUnit.SECONDS); | 121 | Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 240, TimeUnit.SECONDS); |
| 122 | //入库 | 122 | //入库 |
| 123 | - Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | 123 | + //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); |
| 124 | //首班出场指令补发器 | 124 | //首班出场指令补发器 |
| 125 | - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 120, TimeUnit.SECONDS); | 125 | + //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 120, TimeUnit.SECONDS); |
| 126 | //班次误点扫描 | 126 | //班次误点扫描 |
| 127 | //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | 127 | //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); |
| 128 | } | 128 | } |
| @@ -520,6 +520,24 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -520,6 +520,24 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 520 | } | 520 | } |
| 521 | return rs; | 521 | return rs; |
| 522 | } | 522 | } |
| 523 | + | ||
| 524 | + /** | ||
| 525 | + * | ||
| 526 | + * @Title: prveNotExecNum | ||
| 527 | + * @Description: TODO(班次之前未执行班次数量) | ||
| 528 | + */ | ||
| 529 | + public int prveNotExecNum(ScheduleRealInfo sch){ | ||
| 530 | + int n = 0; | ||
| 531 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | ||
| 532 | + for(ScheduleRealInfo s : list){ | ||
| 533 | + if(s.getFcsjActual() == null && !s.isDestroy()) | ||
| 534 | + n ++; | ||
| 535 | + | ||
| 536 | + if(s.getId().equals(sch.getId())) | ||
| 537 | + break; | ||
| 538 | + } | ||
| 539 | + return n; | ||
| 540 | + } | ||
| 523 | 541 | ||
| 524 | /** | 542 | /** |
| 525 | * | 543 | * |
| @@ -577,7 +595,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -577,7 +595,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 577 | 595 | ||
| 578 | public void save(ScheduleRealInfo sch){ | 596 | public void save(ScheduleRealInfo sch){ |
| 579 | //schRepository.save(sch); | 597 | //schRepository.save(sch); |
| 580 | - pstBuffer.add(sch); | 598 | + //pstBuffer.add(sch); |
| 581 | } | 599 | } |
| 582 | 600 | ||
| 583 | 601 |