StationRouteServiceImpl.java
2.94 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
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.StationRoute;
import com.bsth.repository.StationRouteRepository;
import com.bsth.service.StationRouteService;
/**
*
* @ClassName: StationRouteServiceImpl(站点路由service业务层实现类)
*
* @Extends : BaseService
*
* @Description: TODO(站点路由service业务层)
*
* @Author bsth@lq
*
* @Date 2016年5月03日 上午9:21:17
*
* @Version 公交调度系统BS版 0.1
*
*/
@Service
public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integer> implements StationRouteService{
@Autowired
private StationRouteRepository repository;
@Override
public List<Map<String, Object>> findPoints(Map<String, Object> map) {
String lineStr = map.get("line.id_eq").equals("") ? "0" : map.get("line.id_eq").toString();
String directionsStr = map.get("directions_eq").equals("") ? "0" : map.get("directions_eq").toString();
int line = Integer.parseInt(lineStr);
int directions= Integer.parseInt(directionsStr);
List<Object[]> list = repository.findPoints(line, directions);
List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();
List<Map<String, Object>> children = new ArrayList<Map<String,Object>>();
Map<String, Object> listMap = new HashMap<String,Object>();
listMap.put("container", "pjax-container");
listMap.put("enable", true);
listMap.put("groupType", "1");
listMap.put("icon", "");
listMap.put("id", 100);
listMap.put("pId", null);
listMap.put("name", "途径站点");
listMap.put("text", "途径站点");
if(list.size()>0) {
for(int i = 0 ; i < list.size(); i++) {
Map<String, Object> tempM = new HashMap<String, Object>();
tempM.put("id", list.get(i)[0]);
//tempM.put("id", 2);
tempM.put("line", list.get(i)[1]);
tempM.put("station", list.get(i)[2]);
tempM.put("station_name", list.get(i)[3]);
tempM.put("name", list.get(i)[3]);
tempM.put("text", list.get(i)[3]);
tempM.put("station_route_code", list.get(i)[4]);
tempM.put("station_mark", list.get(i)[7]);
tempM.put("b_jwpoints", list.get(i)[8]);
tempM.put("g_polygon_grid", list.get(i)[11]);
tempM.put("radius", list.get(i)[12]);
tempM.put("shapes_type", list.get(i)[13]);
tempM.put("icon", "fa fa-bus");
tempM.put("pId", 100);
tempM.put("groupType", "2");
tempM.put("enable", true);
children.add(tempM);
}
}
listMap.put("children", children);
resultList.add(listMap);
return resultList;
}
}