SectionServiceImpl.java
43.6 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
package com.bsth.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bsth.entity.sys.SysUser;
import com.bsth.security.util.SecurityUtils;
import com.bsth.util.RoadCutDoubleName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bsth.common.ResponseCode;
import com.bsth.entity.Line;
import com.bsth.entity.LsSectionRoute;
import com.bsth.entity.LsStationRoute;
import com.bsth.entity.Section;
import com.bsth.entity.SectionRoute;
import com.bsth.entity.SectionRouteCache;
import com.bsth.entity.StationRoute;
import com.bsth.entity.StationRouteCache;
import com.bsth.repository.LineRepository;
import com.bsth.repository.LineVersionsRepository;
import com.bsth.repository.LsSectionRouteRepository;
import com.bsth.repository.LsStationRouteRepository;
import com.bsth.repository.SectionRepository;
import com.bsth.repository.SectionRouteCacheRepository;
import com.bsth.repository.SectionRouteRepository;
import com.bsth.repository.StationRouteCacheRepository;
import com.bsth.repository.StationRouteRepository;
import com.bsth.service.SectionService;
import com.bsth.util.GetUIDAndCode;
import com.bsth.util.TransGPS;
import com.bsth.util.TransGPS.Location;
import com.bsth.util.Geo.GeoUtils;
import com.bsth.util.Geo.Point;
/**
*
* @ClassName: SectionServiceImpl(路段service业务层实现类)
*
* @Extends : BaseService
*
* @Description: TODO(路段service业务层)
*
* @Author bsth@lq
*
* @Date 2016年05月03日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Service
public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implements SectionService{
@Autowired
SectionRepository repository;
@Autowired
LineRepository lineRepository;
@Autowired
LineVersionsRepository lineVersionsRepository;
@Autowired
SectionRouteRepository routeRepository;
@Autowired
LsSectionRouteRepository lsRouteRepository;
@Autowired
SectionRouteCacheRepository routeCacheRepository;
@Autowired
StationRouteRepository stationRouteRepository;
@Autowired
LsStationRouteRepository lsStationRouteRepository;
@Autowired
StationRouteCacheRepository stationRouteCacheRepository;
/**
* @Description :TODO(生成新的线路走向)
*
* @param map <sectionId:路段ID; sectionJSON:路段信息>
*
* @return Map<String, Object> <SUCCESS ; ERROR>
*/
@Override
@Transactional
public Map<String, Object> sectionCut(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
// 路段点List
List<Point> bPointsList = new ArrayList<>();
// 截取路段点List
// List<Point> bPointsCutList = new ArrayList<>();
// 截取后的路段
List<Map<String, String>> sectionArrayList = new ArrayList<>();
String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
// 原坐标类型
String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
// 说明
String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
// 是否撤销
Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
// 方向
Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString());
// 线路ID
Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString());
// 道路编码
String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString();
// 路段长度
Double sectionDistance = 0.0;
// 路段路由Id
// Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString());
// 线路编码
String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
// 路段时长
Double sectionTime = 0.0;
// 路段路由
Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
// 限速
Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
// 版本
Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
// 修改日期
String updateDate = formatter.format(date);
String crosesRoad="";
String endNode="";
String startNode="";
String middleNode="";
String sectionType="";
String csectionVector=null;
// 撤销原有路段路由
routeRepository.sectionRouteUpdDestroy(sectionRouteLine,directions);
// 路段保存
for (int i = 0; i < sectionArrayList.size(); i++) {
long sectionMaxId = GetUIDAndCode.getSectionId();
// 路段编码
String sectionCode = String.valueOf(sectionMaxId);
// 路段ID
int sectionId = (int)sectionMaxId;
String sectionName = sectionArrayList.get(i).get("sectionName").toString();
String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString();
String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString();
// WGS坐标点集合
String gsectionVector = null;
if(!sectionsWJPpoints.equals(""))
gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
// 原坐标点集合
String bsectionVectorS = null;
if(!sectionsBpoints.equals(""))
bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, 1, sectionId);
SectionRoute route = new SectionRoute();
Line line = lineRepository.findById(sectionRouteLine).get();
Section section = repository.findById(sectionId).get();
route.setSectionrouteCode(sectionrouteCode+i);
route.setLineCode(lineCode);
route.setSectionCode(sectionCode);
route.setDirections(directions);
route.setVersions(versions);
route.setDestroy(destroy);
route.setDescriptions(descriptions);
route.setCreateBy(createBy);
route.setUpdateBy(updateBy);
route.setLine(line);
route.setSection(section);
route.setIsRoadeSpeed(isRoadeSpeed);
routeRepository.save(route);
}
// 删除缓存路段
routeCacheRepository.sectionRouteCacheDel(lineCode,directions);
// 撤销原有站点路由
stationRouteRepository.stationRouteUpdDestroy(sectionRouteLine,directions);
// 站点保存
List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(sectionRouteLine,directions);
for(int i=0; i < stationRouteList.size(); i++) {
StationRouteCache stationRouteCache = stationRouteList.get(i);
StationRoute stationRoute = new StationRoute();
stationRoute.setLine(stationRouteCache.getLine());
stationRoute.setStation(stationRouteCache.getStation());
stationRoute.setStationName(stationRouteCache.getStationName());
stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode());
stationRoute.setLineCode(stationRouteCache.getLineCode());
stationRoute.setStationCode(stationRouteCache.getStationCode());
stationRoute.setStationMark(stationRouteCache.getStationMark());
stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber());
stationRoute.setDirections(stationRouteCache.getDirections());
stationRoute.setDistances(stationRouteCache.getDistances());
stationRoute.setToTime(stationRouteCache.getToTime());
stationRoute.setFirstTime(stationRouteCache.getFirstTime());
stationRoute.setEndTime(stationRouteCache.getEndTime());
stationRoute.setDescriptions(stationRouteCache.getDescriptions());
stationRoute.setDestroy(stationRouteCache.getDestroy());
stationRoute.setVersions(versions);
stationRoute.setCreateBy(stationRouteCache.getCreateBy());
stationRoute.setCreateDate(stationRouteCache.getCreateDate());
stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
stationRoute.setUpdateDate(stationRouteCache.getUpdateDate());
stationRouteRepository.save(stationRoute);
}
// 删除缓存站点
stationRouteCacheRepository.stationRouteCacheDel(lineCode,directions);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
/**
* @Description :TODO(编辑线路走向保存到线路历史表)
*
* @param map <sectionId:路段ID; sectionJSON:路段信息>
*
* @return Map<String, Object> <SUCCESS ; ERROR>
*/
@Override
@Transactional
public Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
// 路段点List
List<Point> bPointsList = new ArrayList<>();
// 截取后的路段
List<Map<String, String>> sectionArrayList = new ArrayList<>();
String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
// 原坐标类型
String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
// 说明
String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
// 是否撤销
Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
// 方向
Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString());
// 线路ID
Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString());
// 道路编码
String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString();
// 路段长度
Double sectionDistance = 0.0;
// 线路编码
String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
// 路段时长
Double sectionTime = 0.0;
// 路段路由
Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
// 限速
Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
// 版本
Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
String crosesRoad="";
String endNode="";
String startNode="";
String middleNode="";
String sectionType="";
String csectionVector=null;
// 删除原有历史版本路段路由
lsRouteRepository.batchDelete(sectionRouteLine,directions,versions);
// 路段保存
for (int i = 0; i < sectionArrayList.size(); i++) {
long sectionMaxId = GetUIDAndCode.getSectionId();
// 路段编码
String sectionCode = String.valueOf(sectionMaxId);
// 路段ID
int sectionId = (int)sectionMaxId;
String sectionName = sectionArrayList.get(i).get("sectionName").toString();
String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString();
String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString();
// WGS坐标点集合
String gsectionVector = null;
if(!sectionsWJPpoints.equals(""))
gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
// 原坐标点集合
String bsectionVectorS = null;
if(!sectionsBpoints.equals(""))
bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, 1, sectionId);
LsSectionRoute route = new LsSectionRoute();
Line line = lineRepository.findById(sectionRouteLine).get();
Section section = repository.findById(sectionId).get();
route.setSectionrouteCode(sectionrouteCode+i);
route.setLineCode(lineCode);
route.setSectionCode(sectionCode);
route.setDirections(directions);
route.setVersions(versions);
route.setDestroy(destroy);
route.setDescriptions(descriptions);
route.setCreateBy(createBy);
route.setUpdateBy(updateBy);
route.setLine(line);
route.setSection(section);
route.setIsRoadeSpeed(isRoadeSpeed);
lsRouteRepository.save(route);
}
// 删除缓存路段
routeCacheRepository.sectionRouteCacheDel(lineCode,directions);
// 删除原有历史表站点路由
lsStationRouteRepository.batchDelete(sectionRouteLine,directions,versions);
// 站点保存
List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(sectionRouteLine,directions);
for(int i=0; i < stationRouteList.size(); i++) {
StationRouteCache stationRouteCache = stationRouteList.get(i);
LsStationRoute stationRoute = new LsStationRoute();
stationRoute.setLine(stationRouteCache.getLine());
stationRoute.setStation(stationRouteCache.getStation());
stationRoute.setStationName(stationRouteCache.getStationName());
stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode());
stationRoute.setLineCode(stationRouteCache.getLineCode());
stationRoute.setStationCode(stationRouteCache.getStationCode());
stationRoute.setStationMark(stationRouteCache.getStationMark());
stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber());
stationRoute.setDirections(stationRouteCache.getDirections());
stationRoute.setDistances(stationRouteCache.getDistances());
stationRoute.setToTime(stationRouteCache.getToTime());
stationRoute.setFirstTime(stationRouteCache.getFirstTime());
stationRoute.setEndTime(stationRouteCache.getEndTime());
stationRoute.setDescriptions(stationRouteCache.getDescriptions());
stationRoute.setDestroy(stationRouteCache.getDestroy());
stationRoute.setVersions(versions);
stationRoute.setCreateBy(stationRouteCache.getCreateBy());
stationRoute.setCreateDate(stationRouteCache.getCreateDate());
stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
stationRoute.setUpdateDate(stationRouteCache.getUpdateDate());
lsStationRouteRepository.save(stationRoute);
}
// 删除缓存站点
stationRouteCacheRepository.stationRouteCacheDel(lineCode,directions);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
/**
* @Description :TODO(生成双路名路段)
* @param map <lineId:线路ID; route:路段信息>
* @return
*/
@Override
@Transactional
public Map<String, Object> doubleName(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
// 路段点List
List<Point> bPointsList = new ArrayList<>();
// 截取后的路段
List<Map<String, String>> sectionArrayList = new ArrayList<>();
Integer lineId = Integer.parseInt(map.get("lineId").equals("") ? "" :map.get("lineId").toString());
String lineCode = map.get("lineCode").equals("") ? "" :map.get("lineCode").toString();
Integer directions = Integer.parseInt(map.get("directions").equals("") ? "" :map.get("directions").toString());
String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" :map.get("sectionrouteCode").toString();
Integer versions = Integer.parseInt(map.get("versions").equals("") ? "" :map.get("versions").toString());
String stationRouteBegin = map.get("stationRouteBegin").equals("") ? "" :map.get("stationRouteBegin").toString();
String stationRouteFinish = map.get("stationRouteFinish").equals("") ? "" :map.get("stationRouteFinish").toString();
String routes = map.get("route").equals("") ? "" :map.get("route").toString();
if(!routes.equals("")) {
String sectionStr = "";
// 转换成JSON数组
JSONArray sectionsArray = JSONArray.parseArray(routes);
// 遍历
for(int s = 0 ;s<sectionsArray.size();s++) {
String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
if(s == sectionsArray.size()-1){
sectionStr += pointsLngStr+","+pointsLatStr;
} else {
sectionStr += pointsLngStr+","+pointsLatStr+";";
}
}
Map<String, Object> roads = RoadCutDoubleName.start(sectionStr);
if (!roads.isEmpty()) {
List bSectionList = (List) roads.get("bSections");
List roadName = (List) roads.get("roadName");
// 路段序号
Integer routeCode = 0;
if(!sectionrouteCode.equals("")){
String sectionrouteCodeArray[] = sectionrouteCode.split("_");
routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1;
}else {
routeCode = 1;
}
// 增加路段序号
for(int i = 0; i < bSectionList.size(); i++){
List<Location> bSection = new ArrayList<>();
bSectionList.get(i);
bSection = (List<Location>) bSectionList.get(i);
String sectionsBpoints = "";
// WGS线状图形坐标集合
String sectionsWJPpoints = "";
for (int j = 0; j < bSection.size(); j++) {
bSection.get(j);
Location point = bSection.get(j);
String pointsLngStr = String.valueOf(point.getLng());
String pointsLatStr = String.valueOf(point.getLat());
/** to WGS坐标 */
Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
String WGSLngStr = String.valueOf(resultPoint.getLng());
String WGSLatStr = String.valueOf(resultPoint.getLat());
if(j == 0) {
sectionsBpoints = pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
}else {
sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
}
}
// 获取当前最大Id
long sectionMaxId = GetUIDAndCode.getSectionId();
// 路段编码
String sectionCode = String.valueOf(sectionMaxId);
// 路段ID
int sectionId = (int)sectionMaxId;
String sectionName = roadName.get(i).toString();
// WGS坐标点集合
String gsectionVector = null;
if(!sectionsWJPpoints.equals("")) {
gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
}
// 原坐标点集合
String bsectionVectorS = null;
if(!sectionsBpoints.equals("")) {
bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
}
repository.systemSave(sectionCode, sectionName, null, "", "", "", gsectionVector, bsectionVectorS, "", null, "", 0, 0, "", 0, "", versions, sectionId);
routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode+i);
SectionRoute route = new SectionRoute();
Line line = lineRepository.findById(lineId).get();
Section section = repository.findById(sectionId).get();
route.setSectionrouteCode(routeCode+i);
route.setLineCode(lineCode);
route.setSectionCode(sectionCode);
route.setDirections(directions);
route.setVersions(versions);
route.setDestroy(0);
route.setLine(line);
route.setSection(section);
route.setIsRoadeSpeed(0);
routeRepository.save(route);
}
resultMap.put("status", ResponseCode.SUCCESS);
return resultMap;
} else {
resultMap.put("status", "Failure");
return resultMap;
}
}
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
}
return resultMap;
}
private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList,
String bsectionVector, String bsectionVectorCutList) {
if(!bsectionVector.equals("")) {
// 转换成JSON数组
JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
// 遍历
for(int s = 0 ;s<sectionsArray.size();s++) {
String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr)));
}
}
if(!bsectionVectorCutList.equals("")) {
// 转换成JSON数组
JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList);
// 截取路段在总路段中的下表
int firstTemp = 0;
int lastTemp = 0;
// 每个截取的路段去总路段中获取
for (int i = 0; i < sectionsArrayList.size(); i++) {
// 切点列表
JSONObject sectionsArray = sectionsArrayList.getJSONObject(i);
String sectionName = sectionsArray.get("name").toString();
JSONArray sectionPoints = sectionsArray.getJSONArray("section");
// 用两个坐标点去截取总路段
if (i == 0) {
for(int s = 0 ;s<sectionPoints.size();s++) {
String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString();
String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString();
Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
double distance = 0;
// 寻找最近点
for (int index = firstTemp; index < bPointsList.size(); index++) {
if (index == firstTemp) {
distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
} else {
double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
if(distance > distanceTemp) {
distance = distanceTemp;
lastTemp = index;
}
}
}
if (s == 0) {
// 第一个点作为路段的起点
firstTemp = lastTemp;
}
// 用切点替换最近点
if(lastTemp == firstTemp) {
bPointsList.add(++lastTemp, bPointcut);
} else {
bPointsList.set(lastTemp, bPointcut);
}
}
} else {
String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString();
String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString();
Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
double distance = 0;
// 寻找最近点
for (int index = firstTemp; index < bPointsList.size(); index++) {
if (index == firstTemp) {
distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
} else {
double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
if(distance > distanceTemp) {
distance = distanceTemp;
lastTemp = index;
}
}
}
// 用切点替换最近点
if(lastTemp == firstTemp) {
bPointsList.add(++lastTemp, bPointcut);
} else {
bPointsList.set(lastTemp, bPointcut);
}
}
// 切路段
if (sectionName != "" && sectionName != null ) {
// 原始线状图形坐标集合
String sectionsBpoints = "";
// WGS线状图形坐标集合
String sectionsWJPpoints = "";
for (int j = firstTemp; j <= lastTemp; j++) {
Point point = bPointsList.get(j);
String pointsLngStr = String.valueOf(point.getLon());
String pointsLatStr = String.valueOf(point.getLat());
/** to WGS坐标 */
Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
String WGSLngStr = String.valueOf(resultPoint.getLng());
String WGSLatStr = String.valueOf(resultPoint.getLat());
if(j == firstTemp) {
sectionsBpoints = pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
}else {
sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
}
}
Map<String, String> sectionCutMap = new HashMap<String, String>();
sectionCutMap.put("sectionName", sectionName);
sectionCutMap.put("sectionsBpoints", sectionsBpoints);
sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints);
sectionArrayList.add(sectionCutMap);
}
// 上一个路段的终点作为下一个路段的起点
firstTemp = lastTemp;
}
}
}
/**
* @Description :TODO(编辑线路走向)
*
* @param map <sectionId:路段ID; sectionJSON:路段信息>
*
* @return Map<String, Object> <SUCCESS ; ERROR>
*/
@Override
@Transactional
public Map<String, Object> sectionUpdate(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString();
// 原始线状图形坐标集合
String sectionsBpoints = "";
// WGS线状图形坐标集合
String sectionsWJPpoints = "";
if(!bsectionVector.equals("")) {
// 转换成JSON数组
JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
// 遍历
for(int s = 0 ;s<sectionsArray.size();s++) {
String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
/** to WGS坐标 */
Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
String WGSLngStr = String.valueOf(resultPoint.getLng());
String WGSLatStr = String.valueOf(resultPoint.getLat());
if(s==0) {
sectionsBpoints = pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
}else {
sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
}
}
}
// 原坐标类型
String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
// 说明
String descriptions = "";
// 是否撤销
Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
// 方向
Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
// 线路ID
Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString());
// 道路编码
String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
// 路段编码
String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();
// 路段长度
Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString());
// 路段ID
Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString());
// 路段名称
String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();
// 路段路由Id
Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString());
// 线路编码
String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();
// 路段时长
Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
// 路段路由
Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
SectionRoute resultS = routeRepository.findById(sectionRouteId).get();
int old_code = resultS.getSectionrouteCode();
// 是否修改路段序号标记
boolean type = false;
if(sectionrouteCode!=null) {
if(++sectionrouteCode == old_code) {
type = true;
}
// 默认是最前面路段
}else {
sectionrouteCode = 1;
}
if(!type)
routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
// 限速
Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
// 版本
Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
// WGS坐标点集合
String gsectionVector = null;
if(!sectionsWJPpoints.equals("")) {
gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
}
// 原坐标点集合
String bsectionVectorS = null;
if(!sectionsBpoints.equals("")) {
bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
}
Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
// 修改日期
String updateDate = formatter.format(date);
String crosesRoad="";
String endNode="";
String startNode="";
String middleNode="";
String sectionType="";
// 更新
repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);
SectionRoute route = new SectionRoute();
Line line = lineRepository.findById(sectionRouteLine).get();
Section section = repository.findById(sectionId).get();
route.setId(sectionRouteId);
route.setSectionrouteCode(sectionrouteCode);
route.setLineCode(lineCode);
route.setSectionCode(sectionCode);
route.setDirections(directions);
route.setVersions(version);
route.setDestroy(destroy);
route.setCreateBy(createBy);
route.setUpdateBy(updateBy);
route.setLine(line);
route.setSection(section);
route.setIsRoadeSpeed(isRoadeSpeed);
routeRepository.save(route);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
/**
* @Description :TODO(编辑缓存线路走向)
*/
@Override
@Transactional
public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString();
// 原始线状图形坐标集合
String sectionsBpoints = "";
// WGS线状图形坐标集合
String sectionsWJPpoints = "";
if(!bsectionVector.equals("")) {
// 转换成JSON数组
JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
// 遍历
for(int s = 0 ;s<sectionsArray.size();s++) {
String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
/** to WGS坐标 */
Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
String WGSLngStr = String.valueOf(resultPoint.getLng());
String WGSLatStr = String.valueOf(resultPoint.getLat());
if(s==0) {
sectionsBpoints = pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
}else {
sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
}
}
}
// 原坐标类型
String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
// 说明
String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
// 是否撤销
Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
// 方向
Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
// 线路ID
Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString());
// 道路编码
String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
// 路段编码
String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();
// 路段长度
Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString());
// 路段ID
Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString());
// 路段名称
String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();
// 路段路由Id
Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString());
// 线路编码
String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();
// 路段时长
Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
// 路段路由
Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
// Integer sectionrouteCode = 1;
SectionRouteCache resultS = routeCacheRepository.findById(sectionRouteId).get();
int old_code = resultS.getSectionrouteCode();
// 是否修改路段序号标记
boolean type = false;
if(sectionrouteCode!=null) {
if(sectionrouteCode == old_code) {
type = true;
} else {
sectionrouteCode += 1;
}
// 默认是最前面路段
}else {
sectionrouteCode = 1;
}
if(!type)
routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode);
// 限速
Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());
// 版本
Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
// WGS坐标点集合
String gsectionVector = null;
if(!sectionsWJPpoints.equals("")) {
gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
}
// 原坐标点集合
String bsectionVectorS = null;
if(!sectionsBpoints.equals("")) {
bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
}
Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
// 修改日期
String updateDate = formatter.format(date);
String crosesRoad="";
String endNode="";
String startNode="";
String middleNode="";
String sectionType="";
// 更新
repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);
SectionRouteCache route = new SectionRouteCache();
Line line = lineRepository.findById(sectionRouteLine).get();
Section section = repository.findById(sectionId).get();
route.setId(sectionRouteId);
route.setSectionrouteCode(sectionrouteCode);
route.setLineCode(lineCode);
route.setSectionCode(sectionCode);
route.setDirections(directions);
route.setVersions(version);
route.setDestroy(destroy);
route.setDescriptions(descriptions);
route.setCreateBy(createBy);
route.setUpdateBy(updateBy);
route.setLine(line);
route.setSection(section);
route.setIsRoadeSpeed(isRoadeSpeed);
routeCacheRepository.save(route);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
/** 百度坐标转WGS坐标 */
public Location FromBDPointToWGSPoint(String bLonx,String bLatx) {
double lng = Double.parseDouble(bLonx);
double lat = Double.parseDouble(bLatx);
Location bdLoc = TransGPS.LocationMake(lng, lat);
Location location = TransGPS.bd_decrypt(bdLoc);
Location WGSPoint = TransGPS.transformFromGCJToWGS(location);
return WGSPoint;
}
/**
* 新增路段信息
*
* @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID
*
* lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长;
*
* sectionrouteCode:路段序号;speedLimit:路段限速>
*
* @return map<SUCCESS:成功;ERROR:异常>
*/
@Override
@Transactional
public Map<String, Object> sectionSave(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
// 线路ID.
Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString());
// 线路编码.
String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();
// 路段名称.
String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();
// 路段编码.
String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();
// 道路编码.
String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
// 原始坐标类型.
String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString();
// 路段几何图形坐标.
String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString();
// 路段序号
String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString();
// 路段时长.
Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString());
// 路段距离.
Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString());
// 路段限速.
Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString());
// 版本.
Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString());
// 是否撤销.
Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString());
// 路段方向.
Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString());
// 描述与说明.
String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString();
// 原始线状图形坐标集合
String sectionsBpoints = "";
// WGS线状图形坐标集合
String sectionsWJPpoints = "";
if(!sectionJSON.equals("")) {
// 转换成JSON数组
JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
// 遍历
for(int s = 0 ;s<sectionsArray.size();s++) {
String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
String WGSLngStr = "";
String WGSLatStr = "";
Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
WGSLngStr = String.valueOf(resultPoint.getLng());
WGSLatStr = String.valueOf(resultPoint.getLat());
if(s==0) {
sectionsBpoints = pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
}else {
sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
}
}
}
// WGS坐标点集合
String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
// 原坐标点集合
String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
String crosesRoad="";
String endNode ="";
String startNode="";
String middleNode="";
String sectionType="";
String csectionVector=null;
Integer id = Integer.valueOf(sectionCode);
repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id);
Section section = repository.findById(id).get();
Line line = lineRepository.findById(lineId).get();
// 路段路由
SectionRoute sectionRoute = new SectionRoute();
Integer routeCode = null;
if(!sectionrouteCode.equals("")){
String sectionrouteCodeArray[] = sectionrouteCode.split("_");
routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1;
}else {
routeCode = 1;
}
routeRepository.sectionUpdSectionRouteCode(lineId, directions, routeCode);
sectionRoute.setSectionrouteCode(routeCode);
sectionRoute.setLineCode(lineCode);
sectionRoute.setSection(section);
sectionRoute.setSectionCode(sectionCode);
sectionRoute.setDirections(directions);
sectionRoute.setDescriptions(descriptions);
sectionRoute.setDestroy(destroy);
sectionRoute.setVersions(versions);
sectionRoute.setLine(line);
routeRepository.save(sectionRoute);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
}