ScheduleRealInfoController.java
17 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
package com.bsth.controller.realcontrol;
import com.alibaba.fastjson.JSONArray;
import com.bsth.controller.BaseController;
import com.bsth.controller.realcontrol.dto.ChangePersonCar;
import com.bsth.controller.realcontrol.dto.DfsjChange;
import com.bsth.data.BasicData;
import com.bsth.data.schedule.DayOfSchedule;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.entity.schedule.SchedulePlanInfo;
import com.bsth.service.realcontrol.ScheduleRealInfoService;
import org.apache.commons.lang3.StringEscapeUtils;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
@RequestMapping("/realSchedule")
public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
/*@Autowired
GetSchedulePlanThread getSchedulePlanThread;*/
@Autowired
ScheduleRealInfoService scheduleRealInfoService;
@Autowired
DayOfSchedule dayOfSchedule;
@RequestMapping(value = "/lines")
public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
return scheduleRealInfoService.findByLines(lines);
}
/**
*
* @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,String bcType) {
return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType);
}
/**
*
* @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
*/
@RequestMapping(value = "/destroy", method = RequestMethod.POST)
public Map<String, Object> destroy(@RequestParam String idsStr
/*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
@RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/);
}
/**
*
* @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
*/
@RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
public Map<String, String> carDeviceMapp() {
return BasicData.deviceId2NbbmMap.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: realOutAdjust
* @Description: TODO(实发调整)
* @param @param id 班次ID
* @param @param fcsjActual 实际发车时间 HH:mm
* @param @param remarks 备注
* @throws
*/
@RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,
@RequestParam String remarks) {
return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);
}
/**
*
* @Title: revokeDestroy
* @Description: TODO(撤销烂班)
* @param @param id
* @throws
*/
@RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
public Map<String, Object> revokeDestroy(@RequestParam Long id){
return scheduleRealInfoService.revokeDestroy(id);
}
/**
*
* @Title: revokeRealOutgo
* @Description: TODO(撤销实发)
* @param @param id
* @throws
*/
@RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
return scheduleRealInfoService.revokeRealOutgo(id);
}
/**
*
* @Title: spaceAdjust
* @Description: TODO(间隔调整)
* @param @param ids 要调整的班次数组ID
* @param @param space 间隔
* @throws
*/
@RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
return scheduleRealInfoService.spaceAdjust(ids, space);
}
/**
*
* @Title: schInfoFineTune
* @Description: TODO(发车信息微调)
* @param @param map
* @throws
*/
@RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
return scheduleRealInfoService.schInfoFineTune(map);
}
/**
*
* @Title: trustStatus @Description: TODO(线路托管状态) @param @param lineCodes
* 线路编码 @throws
*/
@RequestMapping(value = "/trustStatus")
public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) {
return scheduleRealInfoService.trustStatus(lineCodes);
}
/**
*
* @Title: outgoAdjustAll
* @Description: TODO(批量待发调整)
* @param @param list
* @throws
*/
@RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
public Map<String, Object> outgoAdjustAll(@RequestParam String params){
//反转义
params = StringEscapeUtils.unescapeHtml4(params);
return scheduleRealInfoService.outgoAdjustAll(params);
}
/**
*
* @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;
}
/**
*
* @Title: findByLineAndUpDown
* @Description: TODO(根据线路和走向获取班次)
* @param @param line
* @param @param upDown
*/
@RequestMapping(value = "/findByLineAndUpDown")
public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
return dayOfSchedule.findByLineAndUpDown(line, upDown);
}
/**
*
* @Title: findRouteByLine
* @Description: TODO(获取线路的站点,路段路由)
* @param @param lineCode
* @throws
*/
@RequestMapping(value = "/findRouteByLine")
public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
return scheduleRealInfoService.findRouteByLine(lineCode);
}
@RequestMapping(value = "/test/getSch")
public int getSch(){
//getSchedulePlanThread.start();
return 1;
}
/**
*
* @Title: removeChildTask
* @Description: TODO(删除子任务)
* @param @param taskId 子任务ID
* @throws
*/
@RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
return scheduleRealInfoService.removeChildTask(taskId);
}
/**
*
* @Title: findByLineCode
* @Description: TODO(根据线路获取班次信息)
* @param @param lineCode
*/
@RequestMapping(value = "/lineCode/{lineCode}")
public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
//return ScheduleBuffer.realSchedulListMap.get(lineCode);
return dayOfSchedule.findByLineCode(lineCode);
}
@RequestMapping(value = "/queryUserInfo")
public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
@RequestParam String date,@RequestParam String state) {
return scheduleRealInfoService.queryUserInfo(line, date,state);
}
@RequestMapping(value = "/queryUserInfoPx")
public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
@RequestParam String date,@RequestParam String state,@RequestParam String type) {
return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
}
@RequestMapping(value = "/exportWaybill")
public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
@RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
}
@RequestMapping(value = "/exportWaybillQp")
public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
,@RequestParam String date,@RequestParam String line) {
return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
}
@RequestMapping(value = "/dailyInfo")
public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
return scheduleRealInfoService.dailyInfo(line, date, type);
}
@RequestMapping(value = "/historyMessage")
public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
@RequestParam String code, @RequestParam String type) {
return scheduleRealInfoService.historyMessage(line, date, code, type);
}
@RequestMapping(value="/findLine")
public List<Map<String,String>> findLine(@RequestParam String line){
return scheduleRealInfoService.findLine(line);
}
@RequestMapping(value="/findKMBC")
public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date,line);
}
@RequestMapping(value="/findKMBCQp")
public Map<String,Object> findKMBCQp(@RequestParam String clZbh
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
}
@RequestMapping(value="/findLpName")
public List<Map<String,String>> findLpName(@RequestParam String lpName){
return scheduleRealInfoService.findLpName(lpName);
}
@RequestMapping(value = "/account")
public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
@RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
return scheduleRealInfoService.account(line, date, code, xlName, type);
}
@RequestMapping(value = "/correctForm")
public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate,
@RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type);
}
/**
* @Title queryListWaybill
* @Description 查询行车路单列表
* @param jName 驾驶员名字
* @param clZbh 车辆自编号(内部编号)
* @param lpName 路牌
* @return
*/
@RequestMapping(value="/queryListWaybill")
public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
,@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
}
@RequestMapping(value="/queryListWaybillQp")
public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
@RequestParam String date,@RequestParam String line){
return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
}
@RequestMapping(value="/statisticsDaily")
public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
@RequestParam String xlName, @RequestParam String type){
return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
}
@RequestMapping(value="/MapById",method = RequestMethod.GET)
public Map<String, Object> MapById(@RequestParam("id") Long id){
return scheduleRealInfoService.MapById(id);
}
/**
* @Title: scheduleDaily
* @Description: TODO(调度日报表)
* @param line 线路
* @param date 时间
* @return
*/
@RequestMapping(value="/scheduleDaily")
public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.scheduleDaily(line,date);
}
@RequestMapping(value="/realScheduleList")
public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleList(line,date);
}
@RequestMapping(value="/realScheduleListQp")
public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.realScheduleListQp(line,date);
}
@RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
return scheduleRealInfoService.multi_tzrc(cpcs);
}
@RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
return scheduleRealInfoService.multi_dftz(dfsjcs);
}
@RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks){
return scheduleRealInfoService.changeBcType(id, bcType, remarks);
}
@RequestMapping(value="/history", method=RequestMethod.POST)
public Map<String,Object> historySave(ScheduleRealInfo sch){
return scheduleRealInfoService.historySave(sch);
}
private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
private final static long ONE_DAY = 1000 * 60 * 60 * 24;
/**
* 获取可编辑的历史班次日期
* @return
*/
@RequestMapping("dateArray")
public List<String> dateArray(){
List<String> rs = new ArrayList<>();
long t = new Date().getTime() - ONE_DAY;
for(int i = 0; i < 5; i ++){
rs.add(fmtyyyyMMdd.print(t));
t -= ONE_DAY;
}
return rs;
}
@RequestMapping(value = "svgAttr", method = RequestMethod.POST)
public Map<String, Object> svgAttr(@RequestParam String jsonStr){
return scheduleRealInfoService.svgAttr(jsonStr);
}
@RequestMapping(value = "svgAttr", method = RequestMethod.GET)
public Map<String, Object> findSvgAttr(@RequestParam String idx){
return scheduleRealInfoService.findSvgAttr(idx);
}
@RequestMapping(value = "addRemarks", method = RequestMethod.POST)
public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
return scheduleRealInfoService.addRemarks(id, remarks);
}
@RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
return scheduleRealInfoService.scheduleDailyQp(line,date);
}
@RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
return scheduleRealInfoService.scheduleDailyExport(map);
}
@RequestMapping(value = "exportWaybillMore", method = RequestMethod.POST)
public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
return scheduleRealInfoService.exportWaybillMore(map);
}
/**
* 获取当日计划排班 , 从计划表抓取数据
* @return
*/
@RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
return scheduleRealInfoService.currentSchedulePlan(lineCode);
}
@RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
}
}