Commit 8884ef44ad4cdef18902a7f08153aa16e6e8a1b9

Authored by 王通
1 parent e87339f6

1.嘉定公交要求可编辑的历史班次从3天变更至10天

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