Commit 112c42c9729c07d446249120cf87d6215f6d766b
1 parent
b11fe36f
update
Showing
1 changed file
with
49 additions
and
4 deletions
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -2,7 +2,6 @@ package com.bsth.data.schedule; | @@ -2,7 +2,6 @@ package com.bsth.data.schedule; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | -import com.bsth.Application; | ||
| 6 | import com.bsth.data.LineConfigData; | 5 | import com.bsth.data.LineConfigData; |
| 7 | import com.bsth.data.directive.FirstScheduleCheckThread; | 6 | import com.bsth.data.directive.FirstScheduleCheckThread; |
| 8 | import com.bsth.data.gpsdata.GpsRealData; | 7 | import com.bsth.data.gpsdata.GpsRealData; |
| @@ -34,7 +33,6 @@ import org.springframework.stereotype.Component; | @@ -34,7 +33,6 @@ import org.springframework.stereotype.Component; | ||
| 34 | import java.text.ParseException; | 33 | import java.text.ParseException; |
| 35 | import java.text.SimpleDateFormat; | 34 | import java.text.SimpleDateFormat; |
| 36 | import java.util.*; | 35 | import java.util.*; |
| 37 | -import java.util.concurrent.TimeUnit; | ||
| 38 | 36 | ||
| 39 | /** | 37 | /** |
| 40 | * @author PanZhao | 38 | * @author PanZhao |
| @@ -134,7 +132,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -134,7 +132,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 134 | //首班出场指令补发器 | 132 | //首班出场指令补发器 |
| 135 | // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); | 133 | // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); |
| 136 | //班次误点扫描 | 134 | //班次误点扫描 |
| 137 | - Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | 135 | +// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); |
| 138 | 136 | ||
| 139 | //每天凌晨2点20提交数据到运管处 | 137 | //每天凌晨2点20提交数据到运管处 |
| 140 | long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | 138 | long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); |
| @@ -221,7 +219,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -221,7 +219,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 221 | } | 219 | } |
| 222 | 220 | ||
| 223 | // 页面 翻班通知 | 221 | // 页面 翻班通知 |
| 224 | - sendUtils.shiftSchedule(lineCode); | 222 | + //sendUtils.shiftSchedule(lineCode); |
| 225 | } catch (Exception e) { | 223 | } catch (Exception e) { |
| 226 | logger.error("", e); | 224 | logger.error("", e); |
| 227 | return -1; | 225 | return -1; |
| @@ -492,6 +490,41 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -492,6 +490,41 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 492 | } | 490 | } |
| 493 | 491 | ||
| 494 | /** | 492 | /** |
| 493 | + * 下一个相同走向的班次 | ||
| 494 | + * @param sch | ||
| 495 | + * @return | ||
| 496 | + */ | ||
| 497 | + public ScheduleRealInfo nextSame(ScheduleRealInfo sch){ | ||
| 498 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | ||
| 499 | + int outConfig = -1; | ||
| 500 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | ||
| 501 | + if (config != null) | ||
| 502 | + outConfig = config.getOutConfig(); | ||
| 503 | + | ||
| 504 | + boolean flag = false; | ||
| 505 | + ScheduleRealInfo next = null; | ||
| 506 | + for (ScheduleRealInfo temp : list) { | ||
| 507 | + if (temp.getId() == sch.getId()) { | ||
| 508 | + flag = true; | ||
| 509 | + continue; | ||
| 510 | + } | ||
| 511 | + //忽略烂班 | ||
| 512 | + if (temp.isDestroy()) | ||
| 513 | + continue; | ||
| 514 | + | ||
| 515 | + //出站既出场,忽略出场班次 | ||
| 516 | + if (outConfig == 2 && temp.getBcType().equals("out")) | ||
| 517 | + continue; | ||
| 518 | + | ||
| 519 | + if (flag && temp.getXlDir().equals(sch.getXlDir())) { | ||
| 520 | + next = temp; | ||
| 521 | + break; | ||
| 522 | + } | ||
| 523 | + } | ||
| 524 | + return next; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + /** | ||
| 495 | * 上一个班次 | 528 | * 上一个班次 |
| 496 | * | 529 | * |
| 497 | * @param sch | 530 | * @param sch |
| @@ -516,6 +549,18 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -516,6 +549,18 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 516 | return prev; | 549 | return prev; |
| 517 | } | 550 | } |
| 518 | 551 | ||
| 552 | + /** | ||
| 553 | + * 是否是首班出场 | ||
| 554 | + * @param sch | ||
| 555 | + * @return | ||
| 556 | + */ | ||
| 557 | + public boolean isFirstOut(ScheduleRealInfo sch){ | ||
| 558 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | ||
| 559 | + if(list.get(0).equals(sch) && sch.getBcType().equals("out")) | ||
| 560 | + return true; | ||
| 561 | + return false; | ||
| 562 | + } | ||
| 563 | + | ||
| 519 | public void put(ScheduleRealInfo sch) { | 564 | public void put(ScheduleRealInfo sch) { |
| 520 | schAttrCalculator | 565 | schAttrCalculator |
| 521 | .calcRealDate(sch) | 566 | .calcRealDate(sch) |