GpsController.java
2.23 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
package com.bsth.controller.gps;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.bsth.data.BasicData;
import com.bsth.data.gpsdata.GpsEntity;
import com.bsth.data.gpsdata.GpsRealData;
import com.bsth.service.gps.GpsService;
import com.google.common.base.Splitter;
@RestController
@RequestMapping("gps")
public class GpsController {
@Autowired
GpsRealData gpsRealData;
@Autowired
GpsService gpsService;
@RequestMapping(value = "/real/line/{lineCode}")
public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
return gpsRealData.getByLine(lineCode);
}
@RequestMapping(value = "/real/line")
public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) {
return gpsRealData.get(Splitter.on(",").splitToList(lineCodes));
}
/**
*
* @Title: history @Description: TODO(这个方法给测试页面用) @throws
*/
@RequestMapping(value = "/history/{device}")
public List<Map<String, Object>> history(@PathVariable("device") String device, @RequestParam Long startTime,
@RequestParam Long endTime, @RequestParam int directions) {
return gpsService.history(device, startTime, endTime, directions);
}
@RequestMapping(value = "/gpsHistory/multiple")
public List<Map<String, Object>> gpsHistory(@RequestParam String[] nbbmArray, @RequestParam Long st,
@RequestParam Long et) {
return gpsService.history(nbbmArray, st, et);
}
/*@RequestMapping(value = "/arrival/ram")
public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
return ArrivalDataBuffer.allMap.get(nbbm);
}*/
@RequestMapping(value = "/Car2DeviceId")
public Map<String, String> findCarDeviceIdMap() {
return BasicData.deviceId2NbbmMap.inverse();
}
@RequestMapping(value = "/buffAera")
public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){
return gpsService.findBuffAeraByCode(code, type);
}
}