ScheduleRealInfoController.java
37 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
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
package com.bsth.controller.realcontrol;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.*;
import com.bsth.data.forecast.entity.ArrivalEntity;
import com.bsth.entity.sys.SysUser;
import com.bsth.security.util.SecurityUtils;
import com.bsth.util.ReportUtils;
import com.bsth.util.db.DBUtils_MS;
import com.bsth.util.db.DBUtils_control;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONArray;
import com.bsth.common.ResponseCode;
import com.bsth.controller.BaseController;
import com.bsth.controller.realcontrol.dto.ChangePersonCar;
import com.bsth.controller.realcontrol.dto.DfsjChange;
import com.bsth.data.BasicData;
import com.bsth.data.schedule.DayOfSchedule;
import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.entity.report.RepairReport;
import com.bsth.entity.schedule.SchedulePlanInfo;
import com.bsth.service.realcontrol.ScheduleRealInfoService;
@RestController
@RequestMapping("/realSchedule")
public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
@Autowired
ScheduleRealInfoService scheduleRealInfoService;
@Autowired
DayOfSchedule dayOfSchedule;
@RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
}
@RequestMapping(value = "/lines")
public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
return scheduleRealInfoService.findByLines(lines);
}
@RequestMapping(value = "/car")
public List<ScheduleRealInfo> findByCar(String nbbm){
return dayOfSchedule.findByNbbm(nbbm);
}
/**
*
* @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
* 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
*/
@RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
@RequestParam String dfsj,String bcType,
@RequestParam(defaultValue = "") String opType) {
return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
}
/**
*
* @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
*/
@RequestMapping(value = "/destroy", method = RequestMethod.POST)
public Map<String, Object> destroy(@RequestParam String idsStr
/*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
@RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
}
/**
*
* @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
*/
@RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
public Map<String, String> carDeviceMapp() {
return BasicData.deviceId2NbbmMap.inverse();
}
/**
*
* @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
* lineId @throws
*/
@RequestMapping(value = "/driver", method = RequestMethod.GET)
public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
return scheduleRealInfoService.findDriverByLine(lineCode);
}
/**
*
* @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
* lineId @throws
*/
@RequestMapping(value = "/conductor", method = RequestMethod.GET)
public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
return scheduleRealInfoService.findConductorByLine(lineCode);
}
/**
*
* @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
* lineId @throws
*/
@RequestMapping(value = "/cars", method = RequestMethod.GET)
public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
return scheduleRealInfoService.findCarByLine(lineCode);
}
/**
*
* @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
*/
@RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
return scheduleRealInfoService.sreachVehic(nbbm);
}
/**
*
* @Title: realOutAdjust
* @Description: TODO(实发调整)
* @param @param id 班次ID
* @param @param fcsjActual 实际发车时间 HH:mm
* @param @param remarks 备注
* @throws
*/
@RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
return scheduleRealInfoService.realOutAdjust(map);
}
/**
*
* @Title: revokeDestroy
* @Description: TODO(撤销烂班)
* @param @param id
* @throws
*/
@RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
public Map<String, Object> revokeDestroy(@RequestParam Long id){
return scheduleRealInfoService.revokeDestroy(id);
}
/**
*
* @Title: revokeRealOutgo
* @Description: TODO(撤销实发)
* @param @param id
* @throws
*/
@RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
return scheduleRealInfoService.revokeRealOutgo(id);
}
/**
* 撤销执行
* @param id
* @return
*/
@RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
public Map<String, Object> revokeRealArrive(@RequestParam Long id){
return scheduleRealInfoService.revokeRealArrive(id);
}
/**
*
* @Title: spaceAdjust
* @Description: TODO(间隔调整)
* @param @param ids 要调整的班次数组ID
* @param @param space 间隔
* @throws
*/
@RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
return scheduleRealInfoService.spaceAdjust(ids, space);
}
/**
*
* @Title: schInfoFineTune
* @Description: TODO(发车信息微调)
* @param @param map
* @throws
*/
@RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
return scheduleRealInfoService.schInfoFineTune(map);
}
/**
*
* @Title: outgoAdjustAll
* @Description: TODO(批量待发调整)
* @param @param list
* @throws
*/
@RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
public Map<String, Object> outgoAdjustAll(@RequestParam String params){
//反转义
params = StringEscapeUtils.unescapeHtml4(params);
return scheduleRealInfoService.outgoAdjustAll(params);
}
/**
*
* @Title: findByLineAndUpDown
* @Description: TODO(根据线路和走向获取班次)
* @param @param line
* @param @param upDown
*/
@RequestMapping(value = "/findByLineAndUpDown")
public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
return dayOfSchedule.findByLineAndUpDown(line, upDown);
}
/**
*
* @Title: findRouteByLine
* @Description: TODO(获取线路的站点,路段路由)
* @param @param lineCode
* @throws
*/
@RequestMapping(value = "/findRouteByLine")
public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
return scheduleRealInfoService.findRouteByLine(lineCode);
}
/**
*
* @Title: removeChildTask
* @Description: TODO(删除子任务)
* @param @param taskId 子任务ID
* @throws
*/
@RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
return scheduleRealInfoService.removeChildTask(taskId);
}
/**
*
* @Title: findByLineCode
* @Description: TODO(根据线路获取班次信息)
* @param @param lineCode
*/
@RequestMapping(value = "/lineCode/{lineCode}")
public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
return dayOfSchedule.findByLineCode(lineCode);
}
@RequestMapping(value = "/queryUserInfo")
public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
@RequestParam String date,@RequestParam String state) {
return scheduleRealInfoService.queryUserInfo(line, date,state);
}
@RequestMapping(value = "/queryUserInfoPx")
public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
@RequestParam String date,@RequestParam String state,@RequestParam String type) {
return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
}
@RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,
@RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);
}
@RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
,@RequestParam String date,@RequestParam String line) {
return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
}
@RequestMapping(value = "/dailyInfo")
public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
return scheduleRealInfoService.dailyInfo(line, date, type);
}
@RequestMapping(value = "/historyMessage")
public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
@RequestParam String code, @RequestParam String type) {
return scheduleRealInfoService.historyMessage(line, date, code, type);
}
@RequestMapping(value="/findLine")
public List<Map<String,String>> findLine(@RequestParam String line){
return scheduleRealInfoService.findLine(line);
}
@RequestMapping(value="/findKMBC",method = RequestMethod.GET)
public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
}
/**
* 路单公里统计 (闵行审计专用)
* @param jGh
* @param clZbh
* @param lpName
* @param date
* @param line
* @return
*/
@RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
}
@RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
public Map<String,Object> findKMBCQp(@RequestParam String clZbh
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
}
@RequestMapping(value="/findLpName")
public List<Map<String,String>> findLpName(@RequestParam String lpName){
return scheduleRealInfoService.findLpName(lpName);
}
@RequestMapping(value = "/account")
public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
@RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
return scheduleRealInfoService.account(line, date, code, xlName, type);
}
@RequestMapping(value = "/accountPx")
public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
@RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
}
@RequestMapping(value = "/correctForm")
public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
@RequestParam String endDate,
@RequestParam String lpName, @RequestParam String code,
@RequestParam String type,@RequestParam String changType) {
return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
}
/**
* @Title queryListWaybill
* @Description 查询行车路单列表
* @param jGh 驾驶员名字
* @param clZbh 车辆自编号(内部编号)
* @param lpName 路牌
* @return
*/
@RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);
}
/**
* @Title queryListWaybill
* @Description 查询行车路单列表(闵行审计专用路单)
* @param jName 驾驶员名字
* @param clZbh 车辆自编号(内部编号)
* @param lpName 路牌
* @return
*/
@RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
}
@RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
}
@RequestMapping(value="/statisticsDaily")
public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
@RequestParam String xlName, @RequestParam String type){
return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
}
@RequestMapping(value="/statisticsDaily_mh_2")
public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
@RequestParam String xlName, @RequestParam String type){
return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
}
@RequestMapping(value="/statisticsDailyTj")
public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
String gsdm="";
if(map.get("gsdm")!=null){
gsdm=map.get("gsdm").toString();
}
String fgsdm="";
if(map.get("fgsdm")!=null){
fgsdm=map.get("fgsdm").toString();
}
String line="";
if(map.get("line")!=null){
line=map.get("line").toString();
}
String date="";
if(map.get("date")!=null){
date=map.get("date").toString();
}
String date2="";
if(map.get("date2")!=null){
date2=map.get("date2").toString();
}
String xlName="";
if(map.get("xlName")!=null){
xlName=map.get("xlName").toString();
}
String type="";
if(map.get("type")!=null){
type=map.get("type").toString();
}
String nature="0";
if(map.get("nature")!=null){
nature=map.get("nature").toString();
}
return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
}
/*
* 公里修正报表
*/
@RequestMapping(value="/mileageReportTj")
public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
String gsdm="";
if(map.get("gsdm")!=null){
gsdm=map.get("gsdm").toString();
}
String fgsdm="";
if(map.get("fgsdm")!=null){
fgsdm=map.get("fgsdm").toString();
}
String line="";
if(map.get("line")!=null){
line=map.get("line").toString();
}
String date="";
if(map.get("date")!=null){
date=map.get("date").toString();
}
String date2="";
if(map.get("date2")!=null){
date2=map.get("date2").toString();
}
String xlName="";
if(map.get("xlName")!=null){
xlName=map.get("xlName").toString();
}
return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
}
/*
* 班次修正报表
*/
@RequestMapping(value="/scheduleCorrectionReport")
public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
String gsdm="";
if(map.get("gsdm")!=null){
gsdm=map.get("gsdm").toString();
}
String fgsdm="";
if(map.get("fgsdm")!=null){
fgsdm=map.get("fgsdm").toString();
}
String line="";
if(map.get("line")!=null){
line=map.get("line").toString();
}
String date="";
if(map.get("date")!=null){
date=map.get("date").toString();
}
String date2="";
if(map.get("date2")!=null){
date2=map.get("date2").toString();
}
String xlName="";
if(map.get("xlName")!=null){
xlName=map.get("xlName").toString();
}
return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
}
@RequestMapping(value="/MapById",method = RequestMethod.GET)
public Map<String, Object> MapById(@RequestParam("id") Long id){
return scheduleRealInfoService.MapById(id);
}
@RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
return scheduleRealInfoService.MapByIdQp(id);
}
/**
* @Title: scheduleDaily
* @Description: TODO(调度日报表)
* @param line 线路
* @param date 时间
* @return
*/
@RequestMapping(value="/scheduleDaily")
public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.scheduleDaily(line,date);
}
@RequestMapping(value="/realScheduleList")
public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleList(line,date);
}
@RequestMapping(value="/realScheduleList_zrw")
public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleList_zrw(line,date);
}
@RequestMapping(value="/realScheduleList_mh_2")
public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleList_mh_2(line,date);
}
@RequestMapping(value="/realScheduleListQp")
public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleListQp(line,date);
}
@RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
return scheduleRealInfoService.multi_tzrc(cpcs, null);
}
@RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
return scheduleRealInfoService.multi_dftz(dfsjcs);
}
@RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
}
@RequestMapping(value="/history", method=RequestMethod.POST)
public Map<String,Object> historySave(ScheduleRealInfo sch){
return scheduleRealInfoService.historySave(sch);
}
private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
private final static long ONE_DAY = 1000 * 60 * 60 * 24;
/**
* 获取可编辑的历史班次日期
* @return
*/
@RequestMapping("dateArray")
public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
List<String> rs = new ArrayList<>();
long t = System.currentTimeMillis();
if(c != 1)
t -= (ONE_DAY + (1000 * 60 * 60 * 6));
for(int i = 0; i < 3; i ++){
rs.add(fmtyyyyMMdd.print(t));
t -= ONE_DAY;
}
return rs;
}
@RequestMapping(value = "svgAttr", method = RequestMethod.POST)
public Map<String, Object> svgAttr(@RequestParam String jsonStr){
return scheduleRealInfoService.svgAttr(jsonStr);
}
@RequestMapping(value = "svgAttr", method = RequestMethod.GET)
public Map<String, Object> findSvgAttr(@RequestParam String idx){
return scheduleRealInfoService.findSvgAttr(idx);
}
@RequestMapping(value = "addRemarks", method = RequestMethod.POST)
public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
return scheduleRealInfoService.addRemarks(id, remarks);
}
@RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.scheduleDailyQp(line,date);
}
@RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
return scheduleRealInfoService.scheduleDailyExport(map);
}
@RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
return scheduleRealInfoService.exportWaybillMore(map);
}
/**
* 获取当日计划排班 , 从计划表抓取数据
* @return
*/
@RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
return scheduleRealInfoService.currentSchedulePlan(lineCode);
}
@RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
}
/**
* 删除当日实际排班
* @return
*/
@RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
return dayOfSchedule.deleteRealSchedule(lineCode);
}
/**
* 从计划表重新加载当日排班
* @param lineCode
* @return
*/
@RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
Map<String, Object> rs = new HashMap<>();
List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
if(list != null && list.size() > 0){
rs.put("status", ResponseCode.ERROR);
rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
return rs;
}
int code = dayOfSchedule.reloadSch(lineCode);
//重新按公司编码索引数据
dayOfSchedule.groupByGsbm();
rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
return rs;
}
/**
* 误点调整
* @param idx
* @param minute
* @return
*/
@RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
return scheduleRealInfoService.lateAdjust(idx, minute);
}
/**
* 获取所有应发未到的班次
* @param idx
* @return
*/
@RequestMapping(value = "allLate2")
public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
return scheduleRealInfoService.allLate2(idx);
}
/**
* 添加一个临加到历史库
* @param sch
* @return
*/
@RequestMapping(value = "history/add", method = RequestMethod.POST)
public Map<String, Object> addToHistory(ScheduleRealInfo sch){
return scheduleRealInfoService.addToHistory(sch);
}
/**
* 从历史库里删除临加班次
* @param id
* @return
*/
@RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
return scheduleRealInfoService.deleteToHistory(id);
}
@RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
Map<String, Object> map =new HashMap<>();
map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
return map;
}
/**
* 从历史库里删除临加班次
* @param param
* @return
*/
@RequestMapping(value = "wxsb", method = RequestMethod.POST)
public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
return scheduleRealInfoService.repairReport(param, true);
}
@RequestMapping(value = "wxsb", method = RequestMethod.GET)
public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
return scheduleRealInfoService.repairReportList(line, date, code, type);
}
@RequestMapping(value = "lineLevel", method = RequestMethod.GET)
public Map<String, String> lineLevel(@RequestParam String idx){
return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
}
/**
* 反馈安全驾驶系统
* @param param
* @return
*/
@RequestMapping(value = "ackDsm", method = RequestMethod.POST)
public Map<String, Object> ackDsm(@RequestParam Map<String, Object> param){
Map<String, Object> res = new HashMap<>();
InputStream in = null;
SysUser user = SecurityUtils.getCurrentUser();
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
StringBuilder url = new StringBuilder("http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?"), uri = new StringBuilder();
HttpURLConnection con = null;
try {
uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8"));
uri.append("&checkTime=").append(URLEncoder.encode(fmt.print(System.currentTimeMillis()), "UTF-8"));
uri.append("&nbbm=").append(URLEncoder.encode(param.get("nbbm").toString(), "UTF-8"));
uri.append("&starttime=").append(URLEncoder.encode(fmt.print(Long.parseLong(param.get("ts").toString())), "UTF-8"));
url.append(uri);
con = (HttpURLConnection)new URL(url.toString()).openConnection();
con.setDoInput(true);
con.setRequestMethod("POST");
con.setConnectTimeout(5000);
con.setReadTimeout(5000);
con.setRequestProperty("keep-alive", "true");
con.setRequestProperty("accept", "*/*");
con.setRequestProperty("content-type", "application/x-www-form-urlencoded");
con.connect();
if (con.getResponseCode() == 200) {
in = con.getInputStream();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
IOUtils.copy(in, bout);
Map<String, Object> map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
System.out.println(map);
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (con != null) {
con.disconnect();
}
}
return res;
}
@RequestMapping(value = "exportPlan", method = RequestMethod.GET)
public Map<String, Object> exportPlan(@RequestParam String date){
Map<String, Object> res = new HashMap<>();
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
List<Map<String, Object>> list = new ArrayList<>();
String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'";
try{
conn = DBUtils_control.getConnection();
ps = conn.prepareStatement(sql);
ps.setString(1, date);
rs = ps.executeQuery();
ObjectMapper mapper = new ObjectMapper();
while (rs.next()) {
SchedulePlan schedulePlan = new SchedulePlan();
schedulePlan.setXlName(rs.getString("xl_name"));
schedulePlan.setXlDir(rs.getInt("xl_dir"));
Date scheduleDate = rs.getDate("schedule_date");
schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd"));
String fcsj = rs.getString("fcsj");
int bcsj = rs.getInt("bcsj");
DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj);
schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00"));
DateTime ddsjDt = fcsjDt.plusMinutes(bcsj);
schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00"));
schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00"));
DateTime endDt = fcsjDt.plusHours(1);
schedulePlan.setSjdEnd(endDt.toString("HH:00:00"));
schedulePlan.setClZbh(rs.getString("cl_zbh"));
schedulePlan.setJsy(rs.getString("j_name"));
schedulePlan.setBcsj(bcsj);
list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class));
}
List<Iterator<?>> iterators = new ArrayList<Iterator<?>>();
iterators.add(list.iterator());
String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
String sourcePath = path + "mould/schedulePlan.xls";
new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls");
res.put("status", ResponseCode.SUCCESS);
res.put("msg", "成功");
} catch (Exception e) {
res.put("status", ResponseCode.ERROR);
res.put("msg", e.getMessage());
} finally {
DBUtils_control.close(rs, ps, conn);
}
return res;
}
public final static class SchedulePlan {
private String company = "浦东公司[46]";
private String xlName = "";
private int xlDir;
private String xlDirStr = "";
private String scheduleDate = "";
private String sjdStart = "";
private String sjdEnd = "";
private String fcsj = "";
private int bcsj;
private String ddsj = "";
private int yys = 25;
private String clZbh = "";
private String cph = "";
private String color = "绿牌";
private String jsy = "";
private String jsydh = "";
private int pj = 10;
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getXlName() {
return xlName;
}
public void setXlName(String xlName) {
this.xlName = xlName;
}
public int getXlDir() {
return xlDir;
}
public void setXlDir(int xlDir) {
this.xlDir = xlDir;
}
public String getXlDirStr() {
xlDirStr = "";
if (xlDir == 0) {
xlDirStr = "上行";
} else if (xlDir == 1) {
xlDirStr = "下行";
}
return xlDirStr;
}
public void setXlDirStr(String xlDirStr) {
this.xlDirStr = xlDirStr;
}
public String getScheduleDate() {
return scheduleDate;
}
public void setScheduleDate(String scheduleDate) {
this.scheduleDate = scheduleDate;
}
public String getSjdStart() {
return sjdStart;
}
public void setSjdStart(String sjdStart) {
this.sjdStart = sjdStart;
}
public String getSjdEnd() {
return sjdEnd;
}
public void setSjdEnd(String sjdEnd) {
this.sjdEnd = sjdEnd;
}
public String getFcsj() {
return fcsj;
}
public void setFcsj(String fcsj) {
this.fcsj = fcsj;
}
public int getBcsj() {
return bcsj;
}
public void setBcsj(int bcsj) {
this.bcsj = bcsj;
}
public String getDdsj() {
return ddsj;
}
public void setDdsj(String ddsj) {
this.ddsj = ddsj;
}
public int getYys() {
return yys;
}
public void setYys(int yys) {
this.yys = yys;
}
public String getClZbh() {
return clZbh;
}
public void setClZbh(String clZbh) {
this.clZbh = clZbh;
}
public String getCph() {
cph = BasicData.nbbmCompanyPlateMap.get(clZbh);
if (cph == null) {
cph = "";
}
return cph;
}
public void setCph(String cph) {
this.cph = cph;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getJsy() {
return jsy;
}
public void setJsy(String jsy) {
this.jsy = jsy;
}
public String getJsydh() {
return jsydh;
}
public void setJsydh(String jsydh) {
this.jsydh = jsydh;
}
public int getPj() {
return pj;
}
public void setPj(int pj) {
this.pj = pj;
}
}
}