DirectiveController.java
5.05 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
package com.bsth.controller.directive;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bsth.entity.directive.D80;
import com.bsth.entity.directive.DC0_A3;
import com.bsth.entity.sys.SysUser;
import com.bsth.security.util.SecurityUtils;
import com.bsth.service.directive.DirectiveService;
/**
*
* @ClassName: DirectiveController
* @Description: TODO(页面下发调度指令) .0
* @author PanZhao
* @date 2016年6月8日 上午9:34:51
*
*/
@RestController
@RequestMapping("/directive")
public class DirectiveController {
@Autowired
DirectiveService directiveService;
/**
*
* @Title: send60
* @Description: TODO(60协议短语下发)
* @throws
*/
@RequestMapping(value = "/phrase", method = RequestMethod.POST)
public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){
SysUser user = SecurityUtils.getCurrentUser();
return directiveService.send60Phrase(nbbm, text, user.getUserName());
}
/**
*
* @Title: send60Dispatch
* @Description: TODO(班次信息下发)
* @param @param id
* @throws
*/
@RequestMapping(value = "/dispatch", method = RequestMethod.POST)
public int send60Dispatch(@RequestParam Long id){
SysUser user = SecurityUtils.getCurrentUser();
return directiveService.send60Dispatch(id, user.getUserName());
}
/**
*
* @Title: lineChange
* @Description: TODO(切换线路)
* @param @param nbbm 车辆内部编码
* @param @param lineId 新线路编码
* @throws
*/
@RequestMapping(value = "/lineChnage", method = RequestMethod.POST)
public int lineChange(@RequestParam String nbbm, @RequestParam String lineId){
SysUser user = SecurityUtils.getCurrentUser();
return directiveService.lineChange(nbbm, lineId, user.getUserName());
}
/**
*
* @Title: upDownChange
* @Description: TODO(上下行切换)
* @param @param nbbm 车辆内部编码
* @param @param upDon
* @throws
*/
@RequestMapping(value = "/upDownChange", method = RequestMethod.POST)
public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){
SysUser user = SecurityUtils.getCurrentUser();
return directiveService.upDownChange(nbbm, upDown, user.getUserName());
}
/**
*
* @Title: findNoCofm80
* @Description: TODO(根据线路获取未确认的80驾驶员上报数据)
* @throws
*/
@RequestMapping(value = "/findNoCofm80", method = RequestMethod.GET)
public Map<String, List<D80>> findNoCofm80(@RequestParam String lineCodes){
return directiveService.findNoCofm80(lineCodes);
}
@RequestMapping(value = "/findAll80", method = RequestMethod.GET)
public Map<String, Object> findAll80(@RequestParam Map<String, Object> map,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "12") int size){
return directiveService.findAll80(map, page,size);
}
/**
*
* @Title: reply80
* @Description: TODO(回复80)
* @param @param reply 0:同意 -1:不同意
* @throws
*/
@RequestMapping(value = "/reply80", method = RequestMethod.POST)
public Map<String, Object> reply80(@RequestParam int id, @RequestParam int reply){
return directiveService.reply80(id, reply);
}
/**
*
* @Title: findDirective
* @Description: TODO(查询调度指令)
* @param @param nbbm 车辆
* @param @param dType 类型
* @param @param page 页号
* @param @param size 每页数量
* @throws
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Map<String, Object> findDirective(String nbbm,@RequestParam int dType
, @RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "10") int size){
return directiveService.findDirective(nbbm, dType, page, size);
}
@RequestMapping(value = "/c0a4", method = RequestMethod.POST)
public int c0a4(@RequestParam String nbbm){
return directiveService.sendC0A4(nbbm);
}
// @RequestMapping(value = "/c0a3", method = RequestMethod.POST)
// public int c0a3(@RequestParam DC0_A4 c0a4){
// return directiveService.sendC0A3(c0a4);
// }
@RequestMapping(value = "/c0a3", method = RequestMethod.POST)
public int c0a3(String json){
json = StringEscapeUtils.unescapeHtml4(json);
DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class);
return directiveService.sendC0A3(c0a3);
}
@RequestMapping(value = "/c0a5", method = RequestMethod.POST)
public int c0a5(String json){
json = StringEscapeUtils.unescapeHtml4(json);
//DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class);
return directiveService.sendC0A5(json);
}
}