InoutCarparkController.java
4.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
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
package com.bsth.controller;
import com.bsth.common.ResponseCode;
import com.bsth.entity.LsInoutSectionRoute;
import com.bsth.service.InoutCarparkService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("inout")
public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{
private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class);
@Autowired
InoutCarparkService inoutCarparkService;
@RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET)
public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) {
return inoutCarparkService.getStartEndByLine(lineId, version);
}
@RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET)
public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) {
return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end);
}
/**
* 新增路段信息
*
* @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID
*
* lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长;
*
* sectionrouteCode:路段序号;speedLimit:路段限速>
*
* @return map<SUCCESS:成功;ERROR:异常>
*/
@RequestMapping(value="sectionSave" , method = RequestMethod.POST)
public Map<String, Object> sectionSave(LsInoutSectionRoute sectionRoute) {
Map<String, Object> result = new HashMap<>();
try {
inoutCarparkService.add(sectionRoute);
result.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
result.put("status", ResponseCode.ERROR);
result.put("msg", e.getMessage());
logger.error("", e);
}
return result;
}
/**
* @Description :TODO(编辑线路走向)
*
* @param map <sectionId:路段ID; sectionJSON:路段信息>
*
* @return Map<String, Object> <SUCCESS ; ERROR>
*/
@RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
public Map<String, Object> sectionUpdate(LsInoutSectionRoute sectionRoute) {
Map<String, Object> result = new HashMap<>();
try {
inoutCarparkService.modify(sectionRoute);
result.put("status", ResponseCode.SUCCESS);
} catch (Exception e) {
result.put("status", ResponseCode.ERROR);
result.put("msg", e.getMessage());
logger.error("", e);
}
return result;
}
/**
* @param id //路段路由id
* @Description: TODO(撤销路段)
*/
@RequestMapping(value = "/destroy", method = RequestMethod.POST)
public Map<String, Object> destroy(@RequestParam Map<String, Object> map) {
return inoutCarparkService.destroy(map);
}
/**
* 从历史轨迹做进场路径规划
* @Description: TODO(撤销路段)
*/
@RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST)
public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){
Map<String, Object> result = new HashMap<>();
result.put("status", ResponseCode.SUCCESS);
try {
String schId = (String)map.get("schId"), version = (String)map.get("version");
if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) {
throw new RuntimeException("无效的参数");
}
inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version));
} catch (Exception e) {
result.put("status", ResponseCode.ERROR);
logger.error("路径规划异常", e);
}
return result;
}
}