Commit 7a72d561867ec81f84e2be373d317fb45574ed2a
1 parent
f0a0253e
update
Showing
13 changed files
with
152 additions
and
225 deletions
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| @@ -34,4 +34,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | @@ -34,4 +34,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | ||
| 34 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ | 34 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ |
| 35 | return lineConfigService.editStartOptTime(time, lineCode); | 35 | return lineConfigService.editStartOptTime(time, lineCode); |
| 36 | } | 36 | } |
| 37 | + | ||
| 38 | + @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) | ||
| 39 | + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ | ||
| 40 | + return lineConfigService.editOutTimeType(lineCode, type); | ||
| 41 | + } | ||
| 37 | } | 42 | } |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| @@ -63,7 +63,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -63,7 +63,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 63 | @Override | 63 | @Override |
| 64 | public void run(String... arg0) throws Exception { | 64 | public void run(String... arg0) throws Exception { |
| 65 | logger.info("gpsDataLoader,20,8"); | 65 | logger.info("gpsDataLoader,20,8"); |
| 66 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 8, TimeUnit.SECONDS); | 66 | + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 8, TimeUnit.SECONDS); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | public static GpsEntity add(GpsEntity gps) { | 69 | public static GpsEntity add(GpsEntity gps) { |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| @@ -158,7 +158,6 @@ public class Arrival2Schedule implements ApplicationContextAware { | @@ -158,7 +158,6 @@ public class Arrival2Schedule implements ApplicationContextAware { | ||
| 158 | 158 | ||
| 159 | //漂移判定 | 159 | //漂移判定 |
| 160 | if(driftCheck(mr, arr)){ | 160 | if(driftCheck(mr, arr)){ |
| 161 | - | ||
| 162 | mr.sch.setFcsjActualAll(mr.ts); | 161 | mr.sch.setFcsjActualAll(mr.ts); |
| 163 | //通知客户端 | 162 | //通知客户端 |
| 164 | sendUtils.sendFcsj(mr.sch); | 163 | sendUtils.sendFcsj(mr.sch); |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -62,15 +62,11 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -62,15 +62,11 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 62 | public static LinkedList<ScheduleRealInfo> pstBuffer; | 62 | public static LinkedList<ScheduleRealInfo> pstBuffer; |
| 63 | 63 | ||
| 64 | // 排序器 | 64 | // 排序器 |
| 65 | - private static ScheduleComparator.FCNO schNoComparator; | ||
| 66 | - //private static ScheduleComparator.FCSJ schFcsjComparator; | 65 | + private static ScheduleComparator.FCSJ schFCSJComparator; |
| 67 | 66 | ||
| 68 | @Autowired | 67 | @Autowired |
| 69 | LineConfigData lineConfigData; | 68 | LineConfigData lineConfigData; |
| 70 | 69 | ||
| 71 | - /*@Autowired | ||
| 72 | - ScheduleRealInfoService scheduleRealService;*/ | ||
| 73 | - | ||
| 74 | @Autowired | 70 | @Autowired |
| 75 | ScheduleRealInfoRepository schRepository; | 71 | ScheduleRealInfoRepository schRepository; |
| 76 | 72 | ||
| @@ -90,7 +86,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -90,7 +86,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 90 | nbbmScheduleMap = ArrayListMultimap.create(); | 86 | nbbmScheduleMap = ArrayListMultimap.create(); |
| 91 | id2SchedulMap = new HashMap<>(); | 87 | id2SchedulMap = new HashMap<>(); |
| 92 | pstBuffer = new LinkedList<>(); | 88 | pstBuffer = new LinkedList<>(); |
| 93 | - schNoComparator = new ScheduleComparator.FCNO(); | 89 | + schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 94 | currSchDateMap = new HashMap<>(); | 90 | currSchDateMap = new HashMap<>(); |
| 95 | nbbm2SEStationMap = TreeMultimap.create(); | 91 | nbbm2SEStationMap = TreeMultimap.create(); |
| 96 | } | 92 | } |
| @@ -167,11 +163,18 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -167,11 +163,18 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 167 | //添加到缓存 | 163 | //添加到缓存 |
| 168 | putAll(list); | 164 | putAll(list); |
| 169 | 165 | ||
| 170 | - //计算“起点站应到”时间 | ||
| 171 | Set<String> cars = searchAllCars(list); | 166 | Set<String> cars = searchAllCars(list); |
| 167 | + //计算“起点站应到”时间 | ||
| 172 | for(String nbbm : cars) | 168 | for(String nbbm : cars) |
| 173 | schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | 169 | schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); |
| 174 | 170 | ||
| 171 | + //是否是出站即出场 | ||
| 172 | + LineConfig conf = lineConfigData.get(lineCode); | ||
| 173 | + if(conf.getOutConfig() == 2){ | ||
| 174 | + for(String nbbm : cars) | ||
| 175 | + schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm)); | ||
| 176 | + } | ||
| 177 | + | ||
| 175 | // 页面 翻班通知 | 178 | // 页面 翻班通知 |
| 176 | sendUtils.shiftSchedule(lineCode); | 179 | sendUtils.shiftSchedule(lineCode); |
| 177 | } catch (Exception e) { | 180 | } catch (Exception e) { |
| @@ -290,6 +293,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -290,6 +293,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 290 | logger.error("loadPlanSch... 计算终点时间失败..."); | 293 | logger.error("loadPlanSch... 计算终点时间失败..."); |
| 291 | } | 294 | } |
| 292 | } | 295 | } |
| 296 | + //计划里程为0,直接清空 | ||
| 297 | + if(sch.getJhlc() != null && sch.getJhlc() == 0) | ||
| 298 | + sch.setJhlc(null); | ||
| 293 | } | 299 | } |
| 294 | } catch (Exception e) { | 300 | } catch (Exception e) { |
| 295 | logger.error("", e); | 301 | logger.error("", e); |
| @@ -418,28 +424,6 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -418,28 +424,6 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 418 | return next; | 424 | return next; |
| 419 | } | 425 | } |
| 420 | 426 | ||
| 421 | - /** | ||
| 422 | - * | ||
| 423 | - * @Title: prveRealSch | ||
| 424 | - * @Description: TODO(获取上一个已实际发出的班次) | ||
| 425 | - */ | ||
| 426 | -/* public ScheduleRealInfo prveSjfc(ScheduleRealInfo sch) { | ||
| 427 | - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | ||
| 428 | - // 排序 | ||
| 429 | - Collections.sort(list, schNoComparator); | ||
| 430 | - | ||
| 431 | - ScheduleRealInfo prve = null; | ||
| 432 | - | ||
| 433 | - int i = list.indexOf(sch); | ||
| 434 | - for (; i >= 0; i--){ | ||
| 435 | - if (list.get(i).getFcsjActual() != null){ | ||
| 436 | - prve = list.get(i); | ||
| 437 | - break; | ||
| 438 | - } | ||
| 439 | - } | ||
| 440 | - return prve; | ||
| 441 | - }*/ | ||
| 442 | - | ||
| 443 | public void put(ScheduleRealInfo sch) { | 427 | public void put(ScheduleRealInfo sch) { |
| 444 | schAttrCalculator | 428 | schAttrCalculator |
| 445 | .calcRealDate(sch) | 429 | .calcRealDate(sch) |
| @@ -466,7 +450,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -466,7 +450,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 466 | public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { | 450 | public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { |
| 467 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | 451 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 468 | // 排序 | 452 | // 排序 |
| 469 | - Collections.sort(list, schNoComparator); | 453 | + Collections.sort(list, schFCSJComparator); |
| 470 | 454 | ||
| 471 | List<ScheduleRealInfo> rs = new ArrayList<>(); | 455 | List<ScheduleRealInfo> rs = new ArrayList<>(); |
| 472 | ScheduleRealInfo temp; | 456 | ScheduleRealInfo temp; |
| @@ -554,33 +538,6 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -554,33 +538,6 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 554 | pstBuffer.add(sch); | 538 | pstBuffer.add(sch); |
| 555 | } | 539 | } |
| 556 | 540 | ||
| 557 | - /** | ||
| 558 | - * | ||
| 559 | - * @Title: outSch | ||
| 560 | - * @Description: TODO(出场班次) | ||
| 561 | - */ | ||
| 562 | -/* public List<ScheduleRealInfo> outSch(String nbbm){ | ||
| 563 | - List<ScheduleRealInfo> all = nbbmScheduleMap.get(nbbm) | ||
| 564 | - ,outList = new ArrayList<>(); | ||
| 565 | - | ||
| 566 | - for(ScheduleRealInfo sch : all){ | ||
| 567 | - if(sch.getBcType().equals("out")) | ||
| 568 | - outList.add(sch); | ||
| 569 | - } | ||
| 570 | - return outList; | ||
| 571 | - } | ||
| 572 | - | ||
| 573 | - public ScheduleRealInfo nextOut(String nbbm){ | ||
| 574 | - List<ScheduleRealInfo> list = outSch(nbbm); | ||
| 575 | - Collections.sort(list, schNoComparator); | ||
| 576 | - ScheduleRealInfo sch = null; | ||
| 577 | - for(ScheduleRealInfo temp : list){ | ||
| 578 | - if(temp.getFcsjActual() == null) | ||
| 579 | - sch = temp; | ||
| 580 | - } | ||
| 581 | - | ||
| 582 | - return sch; | ||
| 583 | - }*/ | ||
| 584 | 541 | ||
| 585 | /** | 542 | /** |
| 586 | * | 543 | * |
| @@ -590,7 +547,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -590,7 +547,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 590 | public ScheduleRealInfo nextByBcType(String nbbm, String bcType){ | 547 | public ScheduleRealInfo nextByBcType(String nbbm, String bcType){ |
| 591 | List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); | 548 | List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); |
| 592 | 549 | ||
| 593 | - Collections.sort(list, schNoComparator); | 550 | + Collections.sort(list, schFCSJComparator); |
| 594 | ScheduleRealInfo sch = null; | 551 | ScheduleRealInfo sch = null; |
| 595 | for(ScheduleRealInfo temp : list){ | 552 | for(ScheduleRealInfo temp : list){ |
| 596 | if(temp.getFcsjActual() == null) | 553 | if(temp.getFcsjActual() == null) |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| @@ -87,7 +87,7 @@ public class SchAttrCalculator { | @@ -87,7 +87,7 @@ public class SchAttrCalculator { | ||
| 87 | * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) | 87 | * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) |
| 88 | */ | 88 | */ |
| 89 | public void calcQdzTimePlan(List<ScheduleRealInfo> list){ | 89 | public void calcQdzTimePlan(List<ScheduleRealInfo> list){ |
| 90 | - Collections.sort(list, new ScheduleComparator.FCNO()); | 90 | + Collections.sort(list, new ScheduleComparator.FCSJ()); |
| 91 | 91 | ||
| 92 | int len = list.size(); | 92 | int len = list.size(); |
| 93 | if(len == 0) | 93 | if(len == 0) |
| @@ -102,6 +102,34 @@ public class SchAttrCalculator { | @@ -102,6 +102,34 @@ public class SchAttrCalculator { | ||
| 102 | prve = curr; | 102 | prve = curr; |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * | ||
| 108 | + * @Title: connectOutSchedule | ||
| 109 | + * @Description: TODO(关联出场班次) | ||
| 110 | + */ | ||
| 111 | + public void connectOutSchedule(List<ScheduleRealInfo> list){ | ||
| 112 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 113 | + | ||
| 114 | + int len = list.size(); | ||
| 115 | + if(len == 0) | ||
| 116 | + return; | ||
| 117 | + | ||
| 118 | + ScheduleRealInfo prve = list.get(0), curr; | ||
| 119 | + for(int i = 1; i < len; i ++){ | ||
| 120 | + curr = list.get(i); | ||
| 121 | + | ||
| 122 | + //出站即出场关联 | ||
| 123 | + if(prve.getBcType().equals("out") && prve.getJhlc() == null) | ||
| 124 | + curr.setTwinsSch(prve); | ||
| 125 | + | ||
| 126 | + //进站即进场关联 | ||
| 127 | + if(curr.getBcType().equals("in") && curr.getJhlc() == null) | ||
| 128 | + prve.setTwinsSch(curr); | ||
| 129 | + | ||
| 130 | + prve = curr; | ||
| 131 | + } | ||
| 132 | + } | ||
| 105 | 133 | ||
| 106 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { | 134 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { |
| 107 | sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); | 135 | sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
| @@ -14,12 +14,12 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | @@ -14,12 +14,12 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 14 | */ | 14 | */ |
| 15 | public class ScheduleComparator { | 15 | public class ScheduleComparator { |
| 16 | 16 | ||
| 17 | - public static class FCNO implements Comparator<ScheduleRealInfo>{ | 17 | +/* public static class FCNO implements Comparator<ScheduleRealInfo>{ |
| 18 | @Override | 18 | @Override |
| 19 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | 19 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 20 | return s1.getFcno() - s2.getFcno(); | 20 | return s1.getFcno() - s2.getFcno(); |
| 21 | } | 21 | } |
| 22 | - } | 22 | + }*/ |
| 23 | 23 | ||
| 24 | public static class FCSJ implements Comparator<ScheduleRealInfo>{ | 24 | public static class FCSJ implements Comparator<ScheduleRealInfo>{ |
| 25 | 25 |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| @@ -55,10 +55,10 @@ public class LineConfig { | @@ -55,10 +55,10 @@ public class LineConfig { | ||
| 55 | /** 托管状态 */ | 55 | /** 托管状态 */ |
| 56 | private boolean trust; | 56 | private boolean trust; |
| 57 | 57 | ||
| 58 | - /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 */ | 58 | + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */ |
| 59 | private int outConfig; | 59 | private int outConfig; |
| 60 | 60 | ||
| 61 | - /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 */ | 61 | + /** 进场时间设置 0:真实进场(设备进入缓冲区时间) 1:请求进场时间 2:出站即出场*/ |
| 62 | private int inConfig; | 62 | private int inConfig; |
| 63 | 63 | ||
| 64 | /** 短语模板 , 号分隔多个 */ | 64 | /** 短语模板 , 号分隔多个 */ |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -102,19 +102,10 @@ public class ScheduleRealInfo { | @@ -102,19 +102,10 @@ public class ScheduleRealInfo { | ||
| 102 | */ | 102 | */ |
| 103 | private String bcType; | 103 | private String bcType; |
| 104 | 104 | ||
| 105 | - /** 设备请求出场或进场时间(班次为 出场或进场 时,该字段可能有值) | ||
| 106 | - private Long devRequestTime;*/ | ||
| 107 | - | ||
| 108 | - /** 停车场既首发站 */ | ||
| 109 | - @Transient | ||
| 110 | - private boolean parkIsFirstStation; | ||
| 111 | - /** 首发站既停车场 */ | ||
| 112 | - @Transient | ||
| 113 | - private boolean firstStationIsPark; | ||
| 114 | - /** 与其共享发车时间的进出场班次 */ | 105 | + /** 出站即出场 , 关联的进出场班次 */ |
| 115 | @JsonIgnore | 106 | @JsonIgnore |
| 116 | @Transient | 107 | @Transient |
| 117 | - private ScheduleRealInfo twins; | 108 | + private ScheduleRealInfo twinsSch; |
| 118 | 109 | ||
| 119 | /** 创建人 */ | 110 | /** 创建人 */ |
| 120 | @JsonIgnore | 111 | @JsonIgnore |
| @@ -539,35 +530,6 @@ public class ScheduleRealInfo { | @@ -539,35 +530,6 @@ public class ScheduleRealInfo { | ||
| 539 | } | 530 | } |
| 540 | } | 531 | } |
| 541 | 532 | ||
| 542 | - /** | ||
| 543 | - * @throws ParseException | ||
| 544 | - * | ||
| 545 | - * @Title: syncTime | ||
| 546 | - * @Description: TODO(根据计发时间,计算待发时间和终点时间) | ||
| 547 | - * @param 设定文件 | ||
| 548 | - * @return void 返回类型 | ||
| 549 | - * @throws | ||
| 550 | - | ||
| 551 | - public void syncTime(){ | ||
| 552 | - try{ | ||
| 553 | - this.setDfsj(this.getFcsj()); | ||
| 554 | - //发车时间戳 | ||
| 555 | - this.setFcsjT(sdfyyyyMMddHHmm.parse(this.realExecDate + " " + this.getFcsj()).getTime()); | ||
| 556 | - //待发时间戳 | ||
| 557 | - this.setDfsjT(this.getFcsjT()); | ||
| 558 | - //计算终点时间 | ||
| 559 | - calcEndTime(); | ||
| 560 | - | ||
| 561 | - if(this.fcsjActual != null) | ||
| 562 | - this.setFcsjActualAll(this.fcsjActual); | ||
| 563 | - | ||
| 564 | - if(this.zdsjActual != null) | ||
| 565 | - this.setZdsjActualAll(this.zdsjActual); | ||
| 566 | - }catch(Exception e){ | ||
| 567 | - e.printStackTrace(); | ||
| 568 | - } | ||
| 569 | - } */ | ||
| 570 | - | ||
| 571 | public void calcEndTime(){ | 533 | public void calcEndTime(){ |
| 572 | //计划终点时间 | 534 | //计划终点时间 |
| 573 | if(this.getBcsj() != null){ | 535 | if(this.getBcsj() != null){ |
| @@ -671,21 +633,6 @@ public class ScheduleRealInfo { | @@ -671,21 +633,6 @@ public class ScheduleRealInfo { | ||
| 671 | calcStatus(); | 633 | calcStatus(); |
| 672 | } | 634 | } |
| 673 | 635 | ||
| 674 | - //和依赖班次同步发车时间 | ||
| 675 | -/* public void synchroFcsj(){ | ||
| 676 | - if(this.isFirstStationIsPark() || this.isParkIsFirstStation()){ | ||
| 677 | - ScheduleRealInfo twinsSch = this.twins; | ||
| 678 | - if(null != twinsSch){ | ||
| 679 | - //有关联的出场班次 | ||
| 680 | - twinsSch.setFcsjActual(this.fcsjActual); | ||
| 681 | - twinsSch.setFcsjActualTime(this.fcsjActualTime); | ||
| 682 | - if(null != twinsSch.getSjfcModel()) | ||
| 683 | - twinsSch.getSjfcModel().setPersonTime(this.fcsjActualTime); | ||
| 684 | - twinsSch.calcStatus(); | ||
| 685 | - } | ||
| 686 | - } | ||
| 687 | - }*/ | ||
| 688 | - | ||
| 689 | /** | 636 | /** |
| 690 | * | 637 | * |
| 691 | * @Title: setFcsjActualAll | 638 | * @Title: setFcsjActualAll |
| @@ -718,19 +665,6 @@ public class ScheduleRealInfo { | @@ -718,19 +665,6 @@ public class ScheduleRealInfo { | ||
| 718 | } | 665 | } |
| 719 | } | 666 | } |
| 720 | 667 | ||
| 721 | - //和依赖的进场班次同步终点时间 | ||
| 722 | -/* public void synchroZdsj(){ | ||
| 723 | - if(this.isFirstStationIsPark()){ | ||
| 724 | - ScheduleRealInfo twinsSch = this.twins; | ||
| 725 | - if(null != twinsSch && twinsSch.getBcType().equals("in")){ | ||
| 726 | - //有关联的进场班次 | ||
| 727 | - twinsSch.setFcsjActual(this.zdsjActual); | ||
| 728 | - twinsSch.setFcsjActualTime(this.zdsjActualTime); | ||
| 729 | - twinsSch.calcStatus(); | ||
| 730 | - } | ||
| 731 | - } | ||
| 732 | - }*/ | ||
| 733 | - | ||
| 734 | public Long getSpId() { | 668 | public Long getSpId() { |
| 735 | return spId; | 669 | return spId; |
| 736 | } | 670 | } |
| @@ -755,9 +689,9 @@ public class ScheduleRealInfo { | @@ -755,9 +689,9 @@ public class ScheduleRealInfo { | ||
| 755 | if(StringUtils.isNotBlank(this.fcsjActual)){ | 689 | if(StringUtils.isNotBlank(this.fcsjActual)){ |
| 756 | this.status = 1; | 690 | this.status = 1; |
| 757 | 691 | ||
| 758 | - //进出场班次并且没有终点时间的 | 692 | + //进出场班次并且没有计划里程的 |
| 759 | if((this.bcType.equals("out") || this.bcType.equals("in")) | 693 | if((this.bcType.equals("out") || this.bcType.equals("in")) |
| 760 | - && this.zdsj == null){ | 694 | + && this.jhlc == null){ |
| 761 | this.status = 2; | 695 | this.status = 2; |
| 762 | } | 696 | } |
| 763 | } | 697 | } |
| @@ -792,60 +726,12 @@ public class ScheduleRealInfo { | @@ -792,60 +726,12 @@ public class ScheduleRealInfo { | ||
| 792 | public void setScheduleDateStr(String scheduleDateStr) { | 726 | public void setScheduleDateStr(String scheduleDateStr) { |
| 793 | this.scheduleDateStr = scheduleDateStr; | 727 | this.scheduleDateStr = scheduleDateStr; |
| 794 | } | 728 | } |
| 795 | - | ||
| 796 | - public boolean isParkIsFirstStation() { | ||
| 797 | - return parkIsFirstStation; | ||
| 798 | - } | ||
| 799 | - | ||
| 800 | - public void setParkIsFirstStation(boolean parkIsFirstStation) { | ||
| 801 | - this.parkIsFirstStation = parkIsFirstStation; | ||
| 802 | - } | ||
| 803 | - | ||
| 804 | -/* public ScheduleRealInfo getTwins() { | ||
| 805 | - return twins; | ||
| 806 | - } | ||
| 807 | - | ||
| 808 | - public void setTwins(ScheduleRealInfo twins) { | ||
| 809 | - this.twins = twins; | ||
| 810 | - } | ||
| 811 | - | ||
| 812 | - public boolean isFirstStationIsPark() { | ||
| 813 | - return firstStationIsPark; | ||
| 814 | - } | ||
| 815 | - | ||
| 816 | - public void setFirstStationIsPark(boolean firstStationIsPark) { | ||
| 817 | - this.firstStationIsPark = firstStationIsPark; | ||
| 818 | - }*/ | ||
| 819 | - | ||
| 820 | - | ||
| 821 | - /*public boolean statusTostart(){ | ||
| 822 | - return this.getFcsjActual() == null | ||
| 823 | - && this.getSjfcModel().getTime() != null; | ||
| 824 | - } | ||
| 825 | - | ||
| 826 | - public boolean statusToEnd(){ | ||
| 827 | - return this.getZdsjActual() == null | ||
| 828 | - && this.getSjddModel().getTime() != null; | ||
| 829 | - } | ||
| 830 | - | ||
| 831 | - public void revokeRealOutgo() { | ||
| 832 | - //this.setStatus(0); | ||
| 833 | - this.setFcsjActual(null); | ||
| 834 | - this.setFcsjActualTime(null); | ||
| 835 | - if(null != this.getSjfcModel()) | ||
| 836 | - this.getSjfcModel().resetNull(); | ||
| 837 | - this.calcStatus(); | ||
| 838 | - }*/ | ||
| 839 | 729 | ||
| 840 | public void clearFcsjActual(){ | 730 | public void clearFcsjActual(){ |
| 841 | this.setFcsjActual(null); | 731 | this.setFcsjActual(null); |
| 842 | this.setFcsjActualTime(null); | 732 | this.setFcsjActualTime(null); |
| 843 | this.calcStatus(); | 733 | this.calcStatus(); |
| 844 | } | 734 | } |
| 845 | - | ||
| 846 | -/* public boolean existDependent() { | ||
| 847 | - return this.isFirstStationIsPark() || this.parkIsFirstStation; | ||
| 848 | - }*/ | ||
| 849 | 735 | ||
| 850 | //清除实际终点时间 | 736 | //清除实际终点时间 |
| 851 | public void clearZdsjActual(){ | 737 | public void clearZdsjActual(){ |
| @@ -862,4 +748,12 @@ public class ScheduleRealInfo { | @@ -862,4 +748,12 @@ public class ScheduleRealInfo { | ||
| 862 | public void setOpDirectiveState(Integer opDirectiveState) { | 748 | public void setOpDirectiveState(Integer opDirectiveState) { |
| 863 | this.opDirectiveState = opDirectiveState; | 749 | this.opDirectiveState = opDirectiveState; |
| 864 | } | 750 | } |
| 751 | + | ||
| 752 | + public ScheduleRealInfo getTwinsSch() { | ||
| 753 | + return twinsSch; | ||
| 754 | + } | ||
| 755 | + | ||
| 756 | + public void setTwinsSch(ScheduleRealInfo twinsSch) { | ||
| 757 | + this.twinsSch = twinsSch; | ||
| 758 | + } | ||
| 865 | } | 759 | } |
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
| @@ -13,4 +13,6 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | @@ -13,4 +13,6 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | ||
| 13 | 13 | ||
| 14 | Map<String, Object> editStartOptTime(String time, String lineCode); | 14 | Map<String, Object> editStartOptTime(String time, String lineCode); |
| 15 | 15 | ||
| 16 | + Map<String, Object> editOutTimeType(String lineCode, int type); | ||
| 17 | + | ||
| 16 | } | 18 | } |
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
| @@ -64,4 +64,18 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -64,4 +64,18 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 64 | rs.put("time", time); | 64 | rs.put("time", time); |
| 65 | return rs; | 65 | return rs; |
| 66 | } | 66 | } |
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public Map<String, Object> editOutTimeType(String lineCode, int type) { | ||
| 70 | + Map<String, Object> rs = new HashMap<>(); | ||
| 71 | + LineConfig conf = lineConfigData.get(lineCode); | ||
| 72 | + | ||
| 73 | + conf.setOutConfig(type); | ||
| 74 | + conf.setInConfig(type); | ||
| 75 | + lineConfigData.set(conf); | ||
| 76 | + | ||
| 77 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 78 | + rs.put("type", type); | ||
| 79 | + return rs; | ||
| 80 | + } | ||
| 67 | } | 81 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -712,7 +712,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -712,7 +712,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 712 | } | 712 | } |
| 713 | else{ | 713 | else{ |
| 714 | // 按发车时间排序 | 714 | // 按发车时间排序 |
| 715 | - Collections.sort(list, new ScheduleComparator.FCNO()); | 715 | + Collections.sort(list, new ScheduleComparator.FCSJ()); |
| 716 | 716 | ||
| 717 | // 以第一个实际发车/待发时间为起点,调整间隔 | 717 | // 以第一个实际发车/待发时间为起点,调整间隔 |
| 718 | sch = list.get(0); | 718 | sch = list.get(0); |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; | @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; | ||
| 14 | 14 | ||
| 15 | import com.alibaba.fastjson.JSONObject; | 15 | import com.alibaba.fastjson.JSONObject; |
| 16 | import com.bsth.data.BasicData; | 16 | import com.bsth.data.BasicData; |
| 17 | +import com.bsth.data.LineConfigData; | ||
| 17 | import com.bsth.data.schedule.DayOfSchedule; | 18 | import com.bsth.data.schedule.DayOfSchedule; |
| 18 | import com.bsth.entity.directive.D80; | 19 | import com.bsth.entity.directive.D80; |
| 19 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| @@ -24,6 +25,9 @@ public class SendUtils{ | @@ -24,6 +25,9 @@ public class SendUtils{ | ||
| 24 | 25 | ||
| 25 | @Autowired | 26 | @Autowired |
| 26 | private RealControlSocketHandler socketHandler; | 27 | private RealControlSocketHandler socketHandler; |
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + LineConfigData lineConfigData; | ||
| 27 | 31 | ||
| 28 | private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | 32 | private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| 29 | 33 | ||
| @@ -33,17 +37,19 @@ public class SendUtils{ | @@ -33,17 +37,19 @@ public class SendUtils{ | ||
| 33 | * @throws JsonProcessingException | 37 | * @throws JsonProcessingException |
| 34 | * TODO(推送发车信息) | 38 | * TODO(推送发车信息) |
| 35 | */ | 39 | */ |
| 36 | - public void sendFcsj(ScheduleRealInfo schedule) { | ||
| 37 | - | 40 | + public void sendFcsj(ScheduleRealInfo sch) { |
| 41 | + //处理出站即出场的班次 | ||
| 42 | + connectOutSchTime(sch); | ||
| 43 | + | ||
| 38 | Map<String, Object> map = new HashMap<>(); | 44 | Map<String, Object> map = new HashMap<>(); |
| 39 | map.put("fn", "faChe"); | 45 | map.put("fn", "faChe"); |
| 40 | - map.put("t", schedule); | 46 | + map.put("t", sch); |
| 41 | map.put("dataStr", sdf.format(new Date())); | 47 | map.put("dataStr", sdf.format(new Date())); |
| 42 | 48 | ||
| 43 | ObjectMapper mapper = new ObjectMapper(); | 49 | ObjectMapper mapper = new ObjectMapper(); |
| 44 | 50 | ||
| 45 | try { | 51 | try { |
| 46 | - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); | 52 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); |
| 47 | } catch (Exception e) { | 53 | } catch (Exception e) { |
| 48 | logger.error("", e); | 54 | logger.error("", e); |
| 49 | } | 55 | } |
| @@ -77,11 +83,13 @@ public class SendUtils{ | @@ -77,11 +83,13 @@ public class SendUtils{ | ||
| 77 | * @throws NumberFormatException @Title: sendFcsj @Description: | 83 | * @throws NumberFormatException @Title: sendFcsj @Description: |
| 78 | * TODO(推送到达终点时间) @param @param schedule 班次 @throws | 84 | * TODO(推送到达终点时间) @param @param schedule 班次 @throws |
| 79 | */ | 85 | */ |
| 80 | - public void sendZdsj(ScheduleRealInfo schedule, ScheduleRealInfo nextSch, int finish) { | 86 | + public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) { |
| 87 | + //处理进站即进场的班次 | ||
| 88 | + connectInSchTime(sch); | ||
| 81 | 89 | ||
| 82 | Map<String, Object> map = new HashMap<>(); | 90 | Map<String, Object> map = new HashMap<>(); |
| 83 | map.put("fn", "zhongDian"); | 91 | map.put("fn", "zhongDian"); |
| 84 | - map.put("t", schedule); | 92 | + map.put("t", sch); |
| 85 | map.put("nt", nextSch); | 93 | map.put("nt", nextSch); |
| 86 | map.put("finish", finish); | 94 | map.put("finish", finish); |
| 87 | map.put("dataStr", sdf.format(new Date())); | 95 | map.put("dataStr", sdf.format(new Date())); |
| @@ -89,7 +97,7 @@ public class SendUtils{ | @@ -89,7 +97,7 @@ public class SendUtils{ | ||
| 89 | ObjectMapper mapper = new ObjectMapper(); | 97 | ObjectMapper mapper = new ObjectMapper(); |
| 90 | 98 | ||
| 91 | try { | 99 | try { |
| 92 | - socketHandler.sendMessageToLine(schedule.getXlBm(), mapper.writeValueAsString(map)); | 100 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); |
| 93 | } catch (Exception e) { | 101 | } catch (Exception e) { |
| 94 | logger.error("", e); | 102 | logger.error("", e); |
| 95 | } | 103 | } |
| @@ -141,5 +149,36 @@ public class SendUtils{ | @@ -141,5 +149,36 @@ public class SendUtils{ | ||
| 141 | refreshSch(list); | 149 | refreshSch(list); |
| 142 | } | 150 | } |
| 143 | 151 | ||
| 144 | - //public void sendReportOutTime(ScheduleRealInfo sch) | 152 | + |
| 153 | + //出站即出场 | ||
| 154 | + public void connectOutSchTime(ScheduleRealInfo sch){ | ||
| 155 | + try{ | ||
| 156 | + ScheduleRealInfo twins = sch.getTwinsSch(); | ||
| 157 | + if(twins != null | ||
| 158 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2){ | ||
| 159 | + | ||
| 160 | + twins.setFcsjActualAll(sch.getFcsjActualTime()); | ||
| 161 | + //刷新关联的出场班次 | ||
| 162 | + refreshSch(twins); | ||
| 163 | + } | ||
| 164 | + }catch(Exception e){ | ||
| 165 | + logger.error("", e); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + //进站即出场 | ||
| 170 | + public void connectInSchTime(ScheduleRealInfo sch){ | ||
| 171 | + try{ | ||
| 172 | + ScheduleRealInfo twins = sch.getTwinsSch(); | ||
| 173 | + if(twins != null | ||
| 174 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2){ | ||
| 175 | + | ||
| 176 | + twins.setZdsjActualAll(sch.getZdsjActualTime()); | ||
| 177 | + //刷新关联的出场班次 | ||
| 178 | + refreshSch(twins); | ||
| 179 | + } | ||
| 180 | + }catch(Exception e){ | ||
| 181 | + logger.error("", e); | ||
| 182 | + } | ||
| 183 | + } | ||
| 145 | } | 184 | } |
src/main/resources/static/pages/control/lineConfig/config.html
| @@ -211,23 +211,14 @@ butto.line-config-btn:active{ | @@ -211,23 +211,14 @@ butto.line-config-btn:active{ | ||
| 211 | </div> | 211 | </div> |
| 212 | </section> | 212 | </section> |
| 213 | 213 | ||
| 214 | - <!--<section> | ||
| 215 | - <h3>出场时间</h3> | ||
| 216 | - | ||
| 217 | - <div class="settings-row" > | ||
| 218 | - <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 作为出场班次的实际时间。</p> | ||
| 219 | - </div> | ||
| 220 | - </section> | ||
| 221 | ---> | ||
| 222 | -<!-- | ||
| 223 | <section> | 214 | <section> |
| 224 | - <h3>进场时间</h3> | 215 | + <h3>班次进出场时间</h3> |
| 225 | 216 | ||
| 226 | <div class="settings-row" > | 217 | <div class="settings-row" > |
| 227 | - <p > 使用 <a href="javascript:;" data-type="select" id="inTimeType"></a> 作为进场班次的实际时间。</p> | 218 | + <p > 使用 <a href="javascript:;" data-type="select" id="outTimeType"></a> 时间作为出场班次的实际时间。</p> |
| 228 | </div> | 219 | </div> |
| 229 | </section> | 220 | </section> |
| 230 | ---> | 221 | + |
| 231 | </form> | 222 | </form> |
| 232 | </script> | 223 | </script> |
| 233 | 224 | ||
| @@ -305,7 +296,6 @@ butto.line-config-btn:active{ | @@ -305,7 +296,6 @@ butto.line-config-btn:active{ | ||
| 305 | //运营开始时间 | 296 | //运营开始时间 |
| 306 | $('#startOptTimeLink').editable({ | 297 | $('#startOptTimeLink').editable({ |
| 307 | type: 'time', | 298 | type: 'time', |
| 308 | - title:'修改线路运营开始时间', | ||
| 309 | placement: 'right', | 299 | placement: 'right', |
| 310 | display: false, | 300 | display: false, |
| 311 | validate: function(value){ | 301 | validate: function(value){ |
| @@ -316,42 +306,41 @@ butto.line-config-btn:active{ | @@ -316,42 +306,41 @@ butto.line-config-btn:active{ | ||
| 316 | }) | 306 | }) |
| 317 | .on('save', function(e, params) { | 307 | .on('save', function(e, params) { |
| 318 | var index = showLoad('提交数据...'); | 308 | var index = showLoad('提交数据...'); |
| 319 | - var lineCode = $('.line_config_tree li.selected').data('code'); | ||
| 320 | - $post('/lineConfig/editTime', {lineCode: lineCode, time: params.newValue} | 309 | + $post('/lineConfig/editTime', {lineCode: getLineCode(), time: params.newValue} |
| 321 | ,function(rs){ | 310 | ,function(rs){ |
| 322 | layer.close(index); | 311 | layer.close(index); |
| 323 | $('#startOptTimeLink').text(rs.time); | 312 | $('#startOptTimeLink').text(rs.time); |
| 324 | }); | 313 | }); |
| 325 | }); | 314 | }); |
| 326 | 315 | ||
| 327 | -/* //出场时间类型 | 316 | + //进出场时间类型 |
| 328 | $('#outTimeType').editable({ | 317 | $('#outTimeType').editable({ |
| 329 | value: conf.outConfig, | 318 | value: conf.outConfig, |
| 330 | inputclass: 'form-control', | 319 | inputclass: 'form-control', |
| 331 | placement: 'right', | 320 | placement: 'right', |
| 332 | source: [{ | 321 | source: [{ |
| 333 | value: 0, | 322 | value: 0, |
| 334 | - text: '离开缓冲区时间' | 323 | + text: 'gps出场' |
| 335 | }, { | 324 | }, { |
| 336 | value: 1, | 325 | value: 1, |
| 337 | - text: '请求出场时间' | ||
| 338 | - }] | ||
| 339 | - }); | ||
| 340 | - | ||
| 341 | - //进场时间类型 | ||
| 342 | - $('#inTimeType').editable({ | ||
| 343 | - value: conf.inConfig, | ||
| 344 | - inputclass: 'form-control', | ||
| 345 | - placement: 'right', | ||
| 346 | - source: [{ | ||
| 347 | - value: 0, | ||
| 348 | - text: '离开缓冲区时间' | 326 | + text: '请求出场' |
| 349 | }, { | 327 | }, { |
| 350 | - value: 1, | ||
| 351 | - text: '请求进场时间' | 328 | + value: 2, |
| 329 | + text: '出站即出场' | ||
| 352 | }] | 330 | }] |
| 353 | - }); */ | ||
| 354 | - | 331 | + }) |
| 332 | + .on('save', function(e, params) { | ||
| 333 | + var index = showLoad('提交数据...'); | ||
| 334 | + $post('/lineConfig/editOutTimeType', {lineCode: lineCode, type: params.newValue} | ||
| 335 | + ,function(rs){ | ||
| 336 | + layer.close(index); | ||
| 337 | + $('#outTimeType').val(rs.type); | ||
| 338 | + }); | ||
| 339 | + }); | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + function getLineCode(){ | ||
| 343 | + return $('.line_config_tree li.selected').data('code'); | ||
| 355 | } | 344 | } |
| 356 | }(); | 345 | }(); |
| 357 | </script> | 346 | </script> |
| 358 | \ No newline at end of file | 347 | \ No newline at end of file |