ScheduleRealInfo.java
17.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
package com.bsth.entity.realcontrol;
import com.bsth.entity.sys.SysUser;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* 实际排班计划明细。
*/
@Entity
@Table(name = "bsth_c_s_sp_info_real")
@NamedEntityGraphs({
@NamedEntityGraph(name = "scheduleRealInfo_cTasks", attributeNodes = {
@NamedAttributeNode("cTasks")
})
})
public class ScheduleRealInfo {
/** 主键Id */
@Id
@GeneratedValue
private Long id;
/** 计划ID */
private Long spId;
/** 排班计划日期 */
private Date scheduleDate;
private String scheduleDateStr;
/** 真实执行时间 yyyy-MM-dd */
private String realExecDate;
/** 线路名称 */
private String xlName;
/** 线路编码 */
private String xlBm;
/** 路牌名称 */
private String lpName;
/** 车辆自编号 */
private String clZbh;
/** 驾驶员工号 */
private String jGh;
/** 驾驶员名字 */
private String jName;
/** 售票员工号 */
private String sGh;
/** 售票员名字 */
private String sName;
/** 线路方向 */
private String xlDir;
/** 起点站code*/
private String qdzCode;
/** 起点站名字 */
private String qdzName;
/** 终点站code*/
private String zdzCode;
/** 终点站名字 */
private String zdzName;
/** 计划发车时间(格式 HH:mm) */
private String fcsj;
/** 计划发车时间戳*/
@Transient
private Long fcsjT;
/** 计划终点时间(格式 HH:mm) */
private String zdsj;
/** 计划终点时间戳*/
@Transient
private Long zdsjT;
/** 发车顺序号 */
private Integer fcno;
/** 对应班次数 */
private Integer bcs;
/** 计划里程 */
private Double jhlc;
/** 原始计划里程 (原计调的数据) */
private Double jhlcOrig;
/** 实际里程 这个字段被废弃*/
private Double realMileage;
/** 实际里程 */
@Transient
private String sjlc;
/** 班次历时 */
private Integer bcsj;
/**
* 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
*/
private String bcType;
/** 创建人 */
@JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
private SysUser createBy;
/** 修改人 */
@JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
private SysUser updateBy;
/** 创建日期 */
@Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private Date createDate;
/** 修改日期 */
@Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private Date updateDate;
/** 实际发车时间*/
private String fcsjActual;
/** 实际发车时间戳*/
@Transient
private Long fcsjActualTime;
/**实际终点时间 */
private String zdsjActual;
/** 实际终点时间戳*/
@Transient
private Long zdsjActualTime;
/**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
private int status;
private String adjustExps;
/** 是否是临加班次 */
private boolean sflj;
/** 是否误点 (应发未发)*/
@Transient
private boolean late;
/** 是否误点 (应发未到) */
@Transient
private boolean late2;
/** 误点停靠时间 */
@Transient
private float lateMinute;
/** 备注*/
private String remarks;
/** 原计划排班备注 */
private String remark;
/**待发时间(格式 HH:mm) */
private String dfsj;
/**待发时间戳 */
@Transient
private Long dfsjT;
/** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
private Integer directiveState = -1;
/** “运营状态” 指令下发状态 60: 已发送, 100: 设备确认收到 0:失败*/
private Integer opDirectiveState;
/** 起点站计划到达时间 */
@Transient
private String qdzArrDatejh;
/** 起点站实际到达时间 */
@Transient
private String qdzArrDatesj;
/** 子任务 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
private Set<ChildTaskPlan> cTasks = new HashSet<>();
/** 关联的公司名称 */
private String gsName;
/** 关联的公司编码 */
private String gsBm;
/** 关联的分公司名称 */
private String fgsName;
/** 关联的分公司编码 */
private String fgsBm;
/** 出场顺序号 */
private Integer ccno;
//待发调试(是否自动调整)
private boolean dfAuto;
//是否有GPS信号
private boolean online;
/** 是否有补发GPS信号 */
private boolean reissue;
public boolean isDfAuto() {
return dfAuto;
}
public void setDfAuto(boolean dfAuto) {
this.dfAuto = dfAuto;
}
public boolean isOnline() {
return online;
}
public void setOnline(boolean online) {
this.online = online;
}
public String getQdzArrDatejh() {
return qdzArrDatejh;
}
public void setQdzArrDatejh(String qdzArrDatejh) {
this.qdzArrDatejh = qdzArrDatejh;
}
public String getQdzArrDatesj() {
return qdzArrDatesj;
}
public void setQdzArrDatesj(String qdzArrDatesj) {
this.qdzArrDatesj = qdzArrDatesj;
}
public void setcTasks(Set<ChildTaskPlan> cTasks) {
this.cTasks = cTasks;
}
public String getGsName() {
return gsName;
}
public void setGsName(String gsName) {
this.gsName = gsName;
}
public String getGsBm() {
return gsBm;
}
public void setGsBm(String gsBm) {
this.gsBm = gsBm;
}
public String getFgsName() {
return fgsName;
}
public void setFgsName(String fgsName) {
this.fgsName = fgsName;
}
public String getFgsBm() {
return fgsBm;
}
public void setFgsBm(String fgsBm) {
this.fgsBm = fgsBm;
}
public Integer getCcno() {
return ccno;
}
public void setCcno(Integer ccno) {
this.ccno = ccno;
}
/** ----------------
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private RealTimeModel sjfcModel;
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private RealTimeModel sjddModel;
*/
public void addRemarks(String remark){
if(StringUtils.isBlank(remark))
return;
String old = this.getRemarks();
if(StringUtils.isBlank(old))
old = "";
old += remark + ";";
this.setRemarks(old);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getScheduleDate() {
return scheduleDate;
}
public void setScheduleDate(Date scheduleDate) {
this.scheduleDate = scheduleDate;
}
public String getXlName() {
return xlName;
}
public void setXlName(String xlName) {
this.xlName = xlName;
}
public String getXlBm() {
return xlBm;
}
public void setXlBm(String xlBm) {
this.xlBm = xlBm;
}
public String getLpName() {
return lpName;
}
public void setLpName(String lpName) {
this.lpName = lpName;
}
public String getClZbh() {
return clZbh;
}
public void setClZbh(String clZbh) {
this.clZbh = clZbh;
}
public String getjGh() {
return jGh;
}
public void setjGh(String jGh) {
this.jGh = jGh;
}
public String getjName() {
return jName;
}
public void setjName(String jName) {
this.jName = jName;
}
public String getsGh() {
if(sGh == null)
return "";
return sGh;
}
public void setsGh(String sGh) {
this.sGh = sGh;
}
public String getsName() {
if(sGh == null)
return "";
return sName;
}
public void setsName(String sName) {
this.sName = sName;
}
public String getXlDir() {
return xlDir;
}
public void setXlDir(String xlDir) {
this.xlDir = xlDir;
}
public String getQdzCode() {
return qdzCode;
}
public void setQdzCode(String qdzCode) {
this.qdzCode = qdzCode;
}
public String getQdzName() {
return qdzName;
}
public void setQdzName(String qdzName) {
this.qdzName = qdzName;
}
public String getZdzCode() {
return zdzCode;
}
public void setZdzCode(String zdzCode) {
this.zdzCode = zdzCode;
}
public String getZdzName() {
return zdzName;
}
public void setZdzName(String zdzName) {
this.zdzName = zdzName;
}
public String getFcsj() {
return fcsj;
}
public void setFcsj(String fcsj) {
this.fcsj = fcsj;
}
public Long getFcsjT() {
return fcsjT;
}
public void setFcsjT(Long fcsjT) {
this.fcsjT = fcsjT;
}
public String getZdsj() {
return zdsj;
}
public void setZdsj(String zdsj) {
this.zdsj = zdsj;
}
public Long getZdsjT() {
return zdsjT;
}
public void setZdsjT(Long zdsjT) {
this.zdsjT = zdsjT;
}
public Integer getFcno() {
return fcno;
}
public void setFcno(Integer fcno) {
this.fcno = fcno;
}
public Integer getBcs() {
return bcs;
}
public void setBcs(Integer bcs) {
this.bcs = bcs;
}
public Double getJhlc() {
return jhlc;
}
public void setJhlc(Double jhlc) {
this.jhlc = jhlc;
//临加班次 计划公里 和 实际计划公里一样
if(this.isSflj())
this.setJhlcOrig(this.getJhlc());
}
public String getSjlc() {
return sjlc;
}
public void setSjlc(String sjlc) {
this.sjlc = sjlc;
}
public Integer getBcsj() {
return bcsj;
}
public void setBcsj(Integer bcsj) {
this.bcsj = bcsj;
}
public String getBcType() {
return bcType;
}
public void setBcType(String bcType) {
this.bcType = bcType;
}
public SysUser getCreateBy() {
return createBy;
}
public void setCreateBy(SysUser createBy) {
this.createBy = createBy;
}
public SysUser getUpdateBy() {
return updateBy;
}
public void setUpdateBy(SysUser updateBy) {
this.updateBy = updateBy;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getFcsjActual() {
return fcsjActual;
}
public void setFcsjActual(String fcsjActual) {
this.fcsjActual = fcsjActual;
}
public Long getFcsjActualTime() {
return fcsjActualTime;
}
public void setFcsjActualTime(Long fcsjActualTime) {
this.fcsjActualTime = fcsjActualTime;
}
public String getZdsjActual() {
return zdsjActual;
}
public void setZdsjActual(String zdsjActual) {
this.zdsjActual = zdsjActual;
}
public Long getZdsjActualTime() {
return zdsjActualTime;
}
public void setZdsjActualTime(Long zdsjActualTime) {
this.zdsjActualTime = zdsjActualTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getDfsj() {
return dfsj;
}
public void setDfsj(String dfsj) {
this.dfsj = dfsj;
}
public Long getDfsjT() {
return dfsjT;
}
public void setDfsjT(Long dfsjT) {
this.dfsjT = dfsjT;
}
@Transient
private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
@Transient
private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
public void setDfsjAll(Long dfsjT) {
this.dfsjT = dfsjT;
this.dfsj = fmtHHmm.print(this.dfsjT);
}
public void setDfsjAll(String dfsj) {
this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);
this.dfsj = dfsj;
}
public void calcEndTime(){
//计划终点时间
if(this.getBcsj() != null){
this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000));
this.setZdsj(fmtHHmm.print(this.zdsjT));
}
}
public Integer getDirectiveState() {
return directiveState;
}
public void setDirectiveState(Integer directiveState) {
this.directiveState = directiveState;
}
@Override
public boolean equals(Object obj) {
try{
return this.id.equals(((ScheduleRealInfo)obj).getId());
}catch(Exception e){
return false;
}
}
@Override
public int hashCode() {
return ("schedule_" + this.id).hashCode();
}
public String getQdzArrDateJH() {
return qdzArrDatejh;
}
public void setQdzArrDateJH(String qdzArrDateJH) {
this.qdzArrDatejh = qdzArrDateJH;
}
public String getQdzArrDateSJ() {
return qdzArrDatesj;
}
public void setQdzArrDateSJ(String qdzArrDateSJ) {
this.qdzArrDatesj = qdzArrDateSJ;
}
public boolean isSflj() {
return sflj;
}
public void setSflj(boolean sflj) {
this.sflj = sflj;
}
/**
*
* @Title: setFcsjAll
* @Description: TODO(设置计划发车时间)
* @throws
*/
public void setFcsjAll(String fcsj){
this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj);
this.fcsj = fcsj;
}
/**
*
* @Title: setFcsjAll
* @Description: TODO(设置计划发车时间)
* @throws
*/
public void setFcsjAll(Long fcsjT){
this.fcsjT = fcsjT;
this.fcsj = fmtHHmm.print(fcsjT);
}
/**
*
* @Title: setFcsjActualAll
* @Description: TODO(设置实际发车时间 字符串)
* @throws
*/
public void setFcsjActualAll(String fcsjActual){
this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);
this.fcsjActual = fcsjActual;
calcStatus();
}
/**
*
* @Title: setFcsjActualAll
* @Description: TODO(设置实际发车时间 时间戳)
* @throws
*/
public void setFcsjActualAll(Long t){
this.fcsjActualTime = t;
this.fcsjActual = fmtHHmm.print(t);
//更新班次状态
calcStatus();
}
/**
*
* @Title: setFcsjActualAll
* @Description: TODO(设置实际终点时间)
* @throws
*/
public void setZdsjActualAll(Long t){
this.zdsjActualTime = t;
this.zdsjActual = fmtHHmm.print(t);
//更新班次状态
calcStatus();
}
/**
*
* @Title: setFcsjActualAll
* @Description: TODO(设置实际终点时间)
* @throws
*/
public void setZdsjActualAll(String zdsjActual){
this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);
this.zdsjActual = zdsjActual;
calcStatus();
}
public Long getSpId() {
return spId;
}
public void setSpId(Long spId) {
this.spId = spId;
}
public String getRealExecDate() {
return realExecDate;
}
public void setRealExecDate(String realExecDate) {
this.realExecDate = realExecDate;
}
public void calcStatus() {
if(this.status == -1)
return;
this.status = 0;
if(StringUtils.isNotBlank(this.fcsjActual)){
this.status = 1;
//进出场班次并且没有计划里程的
if((this.bcType.equals("out") || this.bcType.equals("in"))
&& this.jhlc == null){
this.status = 2;
}
}
if(StringUtils.isNotBlank(this.zdsjActual))
this.status = 2;
}
public void destroy(){
this.jhlc = 0.0;
if(this.isSflj())
this.jhlcOrig = 0.0;
this.status = -1;
this.clearFcsjActual();
}
public boolean isDestroy(){
return this.status == -1;
}
/* public boolean isNotDestroy(){
return this.status != -1;
}*/
public Set<ChildTaskPlan> getcTasks() {
return cTasks;
}
/* public void setcTasks(Set<ChildTaskPlan> cTasks) {
this.cTasks = cTasks;
}*/
public String getScheduleDateStr() {
return scheduleDateStr;
}
public void setScheduleDateStr(String scheduleDateStr) {
this.scheduleDateStr = scheduleDateStr;
}
public void clearFcsjActual(){
this.setFcsjActual(null);
this.setFcsjActualTime(null);
this.calcStatus();
}
//清除实际终点时间
public void clearZdsjActual(){
this.setZdsjActual(null);
this.setZdsjActualTime(null);
calcStatus();
}
public Integer getOpDirectiveState() {
return opDirectiveState;
}
public void setOpDirectiveState(Integer opDirectiveState) {
this.opDirectiveState = opDirectiveState;
}
/* public ScheduleRealInfo getTwinsSch() {
return twinsSch;
}
public void setTwinsSch(ScheduleRealInfo twinsSch) {
this.twinsSch = twinsSch;
}*/
public boolean isLate() {
return late;
}
public void setLate(boolean late) {
this.late = late;
}
public String getAdjustExps() {
return adjustExps;
}
public void setAdjustExps(String adjustExps) {
this.adjustExps = adjustExps;
}
public boolean isReissue() {
return reissue;
}
public void setReissue(boolean reissue) {
this.reissue = reissue;
}
public Double getRealMileage() {
return realMileage;
}
public void setRealMileage(Double realMileage) {
this.realMileage = realMileage;
}
public Double getJhlcOrig() {
return jhlcOrig;
}
public void setJhlcOrig(Double jhlcOrig) {
this.jhlcOrig = jhlcOrig;
}
public void reCalcLate() {
if(this.getStatus() == 0
&& this.getFcsjActual() == null
&& this.dfsjT < System.currentTimeMillis()){
this.setLate(true);
}
else
this.setLate(false);
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public float getLateMinute() {
return lateMinute;
}
public void setLateMinute(float lateMinute) {
this.lateMinute = lateMinute;
}
public boolean isLate2() {
return late2;
}
public void setLate2(boolean late2) {
this.late2 = late2;
}
}