GeoDataController.java
1.61 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
package com.bsth.controller;
import com.bsth.data.geo.GeoCacheData;
import com.bsth.entity.SectionRoute;
import com.bsth.entity.StationRoute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("geo_data")
public class GeoDataController {
@RequestMapping("{lineCode}")
public Map<String, Object> find(@PathVariable("lineCode") String lineCode) {
List<StationRoute>[] stationLists = GeoCacheData.find(lineCode);
List<SectionRoute>[] sectionLists = GeoCacheData.findSections(lineCode);
Map<String, Object> rs = new HashMap<>();
rs.put("stations", stationLists);
rs.put("section", sectionLists);
return rs;
}
@RequestMapping("/stations/{lineCode}")
public Map<String, Object> findStations(@PathVariable("lineCode") String lineCode) {
List<StationRoute>[] stationLists = GeoCacheData.find(lineCode);
Map<String, Object> rs = new HashMap<>();
rs.put("stations", stationLists);
return rs;
}
@RequestMapping("/stations/{lineCode}/{upDown}")
public Map<String, Object> findStationsByUpDown(@PathVariable("lineCode") String lineCode,@PathVariable("upDown") int upDown) {
List<StationRoute> list = GeoCacheData.find(lineCode, upDown);
Map<String, Object> rs = new HashMap<>();
rs.put("stations", list);
return rs;
}
}