Commit ab7995a1171221b2509b3e6ee70f4d09d88a9da9

Authored by 娄高锋
1 parent 39dc38d5

调度历史消息,加查询条件:指令类型

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import java.io.ByteArrayOutputStream;  
4 -import java.io.IOException;  
5 -import java.io.InputStream;  
6 -import java.io.OutputStream;  
7 -import java.net.HttpURLConnection;  
8 -import java.net.URL;  
9 -import java.util.ArrayList;  
10 -import java.util.Collection;  
11 -import java.util.HashMap;  
12 -import java.util.List;  
13 -import java.util.Map;  
14 -  
15 -import org.apache.commons.io.IOUtils;  
16 -import org.apache.commons.lang3.StringEscapeUtils;  
17 -import org.joda.time.format.DateTimeFormat;  
18 -import org.joda.time.format.DateTimeFormatter;  
19 -import org.springframework.beans.factory.annotation.Autowired;  
20 -import org.springframework.web.bind.annotation.PathVariable;  
21 -import org.springframework.web.bind.annotation.RequestMapping;  
22 -import org.springframework.web.bind.annotation.RequestMethod;  
23 -import org.springframework.web.bind.annotation.RequestParam;  
24 -import org.springframework.web.bind.annotation.RestController;  
25 -  
26 -import com.alibaba.fastjson.JSONArray;  
27 -import com.bsth.common.ResponseCode;  
28 -import com.bsth.controller.BaseController;  
29 -import com.bsth.controller.realcontrol.dto.ChangePersonCar;  
30 -import com.bsth.controller.realcontrol.dto.DfsjChange;  
31 -import com.bsth.data.BasicData;  
32 -import com.bsth.data.schedule.DayOfSchedule;  
33 -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;  
34 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
35 -import com.bsth.entity.schedule.SchedulePlanInfo;  
36 -import com.bsth.entity.sys.SysUser;  
37 -import com.bsth.security.util.SecurityUtils;  
38 -import com.bsth.service.realcontrol.ScheduleRealInfoService;  
39 -import com.bsth.util.ConfigUtil;  
40 -import com.fasterxml.jackson.databind.ObjectMapper;  
41 -  
42 -@RestController  
43 -@RequestMapping("/realSchedule")  
44 -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {  
45 -  
46 - @Autowired  
47 - ScheduleRealInfoService scheduleRealInfoService;  
48 -  
49 - @Autowired  
50 - DayOfSchedule dayOfSchedule;  
51 - //待发时间调整时间  
52 - public static Long dfsj= 0L;  
53 - //待发时间调整  
54 - public Long dfsj(Long sj){  
55 - dfsj = sj;  
56 - return dfsj;  
57 - }  
58 -  
59 - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)  
60 - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){  
61 - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);  
62 - }  
63 -  
64 - @RequestMapping(value = "/lines")  
65 - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {  
66 - return scheduleRealInfoService.findByLines(lines);  
67 - }  
68 -  
69 - @RequestMapping(value = "/car")  
70 - public List<ScheduleRealInfo> findByCar(String nbbm){  
71 - return dayOfSchedule.findByNbbm(nbbm);  
72 - }  
73 -  
74 - /**  
75 - *  
76 - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id  
77 - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws  
78 - */  
79 - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)  
80 - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,  
81 - @RequestParam String dfsj,String bcType,  
82 - @RequestParam(defaultValue = "") String opType) {  
83 - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);  
84 - }  
85 -  
86 -  
87 - /**  
88 - *  
89 - * @Title: outgoAdjust @Description: TODO(待发调整锁定待发)  
90 - *  
91 - */  
92 - @RequestMapping(value = "/outgoAdjusttwo", method = RequestMethod.POST)  
93 - public Map<String, Object> outgoAdjusttow(@RequestParam String dfsj) {  
94 - return scheduleRealInfoService.outgoAdjusttwo(dfsj);  
95 - }  
96 - /**  
97 - *  
98 - * @Title: outgoAdjust @Description: TODO(待发时间定义)  
99 - *  
100 - */  
101 - @RequestMapping(value = "/outgoAdjusttwodfsj", method = RequestMethod.POST)  
102 - public Long outgoAdjusttowdfsj(@RequestParam Long dfsj) {  
103 - return dfsj(dfsj);  
104 - }  
105 -  
106 - /**  
107 - *  
108 - * @Title: outgoAdjust @Description: TODO(待发时间查询)  
109 - *  
110 - */  
111 - @RequestMapping(value = "/outgoAdjusttwoxc", method = RequestMethod.POST)  
112 - public Long outgoAdjusttowdfsjxc() {  
113 - return dfsj;  
114 - }  
115 -  
116 -  
117 - /**  
118 - *  
119 - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔  
120 - */  
121 - @RequestMapping(value = "/destroy", method = RequestMethod.POST)  
122 - public Map<String, Object> destroy(@RequestParam String idsStr  
123 - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,  
124 - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {  
125 - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);  
126 - }  
127 -  
128 - /**  
129 - *  
130 - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws  
131 - */  
132 - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)  
133 - public Map<String, String> carDeviceMapp() {  
134 - return BasicData.deviceId2NbbmMap.inverse();  
135 - }  
136 -  
137 - /**  
138 - *  
139 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param  
140 - * lineId @throws  
141 - */  
142 - @RequestMapping(value = "/driver", method = RequestMethod.GET)  
143 - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {  
144 - return scheduleRealInfoService.findDriverByLine(lineCode);  
145 - }  
146 -  
147 - /**  
148 - *  
149 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param  
150 - * lineId @throws  
151 - */  
152 - @RequestMapping(value = "/conductor", method = RequestMethod.GET)  
153 - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {  
154 - return scheduleRealInfoService.findConductorByLine(lineCode);  
155 - }  
156 -  
157 - /**  
158 - *  
159 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param  
160 - * lineId @throws  
161 - */  
162 - @RequestMapping(value = "/cars", method = RequestMethod.GET)  
163 - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {  
164 - return scheduleRealInfoService.findCarByLine(lineCode);  
165 - }  
166 -  
167 - /**  
168 - *  
169 - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws  
170 - */  
171 - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)  
172 - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {  
173 - return scheduleRealInfoService.sreachVehic(nbbm);  
174 - }  
175 - /**  
176 - *  
177 - * @Title: realOutAdjust  
178 - * @Description: TODO(实发调整)  
179 - * @param @param id 班次ID  
180 - * @param @param fcsjActual 实际发车时间 HH:mm  
181 - * @param @param remarks 备注  
182 - * @throws  
183 - */  
184 - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)  
185 - public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,  
186 - @RequestParam String remarks) {  
187 - return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);  
188 - }  
189 -  
190 - /**  
191 - *  
192 - * @Title: revokeDestroy  
193 - * @Description: TODO(撤销烂班)  
194 - * @param @param id  
195 - * @throws  
196 - */  
197 - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)  
198 - public Map<String, Object> revokeDestroy(@RequestParam Long id){  
199 - return scheduleRealInfoService.revokeDestroy(id);  
200 - }  
201 -  
202 - /**  
203 - *  
204 - * @Title: revokeRealOutgo  
205 - * @Description: TODO(撤销实发)  
206 - * @param @param id  
207 - * @throws  
208 - */  
209 - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)  
210 - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){  
211 - return scheduleRealInfoService.revokeRealOutgo(id);  
212 - }  
213 -  
214 - /**  
215 - * 撤销执行  
216 - * @param id  
217 - * @return  
218 - */  
219 - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)  
220 - public Map<String, Object> revokeRealArrive(@RequestParam Long id){  
221 - return scheduleRealInfoService.revokeRealArrive(id);  
222 - }  
223 -  
224 - /**  
225 - *  
226 - * @Title: spaceAdjust  
227 - * @Description: TODO(间隔调整)  
228 - * @param @param ids 要调整的班次数组ID  
229 - * @param @param space 间隔  
230 - * @throws  
231 - */  
232 - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)  
233 - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){  
234 - return scheduleRealInfoService.spaceAdjust(ids, space);  
235 - }  
236 -  
237 - /**  
238 - *  
239 - * @Title: schInfoFineTune  
240 - * @Description: TODO(发车信息微调)  
241 - * @param @param map  
242 - * @throws  
243 - */  
244 - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)  
245 - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){  
246 - return scheduleRealInfoService.schInfoFineTune(map);  
247 - }  
248 -  
249 - /**  
250 - *  
251 - * @Title: outgoAdjustAll  
252 - * @Description: TODO(批量待发调整)  
253 - * @param @param list  
254 - * @throws  
255 - */  
256 - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)  
257 - public Map<String, Object> outgoAdjustAll(@RequestParam String params){  
258 - //反转义  
259 - params = StringEscapeUtils.unescapeHtml4(params);  
260 - return scheduleRealInfoService.outgoAdjustAll(params);  
261 - }  
262 -  
263 - /**  
264 - *  
265 - * @Title: findByLineAndUpDown  
266 - * @Description: TODO(根据线路和走向获取班次)  
267 - * @param @param line  
268 - * @param @param upDown  
269 - */  
270 - @RequestMapping(value = "/findByLineAndUpDown")  
271 - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){  
272 - return dayOfSchedule.findByLineAndUpDown(line, upDown);  
273 - }  
274 -  
275 - /**  
276 - *  
277 - * @Title: findRouteByLine  
278 - * @Description: TODO(获取线路的站点,路段路由)  
279 - * @param @param lineCode  
280 - * @throws  
281 - */  
282 - @RequestMapping(value = "/findRouteByLine")  
283 - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){  
284 - return scheduleRealInfoService.findRouteByLine(lineCode);  
285 - }  
286 -  
287 - /**  
288 - *  
289 - * @Title: removeChildTask  
290 - * @Description: TODO(删除子任务)  
291 - * @param @param taskId 子任务ID  
292 - * @throws  
293 - */  
294 - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)  
295 - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){  
296 - return scheduleRealInfoService.removeChildTask(taskId);  
297 - }  
298 -  
299 - /**  
300 - *  
301 - * @Title: findByLineCode  
302 - * @Description: TODO(根据线路获取班次信息)  
303 - * @param @param lineCode  
304 - */  
305 - @RequestMapping(value = "/lineCode/{lineCode}")  
306 - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){  
307 - return dayOfSchedule.findByLineCode(lineCode);  
308 - }  
309 -  
310 - @RequestMapping(value = "/queryUserInfo")  
311 - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,  
312 - @RequestParam String date,@RequestParam String state) {  
313 - return scheduleRealInfoService.queryUserInfo(line, date,state);  
314 - }  
315 -  
316 - @RequestMapping(value = "/queryUserInfoPx")  
317 - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,  
318 - @RequestParam String date,@RequestParam String state,@RequestParam String type) {  
319 - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);  
320 - }  
321 -  
322 - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)  
323 - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,  
324 - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {  
325 - return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);  
326 - }  
327 -  
328 - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)  
329 - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh  
330 - ,@RequestParam String date,@RequestParam String line) {  
331 - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);  
332 - }  
333 -  
334 -  
335 - @RequestMapping(value = "/dailyInfo")  
336 - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {  
337 - return scheduleRealInfoService.dailyInfo(line, date, type);  
338 - }  
339 -  
340 - @RequestMapping(value = "/historyMessage")  
341 - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,  
342 - @RequestParam String code, @RequestParam String type) {  
343 - return scheduleRealInfoService.historyMessage(line, date, code, type);  
344 - }  
345 -  
346 - @RequestMapping(value="/findLine")  
347 - public List<Map<String,String>> findLine(@RequestParam String line){  
348 - return scheduleRealInfoService.findLine(line);  
349 - }  
350 -  
351 - @RequestMapping(value="/findKMBC",method = RequestMethod.GET)  
352 - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
353 - ,@RequestParam String date,@RequestParam String line){  
354 - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);  
355 - }  
356 -  
357 - /**  
358 - * 路单公里统计 (闵行审计专用)  
359 - * @param jGh  
360 - * @param clZbh  
361 - * @param lpName  
362 - * @param date  
363 - * @param line  
364 - * @return  
365 - */  
366 - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)  
367 - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
368 - ,@RequestParam String date,@RequestParam String line){  
369 - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);  
370 - }  
371 -  
372 - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)  
373 - public Map<String,Object> findKMBCQp(@RequestParam String clZbh  
374 - ,@RequestParam String date,@RequestParam String line){  
375 - return scheduleRealInfoService.findKMBCQp(clZbh,date,line);  
376 - }  
377 -  
378 - @RequestMapping(value="/findLpName")  
379 - public List<Map<String,String>> findLpName(@RequestParam String lpName){  
380 - return scheduleRealInfoService.findLpName(lpName);  
381 - }  
382 -  
383 - @RequestMapping(value = "/account")  
384 - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,  
385 - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {  
386 - return scheduleRealInfoService.account(line, date, code, xlName, type);  
387 - }  
388 -  
389 - @RequestMapping(value = "/accountPx")  
390 - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,  
391 - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {  
392 - return scheduleRealInfoService.accountPx(line, date, code, xlName, px);  
393 - }  
394 -  
395 - @RequestMapping(value = "/correctForm")  
396 - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,  
397 - @RequestParam String endDate,  
398 - @RequestParam String lpName, @RequestParam String code,  
399 - @RequestParam String type,@RequestParam String changType) {  
400 - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);  
401 - }  
402 - /**  
403 - * @Title queryListWaybill  
404 - * @Description 查询行车路单列表  
405 - * @param jName 驾驶员名字  
406 - * @param clZbh 车辆自编号(内部编号)  
407 - * @param lpName 路牌  
408 - * @return  
409 - */  
410 - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)  
411 - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName  
412 - ,@RequestParam String date,@RequestParam String line){  
413 - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);  
414 - }  
415 -  
416 - /**  
417 - * @Title queryListWaybill  
418 - * @Description 查询行车路单列表(闵行审计专用路单)  
419 - * @param jName 驾驶员名字  
420 - * @param clZbh 车辆自编号(内部编号)  
421 - * @param lpName 路牌  
422 - * @return  
423 - */  
424 - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)  
425 - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName  
426 - ,@RequestParam String date,@RequestParam String line){  
427 - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);  
428 - }  
429 -  
430 - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)  
431 - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,  
432 - @RequestParam String date,@RequestParam String line){  
433 - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);  
434 - }  
435 -  
436 - @RequestMapping(value="/statisticsDaily")  
437 - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,  
438 - @RequestParam String xlName, @RequestParam String type){  
439 - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);  
440 - }  
441 -  
442 - @RequestMapping(value="/statisticsDaily_mh_2")  
443 - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,  
444 - @RequestParam String xlName, @RequestParam String type){  
445 - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);  
446 - }  
447 -  
448 - @RequestMapping(value="/statisticsDailyTj")  
449 - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){  
450 - String gsdm="";  
451 - if(map.get("gsdm")!=null){  
452 - gsdm=map.get("gsdm").toString();  
453 - }  
454 - String fgsdm="";  
455 - if(map.get("fgsdm")!=null){  
456 - fgsdm=map.get("fgsdm").toString();  
457 - }  
458 - String line="";  
459 - if(map.get("line")!=null){  
460 - line=map.get("line").toString();  
461 - }  
462 - String date="";  
463 - if(map.get("date")!=null){  
464 - date=map.get("date").toString();  
465 - }  
466 - String date2="";  
467 - if(map.get("date2")!=null){  
468 - date2=map.get("date2").toString();  
469 - }  
470 - String xlName="";  
471 - if(map.get("xlName")!=null){  
472 - xlName=map.get("xlName").toString();  
473 - }  
474 - String type="";  
475 - if(map.get("type")!=null){  
476 - type=map.get("type").toString();  
477 - }  
478 - String nature="0";  
479 - if(map.get("nature")!=null){  
480 - nature=map.get("nature").toString();  
481 - }  
482 - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);  
483 - }  
484 -  
485 - /*  
486 - * 公里修正报表  
487 - */  
488 - @RequestMapping(value="/mileageReportTj")  
489 - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){  
490 - String gsdm="";  
491 - if(map.get("gsdm")!=null){  
492 - gsdm=map.get("gsdm").toString();  
493 - }  
494 - String fgsdm="";  
495 - if(map.get("fgsdm")!=null){  
496 - fgsdm=map.get("fgsdm").toString();  
497 - }  
498 - String line="";  
499 - if(map.get("line")!=null){  
500 - line=map.get("line").toString();  
501 - }  
502 - String date="";  
503 - if(map.get("date")!=null){  
504 - date=map.get("date").toString();  
505 - }  
506 - String date2="";  
507 - if(map.get("date2")!=null){  
508 - date2=map.get("date2").toString();  
509 - }  
510 - String xlName="";  
511 - if(map.get("xlName")!=null){  
512 - xlName=map.get("xlName").toString();  
513 - }  
514 - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);  
515 - }  
516 -  
517 - /*  
518 - * 班次修正报表  
519 - */  
520 - @RequestMapping(value="/scheduleCorrectionReport")  
521 - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){  
522 - String gsdm="";  
523 - if(map.get("gsdm")!=null){  
524 - gsdm=map.get("gsdm").toString();  
525 - }  
526 - String fgsdm="";  
527 - if(map.get("fgsdm")!=null){  
528 - fgsdm=map.get("fgsdm").toString();  
529 - }  
530 - String line="";  
531 - if(map.get("line")!=null){  
532 - line=map.get("line").toString();  
533 - }  
534 - String date="";  
535 - if(map.get("date")!=null){  
536 - date=map.get("date").toString();  
537 - }  
538 - String date2="";  
539 - if(map.get("date2")!=null){  
540 - date2=map.get("date2").toString();  
541 - }  
542 - String xlName="";  
543 - if(map.get("xlName")!=null){  
544 - xlName=map.get("xlName").toString();  
545 - }  
546 - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);  
547 - }  
548 -  
549 - @RequestMapping(value="/MapById",method = RequestMethod.GET)  
550 - public Map<String, Object> MapById(@RequestParam("id") Long id){  
551 - return scheduleRealInfoService.MapById(id);  
552 - }  
553 -  
554 - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)  
555 - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){  
556 - return scheduleRealInfoService.MapByIdQp(id);  
557 - }  
558 -  
559 - /**  
560 - * @Title: scheduleDaily  
561 - * @Description: TODO(调度日报表)  
562 - * @param line 线路  
563 - * @param date 时间  
564 - * @return  
565 - */  
566 - @RequestMapping(value="/scheduleDaily")  
567 - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){  
568 - return scheduleRealInfoService.scheduleDaily(line,date);  
569 - }  
570 -  
571 - @RequestMapping(value="/realScheduleList")  
572 - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){  
573 - return scheduleRealInfoService.realScheduleList(line,date);  
574 - }  
575 -  
576 - @RequestMapping(value="/realScheduleList_zrw")  
577 - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){  
578 - return scheduleRealInfoService.realScheduleList_zrw(line,date);  
579 - }  
580 -  
581 - @RequestMapping(value="/realScheduleList_mh_2")  
582 - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){  
583 - return scheduleRealInfoService.realScheduleList_mh_2(line,date);  
584 - }  
585 -  
586 - @RequestMapping(value="/realScheduleListQp")  
587 - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){  
588 - return scheduleRealInfoService.realScheduleListQp(line,date);  
589 - }  
590 -  
591 - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)  
592 - public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){  
593 - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);  
594 - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);  
595 - return scheduleRealInfoService.multi_tzrc(cpcs, null);  
596 - }  
597 -  
598 - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)  
599 - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){  
600 - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);  
601 - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);  
602 - return scheduleRealInfoService.multi_dftz(dfsjcs);  
603 - }  
604 -  
605 - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)  
606 - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){  
607 - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);  
608 - }  
609 -  
610 - @RequestMapping(value="/history", method=RequestMethod.POST)  
611 - public Map<String,Object> historySave(ScheduleRealInfo sch){  
612 - return scheduleRealInfoService.historySave(sch);  
613 - }  
614 -  
615 -  
616 - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");  
617 - private final static long ONE_DAY = 1000 * 60 * 60 * 24;  
618 - /**  
619 - * 获取可编辑的历史班次日期  
620 - * @return  
621 - */  
622 - @RequestMapping("dateArray")  
623 - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){  
624 - List<String> rs = new ArrayList<>();  
625 -  
626 - long t = System.currentTimeMillis();  
627 - if(c != 1)  
628 - t -= (ONE_DAY + (1000 * 60 * 60 * 6));  
629 - for(int i = 0; i < 4; i ++){  
630 - rs.add(fmtyyyyMMdd.print(t));  
631 - t -= ONE_DAY;  
632 - }  
633 - return rs;  
634 - }  
635 -  
636 - @RequestMapping(value = "svgAttr", method = RequestMethod.POST)  
637 - public Map<String, Object> svgAttr(@RequestParam String jsonStr){  
638 - return scheduleRealInfoService.svgAttr(jsonStr);  
639 - }  
640 -  
641 - @RequestMapping(value = "svgAttr", method = RequestMethod.GET)  
642 - public Map<String, Object> findSvgAttr(@RequestParam String idx){  
643 - return scheduleRealInfoService.findSvgAttr(idx);  
644 - }  
645 -  
646 - @RequestMapping(value = "addRemarks", method = RequestMethod.POST)  
647 - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){  
648 - return scheduleRealInfoService.addRemarks(id, remarks);  
649 - }  
650 -  
651 - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)  
652 - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){  
653 - return scheduleRealInfoService.scheduleDailyQp(line,date);  
654 - }  
655 -  
656 - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)  
657 - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){  
658 - return scheduleRealInfoService.scheduleDailyExport(map);  
659 - }  
660 -  
661 - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)  
662 - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){  
663 - return scheduleRealInfoService.exportWaybillMore(map);  
664 - }  
665 -  
666 - /**  
667 - * 获取当日计划排班 , 从计划表抓取数据  
668 - * @return  
669 - */  
670 - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)  
671 - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){  
672 - return scheduleRealInfoService.currentSchedulePlan(lineCode);  
673 - }  
674 -  
675 - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)  
676 - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){  
677 - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);  
678 - }  
679 -  
680 - /**  
681 - * 删除当日实际排班  
682 - * @return  
683 - */  
684 - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)  
685 - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){  
686 - return dayOfSchedule.deleteRealSchedule(lineCode);  
687 - }  
688 -  
689 - /**  
690 - * 从计划表重新加载当日排班  
691 - * @param lineCode  
692 - * @return  
693 - */  
694 - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)  
695 - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){  
696 - Map<String, Object> rs = new HashMap<>();  
697 - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);  
698 - if(list != null && list.size() > 0){  
699 - rs.put("status", ResponseCode.ERROR);  
700 - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");  
701 - return rs;  
702 - }  
703 -  
704 - int code = dayOfSchedule.reloadSch(lineCode);  
705 -  
706 - //重新按公司编码索引数据  
707 - dayOfSchedule.groupByGsbm();  
708 - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);  
709 - return rs;  
710 - }  
711 -  
712 - /**  
713 - * 误点调整  
714 - * @param idx  
715 - * @param minute  
716 - * @return  
717 - */  
718 - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)  
719 - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){  
720 - return scheduleRealInfoService.lateAdjust(idx, minute);  
721 - }  
722 -  
723 - /**  
724 - * 获取所有应发未到的班次  
725 - * @param idx  
726 - * @return  
727 - */  
728 - @RequestMapping(value = "allLate2")  
729 - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){  
730 - return scheduleRealInfoService.allLate2(idx);  
731 - }  
732 -  
733 - /**  
734 - * 添加一个临加到历史库  
735 - * @param sch  
736 - * @return  
737 - */  
738 - @RequestMapping(value = "history/add", method = RequestMethod.POST)  
739 - public Map<String, Object> addToHistory(ScheduleRealInfo sch){  
740 - return scheduleRealInfoService.addToHistory(sch);  
741 - }  
742 -  
743 - /**  
744 - * 从历史库里删除临加班次  
745 - * @param sch  
746 - * @return  
747 - */  
748 - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)  
749 - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){  
750 - return scheduleRealInfoService.deleteToHistory(id);  
751 - }  
752 -  
753 - /**  
754 - * 从历史库里删除临加班次  
755 - * @param sch  
756 - * @return  
757 - */  
758 - @RequestMapping(value = "wxsb", method = RequestMethod.POST)  
759 - public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){  
760 - SysUser user = SecurityUtils.getCurrentUser();  
761 - String uname = user.getUserName();  
762 - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));  
763 - url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));  
764 - // 分公司保存格式 分公司编码_公司编码  
765 - String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));  
766 - String[] arr = val.split("_");  
767 - if (!"22".equals(arr[1])) {  
768 - Map<String, Object> res = new HashMap<String, Object>();  
769 - res.put("status", ResponseCode.ERROR);  
770 - res.put("msg", "除金高公司外暂未开通此功能");  
771 -  
772 - return res;  
773 - }  
774 - url.append("&fgs=").append(arr[0]);  
775 -  
776 - return request(url.toString());  
777 - }  
778 -  
779 - @SuppressWarnings("unchecked")  
780 - private static Map<String, Object> request(String url) {  
781 - Map<String, Object> res = new HashMap<String, Object>();  
782 - res.put("status", ResponseCode.SUCCESS);  
783 - InputStream in = null;  
784 - HttpURLConnection con = null;  
785 - try {  
786 - con = (HttpURLConnection)new URL(url).openConnection();  
787 - con.setRequestMethod("POST");  
788 - con.setRequestProperty("keep-alive", "true");  
789 - con.setRequestProperty("accept", "application/json");  
790 - con.setRequestProperty("content-type", "application/json");  
791 - con.setDoInput(true);  
792 - con.setReadTimeout(2500);  
793 - con.setConnectTimeout(2500);  
794 -  
795 - con.connect();  
796 - if (con.getResponseCode() == 200) {  
797 - in = con.getInputStream();  
798 - ByteArrayOutputStream bout = new ByteArrayOutputStream();  
799 - IOUtils.copy(in, bout); bout.close();  
800 - Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);  
801 - if (!"报修成功".equals(response.get("msg"))) {  
802 - res.put("status", ResponseCode.ERROR);  
803 - res.putAll(response);  
804 - }  
805 - }  
806 - } catch (IOException e) {  
807 - // TODO Auto-generated catch block  
808 - res.put("status", ResponseCode.ERROR);  
809 - res.put("msg", "调用上报接口异常");  
810 - } finally {  
811 - try {  
812 - if (in != null) in.close();  
813 - if (con != null) con.disconnect();  
814 - } catch (IOException e) {  
815 - // TODO Auto-generated catch block  
816 - e.printStackTrace();  
817 - }  
818 - }  
819 -  
820 - return res;  
821 - }  
822 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.IOException;
  5 +import java.io.InputStream;
  6 +import java.io.OutputStream;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.URL;
  9 +import java.util.ArrayList;
  10 +import java.util.Collection;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.apache.commons.io.IOUtils;
  16 +import org.apache.commons.lang3.StringEscapeUtils;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.web.bind.annotation.PathVariable;
  21 +import org.springframework.web.bind.annotation.RequestMapping;
  22 +import org.springframework.web.bind.annotation.RequestMethod;
  23 +import org.springframework.web.bind.annotation.RequestParam;
  24 +import org.springframework.web.bind.annotation.RestController;
  25 +
  26 +import com.alibaba.fastjson.JSONArray;
  27 +import com.bsth.common.ResponseCode;
  28 +import com.bsth.controller.BaseController;
  29 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  30 +import com.bsth.controller.realcontrol.dto.DfsjChange;
  31 +import com.bsth.data.BasicData;
  32 +import com.bsth.data.schedule.DayOfSchedule;
  33 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
  34 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  35 +import com.bsth.entity.schedule.SchedulePlanInfo;
  36 +import com.bsth.entity.sys.SysUser;
  37 +import com.bsth.security.util.SecurityUtils;
  38 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  39 +import com.bsth.util.ConfigUtil;
  40 +import com.fasterxml.jackson.databind.ObjectMapper;
  41 +
  42 +@RestController
  43 +@RequestMapping("/realSchedule")
  44 +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
  45 +
  46 + @Autowired
  47 + ScheduleRealInfoService scheduleRealInfoService;
  48 +
  49 + @Autowired
  50 + DayOfSchedule dayOfSchedule;
  51 + //待发时间调整时间
  52 + public static Long dfsj= 0L;
  53 + //待发时间调整
  54 + public Long dfsj(Long sj){
  55 + dfsj = sj;
  56 + return dfsj;
  57 + }
  58 +
  59 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  60 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  61 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  62 + }
  63 +
  64 + @RequestMapping(value = "/lines")
  65 + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
  66 + return scheduleRealInfoService.findByLines(lines);
  67 + }
  68 +
  69 + @RequestMapping(value = "/car")
  70 + public List<ScheduleRealInfo> findByCar(String nbbm){
  71 + return dayOfSchedule.findByNbbm(nbbm);
  72 + }
  73 +
  74 + /**
  75 + *
  76 + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
  77 + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
  78 + */
  79 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  80 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
  81 + @RequestParam String dfsj,String bcType,
  82 + @RequestParam(defaultValue = "") String opType) {
  83 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
  84 + }
  85 +
  86 +
  87 + /**
  88 + *
  89 + * @Title: outgoAdjust @Description: TODO(待发调整锁定待发)
  90 + *
  91 + */
  92 + @RequestMapping(value = "/outgoAdjusttwo", method = RequestMethod.POST)
  93 + public Map<String, Object> outgoAdjusttow(@RequestParam String dfsj) {
  94 + return scheduleRealInfoService.outgoAdjusttwo(dfsj);
  95 + }
  96 + /**
  97 + *
  98 + * @Title: outgoAdjust @Description: TODO(待发时间定义)
  99 + *
  100 + */
  101 + @RequestMapping(value = "/outgoAdjusttwodfsj", method = RequestMethod.POST)
  102 + public Long outgoAdjusttowdfsj(@RequestParam Long dfsj) {
  103 + return dfsj(dfsj);
  104 + }
  105 +
  106 + /**
  107 + *
  108 + * @Title: outgoAdjust @Description: TODO(待发时间查询)
  109 + *
  110 + */
  111 + @RequestMapping(value = "/outgoAdjusttwoxc", method = RequestMethod.POST)
  112 + public Long outgoAdjusttowdfsjxc() {
  113 + return dfsj;
  114 + }
  115 +
  116 +
  117 + /**
  118 + *
  119 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
  120 + */
  121 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  122 + public Map<String, Object> destroy(@RequestParam String idsStr
  123 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  124 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  125 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
  126 + }
  127 +
  128 + /**
  129 + *
  130 + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
  131 + */
  132 + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
  133 + public Map<String, String> carDeviceMapp() {
  134 + return BasicData.deviceId2NbbmMap.inverse();
  135 + }
  136 +
  137 + /**
  138 + *
  139 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
  140 + * lineId @throws
  141 + */
  142 + @RequestMapping(value = "/driver", method = RequestMethod.GET)
  143 + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
  144 + return scheduleRealInfoService.findDriverByLine(lineCode);
  145 + }
  146 +
  147 + /**
  148 + *
  149 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
  150 + * lineId @throws
  151 + */
  152 + @RequestMapping(value = "/conductor", method = RequestMethod.GET)
  153 + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
  154 + return scheduleRealInfoService.findConductorByLine(lineCode);
  155 + }
  156 +
  157 + /**
  158 + *
  159 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
  160 + * lineId @throws
  161 + */
  162 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  163 + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
  164 + return scheduleRealInfoService.findCarByLine(lineCode);
  165 + }
  166 +
  167 + /**
  168 + *
  169 + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
  170 + */
  171 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  172 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
  173 + return scheduleRealInfoService.sreachVehic(nbbm);
  174 + }
  175 + /**
  176 + *
  177 + * @Title: realOutAdjust
  178 + * @Description: TODO(实发调整)
  179 + * @param @param id 班次ID
  180 + * @param @param fcsjActual 实际发车时间 HH:mm
  181 + * @param @param remarks 备注
  182 + * @throws
  183 + */
  184 + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
  185 + public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,
  186 + @RequestParam String remarks) {
  187 + return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks);
  188 + }
  189 +
  190 + /**
  191 + *
  192 + * @Title: revokeDestroy
  193 + * @Description: TODO(撤销烂班)
  194 + * @param @param id
  195 + * @throws
  196 + */
  197 + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
  198 + public Map<String, Object> revokeDestroy(@RequestParam Long id){
  199 + return scheduleRealInfoService.revokeDestroy(id);
  200 + }
  201 +
  202 + /**
  203 + *
  204 + * @Title: revokeRealOutgo
  205 + * @Description: TODO(撤销实发)
  206 + * @param @param id
  207 + * @throws
  208 + */
  209 + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
  210 + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
  211 + return scheduleRealInfoService.revokeRealOutgo(id);
  212 + }
  213 +
  214 + /**
  215 + * 撤销执行
  216 + * @param id
  217 + * @return
  218 + */
  219 + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
  220 + public Map<String, Object> revokeRealArrive(@RequestParam Long id){
  221 + return scheduleRealInfoService.revokeRealArrive(id);
  222 + }
  223 +
  224 + /**
  225 + *
  226 + * @Title: spaceAdjust
  227 + * @Description: TODO(间隔调整)
  228 + * @param @param ids 要调整的班次数组ID
  229 + * @param @param space 间隔
  230 + * @throws
  231 + */
  232 + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
  233 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
  234 + return scheduleRealInfoService.spaceAdjust(ids, space);
  235 + }
  236 +
  237 + /**
  238 + *
  239 + * @Title: schInfoFineTune
  240 + * @Description: TODO(发车信息微调)
  241 + * @param @param map
  242 + * @throws
  243 + */
  244 + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
  245 + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
  246 + return scheduleRealInfoService.schInfoFineTune(map);
  247 + }
  248 +
  249 + /**
  250 + *
  251 + * @Title: outgoAdjustAll
  252 + * @Description: TODO(批量待发调整)
  253 + * @param @param list
  254 + * @throws
  255 + */
  256 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  257 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  258 + //反转义
  259 + params = StringEscapeUtils.unescapeHtml4(params);
  260 + return scheduleRealInfoService.outgoAdjustAll(params);
  261 + }
  262 +
  263 + /**
  264 + *
  265 + * @Title: findByLineAndUpDown
  266 + * @Description: TODO(根据线路和走向获取班次)
  267 + * @param @param line
  268 + * @param @param upDown
  269 + */
  270 + @RequestMapping(value = "/findByLineAndUpDown")
  271 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
  272 + return dayOfSchedule.findByLineAndUpDown(line, upDown);
  273 + }
  274 +
  275 + /**
  276 + *
  277 + * @Title: findRouteByLine
  278 + * @Description: TODO(获取线路的站点,路段路由)
  279 + * @param @param lineCode
  280 + * @throws
  281 + */
  282 + @RequestMapping(value = "/findRouteByLine")
  283 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  284 + return scheduleRealInfoService.findRouteByLine(lineCode);
  285 + }
  286 +
  287 + /**
  288 + *
  289 + * @Title: removeChildTask
  290 + * @Description: TODO(删除子任务)
  291 + * @param @param taskId 子任务ID
  292 + * @throws
  293 + */
  294 + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
  295 + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
  296 + return scheduleRealInfoService.removeChildTask(taskId);
  297 + }
  298 +
  299 + /**
  300 + *
  301 + * @Title: findByLineCode
  302 + * @Description: TODO(根据线路获取班次信息)
  303 + * @param @param lineCode
  304 + */
  305 + @RequestMapping(value = "/lineCode/{lineCode}")
  306 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  307 + return dayOfSchedule.findByLineCode(lineCode);
  308 + }
  309 +
  310 + @RequestMapping(value = "/queryUserInfo")
  311 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  312 + @RequestParam String date,@RequestParam String state) {
  313 + return scheduleRealInfoService.queryUserInfo(line, date,state);
  314 + }
  315 +
  316 + @RequestMapping(value = "/queryUserInfoPx")
  317 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  318 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  319 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  320 + }
  321 +
  322 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
  323 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
  324 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  325 + return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
  326 + }
  327 +
  328 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
  329 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  330 + ,@RequestParam String date,@RequestParam String line) {
  331 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
  332 + }
  333 +
  334 +
  335 + @RequestMapping(value = "/dailyInfo")
  336 + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
  337 + return scheduleRealInfoService.dailyInfo(line, date, type);
  338 + }
  339 +
  340 + @RequestMapping(value = "/historyMessage")
  341 + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
  342 + @RequestParam String code, @RequestParam String dType, @RequestParam String type) {
  343 + return scheduleRealInfoService.historyMessage(line, date, code, dType, type);
  344 + }
  345 +
  346 + @RequestMapping(value="/findLine")
  347 + public List<Map<String,String>> findLine(@RequestParam String line){
  348 + return scheduleRealInfoService.findLine(line);
  349 + }
  350 +
  351 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
  352 + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  353 + ,@RequestParam String date,@RequestParam String line){
  354 + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
  355 + }
  356 +
  357 + /**
  358 + * 路单公里统计 (闵行审计专用)
  359 + * @param jGh
  360 + * @param clZbh
  361 + * @param lpName
  362 + * @param date
  363 + * @param line
  364 + * @return
  365 + */
  366 + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
  367 + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  368 + ,@RequestParam String date,@RequestParam String line){
  369 + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
  370 + }
  371 +
  372 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
  373 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  374 + ,@RequestParam String date,@RequestParam String line){
  375 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
  376 + }
  377 +
  378 + @RequestMapping(value="/findLpName")
  379 + public List<Map<String,String>> findLpName(@RequestParam String lpName){
  380 + return scheduleRealInfoService.findLpName(lpName);
  381 + }
  382 +
  383 + @RequestMapping(value = "/account")
  384 + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
  385 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  386 + return scheduleRealInfoService.account(line, date, code, xlName, type);
  387 + }
  388 +
  389 + @RequestMapping(value = "/accountPx")
  390 + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
  391 + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
  392 + return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
  393 + }
  394 +
  395 + @RequestMapping(value = "/correctForm")
  396 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  397 + @RequestParam String endDate,
  398 + @RequestParam String lpName, @RequestParam String code,
  399 + @RequestParam String type,@RequestParam String changType) {
  400 + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
  401 + }
  402 + /**
  403 + * @Title queryListWaybill
  404 + * @Description 查询行车路单列表
  405 + * @param jName 驾驶员名字
  406 + * @param clZbh 车辆自编号(内部编号)
  407 + * @param lpName 路牌
  408 + * @return
  409 + */
  410 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
  411 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  412 + ,@RequestParam String date,@RequestParam String line){
  413 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
  414 + }
  415 +
  416 + /**
  417 + * @Title queryListWaybill
  418 + * @Description 查询行车路单列表(闵行审计专用路单)
  419 + * @param jName 驾驶员名字
  420 + * @param clZbh 车辆自编号(内部编号)
  421 + * @param lpName 路牌
  422 + * @return
  423 + */
  424 + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
  425 + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  426 + ,@RequestParam String date,@RequestParam String line){
  427 + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
  428 + }
  429 +
  430 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
  431 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  432 + @RequestParam String date,@RequestParam String line){
  433 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
  434 + }
  435 +
  436 + @RequestMapping(value="/statisticsDaily")
  437 + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
  438 + @RequestParam String xlName, @RequestParam String type){
  439 + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
  440 + }
  441 +
  442 + @RequestMapping(value="/statisticsDaily_mh_2")
  443 + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
  444 + @RequestParam String xlName, @RequestParam String type){
  445 + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
  446 + }
  447 +
  448 + @RequestMapping(value="/statisticsDailyTj")
  449 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
  450 + String gsdm="";
  451 + if(map.get("gsdm")!=null){
  452 + gsdm=map.get("gsdm").toString();
  453 + }
  454 + String fgsdm="";
  455 + if(map.get("fgsdm")!=null){
  456 + fgsdm=map.get("fgsdm").toString();
  457 + }
  458 + String line="";
  459 + if(map.get("line")!=null){
  460 + line=map.get("line").toString();
  461 + }
  462 + String date="";
  463 + if(map.get("date")!=null){
  464 + date=map.get("date").toString();
  465 + }
  466 + String date2="";
  467 + if(map.get("date2")!=null){
  468 + date2=map.get("date2").toString();
  469 + }
  470 + String xlName="";
  471 + if(map.get("xlName")!=null){
  472 + xlName=map.get("xlName").toString();
  473 + }
  474 + String type="";
  475 + if(map.get("type")!=null){
  476 + type=map.get("type").toString();
  477 + }
  478 + String nature="0";
  479 + if(map.get("nature")!=null){
  480 + nature=map.get("nature").toString();
  481 + }
  482 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
  483 + }
  484 +
  485 + /*
  486 + * 公里修正报表
  487 + */
  488 + @RequestMapping(value="/mileageReportTj")
  489 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  490 + String gsdm="";
  491 + if(map.get("gsdm")!=null){
  492 + gsdm=map.get("gsdm").toString();
  493 + }
  494 + String fgsdm="";
  495 + if(map.get("fgsdm")!=null){
  496 + fgsdm=map.get("fgsdm").toString();
  497 + }
  498 + String line="";
  499 + if(map.get("line")!=null){
  500 + line=map.get("line").toString();
  501 + }
  502 + String date="";
  503 + if(map.get("date")!=null){
  504 + date=map.get("date").toString();
  505 + }
  506 + String date2="";
  507 + if(map.get("date2")!=null){
  508 + date2=map.get("date2").toString();
  509 + }
  510 + String xlName="";
  511 + if(map.get("xlName")!=null){
  512 + xlName=map.get("xlName").toString();
  513 + }
  514 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  515 + }
  516 +
  517 + /*
  518 + * 班次修正报表
  519 + */
  520 + @RequestMapping(value="/scheduleCorrectionReport")
  521 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  522 + String gsdm="";
  523 + if(map.get("gsdm")!=null){
  524 + gsdm=map.get("gsdm").toString();
  525 + }
  526 + String fgsdm="";
  527 + if(map.get("fgsdm")!=null){
  528 + fgsdm=map.get("fgsdm").toString();
  529 + }
  530 + String line="";
  531 + if(map.get("line")!=null){
  532 + line=map.get("line").toString();
  533 + }
  534 + String date="";
  535 + if(map.get("date")!=null){
  536 + date=map.get("date").toString();
  537 + }
  538 + String date2="";
  539 + if(map.get("date2")!=null){
  540 + date2=map.get("date2").toString();
  541 + }
  542 + String xlName="";
  543 + if(map.get("xlName")!=null){
  544 + xlName=map.get("xlName").toString();
  545 + }
  546 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  547 + }
  548 +
  549 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  550 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  551 + return scheduleRealInfoService.MapById(id);
  552 + }
  553 +
  554 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  555 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  556 + return scheduleRealInfoService.MapByIdQp(id);
  557 + }
  558 +
  559 + /**
  560 + * @Title: scheduleDaily
  561 + * @Description: TODO(调度日报表)
  562 + * @param line 线路
  563 + * @param date 时间
  564 + * @return
  565 + */
  566 + @RequestMapping(value="/scheduleDaily")
  567 + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
  568 + return scheduleRealInfoService.scheduleDaily(line,date);
  569 + }
  570 +
  571 + @RequestMapping(value="/realScheduleList")
  572 + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
  573 + return scheduleRealInfoService.realScheduleList(line,date);
  574 + }
  575 +
  576 + @RequestMapping(value="/realScheduleList_zrw")
  577 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  578 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  579 + }
  580 +
  581 + @RequestMapping(value="/realScheduleList_mh_2")
  582 + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
  583 + return scheduleRealInfoService.realScheduleList_mh_2(line,date);
  584 + }
  585 +
  586 + @RequestMapping(value="/realScheduleListQp")
  587 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  588 + return scheduleRealInfoService.realScheduleListQp(line,date);
  589 + }
  590 +
  591 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  592 + public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  593 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  594 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  595 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
  596 + }
  597 +
  598 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  599 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  600 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  601 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  602 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  603 + }
  604 +
  605 + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
  606 + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
  607 + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
  608 + }
  609 +
  610 + @RequestMapping(value="/history", method=RequestMethod.POST)
  611 + public Map<String,Object> historySave(ScheduleRealInfo sch){
  612 + return scheduleRealInfoService.historySave(sch);
  613 + }
  614 +
  615 +
  616 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  617 + private final static long ONE_DAY = 1000 * 60 * 60 * 24;
  618 + /**
  619 + * 获取可编辑的历史班次日期
  620 + * @return
  621 + */
  622 + @RequestMapping("dateArray")
  623 + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
  624 + List<String> rs = new ArrayList<>();
  625 +
  626 + long t = System.currentTimeMillis();
  627 + if(c != 1)
  628 + t -= (ONE_DAY + (1000 * 60 * 60 * 6));
  629 + for(int i = 0; i < 4; i ++){
  630 + rs.add(fmtyyyyMMdd.print(t));
  631 + t -= ONE_DAY;
  632 + }
  633 + return rs;
  634 + }
  635 +
  636 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  637 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  638 + return scheduleRealInfoService.svgAttr(jsonStr);
  639 + }
  640 +
  641 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  642 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  643 + return scheduleRealInfoService.findSvgAttr(idx);
  644 + }
  645 +
  646 + @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
  647 + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
  648 + return scheduleRealInfoService.addRemarks(id, remarks);
  649 + }
  650 +
  651 + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
  652 + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
  653 + return scheduleRealInfoService.scheduleDailyQp(line,date);
  654 + }
  655 +
  656 + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
  657 + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
  658 + return scheduleRealInfoService.scheduleDailyExport(map);
  659 + }
  660 +
  661 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  662 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  663 + return scheduleRealInfoService.exportWaybillMore(map);
  664 + }
  665 +
  666 + /**
  667 + * 获取当日计划排班 , 从计划表抓取数据
  668 + * @return
  669 + */
  670 + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
  671 + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
  672 + return scheduleRealInfoService.currentSchedulePlan(lineCode);
  673 + }
  674 +
  675 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  676 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  677 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
  678 + }
  679 +
  680 + /**
  681 + * 删除当日实际排班
  682 + * @return
  683 + */
  684 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  685 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  686 + return dayOfSchedule.deleteRealSchedule(lineCode);
  687 + }
  688 +
  689 + /**
  690 + * 从计划表重新加载当日排班
  691 + * @param lineCode
  692 + * @return
  693 + */
  694 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  695 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  696 + Map<String, Object> rs = new HashMap<>();
  697 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  698 + if(list != null && list.size() > 0){
  699 + rs.put("status", ResponseCode.ERROR);
  700 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  701 + return rs;
  702 + }
  703 +
  704 + int code = dayOfSchedule.reloadSch(lineCode);
  705 +
  706 + //重新按公司编码索引数据
  707 + dayOfSchedule.groupByGsbm();
  708 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  709 + return rs;
  710 + }
  711 +
  712 + /**
  713 + * 误点调整
  714 + * @param idx
  715 + * @param minute
  716 + * @return
  717 + */
  718 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  719 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  720 + return scheduleRealInfoService.lateAdjust(idx, minute);
  721 + }
  722 +
  723 + /**
  724 + * 获取所有应发未到的班次
  725 + * @param idx
  726 + * @return
  727 + */
  728 + @RequestMapping(value = "allLate2")
  729 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  730 + return scheduleRealInfoService.allLate2(idx);
  731 + }
  732 +
  733 + /**
  734 + * 添加一个临加到历史库
  735 + * @param sch
  736 + * @return
  737 + */
  738 + @RequestMapping(value = "history/add", method = RequestMethod.POST)
  739 + public Map<String, Object> addToHistory(ScheduleRealInfo sch){
  740 + return scheduleRealInfoService.addToHistory(sch);
  741 + }
  742 +
  743 + /**
  744 + * 从历史库里删除临加班次
  745 + * @param sch
  746 + * @return
  747 + */
  748 + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
  749 + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
  750 + return scheduleRealInfoService.deleteToHistory(id);
  751 + }
  752 +
  753 + /**
  754 + * 从历史库里删除临加班次
  755 + * @param sch
  756 + * @return
  757 + */
  758 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  759 + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
  760 + SysUser user = SecurityUtils.getCurrentUser();
  761 + String uname = user.getUserName();
  762 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
  763 + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
  764 + // 分公司保存格式 分公司编码_公司编码
  765 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
  766 + String[] arr = val.split("_");
  767 + if (!"22".equals(arr[1])) {
  768 + Map<String, Object> res = new HashMap<String, Object>();
  769 + res.put("status", ResponseCode.ERROR);
  770 + res.put("msg", "除金高公司外暂未开通此功能");
  771 +
  772 + return res;
  773 + }
  774 + url.append("&fgs=").append(arr[0]);
  775 +
  776 + return request(url.toString());
  777 + }
  778 +
  779 + @SuppressWarnings("unchecked")
  780 + private static Map<String, Object> request(String url) {
  781 + Map<String, Object> res = new HashMap<String, Object>();
  782 + res.put("status", ResponseCode.SUCCESS);
  783 + InputStream in = null;
  784 + HttpURLConnection con = null;
  785 + try {
  786 + con = (HttpURLConnection)new URL(url).openConnection();
  787 + con.setRequestMethod("POST");
  788 + con.setRequestProperty("keep-alive", "true");
  789 + con.setRequestProperty("accept", "application/json");
  790 + con.setRequestProperty("content-type", "application/json");
  791 + con.setDoInput(true);
  792 + con.setReadTimeout(2500);
  793 + con.setConnectTimeout(2500);
  794 +
  795 + con.connect();
  796 + if (con.getResponseCode() == 200) {
  797 + in = con.getInputStream();
  798 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  799 + IOUtils.copy(in, bout); bout.close();
  800 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  801 + if (!"报修成功".equals(response.get("msg"))) {
  802 + res.put("status", ResponseCode.ERROR);
  803 + res.putAll(response);
  804 + }
  805 + }
  806 + } catch (IOException e) {
  807 + // TODO Auto-generated catch block
  808 + res.put("status", ResponseCode.ERROR);
  809 + res.put("msg", "调用上报接口异常");
  810 + } finally {
  811 + try {
  812 + if (in != null) in.close();
  813 + if (con != null) con.disconnect();
  814 + } catch (IOException e) {
  815 + // TODO Auto-generated catch block
  816 + e.printStackTrace();
  817 + }
  818 + }
  819 +
  820 + return res;
  821 + }
  822 +}
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -51,6 +51,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -51,6 +51,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
51 + "d.timestamp <=?3 and d.device_id like %?4% ",nativeQuery=true) 51 + "d.timestamp <=?3 and d.device_id like %?4% ",nativeQuery=true)
52 List<Object[]> historyMessage(String line,long d,long t,String code); 52 List<Object[]> historyMessage(String line,long d,long t,String code);
53 53
  54 + //带指令类型字段
  55 + @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from "
  56 + + " bsth_v_directive_60 d where d.line_code=?1 and d.timestamp >=?2 and "
  57 + + "d.timestamp <=?3 and d.device_id like %?4% and d.dispatch_instruct =?5 ",nativeQuery=true)
  58 + List<Object[]> historyMessage(String line,long d,long t,String code,short dispatchInstruct);
  59 +
54 @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs " 60 @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs "
55 + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " 61 + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "
56 + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND " 62 + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -75,7 +75,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -75,7 +75,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
75 75
76 List<Map<String,Object>> dailyInfo(String line,String date,String type); 76 List<Map<String,Object>> dailyInfo(String line,String date,String type);
77 77
78 - List<Object[]> historyMessage(String line,String date,String code, String type); 78 + List<Object[]> historyMessage(String line,String date,String code, String dType, String type);
79 79
80 Map<Integer, Integer> trustStatus(String lineCodes); 80 Map<Integer, Integer> trustStatus(String lineCodes);
81 81
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1246,11 +1246,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1246,11 +1246,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1246 } 1246 }
1247 1247
1248 @Override 1248 @Override
1249 - public List<Object[]> historyMessage(String line, String date, String code, String type) { 1249 + public List<Object[]> historyMessage(String line, String date, String code, String dType, String type) {
1250 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 1250 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1251 1251
1252 long d = 0; 1252 long d = 0;
1253 long t = 0; 1253 long t = 0;
  1254 + short instructType = dType!=null&&dType.length()>0 ? Short.valueOf(dType) : -1;
1254 if (date.length() > 0) { 1255 if (date.length() > 0) {
1255 try { 1256 try {
1256 d = sdf.parse(date + " 00:00:00").getTime(); 1257 d = sdf.parse(date + " 00:00:00").getTime();
@@ -1259,7 +1260,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1259,7 +1260,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1259 // TODO Auto-generated catch block 1260 // TODO Auto-generated catch block
1260 e.printStackTrace(); 1261 e.printStackTrace();
1261 } 1262 }
1262 -  
1263 } 1263 }
1264 String device = ""; 1264 String device = "";
1265 String device2 =""; 1265 String device2 ="";
@@ -1284,7 +1284,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1284,7 +1284,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1284 } 1284 }
1285 List<Object[]> list=new ArrayList<Object[]>(); 1285 List<Object[]> list=new ArrayList<Object[]>();
1286 1286
1287 - List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, d, t, device); 1287 + List<Object[]> list0 = new ArrayList<Object[]>();
  1288 + if(instructType > -1){
  1289 + list0 = scheduleRealInfoRepository.historyMessage(line, d, t, device, instructType);
  1290 + } else {
  1291 + list0 = scheduleRealInfoRepository.historyMessage(line, d, t, device);
  1292 + }
1288 for (Object[] obj : list0) { 1293 for (Object[] obj : list0) {
1289 if (obj != null) { 1294 if (obj != null) {
1290 if(code.equals("")){ 1295 if(code.equals("")){
@@ -1318,7 +1323,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1318,7 +1323,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1318 } 1323 }
1319 list.addAll(list0); 1324 list.addAll(list0);
1320 if(!device2.equals("")){ 1325 if(!device2.equals("")){
1321 - List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2); 1326 + List<Object[]> list1 = new ArrayList<Object[]>();
  1327 + if(instructType > -1){
  1328 + list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2, instructType);
  1329 + } else {
  1330 + list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2);
  1331 + }
1322 for (Object[] obj : list1) { 1332 for (Object[] obj : list1) {
1323 if (obj != null) { 1333 if (obj != null) {
1324 obj[0] =code; 1334 obj[0] =code;
src/main/resources/static/pages/forms/statement/historyMessage.html
@@ -28,16 +28,26 @@ @@ -28,16 +28,26 @@
28 <div class="portlet-title"> 28 <div class="portlet-title">
29 <form id="history" class="form-inline" action=""> 29 <form id="history" class="form-inline" action="">
30 <div style="display: inline-block;"> 30 <div style="display: inline-block;">
  31 + <span class="item-label" style="width: 80px;">指令类型: </span>
  32 + <select class="form-control" id="directiveSelect" name="dType">
  33 + <option value="-1">全部</option>
  34 + <option value="0">调度指令</option>
  35 + <option value="1">运营指令</option>
  36 + <option value="2">线路切换指令</option>
  37 + <option value="3">消息短语</option>
  38 + </select>
  39 + </div>
  40 + <div style="display: inline-block;margin-left: 12px;">
31 <span class="item-label" style="width: 80px;">线路: </span> 41 <span class="item-label" style="width: 80px;">线路: </span>
32 - <select class="form-control" name="line" id="line" style="width: 180px;"></select> 42 + <select class="form-control" name="line" id="line" style="width: 160px;"></select>
33 </div> 43 </div>
34 - <div style="display: inline-block;margin-left: 15px;"> 44 + <div style="display: inline-block;margin-left: 12px;">
35 <span class="item-label" style="width: 80px;">时间: </span> 45 <span class="item-label" style="width: 80px;">时间: </span>
36 - <input class="form-control" type="text" id="date" style="width: 180px;"/> 46 + <input class="form-control" type="text" id="date" style="width: 160px;"/>
37 </div> 47 </div>
38 - <div style="display: inline-block;margin-left: 15px"> 48 + <div style="display: inline-block;margin-left: 12px">
39 <span class="item-label" style="width: 140px;">内部编码: </span> 49 <span class="item-label" style="width: 140px;">内部编码: </span>
40 - <select class="form-control" name="code" id="code" style="width: 180px;"></select> 50 + <select class="form-control" name="code" id="code" style="width: 160px;"></select>
41 </div> 51 </div>
42 <div class="form-group"> 52 <div class="form-group">
43 <input class="btn btn-default" type="button" id="query" value="筛选"/> 53 <input class="btn btn-default" type="button" id="query" value="筛选"/>
@@ -146,6 +156,7 @@ @@ -146,6 +156,7 @@
146 var line = $("#line").val(); 156 var line = $("#line").val();
147 var date = $("#date").val(); 157 var date = $("#date").val();
148 var code = $("#code").val(); 158 var code = $("#code").val();
  159 + var dType = $("#directiveSelect").val();
149 var lineName = $('#line option:selected').text(); 160 var lineName = $('#line option:selected').text();
150 $("#query").on("click",function(){ 161 $("#query").on("click",function(){
151 if($("#date").val() == null || $("#date").val().trim().length == 0){ 162 if($("#date").val() == null || $("#date").val().trim().length == 0){
@@ -155,12 +166,13 @@ @@ -155,12 +166,13 @@
155 line = $("#line").val(); 166 line = $("#line").val();
156 date = $("#date").val(); 167 date = $("#date").val();
157 code = $("#code").val(); 168 code = $("#code").val();
  169 + dType = $("#directiveSelect").val();
158 lineName = $('#line option:selected').text(); 170 lineName = $('#line option:selected').text();
159 var type = "query"; 171 var type = "query";
160 $(".hidden").removeClass("hidden"); 172 $(".hidden").removeClass("hidden");
161 var i = layer.load(2); 173 var i = layer.load(2);
162 // if(code==""||code==null){ 174 // if(code==""||code==null){
163 - $get('/realSchedule/historyMessage',{line:line,date:date,code:code,type:type},function(result){ 175 + $get('/realSchedule/historyMessage',{line:line,date:date,code:code,dType:dType,type:type},function(result){
164 // 把数据填充到模版中 176 // 把数据填充到模版中
165 var tbodyHtml = template('list_history',{list:result}); 177 var tbodyHtml = template('list_history',{list:result});
166 // 把渲染好的模版html文本追加到表格中 178 // 把渲染好的模版html文本追加到表格中