ScheduleRealInfoController.java
6.85 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package com.bsth.controller.realcontrol;
import java.util.Collection;
import java.util.List;
import java.util.Map;
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.bsth.controller.BaseController;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.security.util.SecurityUtils;
import com.bsth.service.realcontrol.ScheduleRealInfoService;
import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
import com.bsth.vehicle.common.CommonMapped;
import com.google.common.base.Splitter;
@RestController
@RequestMapping("/realSchedule")
public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long>{
@Autowired
ScheduleRealInfoService scheduleRealInfoService;
@RequestMapping(value = "/lines")
public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines){
return scheduleRealInfoService.findByLines(lines);
}
/**
*
* @Title: registerLine
* @Description: TODO(注册线路,后续才能收到数据推送)
* @param @param lineCodes
* @throws
*/
@RequestMapping(value = "/registerLine", method = RequestMethod.POST)
public int registerLine(@RequestParam String lineCodes){
List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes);
String userName = SecurityUtils.getCurrentUser().getUserName();
//注销之前的绑定
Collection<String> cs = CommonMapped.lineUserMap.values();
for(String c : cs){
if(c.equals(userName))
cs.remove(c);
}
//重新绑定
for(String line : list)
CommonMapped.lineUserMap.put(Integer.parseInt(line), userName);
return 0;
}
/**
*
* @Title: outgoAdjust
* @Description: TODO(待发调整)
* @param @param id 主键
* @param @param remarks 备注
* @param @param dfsj 待发时间(HH:mm)
* @throws
*/
@RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,@RequestParam String dfsj){
return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj);
}
/**
*
* @Title: destroy
* @Description: TODO(销毁,烂班)
* @param @param idsStr 要烂掉的班次ID ,分隔
* @param @param spaceAdjust 自动调整后续间隔(1 是 -1 否)
* @param @param remarks 备注
* @param @param reason 理由
* @param @param spaceNum 间隔(分钟)
* @throws
*/
@RequestMapping(value = "/destroy", method = RequestMethod.POST)
public Map<String, Object> destroy(@RequestParam String idsStr,@RequestParam int spaceAdjust,@RequestParam String remarks,@RequestParam String reason,@RequestParam int spaceNum){
return scheduleRealInfoService.destroy(idsStr, spaceAdjust, remarks, reason, spaceNum);
}
/**
*
* @Title: carDeviceMapp
* @Description: TODO(获取车辆自编号和设备号对照,从缓存取)
* @throws
*/
@RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
public Map<String, String> carDeviceMapp(){
return CommonMapped.vehicDeviceBiMap.inverse();
}
/**
*
* @Title: findPersionByLine
* @Description: TODO(根据线路主键获取驾驶员)
* @param @param lineId
* @throws
*/
@RequestMapping(value = "/driver", method = RequestMethod.GET)
public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode){
return scheduleRealInfoService.findDriverByLine(lineCode);
}
/**
*
* @Title: findPersionByLine
* @Description: TODO(根据线路主键获取售票员)
* @param @param lineId
* @throws
*/
@RequestMapping(value = "/conductor", method = RequestMethod.GET)
public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode){
return scheduleRealInfoService.findConductorByLine(lineCode);
}
/**
*
* @Title: findPersionByLine
* @Description: TODO(根据线路主键获取车辆)
* @param @param lineId
* @throws
*/
@RequestMapping(value = "/cars", method = RequestMethod.GET)
public List<Map<String, String>> findCarByLine(@RequestParam String lineCode){
return scheduleRealInfoService.findCarByLine(lineCode);
}
/**
*
* @Title: sreachNbbm
* @Description: TODO(搜索车辆内部编码)
* @throws
*/
@RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
public List<Map<String, String>> sreachVehic(@RequestParam String nbbm){
return scheduleRealInfoService.sreachVehic(nbbm);
}
/**
*
* @Title: adjust
* @Description: TODO(调整人车)
* @param @param id 班次ID
* @param @param nbbm 内部编码
* @param @param jsy 驾驶员
* @param @param spy 售票员
* @throws
*/
@RequestMapping(value = "/adjust", method = RequestMethod.POST)
public Map<String, Object> adjust(@RequestParam Long id
, @RequestParam String nbbm
, @RequestParam String jsy
, @RequestParam String spy){
return scheduleRealInfoService.adjust(id, nbbm, jsy, spy);
}
/**
*
* @Title: trustStatus
* @Description: TODO(线路托管状态)
* @param @param lineCodes 线路编码
* @throws
*/
@RequestMapping(value = "/trustStatus")
public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes){
return scheduleRealInfoService.trustStatus(lineCodes);
}
/**
*
* @Title: changeTrustStatus
* @Description: TODO(切换线路托管状态)
* @param @param lineCode 线路编码
* @param @param status 托管状态
* @throws
*/
@RequestMapping(value = "/trustStatus/change", method = RequestMethod.POST)
public int changeTrustStatus(@RequestParam Integer lineCode, @RequestParam Integer status){
ScheduleBuffer.trustMap.put(lineCode, status);
return 200;
}
@RequestMapping(value="/queryUserInfo")
public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.queryUserInfo(line, date);
}
@RequestMapping(value="/exportWaybill")
public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){
return scheduleRealInfoService.exportWaybill(jName, clZbh,lpName);
}
@RequestMapping(value="/dailyInfo")
public List<Map<String,Object>> dailyInfo(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.dailyInfo(line, date);
}
@RequestMapping(value="/historyMessage")
public List<ScheduleRealInfo> historyMessage(@RequestParam String line,@RequestParam String date,@RequestParam String code){
return scheduleRealInfoService.historyMessage(line, date,code);
}
}