TrafficManageServiceImpl.java
39.9 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
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
package com.bsth.service.impl;
import com.bsth.data.BasicData;
import com.bsth.entity.*;
import com.bsth.entity.realcontrol.ChildTaskPlan;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.entity.schedule.SchedulePlanInfo;
import com.bsth.entity.schedule.TTInfo;
import com.bsth.entity.schedule.TTInfoDetail;
import com.bsth.entity.search.CustomerSpecs;
import com.bsth.repository.*;
import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
import com.bsth.repository.schedule.*;
import com.bsth.service.TrafficManageService;
import com.bsth.util.TimeUtils;
import com.bsth.util.db.DBUtils_MS;
import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
import org.apache.commons.lang.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
/**
*
* @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类)
*
* @Extends : BaseService
*
* @Description: TODO(运管处接口service业务层)
*
* @Author bsth@zq
*
* @Date 2016年10月28日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Service
public class TrafficManageServiceImpl implements TrafficManageService{
Logger logger = LoggerFactory.getLogger(this.getClass());
// 线路repository
@Autowired
private LineRepository lineRepository;
// 站点路由repository
@Autowired
private StationRouteRepository stationRouteRepository;
// 线路标准信息repository
@Autowired
private LineInformationRepository lineInformationRepository;
// 车辆repository
@Autowired
private CarsRepository carsRepository;
// 人员repository
@Autowired
private PersonnelRepository personnelRepository;
// 时刻模板repository
@Autowired
private TTInfoRepository ttInfoRepository;
// 时刻模板明细repository
@Autowired
private TTInfoDetailRepository ttInfoDetailRepository;
// 车辆配置信息repository
@Autowired
private CarConfigInfoRepository carConfigInfoRepository;
// 人员配置信息repository
@Autowired
private EmployeeConfigInfoRepository employeeConfigInfoRepository;
// 排班计划明细repository
@Autowired
private SchedulePlanInfoRepository schedulePlanInfoRepository;
// 实际排班计划明细repository
@Autowired
private ScheduleRealInfoRepository scheduleRealInfoRepository;
// 运管处接口
private InternalPortType portType = null;//new Internal().getInternalHttpSoap11Endpoint();
private WebServiceSoap ssop ;
{
try {
ssop = new WebServiceLocator().getWebServiceSoap();
} catch (Exception e) {
e.printStackTrace();
}
}
// 格式化 年月日时分秒 nyrsfm是年月日时分秒的拼音首字母
private SimpleDateFormat sdfnyrsfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 格式化 年月日
private SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd");
// 数字格式化
DecimalFormat format = new DecimalFormat("0.00");
// 用户名
private final String userNameXl = "pudong";
// 密码
private final String passwordXl = "pudong123";
// 用户名
private final String userNameOther = "user";
// 密码
private final String passwordOther = "user";
/**
* 上传线路信息
*/
@Override
public String setXL() {
String result = "failure";
StringBuffer sBuffer = new StringBuffer();
try {
Iterator<Line> lineIterator = lineRepository.findAll().iterator();
Line line = null;
List<StationRoute> stationsList = null;// 站点路由集
List<LineInformation> lineInformationsList = null;
LineInformation lineInformation = null;
sBuffer.append("<XLs>");
while(lineIterator.hasNext()){
line = lineIterator.next();
if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null
|| line.getInUse() == 0){
continue;
}
sBuffer.append("<XL>");
sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");
sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");
sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");
// 线路标准信息实体
lineInformationsList = lineInformationRepository.findByLine(line);
int size = lineInformationsList.size();
if(lineInformationsList != null && size > 0){
double upMileage = 0.0; // 上行里程
double downMileage = 0.0; // 下行里程
// 如果线路标准有多个,累加上行里程和下行里程
for (int i = 0; i < size; i++) {
lineInformation = lineInformationsList.get(i);
upMileage +=lineInformation.getUpMileage();
downMileage +=lineInformation.getDownMileage();
}
sBuffer.append("<QZLC>").append(upMileage).append("</QZLC>");
sBuffer.append("<ZQLC>").append(downMileage).append("</ZQLC>");
}
sBuffer.append("<XLGH>").append(line.getLinePlayType() == null ?"0":line.getLinePlayType())
.append("</XLGH>");
// 循环添加站点信息
sBuffer.append("<StationList>");
// 先查上行
stationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
int startId = 1;
startId = packagStationXml(stationsList, sBuffer, startId);
// 再查下行
stationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
packagStationXml(stationsList, sBuffer, startId);
sBuffer.append("</StationList>");
sBuffer.append("</XL>");
}
sBuffer.append("</XLs>");
System.out.println(sBuffer.toString());
if(sBuffer.indexOf("<XL>") != -1){
String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString());
String portArray[] = portResult.split("\n");
if(portArray.length >= 4){
// 返回数据的编码
String returnCode = portArray[1].substring(portArray[1].indexOf(">")+1,portArray[1].indexOf("</"));
// 返回的信息
String returnDescription = portArray[2].substring(portArray[2].indexOf(">")+1,portArray[2].indexOf("</"));
if(returnCode.equals("1")){
result = "success";
}else{
result = returnDescription;
}
}
}
} catch (Exception e) {
logger.error("setXL:",e);
e.printStackTrace();
}finally{
logger.info("setXL:"+sBuffer.toString());
logger.info("setXL:"+result);
}
return result;
}
/**
* 上传车辆信息
*/
@Override
public String setCL() {
String result = "failure";
StringBuffer sBuffer =new StringBuffer();
try {
sBuffer.append("<CLs>");
Cars cars = null;
String company;
Iterator<Cars> carsIterator = carsRepository.findAll().iterator();
while(carsIterator.hasNext()){
cars = carsIterator.next();
sBuffer.append("<CL>");
company = cars.getCompany();
setCompanyName(company);// 统一公司名称
sBuffer.append("<GSJC>").append(company).append("</GSJC>");
sBuffer.append("<NBH>").append(cars.getInsideCode()).append("</NBH>");
sBuffer.append("<CPH>").append(cars.getCarPlate()).append("</CPH>");
sBuffer.append("<YYZBH>").append(cars.getServiceNo()).append("</YYZBH>");
sBuffer.append("<CZCPH>").append(cars.getCarPlate()).append("</CZCPH>");//******这个数据没有***********
sBuffer.append("<CZZDBH>").append(cars.getEquipmentCode()).append("</CZZDBH>");
sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
sBuffer.append("</CL>");
}
sBuffer.append("</CLs>");
if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setCL:",e);
e.printStackTrace();
}finally{
logger.info("setCL:"+sBuffer.toString());
logger.info("setCL:"+result);
}
return result;
}
/**
* 上传司机信息
*/
@Override
public String setSJ() {
String result = "failure";
StringBuffer sBuffer =new StringBuffer();
try {
sBuffer.append("<SJs>");
Personnel personnel = null;
String company;
Iterator<Personnel> personIterator = personnelRepository.findAll().iterator();
while(personIterator.hasNext()){
personnel = personIterator.next();
sBuffer.append("<SJ>");
company = personnel.getCompany();
setCompanyName(company);// 统一公司名称
sBuffer.append("<GSJC>").append(company).append("</GSJC>");
sBuffer.append("<SJGH>").append(personnel.getJobCode()).append("</SJGH>");
sBuffer.append("<CYZGZH>").append(personnel.getPapersCode()).append("</CYZGZH>");//***********
sBuffer.append("<XM>").append(personnel.getPersonnelName()).append("</XM>");
sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
sBuffer.append("</SJ>");
}
sBuffer.append("</SJs>");
if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
};
} catch (Exception e) {
logger.error("setSJ:",e);
e.printStackTrace();
}finally{
logger.info("setSJ:"+sBuffer.toString());
logger.info("setSJ:"+result);
}
return result;
}
/**
* 上传路单
* @return 上传成功标识
*/
public String setLD(){
String result = "failure";
Line line;
// 取昨天 的日期
String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
StringBuffer sf = new StringBuffer();
try {
sf.append("<DLDS>");
List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date);
List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date);
Map<String,Object> map = new HashMap<String,Object>();
for(Map<String,Object> schRealInfo:listGroup){
if(schRealInfo != null){
//根据车辆自编号查询车牌号
map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
// 获取线路是否使用标识,如果未使用,则不查该线路数据
line = lineRepository.findByLineCode(schRealInfo.get("xlBm")+"");
if(line.getInUse() == null || line.getInUse() == 0){
continue;
}
sf.append("<DLD>");
sf.append("<RQ>"+date+"</RQ>");
sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+"")+"</XLBM>");
sf.append("<LPBH>"+schRealInfo.get("lpName")+"</LPBH>");
sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
sf.append("<LDList>");
int seqNumber = 0;
for(ScheduleRealInfo scheduleRealInfo:list){
if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"")
.equals(scheduleRealInfo.getLpName())
&& (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){
if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in")
|| scheduleRealInfo.getBcType().equals("out")){
continue;
}
scheduleRealInfo.getQdzCode();
sf.append("<LD>");
sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>");
sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>");
sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>");
sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(
scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzName()) + "</FCZDXH>");
sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>");
sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>");
sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>");
sf.append("<SJFCSJ>"+scheduleRealInfo.getFcsjActual()+"</SJFCSJ>");
sf.append("<FCZDLX>"+""+"</FCZDLX>");
sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>");
sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(
scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzName()) +"</DDZDXH>");
sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>");
sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>");
sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>");
sf.append("<DDZDLX>"+""+"</DDZDLX>");
sf.append("<LDSCBZ>"+0+"</LDSCBZ>");
sf.append("<DDBZ>"+scheduleRealInfo.getRemarks()+"</DDBZ>");
sf.append("</LD>");
}
}
sf.append("</LDList>");
sf.append("</DLD>");
}
}
sf.append("</DLDS>");
if(ssop.setLD(userNameOther, passwordOther, sf.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setLD:",e);
e.printStackTrace();
}finally{
logger.info("setLD:"+sf.toString());
logger.info("setLD:"+result);
}
return result;
}
/**
* 上传里程油耗
* @return 上传成功标识
*/
public String setLCYH(){
String result = "failure";
// 取昨天 的日期
String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
StringBuffer sf = new StringBuffer();
try {
sf.append("<LCYHS>");
List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLCYHGroup(date);
List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
Map<String,Object> map = new HashMap<String,Object>();
for(Map<String,Object> schRealInfo:listGroup){
if(schRealInfo != null){
map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
/**
* 如果car==null,则说明该车辆是从线调中换车功能中加进去的,
* 在cars基础信息中查不到车辆的信息,所以忽略该车辆
*/
if(car == null){
continue;
}
//计算总公里和空驶公里,营运公里=总公里-空驶公里
double totalKilometers = 0,emptyKilometers =0;
sf.append("<LCYH>");
sf.append("<RQ>"+date+"</RQ>");
sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
if(list != null && list.size() > 0){
for(ScheduleRealInfo scheduleRealInfo:list){
if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")
.equals(scheduleRealInfo.getClZbh())){
Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
//如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
if(childTaskPlans.isEmpty()){
if(scheduleRealInfo.getStatus() == 2){
totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
|| scheduleRealInfo.getBcType().equals("venting")){
emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
}
}
}else{
Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
while(it.hasNext()){
ChildTaskPlan childTaskPlan = it.next();
if(!childTaskPlan.isDestroy()){
totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();
if(childTaskPlan.getMileageType().equals("empty")){
emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();;
}
}
}
}
}
}
}
sf.append("<ZLC>"+totalKilometers+"</ZLC>");
sf.append("<YYLC>"+emptyKilometers+"</YYLC>");
sf.append("<YH>"+""+"</YH>");
sf.append("<JZYL>"+""+"</JZYL>");
sf.append("<DH>"+""+"</DH>");
sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
sf.append("<BBSCBZ>"+0+"</BBSCBZ>");
sf.append("</LCYH>");
}
}
sf.append("</LCYHS>");
if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setLCYH:",e);
e.printStackTrace();
}finally{
logger.info("setLCYH:"+sf.toString());
logger.info("setLCYH:"+result);
}
return result;
}
/**
* 上传线路调度日报
* @return
*/
public String setDDRB(){
String result = "failure";
// 取昨天 的日期
String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
StringBuffer sf = new StringBuffer();
try {
sf.append("<DDRBS>");
List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setDDRBGroup(date);
List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
for(Map<String,Object> schRealInfo:listGroup){
if(schRealInfo != null){
double jhlc = 0,zlc = 0,jhkslc = 0,sjkslc = 0;
int jhbc = 0,sjbc = 0,jhzgfbc = 0,sjzgfbc = 0,jhwgfbc = 0,sjwgfbc = 0;
sf.append("<DDRB>");
sf.append("<RQ>"+date+"</RQ>");
sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
for(ScheduleRealInfo scheduleRealInfo:list){
if(scheduleRealInfo != null){
if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm())){
//计划
if(!scheduleRealInfo.isSflj()){
jhlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
//计划空驶
if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")){
jhkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
}
//计划早高峰,计划晚高峰
if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){
jhzgfbc++;
} else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){
jhwgfbc++;
}
}
jhbc++;
//实际
Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
//如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
if(childTaskPlans.isEmpty()){
if(scheduleRealInfo.getStatus() == 2){
sjbc++;
zlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
|| scheduleRealInfo.getBcType().equals("venting")){
sjkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();;
}
}
}else{
sjbc++;
Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
while(it.hasNext()){
ChildTaskPlan childTaskPlan = it.next();
if(!childTaskPlan.isDestroy()){
zlc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();
if(childTaskPlan.getMileageType().equals("empty")){
sjkslc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();;
}
}
}
}
//实际早高峰,计划晚高峰
if(scheduleRealInfo.getFcsjActual() != null){
if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){
sjzgfbc++;
} else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){
sjwgfbc++;
}
}
}
}
}
sf.append("<JHLC>"+format.format(jhlc)+"</JHLC>");
sf.append("<SSLC>"+format.format((zlc-sjkslc))+"</SSLC>");
sf.append("<JHKSLC>"+format.format(jhkslc)+"</JHKSLC>");
sf.append("<SJKSLC>"+format.format(sjkslc)+"</SJKSLC>");
sf.append("<JHBC>"+jhbc+"</JHBC>");
sf.append("<SJBC>"+sjbc+"</SJBC>");
sf.append("<JHZGFBC>"+jhzgfbc+"</JHZGFBC>");
sf.append("<SJZGFBC>"+sjzgfbc+"</SJZGFBC>");
sf.append("<JHWGFBC>"+jhwgfbc+"</JHWGFBC>");
sf.append("<SJWGFBC>"+sjwgfbc+"</SJWGFBC>");
sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
sf.append("<RBSCBZ>"+0+"</RBSCBZ>");
sf.append("</DDRB>");
}
}
sf.append("</DDRBS>");
if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setDDRB:",e);
e.printStackTrace();
}finally{
logger.info("setDDRB:"+sf.toString());
logger.info("setDDRB:"+result);
}
return result;
}
/**
* 上传线路计划班次表
*/
@Override
public String setJHBC() {
String result = "failure";
Line line;
StringBuffer sBuffer =new StringBuffer();
try {
sBuffer.append("<JHBCs>");
// 声明变量
SchedulePlanInfo schedulePlanInfo;
String xlbm,zbh = "";
Long lp = 0L;
// 取明天的日期
String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1));
// 查询所有班次
List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow);
int j = 0; // 初始化标识
if(schedulePlanList != null ){
int size = schedulePlanList.size();
for (int i = 0; i < size; i++) {
schedulePlanInfo = schedulePlanList.get(i);
xlbm = schedulePlanInfo.getXlBm();
// 获取线路是否使用标识,如果未使用,则不查该线路数据
line = lineRepository.findByLineCode(xlbm);
if(line.getInUse() == null || line.getInUse() == 0){
continue;
}
if(++j == 1){// 第一次,则初始化值
zbh = schedulePlanInfo.getClZbh();
lp = schedulePlanInfo.getLp();
// 拼装XML
assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp);
}
// 比较是否为同一条线路同一辆车
if(xlbm.equals(schedulePlanInfo.getXlBm())
&& zbh.equals(schedulePlanInfo.getClZbh())
&& lp == schedulePlanInfo.getLp()){
if(schedulePlanInfo.getBcType().equals("in") || schedulePlanInfo.getBcType().equals("out")){
continue;
}
sBuffer.append("<BC>");
sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>");
sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>");
sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>");
sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>");
sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</DDXH>");
sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
.append("</JHDDSJ>");
sBuffer.append("</BC>");
if(i == size -1 ){
sBuffer.append("</BCList>");
sBuffer.append("</JHBC>");
}
}else{
zbh = schedulePlanInfo.getClZbh();
lp = schedulePlanInfo.getLp();
sBuffer.append("</BCList>");
sBuffer.append("</JHBC>");
// 拼装XML
assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp);
}
}
}
// 判断XML是否以</BCList>结尾,如果不是,则加上
String regex = "^*</JHBC>$";
Pattern p = Pattern.compile(regex);
java.util.regex.Matcher m = p.matcher(sBuffer);
boolean isEndWithTrueFlag = false;
while (m.find()) {
isEndWithTrueFlag = true;
}
// 加上缺失的标签
if(!isEndWithTrueFlag){
sBuffer.append("</BCList>");
sBuffer.append("</JHBC>");
}
sBuffer.append("</JHBCs>");
if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setJHBC:",e);
e.printStackTrace();
}finally{
logger.info("setJHBC:"+sBuffer.toString());
logger.info("setJHBC:"+result);
}
return result;
}
/**
* 上传线路班次时刻表数据
*/
@Override
public String setSKB(String ids) {
String result = "failure";
StringBuffer sBuffer = new StringBuffer();
try {
String[] idArray = ids.split(",");
StringBuffer sBufferA;
StringBuffer sBufferB;
TTInfo ttInfo;
TTInfoDetail ttInfoDetail;
Iterator<TTInfoDetail> ttInfoDetailIterator;
HashMap<String,Object> param = new HashMap<String, Object>();
String lineCode ;
sBuffer.append("<SKBs>");
for (int i = 0; i < idArray.length; i++) {
ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i]));
if(ttInfo == null)
continue;
param.put("ttinfo.id_eq", ttInfo.getId());
ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param),
new Sort(Direction.ASC, "xlDir")).iterator();
if(ttInfoDetailIterator.hasNext()){
sBuffer.append("<SKB>");
sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))
.append("</XLBM>");
sBufferB = new StringBuffer();
sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
// 结束日期暂时不要,节假日的班次表才需要,如春节的班次表
sBufferB.append("<JSRQ>").append("").append("</JSRQ>");
sBufferB.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>");
sBufferB.append("<TBYY>").append("").append("</TBYY>");
sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
sBufferB.append("<BCList>");
int num = 1;
while (ttInfoDetailIterator.hasNext()) {
ttInfoDetail = ttInfoDetailIterator.next();
if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){
continue;
}
if(num++ == 1){
sBufferA = new StringBuffer();
sBufferA.append("<JHZLC>").append(ttInfoDetail.getJhlc()).append("</JHZLC>");
sBufferA.append("<JHYYLC>").append(ttInfoDetail.getJhlc()).append("</JHYYLC>");
sBuffer.append(sBufferA).append(sBufferB);
}
lineCode = ttInfoDetail.getXl().getLineCode();
// 如果发车时间格式错误,忽略此条
if(changeTimeFormat(ttInfoDetail) == null){
continue;
}
sBuffer.append("<BC>");
sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>");
sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>");
sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>");
sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>");
sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</DDXH>");
sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
sBuffer.append("</BC>");
}
sBuffer.append("</BCList>");
sBuffer.append("</SKB>");
}
}
sBuffer.append("</SKBs>");
if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setSKB:", e);
e.printStackTrace();
}finally{
logger.info("setSKB:"+sBuffer.toString());
logger.info("setSKB:"+result);
}
return result;
}
/**
* 上传线路人员车辆配置信息
*/
@Override
public String setXLPC() {
String result = "failure";
StringBuffer sBuffer =new StringBuffer();
try {
sBuffer.append("<XLPCs>");
// 声明变量
Line line = null;
Cars cars = null;
List<Personnel> personnelList = null;
List<Cars> carsList = null;
int totalPersonnel,totalCar ;// 人员数量。车辆数量
// 查询所有线路
Iterator<Line> lineIterator = lineRepository.findAll().iterator();
// 循环查找线路下的信息
while(lineIterator.hasNext()){
line = lineIterator.next();
sBuffer.append("<XLPC>");
sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
// 查询驾驶员数量
personnelList = personnelRepository.findJsysByLineId(line.getId());
totalPersonnel = personnelList != null ? personnelList.size():0;
sBuffer.append("<SJRS>").append(totalPersonnel).append("</SJRS>");
// 查询售票员人员数量
personnelList = personnelRepository.findSpysByLineId(line.getId());
totalPersonnel = personnelList != null ? personnelList.size():0;
sBuffer.append("<SPYRS>").append(totalPersonnel).append("</SPYRS>");
// 查询车辆
carsList = carsRepository.findCarsByLineId(line.getId());
totalCar = carsList != null ? carsList.size():0;
sBuffer.append("<PCSL>").append(totalCar).append("</PCSL>");
sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
int carsNum = 0;
// 取车牌号
if(carsList != null){
carsNum = carsList.size();
sBuffer.append("<CPHList>");
for (int i = 0; i < carsNum; i++) {
cars = carsList.get(i);
sBuffer.append("<CPH>").append("沪").append(cars.getCarCode()).append("</CPH>");
}
sBuffer.append("</CPHList>");
}
sBuffer.append("</XLPC>");
}
sBuffer.append("</XLPCs>");
if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setXLPC:",e);
e.printStackTrace();
}finally{
logger.info("setXLPC:"+sBuffer.toString());
logger.info("setXLPC:"+result);
}
return result;
}
/**
* 上传超速数据
*/
@Override
public String setCS() {
String result = "failure";
StringBuffer sBuffer =new StringBuffer();
sBuffer.append("<CSs>");
String sql = "SELECT * FROM bsth_c_speeding where DATE_FORMAT(create_date,'%Y-%m-%d') = ? order by create_date ";
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
// 取昨天 的日期
String yesterday = sdfnyr.format(DateUtils.addDays(new Date(), -1));
try {
conn = DBUtils_MS.getConnection();
ps = conn.prepareStatement(sql);
ps.setString(1, yesterday);
rs = ps.executeQuery();
Float lon, lat;
String kssk;
String speed;
while (rs.next()) {
kssk = sdfnyrsfm.format(rs.getLong("TIMESTAMP"));
speed = rs.getString("SPEED");
// 经纬度
lon = rs.getFloat("LON");
lat = rs.getFloat("LAT");
sBuffer.append("<CS>");
sBuffer.append("<RQ>").append(sdfnyr.format(rs.getDate("CREATE_DATE"))).append("</RQ>");
sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(rs.getString("LINE"))).append("</XLBM>");////////
sBuffer.append("<CPH>").append(rs.getString("VEHICLE")).append("</CPH>");
sBuffer.append("<KSSK>").append(kssk).append("</KSSK>");
sBuffer.append("<KSDDJD>").append(lon).append("</KSDDJD>");
sBuffer.append("<KSDDWD>").append(lat).append("</KSDDWD>");
sBuffer.append("<KSLD>").append("").append("</KSLD>");//**********************
sBuffer.append("<JSSK>").append(kssk).append("</JSSK>");
sBuffer.append("<JSDDJD>").append(lon).append("</JSDDJD>");
sBuffer.append("<JSDDWD>").append(lat).append("</JSDDWD>");
sBuffer.append("<JSLD>").append("").append("</JSLD>");//**********************
sBuffer.append("<PJSD>").append(speed).append("</PJSD>");
sBuffer.append("<ZGSS>").append(speed).append("</ZGSS>");
sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
sBuffer.append("</CS>");
}
sBuffer.append("</CSs>");
if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
result = "success";
}
} catch (Exception e) {
logger.error("setCS:",e);
e.printStackTrace();
} finally {
logger.info("setCS:"+sBuffer.toString());
logger.info("setCS:"+result);
DBUtils_MS.close(rs, ps, conn);
}
return result;
}
/**
* 下载全量的公交基础数据
*/
public String getDownLoadAllDataFile() {
String result = "success";
try {
Runtime currRuntime = Runtime.getRuntime ();
int nFreeMemory = ( int ) (currRuntime.freeMemory() / 1024 / 1024);
int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);
System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");
byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");
String filePath = "E:\\ygc";
BufferedOutputStream bos = null;
FileOutputStream fos = null;
File file = null;
try {
File dir = new File(filePath);
if(!dir.exists()&&dir.isDirectory()){//判断文件目录是否存在
dir.mkdirs();
}
file = new File(filePath+"\\abc.rar");
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
bos.write(res);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 下载增量的公交基础数据
*/
public String getDownLoadIncreaseDataFile() {
String result = "success";
try {
//System.out.println(portType.downloadIncreaseDataFile(args0, args1, args2));
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 指定线路查询方式公交基础数据下载
*/
public String getDownLoadWarrantsBusLineStation() {
String result = "success";
try {
//portType.setXL(userNameXl, passwordXl, sBuffer.toString());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 计算结束时间
* @param fcsj 发车时间
* @param bcsj 班次历时
* @return
*/
private String calcDdsj(String fcsj,Integer bcsj){
String result = "";
if(fcsj.indexOf(":") != -1){
if(bcsj == null){
return fcsj;
}
// 时和分隔开
String[] fcsjArray = fcsj.split(":");
// 分和历时时间相加
Integer fullTime = Integer.valueOf(fcsjArray[1])+ bcsj;
int hour,min,sumHour;
hour = fullTime / 60;
min = fullTime % 60;
sumHour = Integer.valueOf(fcsjArray[0])+hour;
if(sumHour >= 24){
result = String.format("%02d",sumHour - 24);
}else{
result = String.format("%02d",sumHour);;
}
result +=":"+String.format("%02d", min);
}else{
result = fcsj;
}
return result;
}
/**
* 改变时间格式
* @param ttInfoDetail 时刻表详细
* @return xx:yy
*/
private String changeTimeFormat(TTInfoDetail ttInfoDetail){
String result = "00:00";
String fcsj = ttInfoDetail.getFcsj();
if(fcsj.indexOf(":") != -1){
// 时和分隔开
String[] fcsjArray = fcsj.split(":");
result = String.format("%02d", Integer.valueOf(fcsjArray[0]))+":";
result +=String.format("%02d", Integer.valueOf(fcsjArray[1]));
}else{
result = null;
logger.info("setSKB:发车时间错误:ttInfoDetail.id="+ttInfoDetail.getId());
}
return result;
}
/**
* 拼装线路计划班次表的XML
* @param sBuffer
* @param schedulePlanInfo
* @param xlbm
* @param zbh
* @param lp
*/
private void assembleJHBC(StringBuffer sBuffer,SchedulePlanInfo schedulePlanInfo,String xlbm,String zbh,Long lp){
sBuffer.append("<JHBC>");
sBuffer.append("<RQ>").append(sdfnyr.format(schedulePlanInfo.getScheduleDate())).append("</RQ>");
sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(xlbm)).append("</XLBM>");
sBuffer.append("<CPH>").append("沪"+zbh).append("</CPH>");
sBuffer.append("<LPBH>").append(lp).append("</LPBH>");
sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
sBuffer.append("<BCList>");
}
/**
* 转换排班规则
* @param ruleDay
* @return
*/
private String changeRuleDay(String ruleDay){
String result = "";
int flag ;
String[] ruleDayArray = ruleDay.split(",");
for (int i = 0; i < ruleDayArray.length; i++) {
if(ruleDayArray[i].equals("1")){
flag = i+1;
}else{
flag = 0;
}
result += flag;
if(i !=ruleDayArray.length -1){
result +=",";
}
}
return result;
}
/**
* 设置统一的公司名称
* @param company
*/
private void setCompanyName(String company){
if(company.equals("闵行公司")){
company = "浦东闵行公交公司";
}else if(company.equals("杨高公司")){
company = "浦东杨高公交公司";
}else if(company.equals("上南公司")){
company = "浦东上南公交公司";
}else if(company.equals("金高公司")){
company = "浦东金高公交公司";
}else if(company.equals("南汇公司")){
company = "浦东南汇公交公司";
}else if(company.equals("青浦公交")){
company = "浦东青浦公交公司";
}
}
/**
* @param stationsList 站点路由集
* @param sBuffer sBuffer
* @param startId 站点序号起始ID
*
* @return 站点序号累加后的ID
*/
private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){
int size = stationsList.size();
StationRoute srRoute;
String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站
for (int i = 0; i < size; i++) {
srRoute = stationsList.get(i);
zdlx = srRoute.getStationMark();
if(zdlx.equals("B")){
zdlx = "0";
}else if(zdlx.equals("E")){
zdlx = "1";
}else{
zdlx = "2";
}
sBuffer.append("<Station>");
sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationName())).append("</ZDXH>");
sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>");
sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>");
sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>");
sBuffer.append("<ZDJD>").append(srRoute.getStation().getgLonx()).append("</ZDJD>");
sBuffer.append("<ZDWD>").append(srRoute.getStation().getgLaty()).append("</ZDWD>");
sBuffer.append("<ZZ>").append(srRoute.getStation().getAddr()).append("</ZZ>");//站点的具体地址
sBuffer.append("<ZDLX>").append(zdlx).append("</ZDLX>");
sBuffer.append("<ZJLC>").append(srRoute.getDistances()).append("</ZJLC>");
sBuffer.append("</Station>");
startId++;
}
return startId;
}
/**
*
* @param lineCode 线路编码
* @param direction 线路方向
* @param stationName 让点名称
* @return 运管处站点序号
*/
private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){
Integer number = 0;
number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationName);
return number;
}
}