DirectiveController.java
4.35 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
package com.bsth.vehicle.directive.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
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.bsth.entity.sys.SysUser;
import com.bsth.security.util.SecurityUtils;
import com.bsth.util.DateUtils;
import com.bsth.vehicle.directive.entity.Directive80;
import com.bsth.vehicle.directive.service.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 Integer 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.GET)
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<Directive80>> findNoCofm80(@RequestParam String lineCodes){
return directiveService.findNoCofm80(lineCodes);
}
@RequestMapping(value = "/findAll80", method = RequestMethod.GET)
public Page<Directive80> findAll80(@RequestParam Map<String, Object> map,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "12") int size){
return directiveService.findAll80(map, new PageRequest(page, size, new Sort(Direction.DESC, "timestamp")));
}
/**
*
* @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);
}
}