SectionRouteServiceImpl.java
3.66 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
package com.bsth.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bsth.common.ResponseCode;
import com.bsth.entity.SectionRoute;
import com.bsth.repository.SectionRouteRepository;
import com.bsth.service.SectionRouteService;
/**
*
* @ClassName: SectionRouteServiceImpl(路段路由service业务层实现类)
*
* @Extends : BaseService
*
* @Description: TODO(路段路由service业务层)
*
* @Author bsth@lq
*
* @Date 2016年05月03日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Service
public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integer> implements SectionRouteService{
@Autowired
SectionRouteRepository repository;
@Override
public List<Map<String, Object>> getSectionRoute(Map<String, Object> map) {
int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString());
int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString());
List<Object[]> listObjArray = repository.getSectionRoute(lineId, directions);
List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
if(listObjArray.size()>0) {
for(int i = 0 ; i<listObjArray.size() ; i++){
Map<String, Object> tempM = new HashMap<String, Object>();
tempM.put("sectionrouteId",listObjArray.get(i)[0]);
tempM.put("sectionrouteLine",listObjArray.get(i)[1]);
tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]);
tempM.put("sectionrouteSection",listObjArray.get(i)[3]);
tempM.put("sectionrouteSectionCode",listObjArray.get(i)[4]);
tempM.put("sectionrouteCode",listObjArray.get(i)[5]);
tempM.put("sectionrouteDirections",listObjArray.get(i)[6]);
tempM.put("sectionId",listObjArray.get(i)[7]);
tempM.put("sectionCode",listObjArray.get(i)[8]);
tempM.put("sectionName",listObjArray.get(i)[9]);
tempM.put("sectionCrosesRoad",listObjArray.get(i)[10]);
tempM.put("sectionEndNode",listObjArray.get(i)[11]);
tempM.put("sectionStartNode",listObjArray.get(i)[12]);
tempM.put("sectionMiddleNode",listObjArray.get(i)[13]);
tempM.put("sectionType",listObjArray.get(i)[14]);
tempM.put("sectionCsectionVector",listObjArray.get(i)[15]);
tempM.put("sectionBsectionVector",listObjArray.get(i)[16]);
tempM.put("sectionGsectionVector",listObjArray.get(i)[17]);
tempM.put("sectionRoadCoding",listObjArray.get(i)[18]);
tempM.put("sectionDistance",listObjArray.get(i)[19]);
tempM.put("sectionTime",listObjArray.get(i)[20]);
tempM.put("sectiondbType",listObjArray.get(i)[21]);
tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]);
resultList.add(tempM);
}
}
return resultList;
}
@Override
public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<String,Object>();
try {
Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString());
Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString());
repository.stationRouteIsDestroyUpd(stationRouteId, destroy);
resultMap.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
resultMap.put("status", ResponseCode.ERROR);
logger.error("save erro.", e);
}
return resultMap;
}
}