Commit d1e3bd733eb852443ffd142c7ae22e76dda9f4af

Authored by 王通
1 parent 967f9bc8

1.批量调整人车,在浦交存在连续提交2次的情况,会造成数据紊乱

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.Arrays;  
5 -import java.util.Collection;  
6 -import java.util.HashMap;  
7 -import java.util.List;  
8 -import java.util.Map;  
9 -  
10 -import org.apache.commons.lang3.StringEscapeUtils;  
11 -import org.joda.time.format.DateTimeFormat;  
12 -import org.joda.time.format.DateTimeFormatter;  
13 -import org.springframework.beans.factory.annotation.Autowired;  
14 -import org.springframework.web.bind.annotation.PathVariable;  
15 -import org.springframework.web.bind.annotation.RequestMapping;  
16 -import org.springframework.web.bind.annotation.RequestMethod;  
17 -import org.springframework.web.bind.annotation.RequestParam;  
18 -import org.springframework.web.bind.annotation.RestController;  
19 -  
20 -import com.alibaba.fastjson.JSONArray;  
21 -import com.bsth.common.ResponseCode;  
22 -import com.bsth.controller.BaseController;  
23 -import com.bsth.controller.realcontrol.dto.ChangePersonCar;  
24 -import com.bsth.controller.realcontrol.dto.DfsjChange;  
25 -import com.bsth.data.BasicData;  
26 -import com.bsth.data.schedule.DayOfSchedule;  
27 -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;  
28 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
29 -import com.bsth.entity.report.RepairReport;  
30 -import com.bsth.entity.schedule.SchedulePlanInfo;  
31 -import com.bsth.service.realcontrol.ScheduleRealInfoService;  
32 -  
33 -@RestController  
34 -@RequestMapping("/realSchedule")  
35 -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {  
36 -  
37 - @Autowired  
38 - ScheduleRealInfoService scheduleRealInfoService;  
39 -  
40 - @Autowired  
41 - DayOfSchedule dayOfSchedule;  
42 -  
43 - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)  
44 - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){  
45 - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);  
46 - }  
47 -  
48 - @RequestMapping(value = "/lines")  
49 - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {  
50 - return scheduleRealInfoService.findByLines(lines);  
51 - }  
52 -  
53 - @RequestMapping(value = "/car")  
54 - public List<ScheduleRealInfo> findByCar(String nbbm){  
55 - return dayOfSchedule.findByNbbm(nbbm);  
56 - }  
57 -  
58 - /**  
59 - *  
60 - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id  
61 - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws  
62 - */  
63 - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)  
64 - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,  
65 - @RequestParam String dfsj,String bcType,  
66 - @RequestParam(defaultValue = "") String opType) {  
67 - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);  
68 - }  
69 -  
70 - /**  
71 - *  
72 - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔  
73 - */  
74 - @RequestMapping(value = "/destroy", method = RequestMethod.POST)  
75 - public Map<String, Object> destroy(@RequestParam String idsStr  
76 - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,  
77 - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {  
78 - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);  
79 - }  
80 -  
81 - /**  
82 - *  
83 - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws  
84 - */  
85 - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)  
86 - public Map<String, String> carDeviceMapp() {  
87 - return BasicData.deviceId2NbbmMap.inverse();  
88 - }  
89 -  
90 - /**  
91 - *  
92 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param  
93 - * lineId @throws  
94 - */  
95 - @RequestMapping(value = "/driver", method = RequestMethod.GET)  
96 - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {  
97 - return scheduleRealInfoService.findDriverByLine(lineCode);  
98 - }  
99 -  
100 - /**  
101 - *  
102 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param  
103 - * lineId @throws  
104 - */  
105 - @RequestMapping(value = "/conductor", method = RequestMethod.GET)  
106 - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {  
107 - return scheduleRealInfoService.findConductorByLine(lineCode);  
108 - }  
109 -  
110 - /**  
111 - *  
112 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param  
113 - * lineId @throws  
114 - */  
115 - @RequestMapping(value = "/cars", method = RequestMethod.GET)  
116 - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {  
117 - return scheduleRealInfoService.findCarByLine(lineCode);  
118 - }  
119 -  
120 - /**  
121 - *  
122 - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws  
123 - */  
124 - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)  
125 - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {  
126 - return scheduleRealInfoService.sreachVehic(nbbm);  
127 - }  
128 - /**  
129 - *  
130 - * @Title: realOutAdjust  
131 - * @Description: TODO(实发调整)  
132 - * @param @param id 班次ID  
133 - * @param @param fcsjActual 实际发车时间 HH:mm  
134 - * @param @param remarks 备注  
135 - * @throws  
136 - */  
137 - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)  
138 - public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {  
139 - return scheduleRealInfoService.realOutAdjust(map);  
140 - }  
141 -  
142 - /**  
143 - *  
144 - * @Title: revokeDestroy  
145 - * @Description: TODO(撤销烂班)  
146 - * @param @param id  
147 - * @throws  
148 - */  
149 - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)  
150 - public Map<String, Object> revokeDestroy(@RequestParam Long id){  
151 - return scheduleRealInfoService.revokeDestroy(id);  
152 - }  
153 -  
154 - /**  
155 - *  
156 - * @Title: revokeRealOutgo  
157 - * @Description: TODO(撤销实发)  
158 - * @param @param id  
159 - * @throws  
160 - */  
161 - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)  
162 - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){  
163 - return scheduleRealInfoService.revokeRealOutgo(id);  
164 - }  
165 -  
166 - /**  
167 - * 撤销执行  
168 - * @param id  
169 - * @return  
170 - */  
171 - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)  
172 - public Map<String, Object> revokeRealArrive(@RequestParam Long id){  
173 - return scheduleRealInfoService.revokeRealArrive(id);  
174 - }  
175 -  
176 - /**  
177 - *  
178 - * @Title: spaceAdjust  
179 - * @Description: TODO(间隔调整)  
180 - * @param @param ids 要调整的班次数组ID  
181 - * @param @param space 间隔  
182 - * @throws  
183 - */  
184 - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)  
185 - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){  
186 - return scheduleRealInfoService.spaceAdjust(ids, space);  
187 - }  
188 -  
189 - /**  
190 - *  
191 - * @Title: schInfoFineTune  
192 - * @Description: TODO(发车信息微调)  
193 - * @param @param map  
194 - * @throws  
195 - */  
196 - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)  
197 - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){  
198 - return scheduleRealInfoService.schInfoFineTune(map);  
199 - }  
200 -  
201 - /**  
202 - *  
203 - * @Title: outgoAdjustAll  
204 - * @Description: TODO(批量待发调整)  
205 - * @param @param list  
206 - * @throws  
207 - */  
208 - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)  
209 - public Map<String, Object> outgoAdjustAll(@RequestParam String params){  
210 - //反转义  
211 - params = StringEscapeUtils.unescapeHtml4(params);  
212 - return scheduleRealInfoService.outgoAdjustAll(params);  
213 - }  
214 -  
215 - /**  
216 - *  
217 - * @Title: findByLineAndUpDown  
218 - * @Description: TODO(根据线路和走向获取班次)  
219 - * @param @param line  
220 - * @param @param upDown  
221 - */  
222 - @RequestMapping(value = "/findByLineAndUpDown")  
223 - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){  
224 - return dayOfSchedule.findByLineAndUpDown(line, upDown);  
225 - }  
226 -  
227 - /**  
228 - *  
229 - * @Title: findRouteByLine  
230 - * @Description: TODO(获取线路的站点,路段路由)  
231 - * @param @param lineCode  
232 - * @throws  
233 - */  
234 - @RequestMapping(value = "/findRouteByLine")  
235 - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){  
236 - return scheduleRealInfoService.findRouteByLine(lineCode);  
237 - }  
238 -  
239 - /**  
240 - *  
241 - * @Title: removeChildTask  
242 - * @Description: TODO(删除子任务)  
243 - * @param @param taskId 子任务ID  
244 - * @throws  
245 - */  
246 - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)  
247 - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){  
248 - return scheduleRealInfoService.removeChildTask(taskId);  
249 - }  
250 -  
251 - /**  
252 - *  
253 - * @Title: findByLineCode  
254 - * @Description: TODO(根据线路获取班次信息)  
255 - * @param @param lineCode  
256 - */  
257 - @RequestMapping(value = "/lineCode/{lineCode}")  
258 - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){  
259 - return dayOfSchedule.findByLineCode(lineCode);  
260 - }  
261 -  
262 - @RequestMapping(value = "/queryUserInfo")  
263 - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,  
264 - @RequestParam String date,@RequestParam String state) {  
265 - return scheduleRealInfoService.queryUserInfo(line, date,state);  
266 - }  
267 -  
268 - @RequestMapping(value = "/queryUserInfoPx")  
269 - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,  
270 - @RequestParam String date,@RequestParam String state,@RequestParam String type) {  
271 - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);  
272 - }  
273 -  
274 - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)  
275 - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,  
276 - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {  
277 - return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);  
278 - }  
279 -  
280 - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)  
281 - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh  
282 - ,@RequestParam String date,@RequestParam String line) {  
283 - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);  
284 - }  
285 -  
286 -  
287 - @RequestMapping(value = "/dailyInfo")  
288 - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {  
289 - return scheduleRealInfoService.dailyInfo(line, date, type);  
290 - }  
291 -  
292 - @RequestMapping(value = "/historyMessage")  
293 - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,  
294 - @RequestParam String code, @RequestParam String type) {  
295 - return scheduleRealInfoService.historyMessage(line, date, code, type);  
296 - }  
297 -  
298 - @RequestMapping(value="/findLine")  
299 - public List<Map<String,String>> findLine(@RequestParam String line){  
300 - return scheduleRealInfoService.findLine(line);  
301 - }  
302 -  
303 - @RequestMapping(value="/findKMBC",method = RequestMethod.GET)  
304 - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
305 - ,@RequestParam String date,@RequestParam String line){  
306 - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);  
307 - }  
308 -  
309 - /**  
310 - * 路单公里统计 (闵行审计专用)  
311 - * @param jGh  
312 - * @param clZbh  
313 - * @param lpName  
314 - * @param date  
315 - * @param line  
316 - * @return  
317 - */  
318 - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)  
319 - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
320 - ,@RequestParam String date,@RequestParam String line){  
321 - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);  
322 - }  
323 -  
324 - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)  
325 - public Map<String,Object> findKMBCQp(@RequestParam String clZbh  
326 - ,@RequestParam String date,@RequestParam String line){  
327 - return scheduleRealInfoService.findKMBCQp(clZbh,date,line);  
328 - }  
329 -  
330 - @RequestMapping(value="/findLpName")  
331 - public List<Map<String,String>> findLpName(@RequestParam String lpName){  
332 - return scheduleRealInfoService.findLpName(lpName);  
333 - }  
334 -  
335 - @RequestMapping(value = "/account")  
336 - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,  
337 - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {  
338 - return scheduleRealInfoService.account(line, date, code, xlName, type);  
339 - }  
340 -  
341 - @RequestMapping(value = "/accountPx")  
342 - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,  
343 - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {  
344 - return scheduleRealInfoService.accountPx(line, date, code, xlName, px);  
345 - }  
346 -  
347 - @RequestMapping(value = "/correctForm")  
348 - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,  
349 - @RequestParam String endDate,  
350 - @RequestParam String lpName, @RequestParam String code,  
351 - @RequestParam String type,@RequestParam String changType) {  
352 - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);  
353 - }  
354 - /**  
355 - * @Title queryListWaybill  
356 - * @Description 查询行车路单列表  
357 - * @param jName 驾驶员名字  
358 - * @param clZbh 车辆自编号(内部编号)  
359 - * @param lpName 路牌  
360 - * @return  
361 - */  
362 - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)  
363 - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
364 - ,@RequestParam String date,@RequestParam String line){  
365 - return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);  
366 - }  
367 -  
368 - /**  
369 - * @Title queryListWaybill  
370 - * @Description 查询行车路单列表(闵行审计专用路单)  
371 - * @param jName 驾驶员名字  
372 - * @param clZbh 车辆自编号(内部编号)  
373 - * @param lpName 路牌  
374 - * @return  
375 - */  
376 - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)  
377 - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName  
378 - ,@RequestParam String date,@RequestParam String line){  
379 - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);  
380 - }  
381 -  
382 - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)  
383 - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,  
384 - @RequestParam String date,@RequestParam String line){  
385 - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);  
386 - }  
387 -  
388 - @RequestMapping(value="/statisticsDaily")  
389 - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,  
390 - @RequestParam String xlName, @RequestParam String type){  
391 - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);  
392 - }  
393 -  
394 - @RequestMapping(value="/statisticsDaily_mh_2")  
395 - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,  
396 - @RequestParam String xlName, @RequestParam String type){  
397 - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);  
398 - }  
399 -  
400 - @RequestMapping(value="/statisticsDailyTj")  
401 - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){  
402 - String gsdm="";  
403 - if(map.get("gsdm")!=null){  
404 - gsdm=map.get("gsdm").toString();  
405 - }  
406 - String fgsdm="";  
407 - if(map.get("fgsdm")!=null){  
408 - fgsdm=map.get("fgsdm").toString();  
409 - }  
410 - String line="";  
411 - if(map.get("line")!=null){  
412 - line=map.get("line").toString();  
413 - }  
414 - String date="";  
415 - if(map.get("date")!=null){  
416 - date=map.get("date").toString();  
417 - }  
418 - String date2="";  
419 - if(map.get("date2")!=null){  
420 - date2=map.get("date2").toString();  
421 - }  
422 - String xlName="";  
423 - if(map.get("xlName")!=null){  
424 - xlName=map.get("xlName").toString();  
425 - }  
426 - String type="";  
427 - if(map.get("type")!=null){  
428 - type=map.get("type").toString();  
429 - }  
430 - String nature="0";  
431 - if(map.get("nature")!=null){  
432 - nature=map.get("nature").toString();  
433 - }  
434 - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);  
435 - }  
436 -  
437 - /*  
438 - * 公里修正报表  
439 - */  
440 - @RequestMapping(value="/mileageReportTj")  
441 - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){  
442 - String gsdm="";  
443 - if(map.get("gsdm")!=null){  
444 - gsdm=map.get("gsdm").toString();  
445 - }  
446 - String fgsdm="";  
447 - if(map.get("fgsdm")!=null){  
448 - fgsdm=map.get("fgsdm").toString();  
449 - }  
450 - String line="";  
451 - if(map.get("line")!=null){  
452 - line=map.get("line").toString();  
453 - }  
454 - String date="";  
455 - if(map.get("date")!=null){  
456 - date=map.get("date").toString();  
457 - }  
458 - String date2="";  
459 - if(map.get("date2")!=null){  
460 - date2=map.get("date2").toString();  
461 - }  
462 - String xlName="";  
463 - if(map.get("xlName")!=null){  
464 - xlName=map.get("xlName").toString();  
465 - }  
466 - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);  
467 - }  
468 -  
469 - /*  
470 - * 班次修正报表  
471 - */  
472 - @RequestMapping(value="/scheduleCorrectionReport")  
473 - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){  
474 - String gsdm="";  
475 - if(map.get("gsdm")!=null){  
476 - gsdm=map.get("gsdm").toString();  
477 - }  
478 - String fgsdm="";  
479 - if(map.get("fgsdm")!=null){  
480 - fgsdm=map.get("fgsdm").toString();  
481 - }  
482 - String line="";  
483 - if(map.get("line")!=null){  
484 - line=map.get("line").toString();  
485 - }  
486 - String date="";  
487 - if(map.get("date")!=null){  
488 - date=map.get("date").toString();  
489 - }  
490 - String date2="";  
491 - if(map.get("date2")!=null){  
492 - date2=map.get("date2").toString();  
493 - }  
494 - String xlName="";  
495 - if(map.get("xlName")!=null){  
496 - xlName=map.get("xlName").toString();  
497 - }  
498 - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);  
499 - }  
500 -  
501 - @RequestMapping(value="/MapById",method = RequestMethod.GET)  
502 - public Map<String, Object> MapById(@RequestParam("id") Long id){  
503 - return scheduleRealInfoService.MapById(id);  
504 - }  
505 -  
506 - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)  
507 - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){  
508 - return scheduleRealInfoService.MapByIdQp(id);  
509 - }  
510 -  
511 - /**  
512 - * @Title: scheduleDaily  
513 - * @Description: TODO(调度日报表)  
514 - * @param line 线路  
515 - * @param date 时间  
516 - * @return  
517 - */  
518 - @RequestMapping(value="/scheduleDaily")  
519 - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){  
520 - return scheduleRealInfoService.scheduleDaily(line,date);  
521 - }  
522 -  
523 - @RequestMapping(value="/realScheduleList")  
524 - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){  
525 - return scheduleRealInfoService.realScheduleList(line,date);  
526 - }  
527 -  
528 - @RequestMapping(value="/realScheduleList_zrw")  
529 - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){  
530 - return scheduleRealInfoService.realScheduleList_zrw(line,date);  
531 - }  
532 -  
533 - @RequestMapping(value="/realScheduleList_mh_2")  
534 - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){  
535 - return scheduleRealInfoService.realScheduleList_mh_2(line,date);  
536 - }  
537 -  
538 - @RequestMapping(value="/realScheduleListQp")  
539 - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){  
540 - return scheduleRealInfoService.realScheduleListQp(line,date);  
541 - }  
542 -  
543 - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)  
544 - public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){  
545 - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);  
546 - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);  
547 - return scheduleRealInfoService.multi_tzrc(cpcs, null);  
548 - }  
549 -  
550 - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)  
551 - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){  
552 - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);  
553 - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);  
554 - return scheduleRealInfoService.multi_dftz(dfsjcs);  
555 - }  
556 -  
557 - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)  
558 - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){  
559 - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);  
560 - }  
561 -  
562 - @RequestMapping(value="/history", method=RequestMethod.POST)  
563 - public Map<String,Object> historySave(ScheduleRealInfo sch){  
564 - return scheduleRealInfoService.historySave(sch);  
565 - }  
566 -  
567 -  
568 - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");  
569 - private final static long ONE_DAY = 1000 * 60 * 60 * 24;  
570 - /**  
571 - * 获取可编辑的历史班次日期  
572 - * @return  
573 - */  
574 - @RequestMapping("dateArray")  
575 - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){  
576 - List<String> rs = new ArrayList<>();  
577 -  
578 - long t = System.currentTimeMillis();  
579 - if(c != 1)  
580 - t -= (ONE_DAY + (1000 * 60 * 60 * 6));  
581 - for(int i = 0; i < 3; i ++){  
582 - rs.add(fmtyyyyMMdd.print(t));  
583 - t -= ONE_DAY;  
584 - }  
585 - return rs;  
586 - }  
587 -  
588 - @RequestMapping(value = "svgAttr", method = RequestMethod.POST)  
589 - public Map<String, Object> svgAttr(@RequestParam String jsonStr){  
590 - return scheduleRealInfoService.svgAttr(jsonStr);  
591 - }  
592 -  
593 - @RequestMapping(value = "svgAttr", method = RequestMethod.GET)  
594 - public Map<String, Object> findSvgAttr(@RequestParam String idx){  
595 - return scheduleRealInfoService.findSvgAttr(idx);  
596 - }  
597 -  
598 - @RequestMapping(value = "addRemarks", method = RequestMethod.POST)  
599 - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){  
600 - return scheduleRealInfoService.addRemarks(id, remarks);  
601 - }  
602 -  
603 - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)  
604 - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){  
605 - return scheduleRealInfoService.scheduleDailyQp(line,date);  
606 - }  
607 -  
608 - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)  
609 - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){  
610 - return scheduleRealInfoService.scheduleDailyExport(map);  
611 - }  
612 -  
613 - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)  
614 - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){  
615 - return scheduleRealInfoService.exportWaybillMore(map);  
616 - }  
617 -  
618 - /**  
619 - * 获取当日计划排班 , 从计划表抓取数据  
620 - * @return  
621 - */  
622 - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)  
623 - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){  
624 - return scheduleRealInfoService.currentSchedulePlan(lineCode);  
625 - }  
626 -  
627 - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)  
628 - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){  
629 - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);  
630 - }  
631 -  
632 - /**  
633 - * 删除当日实际排班  
634 - * @return  
635 - */  
636 - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)  
637 - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){  
638 - return dayOfSchedule.deleteRealSchedule(lineCode);  
639 - }  
640 -  
641 - /**  
642 - * 从计划表重新加载当日排班  
643 - * @param lineCode  
644 - * @return  
645 - */  
646 - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)  
647 - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){  
648 - Map<String, Object> rs = new HashMap<>();  
649 - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);  
650 - if(list != null && list.size() > 0){  
651 - rs.put("status", ResponseCode.ERROR);  
652 - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");  
653 - return rs;  
654 - }  
655 -  
656 - int code = dayOfSchedule.reloadSch(lineCode);  
657 -  
658 - //重新按公司编码索引数据  
659 - dayOfSchedule.groupByGsbm();  
660 - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);  
661 - return rs;  
662 - }  
663 -  
664 - /**  
665 - * 误点调整  
666 - * @param idx  
667 - * @param minute  
668 - * @return  
669 - */  
670 - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)  
671 - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){  
672 - return scheduleRealInfoService.lateAdjust(idx, minute);  
673 - }  
674 -  
675 - /**  
676 - * 获取所有应发未到的班次  
677 - * @param idx  
678 - * @return  
679 - */  
680 - @RequestMapping(value = "allLate2")  
681 - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){  
682 - return scheduleRealInfoService.allLate2(idx);  
683 - }  
684 -  
685 - /**  
686 - * 添加一个临加到历史库  
687 - * @param sch  
688 - * @return  
689 - */  
690 - @RequestMapping(value = "history/add", method = RequestMethod.POST)  
691 - public Map<String, Object> addToHistory(ScheduleRealInfo sch){  
692 - return scheduleRealInfoService.addToHistory(sch);  
693 - }  
694 -  
695 - /**  
696 - * 从历史库里删除临加班次  
697 - * @param sch  
698 - * @return  
699 - */  
700 - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)  
701 - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){  
702 - return scheduleRealInfoService.deleteToHistory(id);  
703 - }  
704 -  
705 - @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)  
706 - public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){  
707 - Map<String, Object> map =new HashMap<>();  
708 - map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));  
709 - return map;  
710 - }  
711 -  
712 - /**  
713 - * 从历史库里删除临加班次  
714 - * @param sch  
715 - * @return  
716 - */  
717 - @RequestMapping(value = "wxsb", method = RequestMethod.POST)  
718 - public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){  
719 - return scheduleRealInfoService.repairReport(param, true);  
720 - }  
721 -  
722 - @RequestMapping(value = "wxsb", method = RequestMethod.GET)  
723 - public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){  
724 - return scheduleRealInfoService.repairReportList(line, date, code, type);  
725 - }  
726 -  
727 - @RequestMapping(value = "lineLevel", method = RequestMethod.GET)  
728 - public Map<String, String> lineLevel(@RequestParam String idx){  
729 - return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));  
730 - }  
731 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Arrays;
  5 +import java.util.Collection;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.apache.commons.lang3.StringEscapeUtils;
  11 +import org.joda.time.format.DateTimeFormat;
  12 +import org.joda.time.format.DateTimeFormatter;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RequestMethod;
  17 +import org.springframework.web.bind.annotation.RequestParam;
  18 +import org.springframework.web.bind.annotation.RestController;
  19 +
  20 +import com.alibaba.fastjson.JSONArray;
  21 +import com.bsth.common.ResponseCode;
  22 +import com.bsth.controller.BaseController;
  23 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  24 +import com.bsth.controller.realcontrol.dto.DfsjChange;
  25 +import com.bsth.data.BasicData;
  26 +import com.bsth.data.schedule.DayOfSchedule;
  27 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
  28 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  29 +import com.bsth.entity.report.RepairReport;
  30 +import com.bsth.entity.schedule.SchedulePlanInfo;
  31 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  32 +
  33 +@RestController
  34 +@RequestMapping("/realSchedule")
  35 +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
  36 +
  37 + @Autowired
  38 + ScheduleRealInfoService scheduleRealInfoService;
  39 +
  40 + @Autowired
  41 + DayOfSchedule dayOfSchedule;
  42 +
  43 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  44 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  45 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  46 + }
  47 +
  48 + @RequestMapping(value = "/lines")
  49 + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
  50 + return scheduleRealInfoService.findByLines(lines);
  51 + }
  52 +
  53 + @RequestMapping(value = "/car")
  54 + public List<ScheduleRealInfo> findByCar(String nbbm){
  55 + return dayOfSchedule.findByNbbm(nbbm);
  56 + }
  57 +
  58 + /**
  59 + *
  60 + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
  61 + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
  62 + */
  63 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  64 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
  65 + @RequestParam String dfsj,String bcType,
  66 + @RequestParam(defaultValue = "") String opType) {
  67 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
  68 + }
  69 +
  70 + /**
  71 + *
  72 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
  73 + */
  74 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  75 + public Map<String, Object> destroy(@RequestParam String idsStr
  76 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  77 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  78 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
  79 + }
  80 +
  81 + /**
  82 + *
  83 + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
  84 + */
  85 + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
  86 + public Map<String, String> carDeviceMapp() {
  87 + return BasicData.deviceId2NbbmMap.inverse();
  88 + }
  89 +
  90 + /**
  91 + *
  92 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
  93 + * lineId @throws
  94 + */
  95 + @RequestMapping(value = "/driver", method = RequestMethod.GET)
  96 + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
  97 + return scheduleRealInfoService.findDriverByLine(lineCode);
  98 + }
  99 +
  100 + /**
  101 + *
  102 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
  103 + * lineId @throws
  104 + */
  105 + @RequestMapping(value = "/conductor", method = RequestMethod.GET)
  106 + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
  107 + return scheduleRealInfoService.findConductorByLine(lineCode);
  108 + }
  109 +
  110 + /**
  111 + *
  112 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
  113 + * lineId @throws
  114 + */
  115 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  116 + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
  117 + return scheduleRealInfoService.findCarByLine(lineCode);
  118 + }
  119 +
  120 + /**
  121 + *
  122 + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
  123 + */
  124 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  125 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
  126 + return scheduleRealInfoService.sreachVehic(nbbm);
  127 + }
  128 + /**
  129 + *
  130 + * @Title: realOutAdjust
  131 + * @Description: TODO(实发调整)
  132 + * @param @param id 班次ID
  133 + * @param @param fcsjActual 实际发车时间 HH:mm
  134 + * @param @param remarks 备注
  135 + * @throws
  136 + */
  137 + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
  138 + public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
  139 + return scheduleRealInfoService.realOutAdjust(map);
  140 + }
  141 +
  142 + /**
  143 + *
  144 + * @Title: revokeDestroy
  145 + * @Description: TODO(撤销烂班)
  146 + * @param @param id
  147 + * @throws
  148 + */
  149 + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
  150 + public Map<String, Object> revokeDestroy(@RequestParam Long id){
  151 + return scheduleRealInfoService.revokeDestroy(id);
  152 + }
  153 +
  154 + /**
  155 + *
  156 + * @Title: revokeRealOutgo
  157 + * @Description: TODO(撤销实发)
  158 + * @param @param id
  159 + * @throws
  160 + */
  161 + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
  162 + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
  163 + return scheduleRealInfoService.revokeRealOutgo(id);
  164 + }
  165 +
  166 + /**
  167 + * 撤销执行
  168 + * @param id
  169 + * @return
  170 + */
  171 + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
  172 + public Map<String, Object> revokeRealArrive(@RequestParam Long id){
  173 + return scheduleRealInfoService.revokeRealArrive(id);
  174 + }
  175 +
  176 + /**
  177 + *
  178 + * @Title: spaceAdjust
  179 + * @Description: TODO(间隔调整)
  180 + * @param @param ids 要调整的班次数组ID
  181 + * @param @param space 间隔
  182 + * @throws
  183 + */
  184 + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
  185 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
  186 + return scheduleRealInfoService.spaceAdjust(ids, space);
  187 + }
  188 +
  189 + /**
  190 + *
  191 + * @Title: schInfoFineTune
  192 + * @Description: TODO(发车信息微调)
  193 + * @param @param map
  194 + * @throws
  195 + */
  196 + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
  197 + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
  198 + return scheduleRealInfoService.schInfoFineTune(map);
  199 + }
  200 +
  201 + /**
  202 + *
  203 + * @Title: outgoAdjustAll
  204 + * @Description: TODO(批量待发调整)
  205 + * @param @param list
  206 + * @throws
  207 + */
  208 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  209 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  210 + //反转义
  211 + params = StringEscapeUtils.unescapeHtml4(params);
  212 + return scheduleRealInfoService.outgoAdjustAll(params);
  213 + }
  214 +
  215 + /**
  216 + *
  217 + * @Title: findByLineAndUpDown
  218 + * @Description: TODO(根据线路和走向获取班次)
  219 + * @param @param line
  220 + * @param @param upDown
  221 + */
  222 + @RequestMapping(value = "/findByLineAndUpDown")
  223 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
  224 + return dayOfSchedule.findByLineAndUpDown(line, upDown);
  225 + }
  226 +
  227 + /**
  228 + *
  229 + * @Title: findRouteByLine
  230 + * @Description: TODO(获取线路的站点,路段路由)
  231 + * @param @param lineCode
  232 + * @throws
  233 + */
  234 + @RequestMapping(value = "/findRouteByLine")
  235 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  236 + return scheduleRealInfoService.findRouteByLine(lineCode);
  237 + }
  238 +
  239 + /**
  240 + *
  241 + * @Title: removeChildTask
  242 + * @Description: TODO(删除子任务)
  243 + * @param @param taskId 子任务ID
  244 + * @throws
  245 + */
  246 + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
  247 + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
  248 + return scheduleRealInfoService.removeChildTask(taskId);
  249 + }
  250 +
  251 + /**
  252 + *
  253 + * @Title: findByLineCode
  254 + * @Description: TODO(根据线路获取班次信息)
  255 + * @param @param lineCode
  256 + */
  257 + @RequestMapping(value = "/lineCode/{lineCode}")
  258 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  259 + return dayOfSchedule.findByLineCode(lineCode);
  260 + }
  261 +
  262 + @RequestMapping(value = "/queryUserInfo")
  263 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  264 + @RequestParam String date,@RequestParam String state) {
  265 + return scheduleRealInfoService.queryUserInfo(line, date,state);
  266 + }
  267 +
  268 + @RequestMapping(value = "/queryUserInfoPx")
  269 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  270 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  271 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  272 + }
  273 +
  274 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
  275 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,
  276 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  277 + return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);
  278 + }
  279 +
  280 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
  281 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  282 + ,@RequestParam String date,@RequestParam String line) {
  283 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
  284 + }
  285 +
  286 +
  287 + @RequestMapping(value = "/dailyInfo")
  288 + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
  289 + return scheduleRealInfoService.dailyInfo(line, date, type);
  290 + }
  291 +
  292 + @RequestMapping(value = "/historyMessage")
  293 + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
  294 + @RequestParam String code, @RequestParam String type) {
  295 + return scheduleRealInfoService.historyMessage(line, date, code, type);
  296 + }
  297 +
  298 + @RequestMapping(value="/findLine")
  299 + public List<Map<String,String>> findLine(@RequestParam String line){
  300 + return scheduleRealInfoService.findLine(line);
  301 + }
  302 +
  303 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
  304 + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  305 + ,@RequestParam String date,@RequestParam String line){
  306 + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
  307 + }
  308 +
  309 + /**
  310 + * 路单公里统计 (闵行审计专用)
  311 + * @param jGh
  312 + * @param clZbh
  313 + * @param lpName
  314 + * @param date
  315 + * @param line
  316 + * @return
  317 + */
  318 + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
  319 + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  320 + ,@RequestParam String date,@RequestParam String line){
  321 + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
  322 + }
  323 +
  324 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
  325 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  326 + ,@RequestParam String date,@RequestParam String line){
  327 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
  328 + }
  329 +
  330 + @RequestMapping(value="/findLpName")
  331 + public List<Map<String,String>> findLpName(@RequestParam String lpName){
  332 + return scheduleRealInfoService.findLpName(lpName);
  333 + }
  334 +
  335 + @RequestMapping(value = "/account")
  336 + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
  337 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  338 + return scheduleRealInfoService.account(line, date, code, xlName, type);
  339 + }
  340 +
  341 + @RequestMapping(value = "/accountPx")
  342 + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
  343 + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
  344 + return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
  345 + }
  346 +
  347 + @RequestMapping(value = "/correctForm")
  348 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  349 + @RequestParam String endDate,
  350 + @RequestParam String lpName, @RequestParam String code,
  351 + @RequestParam String type,@RequestParam String changType) {
  352 + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
  353 + }
  354 + /**
  355 + * @Title queryListWaybill
  356 + * @Description 查询行车路单列表
  357 + * @param jName 驾驶员名字
  358 + * @param clZbh 车辆自编号(内部编号)
  359 + * @param lpName 路牌
  360 + * @return
  361 + */
  362 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
  363 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  364 + ,@RequestParam String date,@RequestParam String line){
  365 + return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);
  366 + }
  367 +
  368 + /**
  369 + * @Title queryListWaybill
  370 + * @Description 查询行车路单列表(闵行审计专用路单)
  371 + * @param jName 驾驶员名字
  372 + * @param clZbh 车辆自编号(内部编号)
  373 + * @param lpName 路牌
  374 + * @return
  375 + */
  376 + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
  377 + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  378 + ,@RequestParam String date,@RequestParam String line){
  379 + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
  380 + }
  381 +
  382 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
  383 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  384 + @RequestParam String date,@RequestParam String line){
  385 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
  386 + }
  387 +
  388 + @RequestMapping(value="/statisticsDaily")
  389 + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
  390 + @RequestParam String xlName, @RequestParam String type){
  391 + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
  392 + }
  393 +
  394 + @RequestMapping(value="/statisticsDaily_mh_2")
  395 + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
  396 + @RequestParam String xlName, @RequestParam String type){
  397 + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
  398 + }
  399 +
  400 + @RequestMapping(value="/statisticsDailyTj")
  401 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
  402 + String gsdm="";
  403 + if(map.get("gsdm")!=null){
  404 + gsdm=map.get("gsdm").toString();
  405 + }
  406 + String fgsdm="";
  407 + if(map.get("fgsdm")!=null){
  408 + fgsdm=map.get("fgsdm").toString();
  409 + }
  410 + String line="";
  411 + if(map.get("line")!=null){
  412 + line=map.get("line").toString();
  413 + }
  414 + String date="";
  415 + if(map.get("date")!=null){
  416 + date=map.get("date").toString();
  417 + }
  418 + String date2="";
  419 + if(map.get("date2")!=null){
  420 + date2=map.get("date2").toString();
  421 + }
  422 + String xlName="";
  423 + if(map.get("xlName")!=null){
  424 + xlName=map.get("xlName").toString();
  425 + }
  426 + String type="";
  427 + if(map.get("type")!=null){
  428 + type=map.get("type").toString();
  429 + }
  430 + String nature="0";
  431 + if(map.get("nature")!=null){
  432 + nature=map.get("nature").toString();
  433 + }
  434 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
  435 + }
  436 +
  437 + /*
  438 + * 公里修正报表
  439 + */
  440 + @RequestMapping(value="/mileageReportTj")
  441 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  442 + String gsdm="";
  443 + if(map.get("gsdm")!=null){
  444 + gsdm=map.get("gsdm").toString();
  445 + }
  446 + String fgsdm="";
  447 + if(map.get("fgsdm")!=null){
  448 + fgsdm=map.get("fgsdm").toString();
  449 + }
  450 + String line="";
  451 + if(map.get("line")!=null){
  452 + line=map.get("line").toString();
  453 + }
  454 + String date="";
  455 + if(map.get("date")!=null){
  456 + date=map.get("date").toString();
  457 + }
  458 + String date2="";
  459 + if(map.get("date2")!=null){
  460 + date2=map.get("date2").toString();
  461 + }
  462 + String xlName="";
  463 + if(map.get("xlName")!=null){
  464 + xlName=map.get("xlName").toString();
  465 + }
  466 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  467 + }
  468 +
  469 + /*
  470 + * 班次修正报表
  471 + */
  472 + @RequestMapping(value="/scheduleCorrectionReport")
  473 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  474 + String gsdm="";
  475 + if(map.get("gsdm")!=null){
  476 + gsdm=map.get("gsdm").toString();
  477 + }
  478 + String fgsdm="";
  479 + if(map.get("fgsdm")!=null){
  480 + fgsdm=map.get("fgsdm").toString();
  481 + }
  482 + String line="";
  483 + if(map.get("line")!=null){
  484 + line=map.get("line").toString();
  485 + }
  486 + String date="";
  487 + if(map.get("date")!=null){
  488 + date=map.get("date").toString();
  489 + }
  490 + String date2="";
  491 + if(map.get("date2")!=null){
  492 + date2=map.get("date2").toString();
  493 + }
  494 + String xlName="";
  495 + if(map.get("xlName")!=null){
  496 + xlName=map.get("xlName").toString();
  497 + }
  498 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  499 + }
  500 +
  501 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  502 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  503 + return scheduleRealInfoService.MapById(id);
  504 + }
  505 +
  506 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  507 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  508 + return scheduleRealInfoService.MapByIdQp(id);
  509 + }
  510 +
  511 + /**
  512 + * @Title: scheduleDaily
  513 + * @Description: TODO(调度日报表)
  514 + * @param line 线路
  515 + * @param date 时间
  516 + * @return
  517 + */
  518 + @RequestMapping(value="/scheduleDaily")
  519 + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
  520 + return scheduleRealInfoService.scheduleDaily(line,date);
  521 + }
  522 +
  523 + @RequestMapping(value="/realScheduleList")
  524 + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
  525 + return scheduleRealInfoService.realScheduleList(line,date);
  526 + }
  527 +
  528 + @RequestMapping(value="/realScheduleList_zrw")
  529 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  530 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  531 + }
  532 +
  533 + @RequestMapping(value="/realScheduleList_mh_2")
  534 + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
  535 + return scheduleRealInfoService.realScheduleList_mh_2(line,date);
  536 + }
  537 +
  538 + @RequestMapping(value="/realScheduleListQp")
  539 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  540 + return scheduleRealInfoService.realScheduleListQp(line,date);
  541 + }
  542 +
  543 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  544 + public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  545 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  546 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  547 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
  548 + }
  549 +
  550 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  551 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  552 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  553 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  554 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  555 + }
  556 +
  557 + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
  558 + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
  559 + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
  560 + }
  561 +
  562 + @RequestMapping(value="/history", method=RequestMethod.POST)
  563 + public Map<String,Object> historySave(ScheduleRealInfo sch){
  564 + return scheduleRealInfoService.historySave(sch);
  565 + }
  566 +
  567 +
  568 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  569 + private final static long ONE_DAY = 1000 * 60 * 60 * 24;
  570 + /**
  571 + * 获取可编辑的历史班次日期
  572 + * @return
  573 + */
  574 + @RequestMapping("dateArray")
  575 + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
  576 + List<String> rs = new ArrayList<>();
  577 +
  578 + long t = System.currentTimeMillis();
  579 + if(c != 1)
  580 + t -= (ONE_DAY + (1000 * 60 * 60 * 6));
  581 + for(int i = 0; i < 3; i ++){
  582 + rs.add(fmtyyyyMMdd.print(t));
  583 + t -= ONE_DAY;
  584 + }
  585 + return rs;
  586 + }
  587 +
  588 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  589 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  590 + return scheduleRealInfoService.svgAttr(jsonStr);
  591 + }
  592 +
  593 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  594 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  595 + return scheduleRealInfoService.findSvgAttr(idx);
  596 + }
  597 +
  598 + @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
  599 + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
  600 + return scheduleRealInfoService.addRemarks(id, remarks);
  601 + }
  602 +
  603 + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
  604 + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
  605 + return scheduleRealInfoService.scheduleDailyQp(line,date);
  606 + }
  607 +
  608 + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
  609 + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
  610 + return scheduleRealInfoService.scheduleDailyExport(map);
  611 + }
  612 +
  613 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  614 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  615 + return scheduleRealInfoService.exportWaybillMore(map);
  616 + }
  617 +
  618 + /**
  619 + * 获取当日计划排班 , 从计划表抓取数据
  620 + * @return
  621 + */
  622 + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
  623 + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
  624 + return scheduleRealInfoService.currentSchedulePlan(lineCode);
  625 + }
  626 +
  627 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  628 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  629 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
  630 + }
  631 +
  632 + /**
  633 + * 删除当日实际排班
  634 + * @return
  635 + */
  636 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  637 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  638 + return dayOfSchedule.deleteRealSchedule(lineCode);
  639 + }
  640 +
  641 + /**
  642 + * 从计划表重新加载当日排班
  643 + * @param lineCode
  644 + * @return
  645 + */
  646 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  647 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  648 + Map<String, Object> rs = new HashMap<>();
  649 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  650 + if(list != null && list.size() > 0){
  651 + rs.put("status", ResponseCode.ERROR);
  652 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  653 + return rs;
  654 + }
  655 +
  656 + int code = dayOfSchedule.reloadSch(lineCode);
  657 +
  658 + //重新按公司编码索引数据
  659 + dayOfSchedule.groupByGsbm();
  660 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  661 + return rs;
  662 + }
  663 +
  664 + /**
  665 + * 误点调整
  666 + * @param idx
  667 + * @param minute
  668 + * @return
  669 + */
  670 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  671 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  672 + return scheduleRealInfoService.lateAdjust(idx, minute);
  673 + }
  674 +
  675 + /**
  676 + * 获取所有应发未到的班次
  677 + * @param idx
  678 + * @return
  679 + */
  680 + @RequestMapping(value = "allLate2")
  681 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  682 + return scheduleRealInfoService.allLate2(idx);
  683 + }
  684 +
  685 + /**
  686 + * 添加一个临加到历史库
  687 + * @param sch
  688 + * @return
  689 + */
  690 + @RequestMapping(value = "history/add", method = RequestMethod.POST)
  691 + public Map<String, Object> addToHistory(ScheduleRealInfo sch){
  692 + return scheduleRealInfoService.addToHistory(sch);
  693 + }
  694 +
  695 + /**
  696 + * 从历史库里删除临加班次
  697 + * @param sch
  698 + * @return
  699 + */
  700 + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
  701 + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
  702 + return scheduleRealInfoService.deleteToHistory(id);
  703 + }
  704 +
  705 + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
  706 + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
  707 + Map<String, Object> map =new HashMap<>();
  708 + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
  709 + return map;
  710 + }
  711 +
  712 + /**
  713 + * 从历史库里删除临加班次
  714 + * @param sch
  715 + * @return
  716 + */
  717 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  718 + public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
  719 + return scheduleRealInfoService.repairReport(param, true);
  720 + }
  721 +
  722 + @RequestMapping(value = "wxsb", method = RequestMethod.GET)
  723 + public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
  724 + return scheduleRealInfoService.repairReportList(line, date, code, type);
  725 + }
  726 +
  727 + @RequestMapping(value = "lineLevel", method = RequestMethod.GET)
  728 + public Map<String, String> lineLevel(@RequestParam String idx){
  729 + return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
  730 + }
  731 +}