SectionRouteServiceImpl.java
7.38 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
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.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;
/**
* @Description :TODO(查询路段信息)
*
* @param map <line.id_eq:线路ID; directions_eq:方向>
*
* @return Map<String, Object>
*/
@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;
}
/**
* @Description : TODO(根据路段路由Id查询详情)
*
* @param map <id:路段路由ID>
*
* @return List<Map<String, Object>>
*/
@Override
public List<Map<String, Object>> findSectionRouteInfoFormId(Map<String, Object> map) {
// 获取线路ID
Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
List<Object[]> objects = repository.findSectionRouteInfoFormId(id);
List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
int len = objects.size();
if(objects.size()>0) {
for(int i = 0 ; i < len; i++) {
Map<String, Object> tempM = new HashMap<String,Object>();
tempM.put("sectionRouteId", objects.get(i)[0]);
tempM.put("sectionRouteLineCode", objects.get(i)[1]);
tempM.put("sectionRouteCode", objects.get(i)[2]);
tempM.put("sectionRouteDirections", objects.get(i)[3]);
tempM.put("sectionRouteLine", objects.get(i)[4]);
tempM.put("sectionRouteSection", objects.get(i)[5]);
tempM.put("sectionRouteDescriptions", objects.get(i)[6]);
tempM.put("sectionRouteCreateBy", objects.get(i)[7]);
tempM.put("sectionRouteCreateDate", objects.get(i)[8]);
tempM.put("sectionRouteUpdateBy", objects.get(i)[9]);
tempM.put("sectionRouteUpdateDate", objects.get(i)[10]);
tempM.put("sectionRouteVersions", objects.get(i)[11]);
tempM.put("sectionRouteDestroy", objects.get(i)[12]);
tempM.put("sectionId", objects.get(i)[13]);
tempM.put("sectionCode", objects.get(i)[14]);
tempM.put("sectionName", objects.get(i)[15]);
tempM.put("sectionRoadCoding", objects.get(i)[16]);
tempM.put("sectionEndCode", objects.get(i)[17]);
tempM.put("sectionStartNode", objects.get(i)[18]);
tempM.put("sectionMiddleNode", objects.get(i)[19]);
tempM.put("sectionType", objects.get(i)[20]);
tempM.put("sectionCsectionVector", objects.get(i)[21]);
tempM.put("sectionBsectionVector", objects.get(i)[22]);
tempM.put("sectionGsectionVector", objects.get(i)[23]);
tempM.put("sectionDistance", objects.get(i)[24]);
tempM.put("sectionTime", objects.get(i)[25]);
tempM.put("sectionDbtype", objects.get(i)[26]);
tempM.put("sectionSpeedLimit", objects.get(i)[27]);
tempM.put("sectionDescriptions", objects.get(i)[28]);
tempM.put("sectionCreateBy", objects.get(i)[29]);
tempM.put("sectionCreateDate", objects.get(i)[30]);
tempM.put("sectionUpdateBy", objects.get(i)[31]);
tempM.put("sectionUpdateDate", objects.get(i)[32]);
tempM.put("sectionVersion", objects.get(i)[33]);
resultList.add(tempM);
}
}
return resultList;
}
/**
* @Description :TODO(查询线路某方向下的上一个路段序号)
*
* @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码>
*
* @return List<Map<String, Object>>
*/
@Override
public List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map) {
Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString());
List<Object[]> reslutList = repository.findUpSectionRouteCode(lineId, direction, stationRouteCode);
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
if(reslutList.get(0)!=null) {
for(int i = 0 ; i <reslutList.size() ;i++){
Map<String, Object> tempM = new HashMap<String, Object>();
System.out.println(reslutList.get(i));
tempM.put("sectionrouteCode", reslutList.get(i));
list.add(tempM);
}
}
return list;
}
}