Commit 4de38ce85bd3e0c3443c3f803d0341d821998975

Authored by youxiw2000
2 parents abe8327d 0ad6862a

Merge branch 'pudong_jdk8' of 192.168.168.201:panzhaov5/bsth_control into pudong_jdk8

Showing 23 changed files with 2562 additions and 1781 deletions

Too many changes to show.

To preserve performance only 23 of 69 files are displayed.

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.MalformedURLException;  
9 -import java.net.URL;  
10 -import java.net.URLEncoder;  
11 -import java.sql.Connection;  
12 -import java.sql.Date;  
13 -import java.sql.PreparedStatement;  
14 -import java.sql.ResultSet;  
15 -import java.util.*;  
16 -  
17 -import com.bsth.data.forecast.entity.ArrivalEntity;  
18 -import com.bsth.entity.sys.SysUser;  
19 -import com.bsth.security.util.SecurityUtils;  
20 -import com.bsth.util.ReportUtils;  
21 -import com.bsth.util.db.DBUtils_MS;  
22 -import com.bsth.util.db.DBUtils_control;  
23 -import com.fasterxml.jackson.databind.ObjectMapper;  
24 -import org.apache.commons.io.IOUtils;  
25 -import org.apache.commons.lang3.StringEscapeUtils;  
26 -import org.joda.time.DateTime;  
27 -import org.joda.time.format.DateTimeFormat;  
28 -import org.joda.time.format.DateTimeFormatter;  
29 -import org.springframework.beans.factory.annotation.Autowired;  
30 -import org.springframework.web.bind.annotation.*;  
31 -  
32 -import com.alibaba.fastjson.JSONArray;  
33 -import com.bsth.common.ResponseCode;  
34 -import com.bsth.controller.BaseController;  
35 -import com.bsth.controller.realcontrol.dto.ChangePersonCar;  
36 -import com.bsth.controller.realcontrol.dto.DfsjChange;  
37 -import com.bsth.data.BasicData;  
38 -import com.bsth.data.schedule.DayOfSchedule;  
39 -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;  
40 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
41 -import com.bsth.entity.report.RepairReport;  
42 -import com.bsth.entity.schedule.SchedulePlanInfo;  
43 -import com.bsth.service.realcontrol.ScheduleRealInfoService;  
44 -  
45 -@RestController  
46 -@RequestMapping("/realSchedule")  
47 -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {  
48 -  
49 - @Autowired  
50 - ScheduleRealInfoService scheduleRealInfoService;  
51 -  
52 - @Autowired  
53 - DayOfSchedule dayOfSchedule;  
54 -  
55 - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)  
56 - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){  
57 - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);  
58 - }  
59 -  
60 - @RequestMapping(value = "/lines")  
61 - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {  
62 - return scheduleRealInfoService.findByLines(lines);  
63 - }  
64 -  
65 - @RequestMapping(value = "/car")  
66 - public List<ScheduleRealInfo> findByCar(String nbbm){  
67 - return dayOfSchedule.findByNbbm(nbbm);  
68 - }  
69 -  
70 - /**  
71 - *  
72 - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id  
73 - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws  
74 - */  
75 - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)  
76 - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,  
77 - @RequestParam String dfsj,String bcType,  
78 - @RequestParam(defaultValue = "") String opType) {  
79 - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);  
80 - }  
81 -  
82 - /**  
83 - *  
84 - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔  
85 - */  
86 - @RequestMapping(value = "/destroy", method = RequestMethod.POST)  
87 - public Map<String, Object> destroy(@RequestParam String idsStr  
88 - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,  
89 - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {  
90 - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);  
91 - }  
92 -  
93 - /**  
94 - *  
95 - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws  
96 - */  
97 - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)  
98 - public Map<String, String> carDeviceMapp() {  
99 - return BasicData.deviceId2NbbmMap.inverse();  
100 - }  
101 -  
102 - /**  
103 - *  
104 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param  
105 - * lineId @throws  
106 - */  
107 - @RequestMapping(value = "/driver", method = RequestMethod.GET)  
108 - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {  
109 - return scheduleRealInfoService.findDriverByLine(lineCode);  
110 - }  
111 -  
112 - /**  
113 - *  
114 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param  
115 - * lineId @throws  
116 - */  
117 - @RequestMapping(value = "/conductor", method = RequestMethod.GET)  
118 - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {  
119 - return scheduleRealInfoService.findConductorByLine(lineCode);  
120 - }  
121 -  
122 - /**  
123 - *  
124 - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param  
125 - * lineId @throws  
126 - */  
127 - @RequestMapping(value = "/cars", method = RequestMethod.GET)  
128 - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {  
129 - return scheduleRealInfoService.findCarByLine(lineCode);  
130 - }  
131 -  
132 - /**  
133 - *  
134 - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws  
135 - */  
136 - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)  
137 - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {  
138 - return scheduleRealInfoService.sreachVehic(nbbm);  
139 - }  
140 - /**  
141 - *  
142 - * @Title: realOutAdjust  
143 - * @Description: TODO(实发调整)  
144 - * @param @param id 班次ID  
145 - * @param @param fcsjActual 实际发车时间 HH:mm  
146 - * @param @param remarks 备注  
147 - * @throws  
148 - */  
149 - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)  
150 - public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {  
151 - return scheduleRealInfoService.realOutAdjust(map);  
152 - }  
153 -  
154 - /**  
155 - *  
156 - * @Title: revokeDestroy  
157 - * @Description: TODO(撤销烂班)  
158 - * @param @param id  
159 - * @throws  
160 - */  
161 - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)  
162 - public Map<String, Object> revokeDestroy(@RequestParam Long id){  
163 - return scheduleRealInfoService.revokeDestroy(id);  
164 - }  
165 -  
166 - /**  
167 - *  
168 - * @Title: revokeRealOutgo  
169 - * @Description: TODO(撤销实发)  
170 - * @param @param id  
171 - * @throws  
172 - */  
173 - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)  
174 - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){  
175 - return scheduleRealInfoService.revokeRealOutgo(id);  
176 - }  
177 -  
178 - /**  
179 - * 撤销执行  
180 - * @param id  
181 - * @return  
182 - */  
183 - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)  
184 - public Map<String, Object> revokeRealArrive(@RequestParam Long id){  
185 - return scheduleRealInfoService.revokeRealArrive(id);  
186 - }  
187 -  
188 - /**  
189 - *  
190 - * @Title: spaceAdjust  
191 - * @Description: TODO(间隔调整)  
192 - * @param @param ids 要调整的班次数组ID  
193 - * @param @param space 间隔  
194 - * @throws  
195 - */  
196 - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)  
197 - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){  
198 - return scheduleRealInfoService.spaceAdjust(ids, space);  
199 - }  
200 -  
201 - /**  
202 - *  
203 - * @Title: schInfoFineTune  
204 - * @Description: TODO(发车信息微调)  
205 - * @param @param map  
206 - * @throws  
207 - */  
208 - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)  
209 - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){  
210 - return scheduleRealInfoService.schInfoFineTune(map);  
211 - }  
212 -  
213 - /**  
214 - *  
215 - * @Title: outgoAdjustAll  
216 - * @Description: TODO(批量待发调整)  
217 - * @param @param list  
218 - * @throws  
219 - */  
220 - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)  
221 - public Map<String, Object> outgoAdjustAll(@RequestParam String params){  
222 - //反转义  
223 - params = StringEscapeUtils.unescapeHtml4(params);  
224 - return scheduleRealInfoService.outgoAdjustAll(params);  
225 - }  
226 -  
227 - /**  
228 - *  
229 - * @Title: findByLineAndUpDown  
230 - * @Description: TODO(根据线路和走向获取班次)  
231 - * @param @param line  
232 - * @param @param upDown  
233 - */  
234 - @RequestMapping(value = "/findByLineAndUpDown")  
235 - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){  
236 - return dayOfSchedule.findByLineAndUpDown(line, upDown);  
237 - }  
238 -  
239 - /**  
240 - *  
241 - * @Title: findRouteByLine  
242 - * @Description: TODO(获取线路的站点,路段路由)  
243 - * @param @param lineCode  
244 - * @throws  
245 - */  
246 - @RequestMapping(value = "/findRouteByLine")  
247 - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){  
248 - return scheduleRealInfoService.findRouteByLine(lineCode);  
249 - }  
250 -  
251 - /**  
252 - *  
253 - * @Title: removeChildTask  
254 - * @Description: TODO(删除子任务)  
255 - * @param @param taskId 子任务ID  
256 - * @throws  
257 - */  
258 - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)  
259 - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){  
260 - return scheduleRealInfoService.removeChildTask(taskId);  
261 - }  
262 -  
263 - /**  
264 - *  
265 - * @Title: findByLineCode  
266 - * @Description: TODO(根据线路获取班次信息)  
267 - * @param @param lineCode  
268 - */  
269 - @RequestMapping(value = "/lineCode/{lineCode}")  
270 - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){  
271 - return dayOfSchedule.findByLineCode(lineCode);  
272 - }  
273 -  
274 - @RequestMapping(value = "/queryUserInfo")  
275 - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,  
276 - @RequestParam String date,@RequestParam String state) {  
277 - return scheduleRealInfoService.queryUserInfo(line, date,state);  
278 - }  
279 -  
280 - @RequestMapping(value = "/queryUserInfoPx")  
281 - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,  
282 - @RequestParam String date,@RequestParam String state,@RequestParam String type) {  
283 - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);  
284 - }  
285 -  
286 - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)  
287 - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,  
288 - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {  
289 - return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);  
290 - }  
291 -  
292 - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)  
293 - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh  
294 - ,@RequestParam String date,@RequestParam String line) {  
295 - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);  
296 - }  
297 -  
298 -  
299 - @RequestMapping(value = "/dailyInfo")  
300 - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {  
301 - return scheduleRealInfoService.dailyInfo(line, date, type);  
302 - }  
303 -  
304 - @RequestMapping(value = "/historyMessage")  
305 - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,  
306 - @RequestParam String code, @RequestParam String type) {  
307 - return scheduleRealInfoService.historyMessage(line, date, code, type);  
308 - }  
309 -  
310 - @RequestMapping(value="/findLine")  
311 - public List<Map<String,String>> findLine(@RequestParam String line){  
312 - return scheduleRealInfoService.findLine(line);  
313 - }  
314 -  
315 - @RequestMapping(value="/findKMBC",method = RequestMethod.GET)  
316 - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
317 - ,@RequestParam String date,@RequestParam String line){  
318 - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);  
319 - }  
320 -  
321 - /**  
322 - * 路单公里统计 (闵行审计专用)  
323 - * @param jGh  
324 - * @param clZbh  
325 - * @param lpName  
326 - * @param date  
327 - * @param line  
328 - * @return  
329 - */  
330 - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)  
331 - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
332 - ,@RequestParam String date,@RequestParam String line){  
333 - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);  
334 - }  
335 -  
336 - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)  
337 - public Map<String,Object> findKMBCQp(@RequestParam String clZbh  
338 - ,@RequestParam String date,@RequestParam String line){  
339 - return scheduleRealInfoService.findKMBCQp(clZbh,date,line);  
340 - }  
341 -  
342 - @RequestMapping(value="/findLpName")  
343 - public List<Map<String,String>> findLpName(@RequestParam String lpName){  
344 - return scheduleRealInfoService.findLpName(lpName);  
345 - }  
346 -  
347 - @RequestMapping(value = "/account")  
348 - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,  
349 - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {  
350 - return scheduleRealInfoService.account(line, date, code, xlName, type);  
351 - }  
352 -  
353 - @RequestMapping(value = "/accountPx")  
354 - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,  
355 - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {  
356 - return scheduleRealInfoService.accountPx(line, date, code, xlName, px);  
357 - }  
358 -  
359 - @RequestMapping(value = "/correctForm")  
360 - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,  
361 - @RequestParam String endDate,  
362 - @RequestParam String lpName, @RequestParam String code,  
363 - @RequestParam String type,@RequestParam String changType) {  
364 - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);  
365 - }  
366 - /**  
367 - * @Title queryListWaybill  
368 - * @Description 查询行车路单列表  
369 - * @param jGh 驾驶员名字  
370 - * @param clZbh 车辆自编号(内部编号)  
371 - * @param lpName 路牌  
372 - * @return  
373 - */  
374 - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)  
375 - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName  
376 - ,@RequestParam String date,@RequestParam String line){  
377 - return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);  
378 - }  
379 -  
380 - /**  
381 - * @Title queryListWaybill  
382 - * @Description 查询行车路单列表(闵行审计专用路单)  
383 - * @param jName 驾驶员名字  
384 - * @param clZbh 车辆自编号(内部编号)  
385 - * @param lpName 路牌  
386 - * @return  
387 - */  
388 - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)  
389 - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName  
390 - ,@RequestParam String date,@RequestParam String line){  
391 - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);  
392 - }  
393 -  
394 - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)  
395 - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,  
396 - @RequestParam String date,@RequestParam String line){  
397 - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);  
398 - }  
399 -  
400 - @RequestMapping(value="/statisticsDaily")  
401 - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,  
402 - @RequestParam String xlName, @RequestParam String type){  
403 - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);  
404 - }  
405 -  
406 - @RequestMapping(value="/statisticsDaily_mh_2")  
407 - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,  
408 - @RequestParam String xlName, @RequestParam String type){  
409 - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);  
410 - }  
411 -  
412 - @RequestMapping(value="/statisticsDailyTj")  
413 - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){  
414 - String gsdm="";  
415 - if(map.get("gsdm")!=null){  
416 - gsdm=map.get("gsdm").toString();  
417 - }  
418 - String fgsdm="";  
419 - if(map.get("fgsdm")!=null){  
420 - fgsdm=map.get("fgsdm").toString();  
421 - }  
422 - String line="";  
423 - if(map.get("line")!=null){  
424 - line=map.get("line").toString();  
425 - }  
426 - String date="";  
427 - if(map.get("date")!=null){  
428 - date=map.get("date").toString();  
429 - }  
430 - String date2="";  
431 - if(map.get("date2")!=null){  
432 - date2=map.get("date2").toString();  
433 - }  
434 - String xlName="";  
435 - if(map.get("xlName")!=null){  
436 - xlName=map.get("xlName").toString();  
437 - }  
438 - String type="";  
439 - if(map.get("type")!=null){  
440 - type=map.get("type").toString();  
441 - }  
442 - String nature="0";  
443 - if(map.get("nature")!=null){  
444 - nature=map.get("nature").toString();  
445 - }  
446 - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);  
447 - }  
448 -  
449 - /*  
450 - * 公里修正报表  
451 - */  
452 - @RequestMapping(value="/mileageReportTj")  
453 - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){  
454 - String gsdm="";  
455 - if(map.get("gsdm")!=null){  
456 - gsdm=map.get("gsdm").toString();  
457 - }  
458 - String fgsdm="";  
459 - if(map.get("fgsdm")!=null){  
460 - fgsdm=map.get("fgsdm").toString();  
461 - }  
462 - String line="";  
463 - if(map.get("line")!=null){  
464 - line=map.get("line").toString();  
465 - }  
466 - String date="";  
467 - if(map.get("date")!=null){  
468 - date=map.get("date").toString();  
469 - }  
470 - String date2="";  
471 - if(map.get("date2")!=null){  
472 - date2=map.get("date2").toString();  
473 - }  
474 - String xlName="";  
475 - if(map.get("xlName")!=null){  
476 - xlName=map.get("xlName").toString();  
477 - }  
478 - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);  
479 - }  
480 -  
481 - /*  
482 - * 班次修正报表  
483 - */  
484 - @RequestMapping(value="/scheduleCorrectionReport")  
485 - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){  
486 - String gsdm="";  
487 - if(map.get("gsdm")!=null){  
488 - gsdm=map.get("gsdm").toString();  
489 - }  
490 - String fgsdm="";  
491 - if(map.get("fgsdm")!=null){  
492 - fgsdm=map.get("fgsdm").toString();  
493 - }  
494 - String line="";  
495 - if(map.get("line")!=null){  
496 - line=map.get("line").toString();  
497 - }  
498 - String date="";  
499 - if(map.get("date")!=null){  
500 - date=map.get("date").toString();  
501 - }  
502 - String date2="";  
503 - if(map.get("date2")!=null){  
504 - date2=map.get("date2").toString();  
505 - }  
506 - String xlName="";  
507 - if(map.get("xlName")!=null){  
508 - xlName=map.get("xlName").toString();  
509 - }  
510 - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);  
511 - }  
512 -  
513 - @RequestMapping(value="/MapById",method = RequestMethod.GET)  
514 - public Map<String, Object> MapById(@RequestParam("id") Long id){  
515 - return scheduleRealInfoService.MapById(id);  
516 - }  
517 -  
518 - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)  
519 - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){  
520 - return scheduleRealInfoService.MapByIdQp(id);  
521 - }  
522 -  
523 - /**  
524 - * @Title: scheduleDaily  
525 - * @Description: TODO(调度日报表)  
526 - * @param line 线路  
527 - * @param date 时间  
528 - * @return  
529 - */  
530 - @RequestMapping(value="/scheduleDaily")  
531 - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){  
532 - return scheduleRealInfoService.scheduleDaily(line,date);  
533 - }  
534 -  
535 - @RequestMapping(value="/realScheduleList")  
536 - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){  
537 - return scheduleRealInfoService.realScheduleList(line,date);  
538 - }  
539 -  
540 - @RequestMapping(value="/realScheduleList_zrw")  
541 - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){  
542 - return scheduleRealInfoService.realScheduleList_zrw(line,date);  
543 - }  
544 -  
545 - @RequestMapping(value="/realScheduleList_mh_2")  
546 - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){  
547 - return scheduleRealInfoService.realScheduleList_mh_2(line,date);  
548 - }  
549 -  
550 - @RequestMapping(value="/realScheduleListQp")  
551 - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){  
552 - return scheduleRealInfoService.realScheduleListQp(line,date);  
553 - }  
554 -  
555 - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)  
556 - public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){  
557 - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);  
558 - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);  
559 - return scheduleRealInfoService.multi_tzrc(cpcs, null);  
560 - }  
561 -  
562 - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)  
563 - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){  
564 - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);  
565 - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);  
566 - return scheduleRealInfoService.multi_dftz(dfsjcs);  
567 - }  
568 -  
569 - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)  
570 - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){  
571 - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);  
572 - }  
573 -  
574 - @RequestMapping(value="/history", method=RequestMethod.POST)  
575 - public Map<String,Object> historySave(ScheduleRealInfo sch){  
576 - return scheduleRealInfoService.historySave(sch);  
577 - }  
578 -  
579 -  
580 - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");  
581 - private final static long ONE_DAY = 1000 * 60 * 60 * 24;  
582 - /**  
583 - * 获取可编辑的历史班次日期  
584 - * @return  
585 - */  
586 - @RequestMapping("dateArray")  
587 - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){  
588 - List<String> rs = new ArrayList<>();  
589 -  
590 - long t = System.currentTimeMillis();  
591 - if(c != 1)  
592 - t -= (ONE_DAY + (1000 * 60 * 60 * 6));  
593 - for(int i = 0; i < 3; i ++){  
594 - rs.add(fmtyyyyMMdd.print(t));  
595 - t -= ONE_DAY;  
596 - }  
597 - return rs;  
598 - }  
599 -  
600 - @RequestMapping(value = "svgAttr", method = RequestMethod.POST)  
601 - public Map<String, Object> svgAttr(@RequestParam String jsonStr){  
602 - return scheduleRealInfoService.svgAttr(jsonStr);  
603 - }  
604 -  
605 - @RequestMapping(value = "svgAttr", method = RequestMethod.GET)  
606 - public Map<String, Object> findSvgAttr(@RequestParam String idx){  
607 - return scheduleRealInfoService.findSvgAttr(idx);  
608 - }  
609 -  
610 - @RequestMapping(value = "addRemarks", method = RequestMethod.POST)  
611 - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){  
612 - return scheduleRealInfoService.addRemarks(id, remarks);  
613 - }  
614 -  
615 - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)  
616 - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){  
617 - return scheduleRealInfoService.scheduleDailyQp(line,date);  
618 - }  
619 -  
620 - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)  
621 - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){  
622 - return scheduleRealInfoService.scheduleDailyExport(map);  
623 - }  
624 -  
625 - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)  
626 - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){  
627 - return scheduleRealInfoService.exportWaybillMore(map);  
628 - }  
629 -  
630 - /**  
631 - * 获取当日计划排班 , 从计划表抓取数据  
632 - * @return  
633 - */  
634 - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)  
635 - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){  
636 - return scheduleRealInfoService.currentSchedulePlan(lineCode);  
637 - }  
638 -  
639 - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)  
640 - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){  
641 - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);  
642 - }  
643 -  
644 - /**  
645 - * 删除当日实际排班  
646 - * @return  
647 - */  
648 - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)  
649 - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){  
650 - return dayOfSchedule.deleteRealSchedule(lineCode);  
651 - }  
652 -  
653 - /**  
654 - * 从计划表重新加载当日排班  
655 - * @param lineCode  
656 - * @return  
657 - */  
658 - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)  
659 - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){  
660 - Map<String, Object> rs = new HashMap<>();  
661 - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);  
662 - if(list != null && list.size() > 0){  
663 - rs.put("status", ResponseCode.ERROR);  
664 - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");  
665 - return rs;  
666 - }  
667 -  
668 - int code = dayOfSchedule.reloadSch(lineCode);  
669 -  
670 - //重新按公司编码索引数据  
671 - dayOfSchedule.groupByGsbm();  
672 - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);  
673 - return rs;  
674 - }  
675 -  
676 - /**  
677 - * 误点调整  
678 - * @param idx  
679 - * @param minute  
680 - * @return  
681 - */  
682 - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)  
683 - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){  
684 - return scheduleRealInfoService.lateAdjust(idx, minute);  
685 - }  
686 -  
687 - /**  
688 - * 获取所有应发未到的班次  
689 - * @param idx  
690 - * @return  
691 - */  
692 - @RequestMapping(value = "allLate2")  
693 - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){  
694 - return scheduleRealInfoService.allLate2(idx);  
695 - }  
696 -  
697 - /**  
698 - * 添加一个临加到历史库  
699 - * @param sch  
700 - * @return  
701 - */  
702 - @RequestMapping(value = "history/add", method = RequestMethod.POST)  
703 - public Map<String, Object> addToHistory(ScheduleRealInfo sch){  
704 - return scheduleRealInfoService.addToHistory(sch);  
705 - }  
706 -  
707 - /**  
708 - * 从历史库里删除临加班次  
709 - * @param id  
710 - * @return  
711 - */  
712 - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)  
713 - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){  
714 - return scheduleRealInfoService.deleteToHistory(id);  
715 - }  
716 -  
717 - @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)  
718 - public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){  
719 - Map<String, Object> map =new HashMap<>();  
720 - map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));  
721 - return map;  
722 - }  
723 -  
724 - /**  
725 - * 从历史库里删除临加班次  
726 - * @param param  
727 - * @return  
728 - */  
729 - @RequestMapping(value = "wxsb", method = RequestMethod.POST)  
730 - public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){  
731 - return scheduleRealInfoService.repairReport(param, true);  
732 - }  
733 -  
734 - @RequestMapping(value = "wxsb", method = RequestMethod.GET)  
735 - public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){  
736 - return scheduleRealInfoService.repairReportList(line, date, code, type);  
737 - }  
738 -  
739 - @RequestMapping(value = "lineLevel", method = RequestMethod.GET)  
740 - public Map<String, String> lineLevel(@RequestParam String idx){  
741 - return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));  
742 - }  
743 -  
744 - /**  
745 - * 反馈安全驾驶系统  
746 - * @param param  
747 - * @return  
748 - */  
749 - @RequestMapping(value = "ackDsm", method = RequestMethod.POST)  
750 - public Map<String, Object> ackDsm(@RequestParam Map<String, Object> param){  
751 - Map<String, Object> res = new HashMap<>();  
752 - InputStream in = null;  
753 - SysUser user = SecurityUtils.getCurrentUser();  
754 - DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");  
755 - StringBuilder url = new StringBuilder("http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?"), uri = new StringBuilder();  
756 - HttpURLConnection con = null;  
757 - try {  
758 - uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8"));  
759 - uri.append("&checkTime=").append(URLEncoder.encode(fmt.print(System.currentTimeMillis()), "UTF-8"));  
760 - uri.append("&nbbm=").append(URLEncoder.encode(param.get("nbbm").toString(), "UTF-8"));  
761 - uri.append("&starttime=").append(URLEncoder.encode(fmt.print(Long.parseLong(param.get("ts").toString())), "UTF-8"));  
762 - url.append(uri);  
763 - con = (HttpURLConnection)new URL(url.toString()).openConnection();  
764 - con.setDoInput(true);  
765 - con.setRequestMethod("POST");  
766 - con.setConnectTimeout(5000);  
767 - con.setReadTimeout(5000);  
768 - con.setRequestProperty("keep-alive", "true");  
769 - con.setRequestProperty("accept", "*/*");  
770 - con.setRequestProperty("content-type", "application/x-www-form-urlencoded");  
771 - con.connect();  
772 -  
773 - if (con.getResponseCode() == 200) {  
774 - in = con.getInputStream();  
775 - ByteArrayOutputStream bout = new ByteArrayOutputStream();  
776 - IOUtils.copy(in, bout);  
777 - Map<String, Object> map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);  
778 - System.out.println(map);  
779 - }  
780 - } catch (MalformedURLException e) {  
781 - // TODO Auto-generated catch block  
782 - e.printStackTrace();  
783 - } catch (IOException e) {  
784 - // TODO Auto-generated catch block  
785 - e.printStackTrace();  
786 - } finally {  
787 - if (con != null) {  
788 - con.disconnect();  
789 - }  
790 - }  
791 -  
792 - return res;  
793 - }  
794 -  
795 - @RequestMapping(value = "exportPlan", method = RequestMethod.GET)  
796 - public Map<String, Object> exportPlan(@RequestParam String date){  
797 - Map<String, Object> res = new HashMap<>();  
798 - DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");  
799 - Connection conn = null;  
800 - PreparedStatement ps = null;  
801 - ResultSet rs = null;  
802 -  
803 - List<Map<String, Object>> list = new ArrayList<>();  
804 - String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'";  
805 - try{  
806 - conn = DBUtils_control.getConnection();  
807 - ps = conn.prepareStatement(sql);  
808 - ps.setString(1, date);  
809 - rs = ps.executeQuery();  
810 - ObjectMapper mapper = new ObjectMapper();  
811 -  
812 - while (rs.next()) {  
813 - SchedulePlan schedulePlan = new SchedulePlan();  
814 - schedulePlan.setXlName(rs.getString("xl_name"));  
815 - schedulePlan.setXlDir(rs.getInt("xl_dir"));  
816 - Date scheduleDate = rs.getDate("schedule_date");  
817 - schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd"));  
818 - String fcsj = rs.getString("fcsj");  
819 - int bcsj = rs.getInt("bcsj");  
820 - DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj);  
821 - schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00"));  
822 - DateTime ddsjDt = fcsjDt.plusMinutes(bcsj);  
823 - schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00"));  
824 - schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00"));  
825 - DateTime endDt = fcsjDt.plusHours(1);  
826 - schedulePlan.setSjdEnd(endDt.toString("HH:00:00"));  
827 - schedulePlan.setClZbh(rs.getString("cl_zbh"));  
828 - schedulePlan.setJsy(rs.getString("j_name"));  
829 - schedulePlan.setBcsj(bcsj);  
830 -  
831 - list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class));  
832 - }  
833 - List<Iterator<?>> iterators = new ArrayList<Iterator<?>>();  
834 - iterators.add(list.iterator());  
835 - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";  
836 - String sourcePath = path + "mould/schedulePlan.xls";  
837 -  
838 - new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls");  
839 -  
840 - res.put("status", ResponseCode.SUCCESS);  
841 - res.put("msg", "成功");  
842 - } catch (Exception e) {  
843 - res.put("status", ResponseCode.ERROR);  
844 - res.put("msg", e.getMessage());  
845 - } finally {  
846 - DBUtils_control.close(rs, ps, conn);  
847 - }  
848 -  
849 - return res;  
850 - }  
851 -  
852 - public final static class SchedulePlan {  
853 - private String company = "浦东公司[46]";  
854 -  
855 - private String xlName = "";  
856 -  
857 - private int xlDir;  
858 -  
859 - private String xlDirStr = "";  
860 -  
861 - private String scheduleDate = "";  
862 -  
863 - private String sjdStart = "";  
864 -  
865 - private String sjdEnd = "";  
866 -  
867 - private String fcsj = "";  
868 -  
869 - private int bcsj;  
870 -  
871 - private String ddsj = "";  
872 -  
873 - private int yys = 25;  
874 -  
875 - private String clZbh = "";  
876 -  
877 - private String cph = "";  
878 -  
879 - private String color = "绿牌";  
880 -  
881 - private String jsy = "";  
882 -  
883 - private String jsydh = "";  
884 -  
885 - private int pj = 10;  
886 -  
887 - public String getCompany() {  
888 - return company;  
889 - }  
890 -  
891 - public void setCompany(String company) {  
892 - this.company = company;  
893 - }  
894 -  
895 - public String getXlName() {  
896 - return xlName;  
897 - }  
898 -  
899 - public void setXlName(String xlName) {  
900 - this.xlName = xlName;  
901 - }  
902 -  
903 - public int getXlDir() {  
904 - return xlDir;  
905 - }  
906 -  
907 - public void setXlDir(int xlDir) {  
908 - this.xlDir = xlDir;  
909 - }  
910 -  
911 - public String getXlDirStr() {  
912 - xlDirStr = "";  
913 - if (xlDir == 0) {  
914 - xlDirStr = "上行";  
915 - } else if (xlDir == 1) {  
916 - xlDirStr = "下行";  
917 - }  
918 - return xlDirStr;  
919 - }  
920 -  
921 - public void setXlDirStr(String xlDirStr) {  
922 - this.xlDirStr = xlDirStr;  
923 - }  
924 -  
925 - public String getScheduleDate() {  
926 - return scheduleDate;  
927 - }  
928 -  
929 - public void setScheduleDate(String scheduleDate) {  
930 - this.scheduleDate = scheduleDate;  
931 - }  
932 -  
933 - public String getSjdStart() {  
934 - return sjdStart;  
935 - }  
936 -  
937 - public void setSjdStart(String sjdStart) {  
938 - this.sjdStart = sjdStart;  
939 - }  
940 -  
941 - public String getSjdEnd() {  
942 - return sjdEnd;  
943 - }  
944 -  
945 - public void setSjdEnd(String sjdEnd) {  
946 - this.sjdEnd = sjdEnd;  
947 - }  
948 -  
949 - public String getFcsj() {  
950 - return fcsj;  
951 - }  
952 -  
953 - public void setFcsj(String fcsj) {  
954 - this.fcsj = fcsj;  
955 - }  
956 -  
957 - public int getBcsj() {  
958 - return bcsj;  
959 - }  
960 -  
961 - public void setBcsj(int bcsj) {  
962 - this.bcsj = bcsj;  
963 - }  
964 -  
965 - public String getDdsj() {  
966 - return ddsj;  
967 - }  
968 -  
969 - public void setDdsj(String ddsj) {  
970 - this.ddsj = ddsj;  
971 - }  
972 -  
973 - public int getYys() {  
974 - return yys;  
975 - }  
976 -  
977 - public void setYys(int yys) {  
978 - this.yys = yys;  
979 - }  
980 -  
981 - public String getClZbh() {  
982 - return clZbh;  
983 - }  
984 -  
985 - public void setClZbh(String clZbh) {  
986 - this.clZbh = clZbh;  
987 - }  
988 -  
989 - public String getCph() {  
990 - cph = BasicData.nbbmCompanyPlateMap.get(clZbh);  
991 - if (cph == null) {  
992 - cph = "";  
993 - }  
994 - return cph;  
995 - }  
996 -  
997 - public void setCph(String cph) {  
998 - this.cph = cph;  
999 - }  
1000 -  
1001 - public String getColor() {  
1002 - return color;  
1003 - }  
1004 -  
1005 - public void setColor(String color) {  
1006 - this.color = color;  
1007 - }  
1008 -  
1009 - public String getJsy() {  
1010 - return jsy;  
1011 - }  
1012 -  
1013 - public void setJsy(String jsy) {  
1014 - this.jsy = jsy;  
1015 - }  
1016 -  
1017 - public String getJsydh() {  
1018 - return jsydh;  
1019 - }  
1020 -  
1021 - public void setJsydh(String jsydh) {  
1022 - this.jsydh = jsydh;  
1023 - }  
1024 -  
1025 - public int getPj() {  
1026 - return pj;  
1027 - }  
1028 -  
1029 - public void setPj(int pj) {  
1030 - this.pj = pj;  
1031 - }  
1032 - }  
1033 -} 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.MalformedURLException;
  9 +import java.net.URL;
  10 +import java.net.URLEncoder;
  11 +import java.sql.Connection;
  12 +import java.sql.Date;
  13 +import java.sql.PreparedStatement;
  14 +import java.sql.ResultSet;
  15 +import java.util.*;
  16 +
  17 +import com.bsth.data.forecast.entity.ArrivalEntity;
  18 +import com.bsth.entity.sys.SysUser;
  19 +import com.bsth.security.util.SecurityUtils;
  20 +import com.bsth.util.ReportUtils;
  21 +import com.bsth.util.db.DBUtils_MS;
  22 +import com.bsth.util.db.DBUtils_control;
  23 +import com.fasterxml.jackson.databind.ObjectMapper;
  24 +import org.apache.commons.io.IOUtils;
  25 +import org.apache.commons.lang3.StringEscapeUtils;
  26 +import org.joda.time.DateTime;
  27 +import org.joda.time.format.DateTimeFormat;
  28 +import org.joda.time.format.DateTimeFormatter;
  29 +import org.springframework.beans.factory.annotation.Autowired;
  30 +import org.springframework.web.bind.annotation.*;
  31 +
  32 +import com.alibaba.fastjson.JSONArray;
  33 +import com.bsth.common.ResponseCode;
  34 +import com.bsth.controller.BaseController;
  35 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  36 +import com.bsth.controller.realcontrol.dto.DfsjChange;
  37 +import com.bsth.data.BasicData;
  38 +import com.bsth.data.schedule.DayOfSchedule;
  39 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
  40 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  41 +import com.bsth.entity.report.RepairReport;
  42 +import com.bsth.entity.schedule.SchedulePlanInfo;
  43 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  44 +
  45 +@RestController
  46 +@RequestMapping("/realSchedule")
  47 +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
  48 +
  49 + @Autowired
  50 + ScheduleRealInfoService scheduleRealInfoService;
  51 +
  52 + @Autowired
  53 + DayOfSchedule dayOfSchedule;
  54 +
  55 + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST)
  56 + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){
  57 + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm);
  58 + }
  59 +
  60 + @RequestMapping(value = "/lines")
  61 + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) {
  62 + return scheduleRealInfoService.findByLines(lines);
  63 + }
  64 +
  65 + @RequestMapping(value = "/car")
  66 + public List<ScheduleRealInfo> findByCar(String nbbm){
  67 + return dayOfSchedule.findByNbbm(nbbm);
  68 + }
  69 +
  70 + /**
  71 + *
  72 + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
  73 + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws
  74 + */
  75 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  76 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,
  77 + @RequestParam String dfsj,String bcType,
  78 + @RequestParam(defaultValue = "") String opType) {
  79 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null);
  80 + }
  81 +
  82 + /**
  83 + *
  84 + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔
  85 + */
  86 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  87 + public Map<String, Object> destroy(@RequestParam String idsStr
  88 + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/,
  89 + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) {
  90 + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null);
  91 + }
  92 +
  93 + /**
  94 + *
  95 + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws
  96 + */
  97 + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET)
  98 + public Map<String, String> carDeviceMapp() {
  99 + return BasicData.deviceId2NbbmMap.inverse();
  100 + }
  101 +
  102 + /**
  103 + *
  104 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param
  105 + * lineId @throws
  106 + */
  107 + @RequestMapping(value = "/driver", method = RequestMethod.GET)
  108 + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) {
  109 + return scheduleRealInfoService.findDriverByLine(lineCode);
  110 + }
  111 +
  112 + /**
  113 + *
  114 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param
  115 + * lineId @throws
  116 + */
  117 + @RequestMapping(value = "/conductor", method = RequestMethod.GET)
  118 + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) {
  119 + return scheduleRealInfoService.findConductorByLine(lineCode);
  120 + }
  121 +
  122 + /**
  123 + *
  124 + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param
  125 + * lineId @throws
  126 + */
  127 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  128 + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) {
  129 + return scheduleRealInfoService.findCarByLine(lineCode);
  130 + }
  131 +
  132 + /**
  133 + *
  134 + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws
  135 + */
  136 + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET)
  137 + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) {
  138 + return scheduleRealInfoService.sreachVehic(nbbm);
  139 + }
  140 + /**
  141 + *
  142 + * @Title: realOutAdjust
  143 + * @Description: TODO(实发调整)
  144 + * @param @param id 班次ID
  145 + * @param @param fcsjActual 实际发车时间 HH:mm
  146 + * @param @param remarks 备注
  147 + * @throws
  148 + */
  149 + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
  150 + public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
  151 + return scheduleRealInfoService.realOutAdjust(map);
  152 + }
  153 +
  154 + /**
  155 + *
  156 + * @Title: revokeDestroy
  157 + * @Description: TODO(撤销烂班)
  158 + * @param @param id
  159 + * @throws
  160 + */
  161 + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST)
  162 + public Map<String, Object> revokeDestroy(@RequestParam Long id){
  163 + return scheduleRealInfoService.revokeDestroy(id);
  164 + }
  165 +
  166 + /**
  167 + *
  168 + * @Title: revokeRealOutgo
  169 + * @Description: TODO(撤销实发)
  170 + * @param @param id
  171 + * @throws
  172 + */
  173 + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST)
  174 + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){
  175 + return scheduleRealInfoService.revokeRealOutgo(id);
  176 + }
  177 +
  178 + /**
  179 + * 撤销执行
  180 + * @param id
  181 + * @return
  182 + */
  183 + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST)
  184 + public Map<String, Object> revokeRealArrive(@RequestParam Long id){
  185 + return scheduleRealInfoService.revokeRealArrive(id);
  186 + }
  187 +
  188 + /**
  189 + *
  190 + * @Title: spaceAdjust
  191 + * @Description: TODO(间隔调整)
  192 + * @param @param ids 要调整的班次数组ID
  193 + * @param @param space 间隔
  194 + * @throws
  195 + */
  196 + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST)
  197 + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){
  198 + return scheduleRealInfoService.spaceAdjust(ids, space);
  199 + }
  200 +
  201 + /**
  202 + *
  203 + * @Title: schInfoFineTune
  204 + * @Description: TODO(发车信息微调)
  205 + * @param @param map
  206 + * @throws
  207 + */
  208 + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST)
  209 + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){
  210 + return scheduleRealInfoService.schInfoFineTune(map);
  211 + }
  212 +
  213 + /**
  214 + *
  215 + * @Title: outgoAdjustAll
  216 + * @Description: TODO(批量待发调整)
  217 + * @param @param list
  218 + * @throws
  219 + */
  220 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  221 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  222 + //反转义
  223 + params = StringEscapeUtils.unescapeHtml4(params);
  224 + return scheduleRealInfoService.outgoAdjustAll(params);
  225 + }
  226 +
  227 + /**
  228 + *
  229 + * @Title: findByLineAndUpDown
  230 + * @Description: TODO(根据线路和走向获取班次)
  231 + * @param @param line
  232 + * @param @param upDown
  233 + */
  234 + @RequestMapping(value = "/findByLineAndUpDown")
  235 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){
  236 + return dayOfSchedule.findByLineAndUpDown(line, upDown);
  237 + }
  238 +
  239 + /**
  240 + *
  241 + * @Title: findRouteByLine
  242 + * @Description: TODO(获取线路的站点,路段路由)
  243 + * @param @param lineCode
  244 + * @throws
  245 + */
  246 + @RequestMapping(value = "/findRouteByLine")
  247 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  248 + return scheduleRealInfoService.findRouteByLine(lineCode);
  249 + }
  250 +
  251 + /**
  252 + *
  253 + * @Title: removeChildTask
  254 + * @Description: TODO(删除子任务)
  255 + * @param @param taskId 子任务ID
  256 + * @throws
  257 + */
  258 + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE)
  259 + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){
  260 + return scheduleRealInfoService.removeChildTask(taskId);
  261 + }
  262 +
  263 + /**
  264 + *
  265 + * @Title: findByLineCode
  266 + * @Description: TODO(根据线路获取班次信息)
  267 + * @param @param lineCode
  268 + */
  269 + @RequestMapping(value = "/lineCode/{lineCode}")
  270 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  271 + return dayOfSchedule.findByLineCode(lineCode);
  272 + }
  273 +
  274 + @RequestMapping(value = "/queryUserInfo")
  275 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  276 + @RequestParam String date,@RequestParam String state) {
  277 + return scheduleRealInfoService.queryUserInfo(line, date,state);
  278 + }
  279 +
  280 + @RequestMapping(value = "/queryUserInfoPx")
  281 + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line,
  282 + @RequestParam String date,@RequestParam String state,@RequestParam String type) {
  283 + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
  284 + }
  285 +
  286 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
  287 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh,
  288 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  289 + return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line);
  290 + }
  291 +
  292 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
  293 + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
  294 + ,@RequestParam String date,@RequestParam String line) {
  295 + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
  296 + }
  297 +
  298 +
  299 + @RequestMapping(value = "/dailyInfo")
  300 + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) {
  301 + return scheduleRealInfoService.dailyInfo(line, date, type);
  302 + }
  303 +
  304 + @RequestMapping(value = "/historyMessage")
  305 + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date,
  306 + @RequestParam String code, @RequestParam String type) {
  307 + return scheduleRealInfoService.historyMessage(line, date, code, type);
  308 + }
  309 +
  310 + @RequestMapping(value="/findLine")
  311 + public List<Map<String,String>> findLine(@RequestParam String line){
  312 + return scheduleRealInfoService.findLine(line);
  313 + }
  314 +
  315 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
  316 + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  317 + ,@RequestParam String date,@RequestParam String line){
  318 + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line);
  319 + }
  320 +
  321 + /**
  322 + * 路单公里统计 (闵行审计专用)
  323 + * @param jGh
  324 + * @param clZbh
  325 + * @param lpName
  326 + * @param date
  327 + * @param line
  328 + * @return
  329 + */
  330 + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET)
  331 + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  332 + ,@RequestParam String date,@RequestParam String line){
  333 + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line);
  334 + }
  335 +
  336 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
  337 + public Map<String,Object> findKMBCQp(@RequestParam String clZbh
  338 + ,@RequestParam String date,@RequestParam String line){
  339 + return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
  340 + }
  341 +
  342 + @RequestMapping(value="/findLpName")
  343 + public List<Map<String,String>> findLpName(@RequestParam String lpName){
  344 + return scheduleRealInfoService.findLpName(lpName);
  345 + }
  346 +
  347 + @RequestMapping(value = "/account")
  348 + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date,
  349 + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) {
  350 + return scheduleRealInfoService.account(line, date, code, xlName, type);
  351 + }
  352 +
  353 + @RequestMapping(value = "/accountPx")
  354 + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date,
  355 + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) {
  356 + return scheduleRealInfoService.accountPx(line, date, code, xlName, px);
  357 + }
  358 +
  359 + @RequestMapping(value = "/correctForm")
  360 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  361 + @RequestParam String endDate,
  362 + @RequestParam String lpName, @RequestParam String code,
  363 + @RequestParam String type,@RequestParam String changType) {
  364 + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType);
  365 + }
  366 + /**
  367 + * @Title queryListWaybill
  368 + * @Description 查询行车路单列表
  369 + * @param jGh 驾驶员名字
  370 + * @param clZbh 车辆自编号(内部编号)
  371 + * @param lpName 路牌
  372 + * @return
  373 + */
  374 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
  375 + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName
  376 + ,@RequestParam String date,@RequestParam String line){
  377 + return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line);
  378 + }
  379 +
  380 + /**
  381 + * @Title queryListWaybill
  382 + * @Description 查询行车路单列表(闵行审计专用路单)
  383 + * @param jName 驾驶员名字
  384 + * @param clZbh 车辆自编号(内部编号)
  385 + * @param lpName 路牌
  386 + * @return
  387 + */
  388 + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET)
  389 + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  390 + ,@RequestParam String date,@RequestParam String line){
  391 + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line);
  392 + }
  393 +
  394 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
  395 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
  396 + @RequestParam String date,@RequestParam String line){
  397 + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
  398 + }
  399 +
  400 + @RequestMapping(value="/statisticsDaily")
  401 + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date,
  402 + @RequestParam String xlName, @RequestParam String type){
  403 + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
  404 + }
  405 +
  406 + @RequestMapping(value="/statisticsDaily_mh_2")
  407 + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date,
  408 + @RequestParam String xlName, @RequestParam String type){
  409 + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type);
  410 + }
  411 +
  412 + @RequestMapping(value="/dispatchDailySum")
  413 + public List<Map<String,Object>> dispatchDailySum(@RequestParam Map<String, Object> map){
  414 + String date="";
  415 + if(map.get("date")!=null){
  416 + date=map.get("date").toString();
  417 + }
  418 + String date2="";
  419 + if(map.get("date2")!=null){
  420 + date2=map.get("date2").toString();
  421 + }
  422 + String nature="0";
  423 + if(map.get("nature")!=null){
  424 + nature=map.get("nature").toString();
  425 + }
  426 + String type="";
  427 + if(map.get("type")!=null){
  428 + type=map.get("type").toString();
  429 + }
  430 + return scheduleRealInfoService.dispatchDailySum(date, date2, nature, type);
  431 + }
  432 +
  433 + @RequestMapping(value="/statisticsDailyTj")
  434 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){
  435 + String gsdm="";
  436 + if(map.get("gsdm")!=null){
  437 + gsdm=map.get("gsdm").toString();
  438 + }
  439 + String fgsdm="";
  440 + if(map.get("fgsdm")!=null){
  441 + fgsdm=map.get("fgsdm").toString();
  442 + }
  443 + String line="";
  444 + if(map.get("line")!=null){
  445 + line=map.get("line").toString();
  446 + }
  447 + String date="";
  448 + if(map.get("date")!=null){
  449 + date=map.get("date").toString();
  450 + }
  451 + String date2="";
  452 + if(map.get("date2")!=null){
  453 + date2=map.get("date2").toString();
  454 + }
  455 + String xlName="";
  456 + if(map.get("xlName")!=null){
  457 + xlName=map.get("xlName").toString();
  458 + }
  459 + String type="";
  460 + if(map.get("type")!=null){
  461 + type=map.get("type").toString();
  462 + }
  463 + String nature="0";
  464 + if(map.get("nature")!=null){
  465 + nature=map.get("nature").toString();
  466 + }
  467 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
  468 + }
  469 +
  470 + /*
  471 + * 公里修正报表
  472 + */
  473 + @RequestMapping(value="/mileageReportTj")
  474 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  475 + String gsdm="";
  476 + if(map.get("gsdm")!=null){
  477 + gsdm=map.get("gsdm").toString();
  478 + }
  479 + String fgsdm="";
  480 + if(map.get("fgsdm")!=null){
  481 + fgsdm=map.get("fgsdm").toString();
  482 + }
  483 + String line="";
  484 + if(map.get("line")!=null){
  485 + line=map.get("line").toString();
  486 + }
  487 + String date="";
  488 + if(map.get("date")!=null){
  489 + date=map.get("date").toString();
  490 + }
  491 + String date2="";
  492 + if(map.get("date2")!=null){
  493 + date2=map.get("date2").toString();
  494 + }
  495 + String xlName="";
  496 + if(map.get("xlName")!=null){
  497 + xlName=map.get("xlName").toString();
  498 + }
  499 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  500 + }
  501 +
  502 + /*
  503 + * 班次修正报表
  504 + */
  505 + @RequestMapping(value="/scheduleCorrectionReport")
  506 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  507 + String gsdm="";
  508 + if(map.get("gsdm")!=null){
  509 + gsdm=map.get("gsdm").toString();
  510 + }
  511 + String fgsdm="";
  512 + if(map.get("fgsdm")!=null){
  513 + fgsdm=map.get("fgsdm").toString();
  514 + }
  515 + String line="";
  516 + if(map.get("line")!=null){
  517 + line=map.get("line").toString();
  518 + }
  519 + String date="";
  520 + if(map.get("date")!=null){
  521 + date=map.get("date").toString();
  522 + }
  523 + String date2="";
  524 + if(map.get("date2")!=null){
  525 + date2=map.get("date2").toString();
  526 + }
  527 + String xlName="";
  528 + if(map.get("xlName")!=null){
  529 + xlName=map.get("xlName").toString();
  530 + }
  531 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  532 + }
  533 +
  534 + @RequestMapping(value="/MapById",method = RequestMethod.GET)
  535 + public Map<String, Object> MapById(@RequestParam("id") Long id){
  536 + return scheduleRealInfoService.MapById(id);
  537 + }
  538 +
  539 + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET)
  540 + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){
  541 + return scheduleRealInfoService.MapByIdQp(id);
  542 + }
  543 +
  544 + /**
  545 + * @Title: scheduleDaily
  546 + * @Description: TODO(调度日报表)
  547 + * @param line 线路
  548 + * @param date 时间
  549 + * @return
  550 + */
  551 + @RequestMapping(value="/scheduleDaily")
  552 + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){
  553 + return scheduleRealInfoService.scheduleDaily(line,date);
  554 + }
  555 +
  556 + @RequestMapping(value="/realScheduleList")
  557 + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){
  558 + return scheduleRealInfoService.realScheduleList(line,date);
  559 + }
  560 +
  561 + @RequestMapping(value="/realScheduleList_zrw")
  562 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  563 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  564 + }
  565 +
  566 + @RequestMapping(value="/realScheduleList_mh_2")
  567 + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
  568 + return scheduleRealInfoService.realScheduleList_mh_2(line,date);
  569 + }
  570 +
  571 + @RequestMapping(value="/realScheduleListQp")
  572 + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){
  573 + return scheduleRealInfoService.realScheduleListQp(line,date);
  574 + }
  575 +
  576 + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST)
  577 + public synchronized Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){
  578 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  579 + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class);
  580 + return scheduleRealInfoService.multi_tzrc(cpcs, null);
  581 + }
  582 +
  583 + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST)
  584 + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){
  585 + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson);
  586 + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class);
  587 + return scheduleRealInfoService.multi_dftz(dfsjcs);
  588 + }
  589 +
  590 + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST)
  591 + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){
  592 + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName);
  593 + }
  594 +
  595 + @RequestMapping(value="/history", method=RequestMethod.POST)
  596 + public Map<String,Object> historySave(ScheduleRealInfo sch){
  597 + return scheduleRealInfoService.historySave(sch);
  598 + }
  599 +
  600 +
  601 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  602 + private final static long ONE_DAY = 1000 * 60 * 60 * 24;
  603 + /**
  604 + * 获取可编辑的历史班次日期
  605 + * @return
  606 + */
  607 + @RequestMapping("dateArray")
  608 + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){
  609 + List<String> rs = new ArrayList<>();
  610 +
  611 + long t = System.currentTimeMillis();
  612 + if(c != 1)
  613 + t -= (ONE_DAY + (1000 * 60 * 60 * 6));
  614 + for(int i = 0; i < 3; i ++){
  615 + rs.add(fmtyyyyMMdd.print(t));
  616 + t -= ONE_DAY;
  617 + }
  618 + return rs;
  619 + }
  620 +
  621 + @RequestMapping(value = "svgAttr", method = RequestMethod.POST)
  622 + public Map<String, Object> svgAttr(@RequestParam String jsonStr){
  623 + return scheduleRealInfoService.svgAttr(jsonStr);
  624 + }
  625 +
  626 + @RequestMapping(value = "svgAttr", method = RequestMethod.GET)
  627 + public Map<String, Object> findSvgAttr(@RequestParam String idx){
  628 + return scheduleRealInfoService.findSvgAttr(idx);
  629 + }
  630 +
  631 + @RequestMapping(value = "addRemarks", method = RequestMethod.POST)
  632 + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){
  633 + return scheduleRealInfoService.addRemarks(id, remarks);
  634 + }
  635 +
  636 + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET)
  637 + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){
  638 + return scheduleRealInfoService.scheduleDailyQp(line,date);
  639 + }
  640 +
  641 + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET)
  642 + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){
  643 + return scheduleRealInfoService.scheduleDailyExport(map);
  644 + }
  645 +
  646 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
  647 + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
  648 + return scheduleRealInfoService.exportWaybillMore(map);
  649 + }
  650 +
  651 + /**
  652 + * 获取当日计划排班 , 从计划表抓取数据
  653 + * @return
  654 + */
  655 + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET)
  656 + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){
  657 + return scheduleRealInfoService.currentSchedulePlan(lineCode);
  658 + }
  659 +
  660 + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST)
  661 + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){
  662 + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type);
  663 + }
  664 +
  665 + /**
  666 + * 删除当日实际排班
  667 + * @return
  668 + */
  669 + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST)
  670 + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){
  671 + return dayOfSchedule.deleteRealSchedule(lineCode);
  672 + }
  673 +
  674 + /**
  675 + * 从计划表重新加载当日排班
  676 + * @param lineCode
  677 + * @return
  678 + */
  679 + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST)
  680 + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){
  681 + Map<String, Object> rs = new HashMap<>();
  682 + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode);
  683 + if(list != null && list.size() > 0){
  684 + rs.put("status", ResponseCode.ERROR);
  685 + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。");
  686 + return rs;
  687 + }
  688 +
  689 + int code = dayOfSchedule.reloadSch(lineCode);
  690 +
  691 + //重新按公司编码索引数据
  692 + dayOfSchedule.groupByGsbm();
  693 + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
  694 + return rs;
  695 + }
  696 +
  697 + /**
  698 + * 误点调整
  699 + * @param idx
  700 + * @param minute
  701 + * @return
  702 + */
  703 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  704 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  705 + return scheduleRealInfoService.lateAdjust(idx, minute);
  706 + }
  707 +
  708 + /**
  709 + * 获取所有应发未到的班次
  710 + * @param idx
  711 + * @return
  712 + */
  713 + @RequestMapping(value = "allLate2")
  714 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  715 + return scheduleRealInfoService.allLate2(idx);
  716 + }
  717 +
  718 + /**
  719 + * 添加一个临加到历史库
  720 + * @param sch
  721 + * @return
  722 + */
  723 + @RequestMapping(value = "history/add", method = RequestMethod.POST)
  724 + public Map<String, Object> addToHistory(ScheduleRealInfo sch){
  725 + return scheduleRealInfoService.addToHistory(sch);
  726 + }
  727 +
  728 + /**
  729 + * 从历史库里删除临加班次
  730 + * @param id
  731 + * @return
  732 + */
  733 + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE)
  734 + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
  735 + return scheduleRealInfoService.deleteToHistory(id);
  736 + }
  737 +
  738 + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
  739 + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
  740 + Map<String, Object> map =new HashMap<>();
  741 + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
  742 + return map;
  743 + }
  744 +
  745 + /**
  746 + * 从历史库里删除临加班次
  747 + * @param param
  748 + * @return
  749 + */
  750 + @RequestMapping(value = "wxsb", method = RequestMethod.POST)
  751 + public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
  752 + return scheduleRealInfoService.repairReport(param, true);
  753 + }
  754 +
  755 + @RequestMapping(value = "wxsb", method = RequestMethod.GET)
  756 + public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
  757 + return scheduleRealInfoService.repairReportList(line, date, code, type);
  758 + }
  759 +
  760 + @RequestMapping(value = "lineLevel", method = RequestMethod.GET)
  761 + public Map<String, String> lineLevel(@RequestParam String idx){
  762 + return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
  763 + }
  764 +
  765 + /**
  766 + * 反馈安全驾驶系统
  767 + * @param param
  768 + * @return
  769 + */
  770 + @RequestMapping(value = "ackDsm", method = RequestMethod.POST)
  771 + public Map<String, Object> ackDsm(@RequestParam Map<String, Object> param){
  772 + Map<String, Object> res = new HashMap<>();
  773 + InputStream in = null;
  774 + SysUser user = SecurityUtils.getCurrentUser();
  775 + DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
  776 + StringBuilder url = new StringBuilder("http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?"), uri = new StringBuilder();
  777 + HttpURLConnection con = null;
  778 + try {
  779 + uri.append("ddyName=").append(URLEncoder.encode(user == null ? "admin" : user.getUserName(), "UTF-8"));
  780 + uri.append("&checkTime=").append(URLEncoder.encode(fmt.print(System.currentTimeMillis()), "UTF-8"));
  781 + uri.append("&nbbm=").append(URLEncoder.encode(param.get("nbbm").toString(), "UTF-8"));
  782 + uri.append("&starttime=").append(URLEncoder.encode(fmt.print(Long.parseLong(param.get("ts").toString())), "UTF-8"));
  783 + url.append(uri);
  784 + con = (HttpURLConnection)new URL(url.toString()).openConnection();
  785 + con.setDoInput(true);
  786 + con.setRequestMethod("POST");
  787 + con.setConnectTimeout(5000);
  788 + con.setReadTimeout(5000);
  789 + con.setRequestProperty("keep-alive", "true");
  790 + con.setRequestProperty("accept", "*/*");
  791 + con.setRequestProperty("content-type", "application/x-www-form-urlencoded");
  792 + con.connect();
  793 +
  794 + if (con.getResponseCode() == 200) {
  795 + in = con.getInputStream();
  796 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  797 + IOUtils.copy(in, bout);
  798 + Map<String, Object> map = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  799 + System.out.println(map);
  800 + }
  801 + } catch (MalformedURLException e) {
  802 + // TODO Auto-generated catch block
  803 + e.printStackTrace();
  804 + } catch (IOException e) {
  805 + // TODO Auto-generated catch block
  806 + e.printStackTrace();
  807 + } finally {
  808 + if (con != null) {
  809 + con.disconnect();
  810 + }
  811 + }
  812 +
  813 + return res;
  814 + }
  815 +
  816 + @RequestMapping(value = "exportPlan", method = RequestMethod.GET)
  817 + public Map<String, Object> exportPlan(@RequestParam String date){
  818 + Map<String, Object> res = new HashMap<>();
  819 + DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
  820 + Connection conn = null;
  821 + PreparedStatement ps = null;
  822 + ResultSet rs = null;
  823 +
  824 + List<Map<String, Object>> list = new ArrayList<>();
  825 + String sql = "select xl_name,xl_dir,schedule_date,fcsj,cl_zbh,j_name,bcsj from bsth_c_s_sp_info where schedule_date = ? and xl_bm in (22205, 202104, 202105, 202106, 202107, 210415) and bc_type = 'normal'";
  826 + try{
  827 + conn = DBUtils_control.getConnection();
  828 + ps = conn.prepareStatement(sql);
  829 + ps.setString(1, date);
  830 + rs = ps.executeQuery();
  831 + ObjectMapper mapper = new ObjectMapper();
  832 +
  833 + while (rs.next()) {
  834 + SchedulePlan schedulePlan = new SchedulePlan();
  835 + schedulePlan.setXlName(rs.getString("xl_name"));
  836 + schedulePlan.setXlDir(rs.getInt("xl_dir"));
  837 + Date scheduleDate = rs.getDate("schedule_date");
  838 + schedulePlan.setScheduleDate(new DateTime(scheduleDate.getTime()).toString("yyyy-MM-dd"));
  839 + String fcsj = rs.getString("fcsj");
  840 + int bcsj = rs.getInt("bcsj");
  841 + DateTime fcsjDt = dateTimeFormatter.parseDateTime(schedulePlan.getScheduleDate() + " " + fcsj);
  842 + schedulePlan.setFcsj(fcsjDt.toString("HH:mm:00"));
  843 + DateTime ddsjDt = fcsjDt.plusMinutes(bcsj);
  844 + schedulePlan.setDdsj(ddsjDt.toString("HH:mm:00"));
  845 + schedulePlan.setSjdStart(fcsjDt.toString("HH:00:00"));
  846 + DateTime endDt = fcsjDt.plusHours(1);
  847 + schedulePlan.setSjdEnd(endDt.toString("HH:00:00"));
  848 + schedulePlan.setClZbh(rs.getString("cl_zbh"));
  849 + schedulePlan.setJsy(rs.getString("j_name"));
  850 + schedulePlan.setBcsj(bcsj);
  851 +
  852 + list.add(mapper.readValue(mapper.writeValueAsString(schedulePlan), HashMap.class));
  853 + }
  854 + List<Iterator<?>> iterators = new ArrayList<Iterator<?>>();
  855 + iterators.add(list.iterator());
  856 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  857 + String sourcePath = path + "mould/schedulePlan.xls";
  858 +
  859 + new ReportUtils().excelReplace(iterators, new Object[]{}, sourcePath, path + "export/" + date + "-花博会专线班次.xls");
  860 +
  861 + res.put("status", ResponseCode.SUCCESS);
  862 + res.put("msg", "成功");
  863 + } catch (Exception e) {
  864 + res.put("status", ResponseCode.ERROR);
  865 + res.put("msg", e.getMessage());
  866 + } finally {
  867 + DBUtils_control.close(rs, ps, conn);
  868 + }
  869 +
  870 + return res;
  871 + }
  872 +
  873 + public final static class SchedulePlan {
  874 + private String company = "浦东公司[46]";
  875 +
  876 + private String xlName = "";
  877 +
  878 + private int xlDir;
  879 +
  880 + private String xlDirStr = "";
  881 +
  882 + private String scheduleDate = "";
  883 +
  884 + private String sjdStart = "";
  885 +
  886 + private String sjdEnd = "";
  887 +
  888 + private String fcsj = "";
  889 +
  890 + private int bcsj;
  891 +
  892 + private String ddsj = "";
  893 +
  894 + private int yys = 25;
  895 +
  896 + private String clZbh = "";
  897 +
  898 + private String cph = "";
  899 +
  900 + private String color = "绿牌";
  901 +
  902 + private String jsy = "";
  903 +
  904 + private String jsydh = "";
  905 +
  906 + private int pj = 10;
  907 +
  908 + public String getCompany() {
  909 + return company;
  910 + }
  911 +
  912 + public void setCompany(String company) {
  913 + this.company = company;
  914 + }
  915 +
  916 + public String getXlName() {
  917 + return xlName;
  918 + }
  919 +
  920 + public void setXlName(String xlName) {
  921 + this.xlName = xlName;
  922 + }
  923 +
  924 + public int getXlDir() {
  925 + return xlDir;
  926 + }
  927 +
  928 + public void setXlDir(int xlDir) {
  929 + this.xlDir = xlDir;
  930 + }
  931 +
  932 + public String getXlDirStr() {
  933 + xlDirStr = "";
  934 + if (xlDir == 0) {
  935 + xlDirStr = "上行";
  936 + } else if (xlDir == 1) {
  937 + xlDirStr = "下行";
  938 + }
  939 + return xlDirStr;
  940 + }
  941 +
  942 + public void setXlDirStr(String xlDirStr) {
  943 + this.xlDirStr = xlDirStr;
  944 + }
  945 +
  946 + public String getScheduleDate() {
  947 + return scheduleDate;
  948 + }
  949 +
  950 + public void setScheduleDate(String scheduleDate) {
  951 + this.scheduleDate = scheduleDate;
  952 + }
  953 +
  954 + public String getSjdStart() {
  955 + return sjdStart;
  956 + }
  957 +
  958 + public void setSjdStart(String sjdStart) {
  959 + this.sjdStart = sjdStart;
  960 + }
  961 +
  962 + public String getSjdEnd() {
  963 + return sjdEnd;
  964 + }
  965 +
  966 + public void setSjdEnd(String sjdEnd) {
  967 + this.sjdEnd = sjdEnd;
  968 + }
  969 +
  970 + public String getFcsj() {
  971 + return fcsj;
  972 + }
  973 +
  974 + public void setFcsj(String fcsj) {
  975 + this.fcsj = fcsj;
  976 + }
  977 +
  978 + public int getBcsj() {
  979 + return bcsj;
  980 + }
  981 +
  982 + public void setBcsj(int bcsj) {
  983 + this.bcsj = bcsj;
  984 + }
  985 +
  986 + public String getDdsj() {
  987 + return ddsj;
  988 + }
  989 +
  990 + public void setDdsj(String ddsj) {
  991 + this.ddsj = ddsj;
  992 + }
  993 +
  994 + public int getYys() {
  995 + return yys;
  996 + }
  997 +
  998 + public void setYys(int yys) {
  999 + this.yys = yys;
  1000 + }
  1001 +
  1002 + public String getClZbh() {
  1003 + return clZbh;
  1004 + }
  1005 +
  1006 + public void setClZbh(String clZbh) {
  1007 + this.clZbh = clZbh;
  1008 + }
  1009 +
  1010 + public String getCph() {
  1011 + cph = BasicData.nbbmCompanyPlateMap.get(clZbh);
  1012 + if (cph == null) {
  1013 + cph = "";
  1014 + }
  1015 + return cph;
  1016 + }
  1017 +
  1018 + public void setCph(String cph) {
  1019 + this.cph = cph;
  1020 + }
  1021 +
  1022 + public String getColor() {
  1023 + return color;
  1024 + }
  1025 +
  1026 + public void setColor(String color) {
  1027 + this.color = color;
  1028 + }
  1029 +
  1030 + public String getJsy() {
  1031 + return jsy;
  1032 + }
  1033 +
  1034 + public void setJsy(String jsy) {
  1035 + this.jsy = jsy;
  1036 + }
  1037 +
  1038 + public String getJsydh() {
  1039 + return jsydh;
  1040 + }
  1041 +
  1042 + public void setJsydh(String jsydh) {
  1043 + this.jsydh = jsydh;
  1044 + }
  1045 +
  1046 + public int getPj() {
  1047 + return pj;
  1048 + }
  1049 +
  1050 + public void setPj(int pj) {
  1051 + this.pj = pj;
  1052 + }
  1053 + }
  1054 +}
src/main/java/com/bsth/controller/report/ReportController.java
@@ -304,6 +304,12 @@ public class ReportController { @@ -304,6 +304,12 @@ public class ReportController {
304 return service.userList(map); 304 return service.userList(map);
305 } 305 }
306 306
  307 + @RequestMapping(value="/countMileageSum")
  308 + public List<Map<String,Object>> countMileageSum(@RequestParam Map<String, Object> map){
  309 +
  310 + return service.countMileageSum(map);
  311 + }
  312 +
307 @RequestMapping(value="/countLineMileage") 313 @RequestMapping(value="/countLineMileage")
308 public List<Map<String,Object>> countLineMileage(@RequestParam Map<String, Object> map){ 314 public List<Map<String,Object>> countLineMileage(@RequestParam Map<String, Object> map){
309 315
src/main/java/com/bsth/controller/schedule/core/legacy/EmployeeConfigInfoController.java
@@ -61,13 +61,10 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -61,13 +61,10 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
61 } 61 }
62 62
63 @RequestMapping(value = "/validate_get_destroy_info", method = RequestMethod.GET) 63 @RequestMapping(value = "/validate_get_destroy_info", method = RequestMethod.GET)
64 - public Map<String, Object> validate_get_destroy_info(HttpServletRequest request) {  
65 - HttpSession session = request.getSession();  
66 - List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);  
67 - 64 + public Map<String, Object> validate_get_destroy_info() {
68 Map<String, Object> rtn = new HashMap<>(); 65 Map<String, Object> rtn = new HashMap<>();
69 try { 66 try {
70 - rtn.put("data", this.employeeConfigInfoService.validate_get_destroy_info(cmyAuths)); 67 + rtn.put("data", this.employeeConfigInfoService.validate_get_destory_info());
71 rtn.put("status", ResponseCode.SUCCESS); 68 rtn.put("status", ResponseCode.SUCCESS);
72 } catch (Exception exp) { 69 } catch (Exception exp) {
73 rtn.put("status", ResponseCode.ERROR); 70 rtn.put("status", ResponseCode.ERROR);
@@ -77,21 +74,17 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -77,21 +74,17 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
77 return rtn; 74 return rtn;
78 } 75 }
79 @GetMapping(value = "/validate_get_destroy_info/download") 76 @GetMapping(value = "/validate_get_destroy_info/download")
80 - public void exportValidateGetDestroyInfo(  
81 - HttpServletRequest request,  
82 - HttpServletResponse response) throws Exception { 77 + public void exportValidateGetDestroyInfo(HttpServletResponse response) throws Exception {
83 // 流输出导出文件 78 // 流输出导出文件
84 response.setHeader("content-type", "application/octet-stream"); 79 response.setHeader("content-type", "application/octet-stream");
85 - response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("人员配置停用信息.txt", "UTF-8")); 80 + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("排班人员停用信息.txt", "UTF-8"));
86 response.setContentType("application/octet-stream"); 81 response.setContentType("application/octet-stream");
87 82
88 try ( 83 try (
89 OutputStream os = response.getOutputStream(); 84 OutputStream os = response.getOutputStream();
90 PrintWriter printWriter = new PrintWriter(os); 85 PrintWriter printWriter = new PrintWriter(os);
91 ) { 86 ) {
92 - HttpSession session = request.getSession();  
93 - List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);  
94 - List<String> infos = this.employeeConfigInfoService.validate_get_destroy_info(cmyAuths); 87 + List<String> infos = this.employeeConfigInfoService.validate_get_destory_info();
95 for (String info : infos) { 88 for (String info : infos) {
96 printWriter.println(info); 89 printWriter.println(info);
97 } 90 }
src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoDetailController.java
@@ -10,6 +10,7 @@ import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; @@ -10,6 +10,7 @@ import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
10 import com.bsth.service.schedule.timetable.ExcelFormatType; 10 import com.bsth.service.schedule.timetable.ExcelFormatType;
11 import com.bsth.service.schedule.utils.DataToolsFile; 11 import com.bsth.service.schedule.utils.DataToolsFile;
12 import com.bsth.service.schedule.utils.DataToolsFileType; 12 import com.bsth.service.schedule.utils.DataToolsFileType;
  13 +import com.bsth.service.schedule.utils.MyHttpUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 15 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
15 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
@@ -118,12 +119,12 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -118,12 +119,12 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
118 } 119 }
119 return rtn; 120 return rtn;
120 } 121 }
121 - 122 +
122 /** 123 /**
123 * 时刻表明细批量插入 124 * 时刻表明细批量插入
124 - * 125 + *
125 * @param entities 126 * @param entities
126 - * 127 + *
127 * @return 128 * @return
128 */ 129 */
129 @RequestMapping(value = "/skbDetailMxSave" ,method = RequestMethod.POST) 130 @RequestMapping(value = "/skbDetailMxSave" ,method = RequestMethod.POST)
@@ -131,6 +132,60 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -131,6 +132,60 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
131 return ttInfoDetailService.skbDetailMxSave(entities); 132 return ttInfoDetailService.skbDetailMxSave(entities);
132 } 133 }
133 134
  135 + // 导出预览视图数据
  136 + @GetMapping(value = "/exportPvInfo/{id}")
  137 + public void exportPvInfo(@PathVariable("id") Long ttInfoId, HttpServletResponse response) throws Exception {
  138 + DataToolsFile dataToolsFile = this.ttInfoDetailService.exportPvInfo(ttInfoId);
  139 + MyHttpUtils.responseStreamFile(response, dataToolsFile.getFile());
  140 + }
  141 + // 添加路牌
  142 + @GetMapping(value = "/addLp/{ttInfoId}/{lpId}")
  143 + public Map<String, Object> addLp(@PathVariable("ttInfoId") Long ttInfoId, @PathVariable("lpId") Long lpId) {
  144 + Map<String, Object> rtn = new HashMap<>();
  145 + try {
  146 + this.ttInfoDetailService.addLp(ttInfoId, lpId);
  147 + rtn.put("status", ResponseCode.SUCCESS);
  148 + rtn.put("data", "添加路牌成功!");
  149 + } catch (Exception exp) {
  150 + exp.printStackTrace();
  151 + rtn.put("status", ResponseCode.ERROR);
  152 + rtn.put("msg", "添加路牌失败:" + exp.getMessage());
  153 + }
  154 + return rtn;
  155 + }
  156 + // 删除路牌
  157 + @GetMapping(value = "/removeLp/{ttInfoId}/{lpId}")
  158 + public Map<String, Object> removeLp(@PathVariable("ttInfoId") Long ttInfoId, @PathVariable("lpId") Long lpId) {
  159 + Map<String, Object> rtn = new HashMap<>();
  160 + try {
  161 + this.ttInfoDetailService.removeBcByLp(ttInfoId, lpId);
  162 + rtn.put("status", ResponseCode.SUCCESS);
  163 + rtn.put("data", "删除路牌成功!");
  164 + } catch (Exception exp) {
  165 + exp.printStackTrace();
  166 + rtn.put("status", ResponseCode.ERROR);
  167 + rtn.put("msg", "删除路牌失败:" + exp.getMessage());
  168 + }
  169 + return rtn;
  170 + }
  171 + // 调换路牌
  172 + @GetMapping(value = "/switchLp/{ttInfoId}/{lpAId}/{lpBId}")
  173 + public Map<String, Object> switchLp(@PathVariable("ttInfoId") Long ttInfoId,
  174 + @PathVariable("lpAId") Long lpAId,
  175 + @PathVariable("lpBId") Long lpBId) {
  176 + Map<String, Object> rtn = new HashMap<>();
  177 + try {
  178 + this.ttInfoDetailService.switchBcByLp(ttInfoId, lpAId, lpBId);
  179 + rtn.put("status", ResponseCode.SUCCESS);
  180 + rtn.put("data", "调换路牌成功!");
  181 + } catch (Exception exp) {
  182 + exp.printStackTrace();
  183 + rtn.put("status", ResponseCode.ERROR);
  184 + rtn.put("msg", "调换路牌失败:" + exp.getMessage());
  185 + }
  186 + return rtn;
  187 + }
  188 +
134 189
135 @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST) 190 @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST)
136 public void exportFile( 191 public void exportFile(
src/main/java/com/bsth/controller/schedule/datasync/VehicleDataSyncController.java
@@ -6,13 +6,12 @@ import com.bsth.controller.schedule.datasync.request.VehicleDataSyncTaskRequest; @@ -6,13 +6,12 @@ import com.bsth.controller.schedule.datasync.request.VehicleDataSyncTaskRequest;
6 import com.bsth.entity.schedule.datasync.VehicleDataSyncTask; 6 import com.bsth.entity.schedule.datasync.VehicleDataSyncTask;
7 import com.bsth.entity.schedule.datasync.VehicleDataSyncTaskTypeEnum; 7 import com.bsth.entity.schedule.datasync.VehicleDataSyncTaskTypeEnum;
8 import com.bsth.service.schedule.datasync.VehicleDataSyncTaskService; 8 import com.bsth.service.schedule.datasync.VehicleDataSyncTaskService;
9 -import com.bsth.service.schedule.utils.MyStringUtils; 9 +import com.bsth.service.schedule.utils.MyHttpUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.web.bind.annotation.*; 11 import org.springframework.web.bind.annotation.*;
12 12
13 import javax.servlet.http.HttpServletResponse; 13 import javax.servlet.http.HttpServletResponse;
14 -import java.io.*;  
15 -import java.net.URLEncoder; 14 +import java.io.File;
16 import java.util.Date; 15 import java.util.Date;
17 16
18 @RestController 17 @RestController
@@ -107,38 +106,11 @@ public class VehicleDataSyncController extends BController&lt;VehicleDataSyncTask, @@ -107,38 +106,11 @@ public class VehicleDataSyncController extends BController&lt;VehicleDataSyncTask,
107 } 106 }
108 107
109 try { 108 try {
110 - responseStreamFile(response, file); 109 + MyHttpUtils.responseStreamFile(response, file);
111 } catch (Exception exp) { 110 } catch (Exception exp) {
112 exp.printStackTrace(); 111 exp.printStackTrace();
113 throw new RuntimeException("获取同步日志文件错误:" + exp.getMessage()); 112 throw new RuntimeException("获取同步日志文件错误:" + exp.getMessage());
114 } 113 }
115 } 114 }
116 115
117 - // 流输出文件  
118 - private void responseStreamFile(HttpServletResponse response, File file) throws IOException {  
119 - // 流输出导出文件  
120 - response.setHeader("content-type", "application/octet-stream");  
121 - String fileName = file.getName();  
122 - if (MyStringUtils.isContainChinese(fileName)) {  
123 - response.setHeader("Content-Disposition", "attachment; filename*=" + URLEncoder.encode(fileName, "UTF-8"));  
124 - } else {  
125 - response.setHeader("Content-Disposition", "attachment; filename=" + fileName);  
126 - }  
127 - response.setContentType("application/octet-stream");  
128 -  
129 - try (  
130 - OutputStream os = response.getOutputStream();  
131 - BufferedOutputStream bos = new BufferedOutputStream(os);  
132 - InputStream is = new FileInputStream(file);  
133 - BufferedInputStream bis = new BufferedInputStream(is)  
134 - ) {  
135 - int length;  
136 - byte[] temp = new byte[1024 * 10];  
137 - while ((length = bis.read(temp)) != -1) {  
138 - bos.write(temp, 0, length);  
139 - }  
140 - bos.flush();  
141 - }  
142 - }  
143 -  
144 } 116 }
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -25,6 +25,7 @@ import org.joda.time.format.DateTimeFormatter; @@ -25,6 +25,7 @@ import org.joda.time.format.DateTimeFormatter;
25 import org.slf4j.Logger; 25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory; 26 import org.slf4j.LoggerFactory;
27 import org.springframework.beans.factory.annotation.Autowired; 27 import org.springframework.beans.factory.annotation.Autowired;
  28 +import org.springframework.beans.factory.annotation.Value;
28 import org.springframework.dao.DataIntegrityViolationException; 29 import org.springframework.dao.DataIntegrityViolationException;
29 import org.springframework.jdbc.core.BatchPreparedStatementSetter; 30 import org.springframework.jdbc.core.BatchPreparedStatementSetter;
30 import org.springframework.jdbc.core.JdbcTemplate; 31 import org.springframework.jdbc.core.JdbcTemplate;
@@ -52,6 +53,9 @@ import java.util.concurrent.ConcurrentMap; @@ -52,6 +53,9 @@ import java.util.concurrent.ConcurrentMap;
52 @Component 53 @Component
53 public class DayOfSchedule { 54 public class DayOfSchedule {
54 55
  56 + @Value("${ms.fl.generate}")
  57 + private boolean generate;
  58 +
55 Logger logger = LoggerFactory.getLogger(this.getClass()); 59 Logger logger = LoggerFactory.getLogger(this.getClass());
56 60
57 //按线路分组的 “原始计划” 排班数据 61 //按线路分组的 “原始计划” 排班数据
@@ -203,7 +207,9 @@ public class DayOfSchedule { @@ -203,7 +207,9 @@ public class DayOfSchedule {
203 putAll(list); 207 putAll(list);
204 208
205 //标记首末班 209 //标记首末班
206 - FirstAndLastHandler.marks(list); 210 + if (generate) {
  211 + FirstAndLastHandler.marks(list);
  212 + }
207 213
208 Set<String> lps = searchAllLP(list); 214 Set<String> lps = searchAllLP(list);
209 for (String lp : lps) { 215 for (String lp : lps) {
src/main/java/com/bsth/entity/calc/CalcStatistics.java
1 -package com.bsth.entity.calc;  
2 -  
3 -import java.util.Date;  
4 -  
5 -import javax.persistence.*;  
6 -  
7 -@Entity  
8 -@Table(name = "calc_statistics")  
9 -public class CalcStatistics {  
10 - /* 主键*/  
11 - @Id  
12 - @GeneratedValue(strategy = GenerationType.IDENTITY)  
13 - private Long id;  
14 - /* 日期*/  
15 - private Date date;  
16 - /* 日期字符串*/  
17 - private String dateStr;  
18 - /* 线路编码*/  
19 - private String xl;  
20 - /* 线路名称*/  
21 - private String xlName;  
22 - /* 公司代码*/  
23 - private String gsdm;  
24 - /* 分公司代码*/  
25 - private String fgsdm;  
26 - /* 计划总公里*/  
27 - private Double jhzlc;  
28 - /* 计划营运公里*/  
29 - private Double jhyylc;  
30 - /* 计划空驶公里*/  
31 - private Double jhkslc;  
32 - /* 实际总公里*/  
33 - private Double sjzlc;  
34 - /* 实际营运公里*/  
35 - private Double sjyylc;  
36 - /* 实际空驶公里*/  
37 - private Double sjkslc;  
38 - /* 少驶公里*/  
39 - private Double sslc;  
40 - /* 少驶班次*/  
41 - private int ssbc;  
42 - /* 路阻公里*/  
43 - private Double lzlc;  
44 - /* 吊慢公里*/  
45 - private Double dmlc;  
46 - /* 故障公里*/  
47 - private Double gzlc;  
48 - /* 纠纷公里*/  
49 - private Double jflc;  
50 - /* 肇事公里*/  
51 - private Double zslc;  
52 - /* 缺人公里*/  
53 - private Double qrlc;  
54 - /* 缺车公里*/  
55 - private Double qclc;  
56 - /* 客稀公里*/  
57 - private Double kxlc;  
58 - /* 气候公里*/  
59 - private Double qhlc;  
60 - /* 援外公里*/  
61 - private Double ywlc;  
62 - /* 其他公里*/  
63 - private Double qtlc;  
64 - /* 临加公里*/  
65 - private Double ljlc;  
66 - /* 临加空驶公里*/  
67 - private Double ljkslc;  
68 - /* 计划班次*/  
69 - private int jhbcq;  
70 - /* 计划班次(早高峰)*/  
71 - private int jhbcz;  
72 - /* 计划班次(晚高峰)*/  
73 - private int jhbcw;  
74 - /* 实际班次*/  
75 - private int sjbcq;  
76 - /* 实际班次(早高峰)*/  
77 - private int sjbcz;  
78 - /* 实际班次(晚高峰)*/  
79 - private int sjbcw;  
80 - /* 临加班次*/  
81 - private int ljbcq;  
82 - /* 临加班次(早高峰)*/  
83 - private int ljbcz;  
84 - /* 临加班次(晚高峰)*/  
85 - private int ljbcw;  
86 - /* 放站班次*/  
87 - private int fzbcq;  
88 - /* 放站班次(早高峰)*/  
89 - private int fzbcz;  
90 - /* 放站班次(晚高峰)*/  
91 - private int fzbcw;  
92 - /* 调头班次*/  
93 - private int dtbcq;  
94 - /* 调头班次(早高峰)*/  
95 - private int dtbcz;  
96 - /* 调头班次(晚高峰)*/  
97 - private int dtbcw;  
98 - /* 大间隔次数*/  
99 - private int djgq;  
100 - /* 大间隔次数(早高峰)*/  
101 - private int djgz;  
102 - /* 大间隔次数(晚高峰)*/  
103 - private int djgw;  
104 - /* 最大大间隔时间*/  
105 - private int djgsj;  
106 - /* 备注*/  
107 - private String remark;  
108 - /*分公司名字*/  
109 - @Transient  
110 - private String fgsName;  
111 - public Long getId() {  
112 - return id;  
113 - }  
114 - public void setId(Long id) {  
115 - this.id = id;  
116 - }  
117 - public Date getDate() {  
118 - return date;  
119 - }  
120 - public void setDate(Date date) {  
121 - this.date = date;  
122 - }  
123 - public String getDateStr() {  
124 - return dateStr;  
125 - }  
126 - public void setDateStr(String dateStr) {  
127 - this.dateStr = dateStr;  
128 - }  
129 - public String getXl() {  
130 - return xl;  
131 - }  
132 - public void setXl(String xl) {  
133 - this.xl = xl;  
134 - }  
135 - public String getXlName() {  
136 - return xlName;  
137 - }  
138 - public void setXlName(String xlName) {  
139 - this.xlName = xlName;  
140 - }  
141 - public String getGsdm() {  
142 - return gsdm;  
143 - }  
144 - public void setGsdm(String gsdm) {  
145 - this.gsdm = gsdm;  
146 - }  
147 - public String getFgsdm() {  
148 - return fgsdm;  
149 - }  
150 - public void setFgsdm(String fgsdm) {  
151 - this.fgsdm = fgsdm;  
152 - }  
153 - public Double getJhzlc() {  
154 - return jhzlc;  
155 - }  
156 - public void setJhzlc(Double jhzlc) {  
157 - this.jhzlc = jhzlc;  
158 - }  
159 - public Double getJhyylc() {  
160 - return jhyylc;  
161 - }  
162 - public void setJhyylc(Double jhyylc) {  
163 - this.jhyylc = jhyylc;  
164 - }  
165 - public Double getJhkslc() {  
166 - return jhkslc;  
167 - }  
168 - public void setJhkslc(Double jhkslc) {  
169 - this.jhkslc = jhkslc;  
170 - }  
171 - public Double getSjzlc() {  
172 - return sjzlc;  
173 - }  
174 - public void setSjzlc(Double sjzlc) {  
175 - this.sjzlc = sjzlc;  
176 - }  
177 - public Double getSjyylc() {  
178 - return sjyylc;  
179 - }  
180 - public void setSjyylc(Double sjyylc) {  
181 - this.sjyylc = sjyylc;  
182 - }  
183 - public Double getSjkslc() {  
184 - return sjkslc;  
185 - }  
186 - public void setSjkslc(Double sjkslc) {  
187 - this.sjkslc = sjkslc;  
188 - }  
189 - public Double getSslc() {  
190 - return sslc;  
191 - }  
192 - public void setSslc(Double sslc) {  
193 - this.sslc = sslc;  
194 - }  
195 - public int getSsbc() {  
196 - return ssbc;  
197 - }  
198 - public void setSsbc(int ssbc) {  
199 - this.ssbc = ssbc;  
200 - }  
201 - public Double getLzlc() {  
202 - return lzlc;  
203 - }  
204 - public void setLzlc(Double lzlc) {  
205 - this.lzlc = lzlc;  
206 - }  
207 - public Double getDmlc() {  
208 - return dmlc;  
209 - }  
210 - public void setDmlc(Double dmlc) {  
211 - this.dmlc = dmlc;  
212 - }  
213 - public Double getGzlc() {  
214 - return gzlc;  
215 - }  
216 - public void setGzlc(Double gzlc) {  
217 - this.gzlc = gzlc;  
218 - }  
219 - public Double getJflc() {  
220 - return jflc;  
221 - }  
222 - public void setJflc(Double jflc) {  
223 - this.jflc = jflc;  
224 - }  
225 - public Double getZslc() {  
226 - return zslc;  
227 - }  
228 - public void setZslc(Double zslc) {  
229 - this.zslc = zslc;  
230 - }  
231 - public Double getQrlc() {  
232 - return qrlc;  
233 - }  
234 - public void setQrlc(Double qrlc) {  
235 - this.qrlc = qrlc;  
236 - }  
237 - public Double getQclc() {  
238 - return qclc;  
239 - }  
240 - public void setQclc(Double qclc) {  
241 - this.qclc = qclc;  
242 - }  
243 - public Double getKxlc() {  
244 - return kxlc;  
245 - }  
246 - public void setKxlc(Double kxlc) {  
247 - this.kxlc = kxlc;  
248 - }  
249 - public Double getQhlc() {  
250 - return qhlc;  
251 - }  
252 - public void setQhlc(Double qhlc) {  
253 - this.qhlc = qhlc;  
254 - }  
255 - public Double getYwlc() {  
256 - return ywlc;  
257 - }  
258 - public void setYwlc(Double ywlc) {  
259 - this.ywlc = ywlc;  
260 - }  
261 - public Double getQtlc() {  
262 - return qtlc;  
263 - }  
264 - public void setQtlc(Double qtlc) {  
265 - this.qtlc = qtlc;  
266 - }  
267 - public Double getLjlc() {  
268 - return ljlc;  
269 - }  
270 - public void setLjlc(Double ljlc) {  
271 - this.ljlc = ljlc;  
272 - }  
273 - public Double getLjkslc() {  
274 - return ljkslc;  
275 - }  
276 - public void setLjkslc(Double ljkslc) {  
277 - this.ljkslc = ljkslc;  
278 - }  
279 - public int getJhbcq() {  
280 - return jhbcq;  
281 - }  
282 - public void setJhbcq(int jhbcq) {  
283 - this.jhbcq = jhbcq;  
284 - }  
285 - public int getJhbcz() {  
286 - return jhbcz;  
287 - }  
288 - public void setJhbcz(int jhbcz) {  
289 - this.jhbcz = jhbcz;  
290 - }  
291 - public int getJhbcw() {  
292 - return jhbcw;  
293 - }  
294 - public void setJhbcw(int jhbcw) {  
295 - this.jhbcw = jhbcw;  
296 - }  
297 - public int getSjbcq() {  
298 - return sjbcq;  
299 - }  
300 - public void setSjbcq(int sjbcq) {  
301 - this.sjbcq = sjbcq;  
302 - }  
303 - public int getSjbcz() {  
304 - return sjbcz;  
305 - }  
306 - public void setSjbcz(int sjbcz) {  
307 - this.sjbcz = sjbcz;  
308 - }  
309 - public int getSjbcw() {  
310 - return sjbcw;  
311 - }  
312 - public void setSjbcw(int sjbcw) {  
313 - this.sjbcw = sjbcw;  
314 - }  
315 - public int getLjbcq() {  
316 - return ljbcq;  
317 - }  
318 - public void setLjbcq(int ljbcq) {  
319 - this.ljbcq = ljbcq;  
320 - }  
321 - public int getLjbcz() {  
322 - return ljbcz;  
323 - }  
324 - public void setLjbcz(int ljbcz) {  
325 - this.ljbcz = ljbcz;  
326 - }  
327 - public int getLjbcw() {  
328 - return ljbcw;  
329 - }  
330 - public void setLjbcw(int ljbcw) {  
331 - this.ljbcw = ljbcw;  
332 - }  
333 - public int getFzbcq() {  
334 - return fzbcq;  
335 - }  
336 - public void setFzbcq(int fzbcq) {  
337 - this.fzbcq = fzbcq;  
338 - }  
339 - public int getFzbcz() {  
340 - return fzbcz;  
341 - }  
342 - public void setFzbcz(int fzbcz) {  
343 - this.fzbcz = fzbcz;  
344 - }  
345 - public int getFzbcw() {  
346 - return fzbcw;  
347 - }  
348 - public void setFzbcw(int fzbcw) {  
349 - this.fzbcw = fzbcw;  
350 - }  
351 - public int getDtbcq() {  
352 - return dtbcq;  
353 - }  
354 - public void setDtbcq(int dtbcq) {  
355 - this.dtbcq = dtbcq;  
356 - }  
357 - public int getDtbcz() {  
358 - return dtbcz;  
359 - }  
360 - public void setDtbcz(int dtbcz) {  
361 - this.dtbcz = dtbcz;  
362 - }  
363 - public int getDtbcw() {  
364 - return dtbcw;  
365 - }  
366 - public void setDtbcw(int dtbcw) {  
367 - this.dtbcw = dtbcw;  
368 - }  
369 - public int getDjgq() {  
370 - return djgq;  
371 - }  
372 - public void setDjgq(int djgq) {  
373 - this.djgq = djgq;  
374 - }  
375 - public int getDjgz() {  
376 - return djgz;  
377 - }  
378 - public void setDjgz(int djgz) {  
379 - this.djgz = djgz;  
380 - }  
381 - public int getDjgw() {  
382 - return djgw;  
383 - }  
384 - public void setDjgw(int djgw) {  
385 - this.djgw = djgw;  
386 - }  
387 - public int getDjgsj() {  
388 - return djgsj;  
389 - }  
390 - public void setDjgsj(int djgsj) {  
391 - this.djgsj = djgsj;  
392 - }  
393 - public String getRemark() {  
394 - return remark;  
395 - }  
396 - public void setRemark(String remark) {  
397 - this.remark = remark;  
398 - }  
399 - public String getFgsName() {  
400 - return fgsName;  
401 - }  
402 - public void setFgsName(String fgsName) {  
403 - this.fgsName = fgsName;  
404 - }  
405 -  
406 -} 1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.*;
  6 +
  7 +@Entity
  8 +@Table(name = "calc_statistics")
  9 +public class CalcStatistics {
  10 + /* 主键*/
  11 + @Id
  12 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  13 + private Long id;
  14 + /* 日期*/
  15 + private Date date;
  16 + /* 日期字符串*/
  17 + private String dateStr;
  18 + /* 线路编码*/
  19 + private String xl;
  20 + /* 线路名称*/
  21 + private String xlName;
  22 + /* 公司代码*/
  23 + private String gsdm;
  24 + /* 分公司代码*/
  25 + private String fgsdm;
  26 + /* 计划总公里*/
  27 + private Double jhzlc;
  28 + /* 计划营运公里*/
  29 + private Double jhyylc;
  30 + /* 计划空驶公里*/
  31 + private Double jhkslc;
  32 + /* 实际总公里*/
  33 + private Double sjzlc;
  34 + /* 实际营运公里*/
  35 + private Double sjyylc;
  36 + /* 实际空驶公里*/
  37 + private Double sjkslc;
  38 + /* 少驶公里*/
  39 + private Double sslc;
  40 + /* 少驶班次*/
  41 + private int ssbc;
  42 + /* 路阻公里*/
  43 + private Double lzlc;
  44 + /* 吊慢公里*/
  45 + private Double dmlc;
  46 + /* 故障公里*/
  47 + private Double gzlc;
  48 + /* 纠纷公里*/
  49 + private Double jflc;
  50 + /* 肇事公里*/
  51 + private Double zslc;
  52 + /* 缺人公里*/
  53 + private Double qrlc;
  54 + /* 缺车公里*/
  55 + private Double qclc;
  56 + /* 客稀公里*/
  57 + private Double kxlc;
  58 + /* 气候公里*/
  59 + private Double qhlc;
  60 + /* 援外公里*/
  61 + private Double ywlc;
  62 + /* 其他公里*/
  63 + private Double qtlc;
  64 + /* 临加公里*/
  65 + private Double ljlc;
  66 + /* 临加空驶公里*/
  67 + private Double ljkslc;
  68 + /* 计划班次*/
  69 + private int jhbcq;
  70 + /* 计划班次(早高峰)*/
  71 + private int jhbcz;
  72 + /* 计划班次(晚高峰)*/
  73 + private int jhbcw;
  74 + /* 实际班次*/
  75 + private int sjbcq;
  76 + /* 实际班次(早高峰)*/
  77 + private int sjbcz;
  78 + /* 实际班次(晚高峰)*/
  79 + private int sjbcw;
  80 + /* 临加班次*/
  81 + private int ljbcq;
  82 + /* 临加班次(早高峰)*/
  83 + private int ljbcz;
  84 + /* 临加班次(晚高峰)*/
  85 + private int ljbcw;
  86 + /* 放站班次*/
  87 + private int fzbcq;
  88 + /* 放站班次(早高峰)*/
  89 + private int fzbcz;
  90 + /* 放站班次(晚高峰)*/
  91 + private int fzbcw;
  92 + /* 调头班次*/
  93 + private int dtbcq;
  94 + /* 调头班次(早高峰)*/
  95 + private int dtbcz;
  96 + /* 调头班次(晚高峰)*/
  97 + private int dtbcw;
  98 + /* 大间隔次数*/
  99 + private int djgq;
  100 + /* 大间隔次数(早高峰)*/
  101 + private int djgz;
  102 + /* 大间隔次数(晚高峰)*/
  103 + private int djgw;
  104 + /* 最大大间隔时间*/
  105 + private int djgsj;
  106 + /* 备注*/
  107 + private String remark;
  108 +
  109 + /*公司名字*/
  110 + @Transient
  111 + private String gsName;
  112 + /*分公司名字*/
  113 + @Transient
  114 + private String fgsName;
  115 + public Long getId() {
  116 + return id;
  117 + }
  118 + public void setId(Long id) {
  119 + this.id = id;
  120 + }
  121 + public Date getDate() {
  122 + return date;
  123 + }
  124 + public void setDate(Date date) {
  125 + this.date = date;
  126 + }
  127 + public String getDateStr() {
  128 + return dateStr;
  129 + }
  130 + public void setDateStr(String dateStr) {
  131 + this.dateStr = dateStr;
  132 + }
  133 + public String getXl() {
  134 + return xl;
  135 + }
  136 + public void setXl(String xl) {
  137 + this.xl = xl;
  138 + }
  139 + public String getXlName() {
  140 + return xlName;
  141 + }
  142 + public void setXlName(String xlName) {
  143 + this.xlName = xlName;
  144 + }
  145 + public String getGsdm() {
  146 + return gsdm;
  147 + }
  148 + public void setGsdm(String gsdm) {
  149 + this.gsdm = gsdm;
  150 + }
  151 + public String getFgsdm() {
  152 + return fgsdm;
  153 + }
  154 + public void setFgsdm(String fgsdm) {
  155 + this.fgsdm = fgsdm;
  156 + }
  157 + public Double getJhzlc() {
  158 + return jhzlc;
  159 + }
  160 + public void setJhzlc(Double jhzlc) {
  161 + this.jhzlc = jhzlc;
  162 + }
  163 + public Double getJhyylc() {
  164 + return jhyylc;
  165 + }
  166 + public void setJhyylc(Double jhyylc) {
  167 + this.jhyylc = jhyylc;
  168 + }
  169 + public Double getJhkslc() {
  170 + return jhkslc;
  171 + }
  172 + public void setJhkslc(Double jhkslc) {
  173 + this.jhkslc = jhkslc;
  174 + }
  175 + public Double getSjzlc() {
  176 + return sjzlc;
  177 + }
  178 + public void setSjzlc(Double sjzlc) {
  179 + this.sjzlc = sjzlc;
  180 + }
  181 + public Double getSjyylc() {
  182 + return sjyylc;
  183 + }
  184 + public void setSjyylc(Double sjyylc) {
  185 + this.sjyylc = sjyylc;
  186 + }
  187 + public Double getSjkslc() {
  188 + return sjkslc;
  189 + }
  190 + public void setSjkslc(Double sjkslc) {
  191 + this.sjkslc = sjkslc;
  192 + }
  193 + public Double getSslc() {
  194 + return sslc;
  195 + }
  196 + public void setSslc(Double sslc) {
  197 + this.sslc = sslc;
  198 + }
  199 + public int getSsbc() {
  200 + return ssbc;
  201 + }
  202 + public void setSsbc(int ssbc) {
  203 + this.ssbc = ssbc;
  204 + }
  205 + public Double getLzlc() {
  206 + return lzlc;
  207 + }
  208 + public void setLzlc(Double lzlc) {
  209 + this.lzlc = lzlc;
  210 + }
  211 + public Double getDmlc() {
  212 + return dmlc;
  213 + }
  214 + public void setDmlc(Double dmlc) {
  215 + this.dmlc = dmlc;
  216 + }
  217 + public Double getGzlc() {
  218 + return gzlc;
  219 + }
  220 + public void setGzlc(Double gzlc) {
  221 + this.gzlc = gzlc;
  222 + }
  223 + public Double getJflc() {
  224 + return jflc;
  225 + }
  226 + public void setJflc(Double jflc) {
  227 + this.jflc = jflc;
  228 + }
  229 + public Double getZslc() {
  230 + return zslc;
  231 + }
  232 + public void setZslc(Double zslc) {
  233 + this.zslc = zslc;
  234 + }
  235 + public Double getQrlc() {
  236 + return qrlc;
  237 + }
  238 + public void setQrlc(Double qrlc) {
  239 + this.qrlc = qrlc;
  240 + }
  241 + public Double getQclc() {
  242 + return qclc;
  243 + }
  244 + public void setQclc(Double qclc) {
  245 + this.qclc = qclc;
  246 + }
  247 + public Double getKxlc() {
  248 + return kxlc;
  249 + }
  250 + public void setKxlc(Double kxlc) {
  251 + this.kxlc = kxlc;
  252 + }
  253 + public Double getQhlc() {
  254 + return qhlc;
  255 + }
  256 + public void setQhlc(Double qhlc) {
  257 + this.qhlc = qhlc;
  258 + }
  259 + public Double getYwlc() {
  260 + return ywlc;
  261 + }
  262 + public void setYwlc(Double ywlc) {
  263 + this.ywlc = ywlc;
  264 + }
  265 + public Double getQtlc() {
  266 + return qtlc;
  267 + }
  268 + public void setQtlc(Double qtlc) {
  269 + this.qtlc = qtlc;
  270 + }
  271 + public Double getLjlc() {
  272 + return ljlc;
  273 + }
  274 + public void setLjlc(Double ljlc) {
  275 + this.ljlc = ljlc;
  276 + }
  277 + public Double getLjkslc() {
  278 + return ljkslc;
  279 + }
  280 + public void setLjkslc(Double ljkslc) {
  281 + this.ljkslc = ljkslc;
  282 + }
  283 + public int getJhbcq() {
  284 + return jhbcq;
  285 + }
  286 + public void setJhbcq(int jhbcq) {
  287 + this.jhbcq = jhbcq;
  288 + }
  289 + public int getJhbcz() {
  290 + return jhbcz;
  291 + }
  292 + public void setJhbcz(int jhbcz) {
  293 + this.jhbcz = jhbcz;
  294 + }
  295 + public int getJhbcw() {
  296 + return jhbcw;
  297 + }
  298 + public void setJhbcw(int jhbcw) {
  299 + this.jhbcw = jhbcw;
  300 + }
  301 + public int getSjbcq() {
  302 + return sjbcq;
  303 + }
  304 + public void setSjbcq(int sjbcq) {
  305 + this.sjbcq = sjbcq;
  306 + }
  307 + public int getSjbcz() {
  308 + return sjbcz;
  309 + }
  310 + public void setSjbcz(int sjbcz) {
  311 + this.sjbcz = sjbcz;
  312 + }
  313 + public int getSjbcw() {
  314 + return sjbcw;
  315 + }
  316 + public void setSjbcw(int sjbcw) {
  317 + this.sjbcw = sjbcw;
  318 + }
  319 + public int getLjbcq() {
  320 + return ljbcq;
  321 + }
  322 + public void setLjbcq(int ljbcq) {
  323 + this.ljbcq = ljbcq;
  324 + }
  325 + public int getLjbcz() {
  326 + return ljbcz;
  327 + }
  328 + public void setLjbcz(int ljbcz) {
  329 + this.ljbcz = ljbcz;
  330 + }
  331 + public int getLjbcw() {
  332 + return ljbcw;
  333 + }
  334 + public void setLjbcw(int ljbcw) {
  335 + this.ljbcw = ljbcw;
  336 + }
  337 + public int getFzbcq() {
  338 + return fzbcq;
  339 + }
  340 + public void setFzbcq(int fzbcq) {
  341 + this.fzbcq = fzbcq;
  342 + }
  343 + public int getFzbcz() {
  344 + return fzbcz;
  345 + }
  346 + public void setFzbcz(int fzbcz) {
  347 + this.fzbcz = fzbcz;
  348 + }
  349 + public int getFzbcw() {
  350 + return fzbcw;
  351 + }
  352 + public void setFzbcw(int fzbcw) {
  353 + this.fzbcw = fzbcw;
  354 + }
  355 + public int getDtbcq() {
  356 + return dtbcq;
  357 + }
  358 + public void setDtbcq(int dtbcq) {
  359 + this.dtbcq = dtbcq;
  360 + }
  361 + public int getDtbcz() {
  362 + return dtbcz;
  363 + }
  364 + public void setDtbcz(int dtbcz) {
  365 + this.dtbcz = dtbcz;
  366 + }
  367 + public int getDtbcw() {
  368 + return dtbcw;
  369 + }
  370 + public void setDtbcw(int dtbcw) {
  371 + this.dtbcw = dtbcw;
  372 + }
  373 + public int getDjgq() {
  374 + return djgq;
  375 + }
  376 + public void setDjgq(int djgq) {
  377 + this.djgq = djgq;
  378 + }
  379 + public int getDjgz() {
  380 + return djgz;
  381 + }
  382 + public void setDjgz(int djgz) {
  383 + this.djgz = djgz;
  384 + }
  385 + public int getDjgw() {
  386 + return djgw;
  387 + }
  388 + public void setDjgw(int djgw) {
  389 + this.djgw = djgw;
  390 + }
  391 + public int getDjgsj() {
  392 + return djgsj;
  393 + }
  394 + public void setDjgsj(int djgsj) {
  395 + this.djgsj = djgsj;
  396 + }
  397 + public String getRemark() {
  398 + return remark;
  399 + }
  400 + public void setRemark(String remark) {
  401 + this.remark = remark;
  402 + }
  403 + public String getGsName() {
  404 + return gsName;
  405 + }
  406 + public void setGsName(String gsName) {
  407 + this.gsName = gsName;
  408 + }
  409 + public String getFgsName() {
  410 + return fgsName;
  411 + }
  412 + public void setFgsName(String fgsName) {
  413 + this.fgsName = fgsName;
  414 + }
  415 +
  416 +}
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
@@ -54,6 +54,22 @@ public class EmployeeConfigInfo extends BEntity implements Serializable { @@ -54,6 +54,22 @@ public class EmployeeConfigInfo extends BEntity implements Serializable {
54 @Column(nullable = false) 54 @Column(nullable = false)
55 private Boolean isCancel = false; 55 private Boolean isCancel = false;
56 56
  57 + /** 驾驶员停用信息 */
  58 + @Formula("(" +
  59 + "(select IFNULL(t2.destroy, 0) from bsth_c_s_ecinfo t1 left join bsth_c_personnel t2 on t1.jsy = t2.id where t1.id = id)" +
  60 + "+" +
  61 + "(select IFNULL(t2.destroy, 0) from bsth_c_s_ecinfo t1 left join bsth_c_personnel t2 on t1.spy = t2.id where t1.id = id)" +
  62 + ")")
  63 + private Integer ryDestroyStatus;
  64 +
  65 + public Integer getRyDestroyStatus() {
  66 + return ryDestroyStatus;
  67 + }
  68 +
  69 + public void setRyDestroyStatus(Integer ryDestroyStatus) {
  70 + this.ryDestroyStatus = ryDestroyStatus;
  71 + }
  72 +
57 public EmployeeConfigInfo() {} 73 public EmployeeConfigInfo() {}
58 74
59 public EmployeeConfigInfo(Object id, Object xlid, Object xlname, Object jsyid, Object spyid) { 75 public EmployeeConfigInfo(Object id, Object xlid, Object xlname, Object jsyid, Object spyid) {
src/main/java/com/bsth/repository/calc/CalcIntervalRepository.java
@@ -33,6 +33,12 @@ public interface CalcIntervalRepository extends BaseRepository&lt;CalcInterval, Int @@ -33,6 +33,12 @@ public interface CalcIntervalRepository extends BaseRepository&lt;CalcInterval, Int
33 @Query(value="select DISTINCT c from CalcInterval c where c.xlBm = ?1 and c.date = ?2 and c.level like %?3% order by c.xlBm") 33 @Query(value="select DISTINCT c from CalcInterval c where c.xlBm = ?1 and c.date = ?2 and c.level like %?3% order by c.xlBm")
34 List<CalcInterval> selectByDateAndLine(String line,String date,String level); 34 List<CalcInterval> selectByDateAndLine(String line,String date,String level);
35 35
  36 + //按照时间段统计
  37 + @Query(value="select gsbm,fgsbm,xl_bm,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime "
  38 + + " from bsth_c_calc_interval where date >=?1 and date <=?2 "
  39 + + " group by xl_bm,gsbm,fgsbm",nativeQuery=true)
  40 + List<Object[]> countByDate(String date,String date2);
  41 +
36 //按照时间段,公司统计 42 //按照时间段,公司统计
37 @Query(value="select gsbm,fgsbm,xl_bm,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime " 43 @Query(value="select gsbm,fgsbm,xl_bm,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime "
38 + " from bsth_c_calc_interval where gsbm like %?1% and fgsbm like %?2% and date >=?3 and date <=?4 " 44 + " from bsth_c_calc_interval where gsbm like %?1% and fgsbm like %?2% and date >=?3 and date <=?4 "
src/main/java/com/bsth/repository/calc/CalcLineMileageRepository.java
@@ -25,6 +25,10 @@ public interface CalcLineMileageRepository extends BaseRepository&lt;CalcLineMileag @@ -25,6 +25,10 @@ public interface CalcLineMileageRepository extends BaseRepository&lt;CalcLineMileag
25 @Query(value="select DISTINCT c from CalcLineMileage c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.id") 25 @Query(value="select DISTINCT c from CalcLineMileage c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.id")
26 List<CalcLineMileage> selectByDateAndLineTj2(String line,String date,String date2); 26 List<CalcLineMileage> selectByDateAndLineTj2(String line,String date,String date2);
27 27
  28 + //按照时间段统计,全部线路
  29 + @Query(value="select DISTINCT c from CalcLineMileage c where c.dateStr between ?1 and ?2 order by c.id")
  30 + List<CalcLineMileage> selectByDateAndLineTj3(String date,String date2);
  31 +
28 //按照日期和线路删除数据 32 //按照日期和线路删除数据
29 @Modifying 33 @Modifying
30 @Transactional 34 @Transactional
src/main/java/com/bsth/repository/calc/CalcStatisticsRepository.java
@@ -28,6 +28,10 @@ public interface CalcStatisticsRepository extends BaseRepository&lt;CalcStatistics, @@ -28,6 +28,10 @@ public interface CalcStatisticsRepository extends BaseRepository&lt;CalcStatistics,
28 @Query(value="select DISTINCT c from CalcStatistics c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.fgsdm,c.xl") 28 @Query(value="select DISTINCT c from CalcStatistics c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.fgsdm,c.xl")
29 List<CalcStatistics> selectByDateAndLineTj2(String line,String date,String date2); 29 List<CalcStatistics> selectByDateAndLineTj2(String line,String date,String date2);
30 30
  31 + //按照时间段统计
  32 + @Query(value="select DISTINCT c from CalcStatistics c where c.dateStr between ?1 and ?2 order by c.gsdm,c.fgsdm,c.xl")
  33 + List<CalcStatistics> selectByDateAndLineTj3(String date,String date2);
  34 +
31 //按照日期和线路删除数据 35 //按照日期和线路删除数据
32 @Modifying 36 @Modifying
33 @Transactional 37 @Transactional
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -188,6 +188,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -188,6 +188,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
188 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 188 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
189 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.fgsBm,s.xlBm") 189 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.fgsBm,s.xlBm")
190 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2); 190 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);
  191 +
  192 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  193 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr >= ?1 and s.scheduleDateStr<= ?2 order by s.gsBm,s.fgsBm,s.xlBm")
  194 + List<ScheduleRealInfo> scheduleByDateAndLineTj3(String date,String date2);
  195 +
191 //月报表 196 //月报表
192 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 197 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
193 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm") 198 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm")
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
1 package com.bsth.repository.schedule; 1 package com.bsth.repository.schedule;
2 2
3 -import com.bsth.entity.schedule.CarConfigInfo;  
4 import com.bsth.entity.schedule.TTInfoDetail; 3 import com.bsth.entity.schedule.TTInfoDetail;
5 import com.bsth.repository.BaseRepository; 4 import com.bsth.repository.BaseRepository;
6 import org.springframework.data.domain.Page; 5 import org.springframework.data.domain.Page;
@@ -10,9 +9,6 @@ import org.springframework.data.jpa.repository.EntityGraph; @@ -10,9 +9,6 @@ import org.springframework.data.jpa.repository.EntityGraph;
10 import org.springframework.data.jpa.repository.Modifying; 9 import org.springframework.data.jpa.repository.Modifying;
11 import org.springframework.data.jpa.repository.Query; 10 import org.springframework.data.jpa.repository.Query;
12 import org.springframework.stereotype.Repository; 11 import org.springframework.stereotype.Repository;
13 -import org.springframework.transaction.annotation.Isolation;  
14 -import org.springframework.transaction.annotation.Propagation;  
15 -import org.springframework.transaction.annotation.Transactional;  
16 12
17 import java.util.List; 13 import java.util.List;
18 14
@@ -42,9 +38,15 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon @@ -42,9 +38,15 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
42 @Query(value = "select max(tt.fcno) as mx from bsth_c_s_ttinfo_detail tt where tt.xl =?1 and tt.ttinfo =?2", nativeQuery = true) 38 @Query(value = "select max(tt.fcno) as mx from bsth_c_s_ttinfo_detail tt where tt.xl =?1 and tt.ttinfo =?2", nativeQuery = true)
43 Long findMaxFcno(Integer xlid, Long ttinfoid); 39 Long findMaxFcno(Integer xlid, Long ttinfoid);
44 40
  41 + @Query(value = "select max(tt.bcs) as mx from bsth_c_s_ttinfo_detail tt where tt.ttinfo =?1", nativeQuery = true)
  42 + Long findMaxBcs(Long ttinfoid);
  43 +
45 @Query(value = "select tt from TTInfoDetail tt where tt.xl.id = ?1 and tt.ttinfo.id = ?2 and tt.lp.id = ?3 order by tt.fcno asc") 44 @Query(value = "select tt from TTInfoDetail tt where tt.xl.id = ?1 and tt.ttinfo.id = ?2 and tt.lp.id = ?3 order by tt.fcno asc")
46 List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId); 45 List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId);
47 46
  47 + @Query(value = "select tt from TTInfoDetail tt where tt.ttinfo.id = ?1 and tt.lp.id = ?2 order by tt.fcno asc")
  48 + List<TTInfoDetail> findBcdetails(Long ttinfoId, Long lpId);
  49 +
48 List<TTInfoDetail> findByTtinfoId(Long id); 50 List<TTInfoDetail> findByTtinfoId(Long id);
49 51
50 @Modifying 52 @Modifying
@@ -52,6 +54,10 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon @@ -52,6 +54,10 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
52 void deleteByTtinfoIdWithModify(Long ttinfoid); 54 void deleteByTtinfoIdWithModify(Long ttinfoid);
53 55
54 @Modifying 56 @Modifying
  57 + @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1 and t.lp.id = ?2")
  58 + void deleteByTtinfoIdAndLpidWithModify(Long ttinfoid, Long lpid);
  59 +
  60 + @Modifying
55 @Query(value = "delete from TTInfoDetail t where t.xl.id=?1 and t.ttinfo.id = ?2") 61 @Query(value = "delete from TTInfoDetail t where t.xl.id=?1 and t.ttinfo.id = ?2")
56 void deltidc(int xl , Long ttinfoid ); 62 void deltidc(int xl , Long ttinfoid );
57 } 63 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -47,6 +47,8 @@ import org.springframework.jdbc.core.RowMapper; @@ -47,6 +47,8 @@ import org.springframework.jdbc.core.RowMapper;
47 import org.springframework.stereotype.Service; 47 import org.springframework.stereotype.Service;
48 48
49 import javax.transaction.Transactional; 49 import javax.transaction.Transactional;
  50 +
  51 +import java.math.BigDecimal;
50 import java.sql.ResultSet; 52 import java.sql.ResultSet;
51 import java.sql.SQLException; 53 import java.sql.SQLException;
52 import java.text.DecimalFormat; 54 import java.text.DecimalFormat;
@@ -738,7 +740,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -738,7 +740,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
738 String line, String date, String date2, String xlName, String type,String nature) { 740 String line, String date, String date2, String xlName, String type,String nature) {
739 // TODO Auto-generated method stub 741 // TODO Auto-generated method stub
740 List<CalcStatistics> listAll = new ArrayList<CalcStatistics>(); 742 List<CalcStatistics> listAll = new ArrayList<CalcStatistics>();
741 - if(line.length() > 0){ 743 + if(gsdm.equals("") && fgsdm.equals("") && line.equals("")){
  744 + listAll = calcStatisticsRepository.selectByDateAndLineTj3(date, date2);
  745 + } else if(line.length() > 0){
742 listAll = calcStatisticsRepository.selectByDateAndLineTj2(line, date, date2); 746 listAll = calcStatisticsRepository.selectByDateAndLineTj2(line, date, date2);
743 } else { 747 } else {
744 listAll = calcStatisticsRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm); 748 listAll = calcStatisticsRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm);
@@ -767,13 +771,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -767,13 +771,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
767 771
768 for(CalcStatistics s : list){ 772 for(CalcStatistics s : list){
769 try { 773 try {
770 -// String key = PinyinHelper.convertToPinyinString(s.getXl(), "" , PinyinFormat.WITHOUT_TONE);  
771 - String key =s.getFgsdm()+s.getXl();  
772 -// if(line.equals("")){  
773 -// key =s.getFgsdm()+s.getXl();  
774 -// }else{  
775 -// key =s.getXl();  
776 -// } 774 +// String key =s.getGsdm()+"/"+s.getFgsdm()+"/"+s.getXl();
  775 + String key = PinyinHelper.convertToPinyinString(s.getGsdm()+s.getFgsdm()+s.getXlName(), "", PinyinFormat.WITHOUT_TONE);
777 if(!keyMap.containsKey(key)){ 776 if(!keyMap.containsKey(key)){
778 keyMap.put(key, new ArrayList<CalcStatistics>()); 777 keyMap.put(key, new ArrayList<CalcStatistics>());
779 keyList.add(key); 778 keyList.add(key);
@@ -789,18 +788,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -789,18 +788,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
789 for(String key : keyList){ 788 for(String key : keyList){
790 if(keyMap.get(key).size() > 0){ 789 if(keyMap.get(key).size() > 0){
791 CalcStatistics s = keyMap.get(key).get(0); 790 CalcStatistics s = keyMap.get(key).get(0);
792 - if(keyMap.get(key).size() > 1) 791 + if(keyMap.get(key).size() > 1){
793 for(int i = 1; i < keyMap.get(key).size(); i++){ 792 for(int i = 1; i < keyMap.get(key).size(); i++){
794 CalcStatistics s_ = keyMap.get(key).get(i); 793 CalcStatistics s_ = keyMap.get(key).get(i);
795 s = addStatistics(s, s_); 794 s = addStatistics(s, s_);
796 } 795 }
797 -// if(line.equals("")){  
798 - s.setFgsName(BasicData.businessFgsCodeNameMap.get(s.getFgsdm()+"_"+s.getGsdm()));  
799 - /*}else{  
800 - List<Line> l=lineRepository.findLineByCode(line);  
801 - if(l.size()>0)  
802 - s.setFgsName(BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany()));  
803 - }*/ 796 + }
  797 + s.setGsName(BasicData.businessCodeNameMap.get(s.getGsdm()));
  798 + s.setFgsName(BasicData.businessFgsCodeNameMap.get(s.getFgsdm()+"_"+s.getGsdm()));
804 resList.add(s); 799 resList.add(s);
805 } 800 }
806 } 801 }
@@ -809,6 +804,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -809,6 +804,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
809 CalcStatistics temp = new CalcStatistics(); 804 CalcStatistics temp = new CalcStatistics();
810 temp.setXlName("合计"); 805 temp.setXlName("合计");
811 temp.setFgsName(""); 806 temp.setFgsName("");
  807 + temp.setGsName("");
812 for(CalcStatistics s : resList){ 808 for(CalcStatistics s : resList){
813 temp = addStatistics(temp, s); 809 temp = addStatistics(temp, s);
814 } 810 }
@@ -818,6 +814,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -818,6 +814,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
818 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); 814 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
819 for(CalcStatistics c : resList){ 815 for(CalcStatistics c : resList){
820 Map<String, Object> m = new HashMap<String, Object>(); 816 Map<String, Object> m = new HashMap<String, Object>();
  817 + m.put("gsName", c.getGsName());
821 m.put("fgsName", c.getFgsName()); 818 m.put("fgsName", c.getFgsName());
822 m.put("xlName", c.getXlName()); 819 m.put("xlName", c.getXlName());
823 m.put("jhzlc", c.getJhzlc()); 820 m.put("jhzlc", c.getJhzlc());
@@ -888,6 +885,69 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -888,6 +885,69 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
888 logger.info("" , e); 885 logger.info("" , e);
889 } 886 }
890 } 887 }
  888 +
  889 + if (type != null && type.length() != 0 && type.equals("exportAll")) {
  890 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  891 + Map<String, Map<String, Object>> tempMap = new HashMap<String, Map<String, Object>>();
  892 + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>();
  893 + for(Map<String, Object> m : mapList){
  894 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0
  895 + && m.get("gsName").toString().trim().contains("临港")){
  896 + removeList.add(m);
  897 + }
  898 + }
  899 + for(Map<String, Object> m : removeList){
  900 + mapList.remove(m);
  901 + }
  902 + for(Map<String, Object> m : mapList){
  903 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0){
  904 + String gsName = m.get("gsName").toString().trim();
  905 + Map<String, Object> temp = new HashMap<String, Object>();
  906 + if(tempMap.get(gsName) != null){
  907 + temp = tempMap.get(gsName);
  908 + } else {
  909 + temp.put("gsName", gsName);
  910 + temp.put("fgsName", "小计");
  911 + temp.put("xlName", "");
  912 + tempList.add(temp);
  913 + tempMap.put(gsName, temp);
  914 + }
  915 + for(String key : m.keySet()){
  916 + try {
  917 + temp.put(key, new BigDecimal(m.get(key).toString()).add(
  918 + new BigDecimal(temp.get(key)!=null?temp.get(key).toString():"0")));
  919 + } catch (Exception e) {
  920 + // TODO: handle exception
  921 + }
  922 + }
  923 + }
  924 + }
  925 + mapList.addAll(mapList.size()>0?mapList.size()-1:0, tempList);
  926 +
  927 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  928 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  929 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  930 + Map<String, Object> m = new HashMap<String, Object>();
  931 + m.put("date", date + "至" + date2);
  932 + ReportUtils ee = new ReportUtils();
  933 + try {
  934 + String dateTime = "";
  935 + if (date.equals(date2)) {
  936 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  937 + } else {
  938 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  939 + + "-" + sdfSimple.format(sdfMonth.parse(date2));
  940 + }
  941 + listI.add(mapList.iterator());
  942 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  943 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_4.xls",
  944 + path + "export/" + dateTime + "-全部公司-统计日报.xls");
  945 + } catch (Exception e) {
  946 + // TODO: handle exception
  947 + //e.printStackTrace();
  948 + logger.info("", e);
  949 + }
  950 + }
891 951
892 return resList; 952 return resList;
893 } 953 }
@@ -1512,7 +1572,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1512,7 +1572,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1512 List<String> keyList = new ArrayList<String>(); 1572 List<String> keyList = new ArrayList<String>();
1513 Map<String, List<CalcLineMileage>> keyMap = new HashMap<String, List<CalcLineMileage>>(); 1573 Map<String, List<CalcLineMileage>> keyMap = new HashMap<String, List<CalcLineMileage>>();
1514 1574
1515 - if(line == null || line.trim().length() == 0){ 1575 + if((line == null || line.trim().length() == 0)
  1576 + && (gsdm == null || gsdm.trim().length() == 0)
  1577 + && (fgsdm == null || fgsdm.trim().length() == 0)){
  1578 + list = calcLineMileageRepository.selectByDateAndLineTj3(date, date2);
  1579 + } else if(line == null || line.trim().length() == 0){
1516 list = calcLineMileageRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm); 1580 list = calcLineMileageRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm);
1517 } else { 1581 } else {
1518 list = calcLineMileageRepository.selectByDateAndLineTj2(line, date, date2); 1582 list = calcLineMileageRepository.selectByDateAndLineTj2(line, date, date2);
@@ -1558,6 +1622,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1558,6 +1622,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1558 m.put("fgsdm", c.getFgsdm()); 1622 m.put("fgsdm", c.getFgsdm());
1559 m.put("fgs", c.getFgsName()); 1623 m.put("fgs", c.getFgsName());
1560 } 1624 }
  1625 + m.put("xl", c.getXl());
1561 m.put("xlName", c.getXlName()); 1626 m.put("xlName", c.getXlName());
1562 m.put("jhzlc", c.getJhzlc()); 1627 m.put("jhzlc", c.getJhzlc());
1563 m.put("jhlc", c.getJhlc()); 1628 m.put("jhlc", c.getJhlc());
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -118,6 +118,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -118,6 +118,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
118 118
119 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type); 119 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type);
120 120
  121 + List<Map<String,Object>> dispatchDailySum(String date, String date2, String nature, String type);
  122 +
121 List<Map<String,Object>> statisticsDailyTj(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type,String nature); 123 List<Map<String,Object>> statisticsDailyTj(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type,String nature);
122 124
123 //用于实时数据与统计数据合并查询 125 //用于实时数据与统计数据合并查询
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 package com.bsth.service.realcontrol.impl; 1 package com.bsth.service.realcontrol.impl;
2 2
3 import java.io.*; 3 import java.io.*;
  4 +import java.lang.reflect.Field;
  5 +import java.math.BigDecimal;
4 import java.net.HttpURLConnection; 6 import java.net.HttpURLConnection;
5 import java.net.MalformedURLException; 7 import java.net.MalformedURLException;
6 import java.net.URL; 8 import java.net.URL;
@@ -69,6 +71,7 @@ import com.bsth.entity.Cars; @@ -69,6 +71,7 @@ import com.bsth.entity.Cars;
69 import com.bsth.entity.Line; 71 import com.bsth.entity.Line;
70 import com.bsth.entity.Personnel; 72 import com.bsth.entity.Personnel;
71 import com.bsth.entity.calc.CalcInterval; 73 import com.bsth.entity.calc.CalcInterval;
  74 +import com.bsth.entity.calc.CalcStatistics;
72 import com.bsth.entity.oil.Dlb; 75 import com.bsth.entity.oil.Dlb;
73 import com.bsth.entity.oil.Ylb; 76 import com.bsth.entity.oil.Ylb;
74 import com.bsth.entity.oil.Ylxxb; 77 import com.bsth.entity.oil.Ylxxb;
@@ -103,6 +106,7 @@ import com.bsth.repository.schedule.GuideboardInfoRepository; @@ -103,6 +106,7 @@ import com.bsth.repository.schedule.GuideboardInfoRepository;
103 import com.bsth.security.util.SecurityUtils; 106 import com.bsth.security.util.SecurityUtils;
104 import com.bsth.service.LineService; 107 import com.bsth.service.LineService;
105 import com.bsth.service.SectionRouteService; 108 import com.bsth.service.SectionRouteService;
  109 +import com.bsth.service.calc.CalcWaybillService;
106 import com.bsth.service.directive.DirectiveService; 110 import com.bsth.service.directive.DirectiveService;
107 import com.bsth.service.impl.BaseServiceImpl; 111 import com.bsth.service.impl.BaseServiceImpl;
108 import com.bsth.service.realcontrol.ScheduleRealInfoService; 112 import com.bsth.service.realcontrol.ScheduleRealInfoService;
@@ -155,6 +159,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -155,6 +159,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
155 DictionaryService dictionaryService; 159 DictionaryService dictionaryService;
156 160
157 @Autowired 161 @Autowired
  162 + CalcWaybillService calcWaybillService;
  163 +
  164 + @Autowired
158 CalcIntervalRepository calcIntervalRepository; 165 CalcIntervalRepository calcIntervalRepository;
159 /*@Autowired 166 /*@Autowired
160 BorrowCenter borrowCenter;*/ 167 BorrowCenter borrowCenter;*/
@@ -2863,12 +2870,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2863,12 +2870,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2863 } 2870 }
2864 Map<String, Object> map = new HashMap<String, Object>(); 2871 Map<String, Object> map = new HashMap<String, Object>();
2865 if (list.size() > 0) { 2872 if (list.size() > 0) {
  2873 + map.put("gsBm", list.get(0).getGsBm());
2866 map.put("fgsBm", list.get(0).getFgsBm()); 2874 map.put("fgsBm", list.get(0).getFgsBm());
2867 map.put("xlBm", list.get(0).getXlBm()); 2875 map.put("xlBm", list.get(0).getXlBm());
2868 map.put("xlName", list.get(0).getXlName()); 2876 map.put("xlName", list.get(0).getXlName());
2869 map.put("fgsName", list.get(0).getFgsName()); 2877 map.put("fgsName", list.get(0).getFgsName());
  2878 + map.put("gsName", list.get(0).getGsName());
  2879 +
2870 try { 2880 try {
2871 - map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE)); 2881 + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getGsBm()+list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE));
2872 } catch (PinyinException e) { 2882 } catch (PinyinException e) {
2873 // TODO Auto-generated catch block 2883 // TODO Auto-generated catch block
2874 e.printStackTrace(); 2884 e.printStackTrace();
@@ -2948,6 +2958,250 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2948,6 +2958,250 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2948 } 2958 }
2949 return map; 2959 return map;
2950 } 2960 }
  2961 +
  2962 + @Override
  2963 + public List<Map<String, Object>> dispatchDailySum(String date, String date2, String nature, String type) {
  2964 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  2965 +
  2966 +// List<Map<String, Object>> list = statisticsDailyTj("", "", "", date, date2, "", "query", nature);
  2967 + List<CalcStatistics> calc = calcWaybillService.calcStatisticsDaily("", "", "", date, date2, "", "query", nature);
  2968 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  2969 + try {
  2970 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  2971 + for(CalcStatistics c : calc){
  2972 + Map<String, Object> m = new HashMap<>();
  2973 + Field[] fields = c.getClass().getDeclaredFields();
  2974 + for(Field f : fields){
  2975 + f.setAccessible(true);
  2976 + String key = new String(f.getName());
  2977 + m.put(key, f.get(c));
  2978 + }
  2979 + tempList.add(m);
  2980 + }
  2981 + list = tempList;
  2982 + } catch (Exception e) {
  2983 + // TODO: handle exception
  2984 + e.printStackTrace();
  2985 + }
  2986 +
  2987 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  2988 + Map<String, Object> temp = new HashMap<String, Object>();
  2989 + temp.put("gsName", "杨高");temp.put("fgsName", "杨高分");temp.put("key", "05_5");
  2990 + resList.add(temp);keyMap.put("05_5", temp);
  2991 + temp = new HashMap<String, Object>();
  2992 + temp.put("gsName", "杨高");temp.put("fgsName", "金桥分");temp.put("key", "05_2");
  2993 + resList.add(temp);keyMap.put("05_2", temp);
  2994 + temp = new HashMap<String, Object>();
  2995 + temp.put("gsName", "杨高");temp.put("fgsName", "川沙分");temp.put("key", "05_1");
  2996 + resList.add(temp);keyMap.put("05_1", temp);
  2997 + temp = new HashMap<String, Object>();
  2998 + temp.put("gsName", "杨高");temp.put("fgsName", "周浦分");temp.put("key", "05_6");
  2999 + resList.add(temp);keyMap.put("05_6", temp);
  3000 + temp = new HashMap<String, Object>();
  3001 + temp.put("gsName", "杨高");temp.put("fgsName", "小计");temp.put("key", "05_sum");
  3002 + resList.add(temp);keyMap.put("05_sum", temp);
  3003 +
  3004 + temp = new HashMap<String, Object>();
  3005 + temp.put("gsName", "上南");temp.put("fgsName", "一分");temp.put("key", "55_4");
  3006 + resList.add(temp);keyMap.put("55_4", temp);
  3007 + temp = new HashMap<String, Object>();
  3008 + temp.put("gsName", "上南");temp.put("fgsName", "二分");temp.put("key", "55_1");
  3009 + resList.add(temp);keyMap.put("55_1", temp);
  3010 + temp = new HashMap<String, Object>();
  3011 + temp.put("gsName", "上南");temp.put("fgsName", "三分");temp.put("key", "55_2");
  3012 + resList.add(temp);keyMap.put("55_2", temp);
  3013 + temp = new HashMap<String, Object>();
  3014 + temp.put("gsName", "上南");temp.put("fgsName", "六分");temp.put("key", "55_3");
  3015 + resList.add(temp);keyMap.put("55_3", temp);
  3016 + temp = new HashMap<String, Object>();
  3017 + temp.put("gsName", "上南");temp.put("fgsName", "小计");temp.put("key", "55_sum");
  3018 + resList.add(temp);keyMap.put("55_sum", temp);
  3019 +
  3020 + temp = new HashMap<String, Object>();
  3021 + temp.put("gsName", "金高");temp.put("fgsName", "一分");temp.put("key", "22_5");
  3022 + resList.add(temp);keyMap.put("22_5", temp);
  3023 + temp = new HashMap<String, Object>();
  3024 + temp.put("gsName", "金高");temp.put("fgsName", "二分");temp.put("key", "22_2");
  3025 + resList.add(temp);keyMap.put("22_2", temp);
  3026 + temp = new HashMap<String, Object>();
  3027 + temp.put("gsName", "金高");temp.put("fgsName", "三分");temp.put("key", "22_3");
  3028 + resList.add(temp);keyMap.put("22_3", temp);
  3029 + temp = new HashMap<String, Object>();
  3030 + temp.put("gsName", "金高");temp.put("fgsName", "四分");temp.put("key", "22_1");
  3031 + resList.add(temp);keyMap.put("22_1", temp);
  3032 + temp = new HashMap<String, Object>();
  3033 + temp.put("gsName", "金高");temp.put("fgsName", "小计");temp.put("key", "22_sum");
  3034 + resList.add(temp);keyMap.put("22_sum", temp);
  3035 +
  3036 + temp = new HashMap<String, Object>();
  3037 + temp.put("gsName", "南汇");temp.put("fgsName", "一分");temp.put("key", "26_1");
  3038 + resList.add(temp);keyMap.put("26_1", temp);
  3039 + temp = new HashMap<String, Object>();
  3040 + temp.put("gsName", "南汇");temp.put("fgsName", "二分");temp.put("key", "26_2");
  3041 + resList.add(temp);keyMap.put("26_2", temp);
  3042 + temp = new HashMap<String, Object>();
  3043 + temp.put("gsName", "南汇");temp.put("fgsName", "三分");temp.put("key", "26_3");
  3044 + resList.add(temp);keyMap.put("26_3", temp);
  3045 + temp = new HashMap<String, Object>();
  3046 + temp.put("gsName", "南汇");temp.put("fgsName", "六分");temp.put("key", "26_6");
  3047 + resList.add(temp);keyMap.put("26_6", temp);
  3048 + temp = new HashMap<String, Object>();
  3049 + temp.put("gsName", "南汇");temp.put("fgsName", "小计");temp.put("key", "26_sum");
  3050 + resList.add(temp);keyMap.put("26_sum", temp);
  3051 +
  3052 + temp = new HashMap<String, Object>();
  3053 + temp.put("gsName", "浦交");temp.put("fgsName", " ");temp.put("key", "88");
  3054 + resList.add(temp);keyMap.put("88", temp);
  3055 +
  3056 + for(Map<String, Object> m : list){
  3057 + m.put("gsBm", m.get("gsdm"));
  3058 + m.put("fgsBm", m.get("fgsdm"));
  3059 + if(m.get("gsBm") != null && m.get("fgsBm") != null
  3060 + && m.get("gsBm").toString().trim().length() > 0
  3061 + && m.get("fgsBm").toString().trim().length() > 0){
  3062 + String gsBm = m.get("gsBm").toString().trim();
  3063 + String fgsBm = m.get("fgsBm").toString().trim();
  3064 + String key = gsBm + "_" + fgsBm;
  3065 + if(keyMap.containsKey(key)){
  3066 + Map<String, Object> t = keyMap.get(key);
  3067 + for(String s : m.keySet()){
  3068 + if("gsName,fgsName,key".contains(s)){
  3069 + continue;
  3070 + }
  3071 + try {
  3072 + if(t.containsKey(s)){
  3073 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  3074 + } else {
  3075 + t.put(s, m.get(s).toString());
  3076 + }
  3077 + } catch (Exception e) {
  3078 + // TODO: handle exception
  3079 + continue;
  3080 + }
  3081 + }
  3082 + }
  3083 + }
  3084 + }
  3085 +
  3086 + for(Map<String, Object> m : resList){
  3087 + String key = m.get("key").toString();
  3088 + if(key.contains("_sum") || key.equals("88")){
  3089 + continue;
  3090 + }
  3091 +
  3092 + Map<String, Object> t = keyMap.get(key.split("_")[0] + "_sum");
  3093 + for(String s : m.keySet()){
  3094 + if("gsName,fgsName,key".contains(s)){
  3095 + continue;
  3096 + }
  3097 + try {
  3098 + if(t.containsKey(s)){
  3099 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  3100 + } else {
  3101 + t.put(s, m.get(s).toString());
  3102 + }
  3103 + } catch (Exception e) {
  3104 + // TODO: handle exception
  3105 + continue;
  3106 + }
  3107 + }
  3108 +
  3109 + t = keyMap.get("88");
  3110 + for(String s : m.keySet()){
  3111 + if("gsName,fgsName,key".contains(s)){
  3112 + continue;
  3113 + }
  3114 + try {
  3115 + if(t.containsKey(s)){
  3116 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  3117 + } else {
  3118 + t.put(s, m.get(s).toString());
  3119 + }
  3120 + } catch (Exception e) {
  3121 + // TODO: handle exception
  3122 + continue;
  3123 + }
  3124 + }
  3125 + }
  3126 +
  3127 + for(Map<String, Object> m : resList){
  3128 + try {
  3129 + m.put("jhzlc", m.get("jhzlc"));
  3130 + m.put("jhlc", m.get("jhyylc"));
  3131 + m.put("jcclc", m.get("jhkslc"));
  3132 + m.put("sjzgl", m.get("sjzlc"));
  3133 + m.put("sjgl", m.get("sjyylc"));
  3134 + m.put("sjksgl", m.get("sjkslc"));
  3135 + m.put("ssbc", m.get("ssbc"));
  3136 + m.put("ssgl", m.get("sslc"));
  3137 + m.put("ssgl_lz", m.get("lzlc"));
  3138 + m.put("ssgl_dm", m.get("dmlc"));
  3139 + m.put("ssgl_gz", m.get("gzlc"));
  3140 + m.put("ssgl_jf", m.get("jflc"));
  3141 + m.put("ssgl_zs", m.get("zslc"));
  3142 + m.put("ssgl_qr", m.get("qrlc"));
  3143 + m.put("ssgl_qc", m.get("qclc"));
  3144 + m.put("ssgl_kx", m.get("kxlc"));
  3145 + m.put("ssgl_qh", m.get("qhlc"));
  3146 + m.put("ssgl_yw", m.get("ywlc"));
  3147 + m.put("ssgl_other", m.get("qtlc"));
  3148 + m.put("ljgl", m.get("ljlc"));
  3149 + m.put("ljks", m.get("ljkslc"));
  3150 + m.put("jhbc", m.get("jhbcq"));
  3151 + m.put("jhbc_m", m.get("jhbcz"));
  3152 + m.put("jhbc_a", m.get("jhbcw"));
  3153 + m.put("sjbc", m.get("sjbcq"));
  3154 + m.put("sjbc_m", m.get("sjbcz"));
  3155 + m.put("sjbc_a", m.get("sjbcw"));
  3156 + m.put("ljbc", m.get("ljbcq"));
  3157 + m.put("ljbc_m", m.get("ljbcz"));
  3158 + m.put("ljbc_a", m.get("ljbcw"));
  3159 + m.put("fzbc", m.get("fzbcq"));
  3160 + m.put("fzbc_m", m.get("fzbcz"));
  3161 + m.put("fzbc_a", m.get("fzbcw"));
  3162 + m.put("dtbc", m.get("dtbcq"));
  3163 + m.put("dtbc_m", m.get("dtbcz"));
  3164 + m.put("dtbc_a", m.get("dtbcw"));
  3165 + m.put("djg", m.get("djgq"));
  3166 + m.put("djg_m", m.get("djgz"));
  3167 + m.put("djg_a", m.get("djgw"));
  3168 + m.put("djg_time", m.get("djgsj"));
  3169 + m.put("ljzgl", new BigDecimal(m.get("ljgl").toString()).add(new BigDecimal(m.get("ljks").toString())));
  3170 + } catch (Exception e) {
  3171 + // TODO: handle exception
  3172 + m.put("ljzgl", "");
  3173 + continue;
  3174 + }
  3175 + }
  3176 +
  3177 + if (type != null && type.length() != 0 && type.equals("export")) {
  3178 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3179 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3180 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3181 + Map<String, Object> m = new HashMap<String, Object>();
  3182 + m.put("date", date);
  3183 + ReportUtils ee = new ReportUtils();
  3184 + try {
  3185 + String dateTime = "";
  3186 + if (date.equals(date2)) {
  3187 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  3188 + } else {
  3189 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  3190 + + "-" + sdfSimple.format(sdfMonth.parse(date2));
  3191 + }
  3192 + listI.add(resList.iterator());
  3193 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3194 + ee.excelReplace(listI, new Object[]{m}, path + "mould/dispatchDailySum.xls",
  3195 + path + "export/" + dateTime + "-调度日报汇总表.xls");
  3196 + } catch (Exception e) {
  3197 + // TODO: handle exception
  3198 + //e.printStackTrace();
  3199 + logger.info("", e);
  3200 + }
  3201 + }
  3202 +
  3203 + return resList;
  3204 + }
2951 3205
2952 @Override 3206 @Override
2953 public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2, 3207 public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2,
@@ -2957,7 +3211,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2957,7 +3211,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2957 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 3211 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2958 List<Object[]> listInterval=new ArrayList<Object[]>(); 3212 List<Object[]> listInterval=new ArrayList<Object[]>();
2959 line = line.trim(); 3213 line = line.trim();
2960 - if (line.equals("")) { 3214 + if(gsdm.equals("") && fgsdm.equals("") && line.equals("")){
  3215 + //查询所有公司
  3216 + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj3(date, date2);
  3217 + listInterval = calcIntervalRepository.countByDate(date, date2);
  3218 + } else if (line.equals("")) {
2961 //查询所有线路 3219 //查询所有线路
2962 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); 3220 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm);
2963 listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); 3221 listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2);
@@ -3012,7 +3270,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3012,7 +3270,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3012 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 3270 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
3013 for (int i = 0; i < list.size(); i++) { 3271 for (int i = 0; i < list.size(); i++) {
3014 if (i < list.size() - 1) { 3272 if (i < list.size() - 1) {
3015 - if ((list.get(i+1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) { 3273 + if ((list.get(i+1).getGsBm()+"/"+list.get(i+1).getFgsBm()+"/"+list.get(i+1).getXlBm()).equals(
  3274 + list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm())) {
3016 lists.add(list.get(i)); 3275 lists.add(list.get(i));
3017 } else { 3276 } else {
3018 lists.add(list.get(i)); 3277 lists.add(list.get(i));
@@ -3025,7 +3284,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3025,7 +3284,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3025 lists = new ArrayList<ScheduleRealInfo>(); 3284 lists = new ArrayList<ScheduleRealInfo>();
3026 } 3285 }
3027 } else { 3286 } else {
3028 - if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { 3287 + if ((list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm()).equals(
  3288 + list.get(i-1).getGsBm()+"/"+list.get(i-1).getFgsBm()+"/"+list.get(i-1).getXlBm())) {
3029 lists.add(list.get(i)); 3289 lists.add(list.get(i));
3030 Map<String, Object> mm=new HashMap<String,Object>(); 3290 Map<String, Object> mm=new HashMap<String,Object>();
3031 if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ 3291 if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
@@ -3045,15 +3305,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3045,15 +3305,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3045 } 3305 }
3046 } 3306 }
3047 } 3307 }
3048 - /*if(!line.equals("")){  
3049 - List<Line> l=lineRepository.findLineByCode(line);  
3050 - if(l.size()>0)  
3051 - lMap.get(0).put("fgsName", BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany()));  
3052 - }*/ 3308 +
3053 Collections.sort(lMap, new AccountXlbm()); 3309 Collections.sort(lMap, new AccountXlbm());
3054 Map<String, Object> map = new HashMap<String, Object>(); 3310 Map<String, Object> map = new HashMap<String, Object>();
3055 map.put("xlName", "合计"); 3311 map.put("xlName", "合计");
3056 map.put("fgsName", ""); 3312 map.put("fgsName", "");
  3313 + map.put("gsName", "");
3057 double jhyygl = culateService.culateJhgl(list);//计划营运公里 3314 double jhyygl = culateService.culateJhgl(list);//计划营运公里
3058 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) 3315 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
3059 map.put("jhlc", jhyygl); 3316 map.put("jhlc", jhyygl);
@@ -3145,6 +3402,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3145,6 +3402,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3145 map.put("djg_time", "0"); 3402 map.put("djg_time", "0");
3146 } 3403 }
3147 lMap.add(map); 3404 lMap.add(map);
  3405 +
3148 if (type != null && type.length() != 0 && type.equals("export")) { 3406 if (type != null && type.length() != 0 && type.equals("export")) {
3149 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 3407 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3150 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 3408 sdfSimple = new SimpleDateFormat("yyyyMMdd");
@@ -3170,8 +3428,71 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3170,8 +3428,71 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3170 logger.info("", e); 3428 logger.info("", e);
3171 } 3429 }
3172 } 3430 }
3173 -  
3174 - return lMap; 3431 +
  3432 + if (type != null && type.length() != 0 && type.equals("exportAll")) {
  3433 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  3434 + Map<String, Map<String, Object>> tempMap = new HashMap<String, Map<String, Object>>();
  3435 + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>();
  3436 + for(Map<String, Object> m : lMap){
  3437 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0
  3438 + && m.get("gsName").toString().trim().contains("临港")){
  3439 + removeList.add(m);
  3440 + }
  3441 + }
  3442 + for(Map<String, Object> m : removeList){
  3443 + lMap.remove(m);
  3444 + }
  3445 + for(Map<String, Object> m : lMap){
  3446 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0){
  3447 + String gsName = m.get("gsName").toString().trim();
  3448 + Map<String, Object> temp = new HashMap<String, Object>();
  3449 + if(tempMap.get(gsName) != null){
  3450 + temp = tempMap.get(gsName);
  3451 + } else {
  3452 + temp.put("gsName", gsName);
  3453 + temp.put("fgsName", "小计");
  3454 + temp.put("xlName", "");
  3455 + tempList.add(temp);
  3456 + tempMap.put(gsName, temp);
  3457 + }
  3458 + for(String key : m.keySet()){
  3459 + try {
  3460 + temp.put(key, new BigDecimal(m.get(key).toString()).add(
  3461 + new BigDecimal(temp.get(key)!=null?temp.get(key).toString():"0")));
  3462 + } catch (Exception e) {
  3463 + // TODO: handle exception
  3464 + }
  3465 + }
  3466 + }
  3467 + }
  3468 + lMap.addAll(lMap.size()>0?lMap.size()-1:0, tempList);
  3469 +
  3470 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3471 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3472 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3473 + Map<String, Object> m = new HashMap<String, Object>();
  3474 + m.put("date", date + "至" + date2);
  3475 + ReportUtils ee = new ReportUtils();
  3476 + try {
  3477 + String dateTime = "";
  3478 + if (date.equals(date2)) {
  3479 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  3480 + } else {
  3481 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  3482 + + "-" + sdfSimple.format(sdfMonth.parse(date2));
  3483 + }
  3484 + listI.add(lMap.iterator());
  3485 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3486 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_4.xls",
  3487 + path + "export/" + dateTime + "-全部公司-统计日报.xls");
  3488 + } catch (Exception e) {
  3489 + // TODO: handle exception
  3490 + //e.printStackTrace();
  3491 + logger.info("", e);
  3492 + }
  3493 + }
  3494 +
  3495 + return lMap;
3175 } 3496 }
3176 3497
3177 @Override 3498 @Override
src/main/java/com/bsth/service/report/ReportService.java
@@ -49,6 +49,8 @@ public interface ReportService { @@ -49,6 +49,8 @@ public interface ReportService {
49 49
50 List<Map<String, String>> userList(Map<String, Object> map); 50 List<Map<String, String>> userList(Map<String, Object> map);
51 51
  52 + List<Map<String, Object>> countMileageSum(Map<String, Object> map);
  53 +
52 List<Map<String, Object>> countByList(Map<String, Object> map); 54 List<Map<String, Object>> countByList(Map<String, Object> map);
53 List<Map<String, Object>> countByList2(Map<String, Object> map); 55 List<Map<String, Object>> countByList2(Map<String, Object> map);
54 56
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
@@ -124,6 +124,33 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -124,6 +124,33 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
124 } 124 }
125 } 125 }
126 } 126 }
  127 +
  128 + CalcSheet temp = new CalcSheet();
  129 + temp.setGsname("");
  130 + temp.setFgsname("");
  131 + temp.setXlName("合计");
  132 + for(CalcSheet s : list){
  133 + temp.setJhszfcs(Long.valueOf(s.getJhszfcs()!=null?s.getJhszfcs():"0")
  134 + + Long.valueOf(temp.getJhszfcs()!=null?temp.getJhszfcs():"0") + "");
  135 + temp.setSjszfczds(Long.valueOf(s.getSjszfczds()!=null?s.getSjszfczds():"0")
  136 + + Long.valueOf(temp.getSjszfczds()!=null?temp.getSjszfczds():"0") + "");
  137 + temp.setSjszddzds(Long.valueOf(s.getSjszddzds()!=null?s.getSjszddzds():"0")
  138 + + Long.valueOf(temp.getSjszddzds()!=null?temp.getSjszddzds():"0") + "");
  139 + }
  140 + Long jhfc = Long.valueOf(temp.getJhszfcs()!=null?temp.getJhszfcs():"0");
  141 + Long zdfc = Long.valueOf(temp.getSjszfczds()!=null?temp.getSjszfczds():"0");
  142 + Long zddd = Long.valueOf(temp.getSjszddzds()!=null?temp.getSjszddzds():"0");
  143 + if(jhfc > 0l){
  144 + double zdl = (zdfc*1.0)/(jhfc*1.0)*100;
  145 + temp.setSzfczdl(df.format(zdl)+"%");
  146 + zdl = (zddd*1.0)/(jhfc*1.0)*100;
  147 + temp.setSzddzdl(df.format(zdl)+"%");
  148 + }else{
  149 + temp.setSzfczdl("0.0%");
  150 + temp.setSzddzdl("0.0%");
  151 + }
  152 + list.add(temp);
  153 +
127 if(map.get("type").equals("export")){ 154 if(map.get("type").equals("export")){
128 String lineName=""; 155 String lineName="";
129 if(!line.equals("")){ 156 if(!line.equals("")){
@@ -137,9 +164,9 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -137,9 +164,9 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
137 for (int i = 0; i < list.size(); i++) { 164 for (int i = 0; i < list.size(); i++) {
138 CalcSheet c=list.get(i); 165 CalcSheet c=list.get(i);
139 Map<String, Object> m=new HashMap<String,Object>(); 166 Map<String, Object> m=new HashMap<String,Object>();
140 - m.put("gs", c.getGsname());  
141 - m.put("fgs", c.getFgsname());  
142 - m.put("line", c.getXlName()); 167 + m.put("gs", c.getGsname()!=null?c.getGsname():"");
  168 + m.put("fgs", c.getFgsname()!=null?c.getFgsname():"");
  169 + m.put("line", c.getXlName()!=null?c.getXlName():"");
143 m.put("bcs", c.getJhszfcs()); 170 m.put("bcs", c.getJhszfcs());
144 m.put("zdbcs", c.getSjszfczds()); 171 m.put("zdbcs", c.getSjszfczds());
145 m.put("zdlv", c.getSzfczdl()); 172 m.put("zdlv", c.getSzfczdl());
@@ -1021,21 +1048,30 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -1021,21 +1048,30 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
1021 String type=map.get("type").toString(); 1048 String type=map.get("type").toString();
1022 final String dates=date; 1049 final String dates=date;
1023 String sql_=""; 1050 String sql_="";
1024 - if(line.equals("")){  
1025 - sql_= " and gsdm ='"+gs+"' and fgsdm like '%"+fgs+"%'"; 1051 + List<String> objList = new ArrayList<String>();
  1052 + objList.add(startDate);
  1053 + objList.add(endDate);
  1054 + if("".equals(gs.trim()) && "".equals(fgs.trim()) && "".equals(line.trim())){
  1055 +
  1056 + } else if(line.equals("")){
  1057 + sql_= " and gsdm = ? and fgsdm like CONCAT('%',?,'%') ";
  1058 + objList.add(gs);
  1059 + objList.add(fgs);
1026 }else{ 1060 }else{
1027 - sql_=" and xl='"+line+"'"; 1061 + sql_=" and xl = ? ";
  1062 + objList.add(line);
1028 } 1063 }
1029 String sql="select t.*,y.warrant_car as qzpcs from (" 1064 String sql="select t.*,y.warrant_car as qzpcs from ("
1030 + " select gsdm,fgsdm,xl,xl_name,sum(jhcc) as jhcc,sum(sjcc) as sjcc," 1065 + " select gsdm,fgsdm,xl,xl_name,sum(jhcc) as jhcc,sum(sjcc) as sjcc,"
1031 + " sum(sjcczgf) as sjcczgf,sum(jhbcs) as jhbcs,sum(sjbcs) as sjbcs " 1066 + " sum(sjcczgf) as sjcczgf,sum(jhbcs) as jhbcs,sum(sjbcs) as sjbcs "
1032 - + " from bsth_c_calc_sheet where date >='"+startDate+"' and date <='"+endDate+"'" 1067 + + " from bsth_c_calc_sheet where date >= ? and date <= ? "
1033 + sql_ 1068 + sql_
1034 + " group by gsdm,fgsdm,xl,xl_name ) " 1069 + " group by gsdm,fgsdm,xl,xl_name ) "
1035 + " t LEFT JOIN bsth_c_line y " 1070 + " t LEFT JOIN bsth_c_line y "
1036 - + " on t.xl=y.line_code order by fgsdm,xl_name";  
1037 - List<Map<String, Object>> lists=jdbcTemplate.query(sql,  
1038 - new RowMapper<Map<String, Object>>(){ 1071 + + " on t.xl=y.line_code order by gsdm,fgsdm,xl_name";
  1072 + List<Map<String, Object>> lists=jdbcTemplate.query(sql,
  1073 + objList.toArray(),
  1074 + new RowMapper<Map<String, Object>>(){
1039 @Override 1075 @Override
1040 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 1076 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1041 Map<String, Object> s=new HashMap<String,Object>(); 1077 Map<String, Object> s=new HashMap<String,Object>();
@@ -1124,7 +1160,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -1124,7 +1160,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
1124 Map<String, Object> tempMap=new HashMap<String,Object>(); 1160 Map<String, Object> tempMap=new HashMap<String,Object>();
1125 tempMap.put("rq", "分类汇总"); 1161 tempMap.put("rq", "分类汇总");
1126 tempMap.put("line_", "共" + list.size() + "条线路"); 1162 tempMap.put("line_", "共" + list.size() + "条线路");
1127 - tempMap.put("xlName", "共" +count + "条线路"); 1163 + tempMap.put("xlName", "共" + count + "条线路");
1128 tempMap.put("jhcc", jhcc); 1164 tempMap.put("jhcc", jhcc);
1129 tempMap.put("sjcc", sjcc); 1165 tempMap.put("sjcc", sjcc);
1130 tempMap.put("sjcczgf", sjcczgf); 1166 tempMap.put("sjcczgf", sjcczgf);
@@ -1144,6 +1180,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -1144,6 +1180,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
1144 }else{ 1180 }else{
1145 tempMap.put("zxl", "0.00%"); 1181 tempMap.put("zxl", "0.00%");
1146 } 1182 }
  1183 +
1147 if (type.equals("export")) { 1184 if (type.equals("export")) {
1148 String lineName=map.get("lineName").toString(); 1185 String lineName=map.get("lineName").toString();
1149 ReportUtils ee = new ReportUtils(); 1186 ReportUtils ee = new ReportUtils();
@@ -1152,6 +1189,82 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -1152,6 +1189,82 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
1152 ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/" 1189 ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/"
1153 + dates + "-" + lineName + "-营运线路出车率统计表.xls"); 1190 + dates + "-" + lineName + "-营运线路出车率统计表.xls");
1154 } 1191 }
  1192 +
  1193 + if (type.equals("exportAll")) {
  1194 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1195 + Map<String, Map<String, Object>> tempKeyMap = new HashMap<String, Map<String, Object>>();
  1196 + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>();
  1197 + for(Map<String, Object> m : list){
  1198 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0
  1199 + && m.get("gsName").toString().trim().contains("临港")){
  1200 + removeList.add(m);
  1201 + }
  1202 + }
  1203 + for(Map<String, Object> m : removeList){
  1204 + list.remove(m);
  1205 + }
  1206 + for(Map<String, Object> m : list){
  1207 + if(m.get("gsName")!=null && m.get("gsName").toString().trim().length() > 0){
  1208 + Map<String, Object> temp = new HashMap<String, Object>();
  1209 + String gsName = m.get("gsName").toString().trim();
  1210 + if(tempKeyMap.containsKey(gsName)){
  1211 + temp = tempKeyMap.get(gsName);
  1212 + temp.put("count", Long.valueOf(temp.get("count").toString()) + 1);
  1213 + temp.put("jhcc", Long.valueOf(m.get("jhcc")!=null?m.get("jhcc").toString():"0")
  1214 + + Long.valueOf(temp.get("jhcc")!=null?temp.get("jhcc").toString():"0"));
  1215 + temp.put("sjcc", Long.valueOf(m.get("sjcc")!=null?m.get("sjcc").toString():"0")
  1216 + + Long.valueOf(temp.get("sjcc")!=null?temp.get("sjcc").toString():"0"));
  1217 + temp.put("sjcczgf", Long.valueOf(m.get("sjcczgf")!=null?m.get("sjcczgf").toString():"0")
  1218 + + Long.valueOf(temp.get("sjcczgf")!=null?temp.get("sjcczgf").toString():"0"));
  1219 + temp.put("jhbc", Long.valueOf(m.get("jhbc")!=null?m.get("jhbc").toString():"0")
  1220 + + Long.valueOf(temp.get("jhbc")!=null?temp.get("jhbc").toString():"0"));
  1221 + temp.put("sjbc", Long.valueOf(m.get("sjbc")!=null?m.get("sjbc").toString():"0")
  1222 + + Long.valueOf(temp.get("sjbc")!=null?temp.get("sjbc").toString():"0"));
  1223 + temp.put("qzpcs", Long.valueOf(m.get("qzpcs")!=null?m.get("qzpcs").toString():"0")
  1224 + + Long.valueOf(temp.get("qzpcs")!=null?temp.get("qzpcs").toString():"0"));
  1225 + } else {
  1226 + temp.put("rq", "");
  1227 + temp.put("gsName", gsName);
  1228 + temp.put("fgsName", "小计");
  1229 + temp.put("count", 1);
  1230 + temp.put("jhcc", m.get("jhcc")!=null?m.get("jhcc").toString()+"":"0");
  1231 + temp.put("sjcc", m.get("sjcc")!=null?m.get("sjcc").toString()+"":"0");
  1232 + temp.put("sjcczgf", m.get("sjcczgf")!=null?m.get("sjcczgf").toString()+"":"0");
  1233 + temp.put("jhbc", m.get("jhbc")!=null?m.get("jhbc").toString()+"":"0");
  1234 + temp.put("sjbc", m.get("sjbc")!=null?m.get("sjbc").toString()+"":"0");
  1235 + temp.put("qzpcs", m.get("qzpcs")!=null?m.get("qzpcs").toString()+"":"0");
  1236 + temp.put("sm", "");
  1237 + tempList.add(temp);
  1238 + tempKeyMap.put(gsName, temp);
  1239 + }
  1240 + }
  1241 + }
  1242 +
  1243 + for(Map<String, Object> m : tempList){
  1244 + m.put("line_", "共" + m.get("count").toString() + "条线路");
  1245 + m.put("xlName", "共" + m.get("count").toString() + "条线路");
  1246 + if(m.get("jhcc")!=null && Long.valueOf(m.get("jhcc").toString()) > 0l){
  1247 + m.put("ccl", df.format((Float.valueOf(m.get("sjcc").toString()) / Long.valueOf(m.get("jhcc").toString()))*100)+"%");
  1248 + m.put("cclzgf", df.format((Float.valueOf(m.get("sjcczgf").toString()) / Long.valueOf(m.get("jhcc").toString()))*100)+"%");
  1249 + }else{
  1250 + m.put("ccl", "0.00%");
  1251 + m.put("cclzgf", "0.00%");
  1252 + }
  1253 + if(m.get("jhbc")!=null && Long.valueOf(m.get("jhbc").toString()) > 0l){
  1254 + m.put("zxl", df.format((Float.valueOf(m.get("sjbc").toString()) / Long.valueOf(m.get("jhbc").toString()))*100)+"%");
  1255 + }else{
  1256 + m.put("zxl", "0.00%");
  1257 + }
  1258 + list.add(m);
  1259 + }
  1260 +
  1261 + ReportUtils ee = new ReportUtils();
  1262 + listI.add(list.iterator());
  1263 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1264 + ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/"
  1265 + + dates + "-全部公司-营运线路出车率统计表.xls");
  1266 + }
  1267 +
1155 list.add(tempMap); 1268 list.add(tempMap);
1156 return list; 1269 return list;
1157 } 1270 }
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
1 package com.bsth.service.report.impl; 1 package com.bsth.service.report.impl;
2 import com.bsth.common.ResponseCode; 2 import com.bsth.common.ResponseCode;
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
4 -import com.bsth.entity.CarDevice;  
5 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
6 import com.bsth.entity.Personnel; 5 import com.bsth.entity.Personnel;
7 import com.bsth.entity.StationRoute; 6 import com.bsth.entity.StationRoute;
  7 +import com.bsth.entity.calc.CalcStatistics;
8 import com.bsth.entity.excep.ArrivalInfo; 8 import com.bsth.entity.excep.ArrivalInfo;
9 -import com.bsth.entity.mcy_forms.Daily;  
10 import com.bsth.entity.mcy_forms.Singledata; 9 import com.bsth.entity.mcy_forms.Singledata;
11 import com.bsth.entity.oil.Dlb; 10 import com.bsth.entity.oil.Dlb;
12 import com.bsth.entity.oil.Ylb; 11 import com.bsth.entity.oil.Ylb;
@@ -17,6 +16,7 @@ import com.bsth.entity.sys.Interval; @@ -17,6 +16,7 @@ import com.bsth.entity.sys.Interval;
17 import com.bsth.repository.LineRepository; 16 import com.bsth.repository.LineRepository;
18 import com.bsth.repository.StationRouteRepository; 17 import com.bsth.repository.StationRouteRepository;
19 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 18 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  19 +import com.bsth.service.LineService;
20 import com.bsth.service.calc.CalcWaybillService; 20 import com.bsth.service.calc.CalcWaybillService;
21 import com.bsth.service.report.CulateMileageService; 21 import com.bsth.service.report.CulateMileageService;
22 import com.bsth.service.report.ReportService; 22 import com.bsth.service.report.ReportService;
@@ -26,10 +26,8 @@ import com.bsth.util.ComparableChild; @@ -26,10 +26,8 @@ import com.bsth.util.ComparableChild;
26 import com.bsth.util.ComparableJob; 26 import com.bsth.util.ComparableJob;
27 import com.bsth.util.ReportUtils; 27 import com.bsth.util.ReportUtils;
28 import com.bsth.util.db.DBUtils_MS; 28 import com.bsth.util.db.DBUtils_MS;
29 -import com.google.protobuf.StringValue;  
30 29
31 import org.apache.commons.lang.StringUtils; 30 import org.apache.commons.lang.StringUtils;
32 -import org.apache.poi.hssf.usermodel.HSSFWorkbook;  
33 import org.slf4j.Logger; 31 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory; 32 import org.slf4j.LoggerFactory;
35 import org.springframework.beans.factory.annotation.Autowired; 33 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,7 +35,7 @@ import org.springframework.jdbc.core.JdbcTemplate; @@ -37,7 +35,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
37 import org.springframework.jdbc.core.RowMapper; 35 import org.springframework.jdbc.core.RowMapper;
38 import org.springframework.stereotype.Service; 36 import org.springframework.stereotype.Service;
39 37
40 -import java.io.FileOutputStream; 38 +import java.math.BigDecimal;
41 import java.sql.Connection; 39 import java.sql.Connection;
42 import java.sql.PreparedStatement; 40 import java.sql.PreparedStatement;
43 import java.sql.ResultSet; 41 import java.sql.ResultSet;
@@ -47,8 +45,6 @@ import java.text.ParseException; @@ -47,8 +45,6 @@ import java.text.ParseException;
47 import java.text.SimpleDateFormat; 45 import java.text.SimpleDateFormat;
48 import java.util.*; 46 import java.util.*;
49 47
50 -import javax.persistence.criteria.CriteriaBuilder.In;  
51 -  
52 @Service 48 @Service
53 public class ReportServiceImpl implements ReportService{ 49 public class ReportServiceImpl implements ReportService{
54 50
@@ -72,6 +68,8 @@ public class ReportServiceImpl implements ReportService{ @@ -72,6 +68,8 @@ public class ReportServiceImpl implements ReportService{
72 @Autowired 68 @Autowired
73 CulateMileageService culateService; 69 CulateMileageService culateService;
74 @Autowired 70 @Autowired
  71 + LineService lineService;
  72 + @Autowired
75 LineRepository lineRepository; 73 LineRepository lineRepository;
76 @Autowired 74 @Autowired
77 StationRouteRepository stationRouteRepository; 75 StationRouteRepository stationRouteRepository;
@@ -2509,6 +2507,222 @@ public class ReportServiceImpl implements ReportService{ @@ -2509,6 +2507,222 @@ public class ReportServiceImpl implements ReportService{
2509 List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd); 2507 List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
2510 return listStation; 2508 return listStation;
2511 } 2509 }
  2510 +
  2511 + @Override
  2512 + public List<Map<String, Object>> countMileageSum(Map<String, Object> map) {
  2513 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  2514 +
  2515 + String date="", date2="";
  2516 + if(map.get("date")!=null){
  2517 + date=map.get("date").toString();
  2518 + }
  2519 + if(map.get("date2")!=null){
  2520 + date2=map.get("date2").toString();
  2521 + }
  2522 + String nature="0";
  2523 + if(map.get("nature")!=null){
  2524 + nature=map.get("nature").toString();
  2525 + }
  2526 + String type="";
  2527 + if(map.get("type")!=null){
  2528 + type=map.get("type").toString();
  2529 + }
  2530 +// Map<String, Object> param = new HashMap<String, Object>();
  2531 +// param.put("date", date);
  2532 +// param.put("date2", date2);
  2533 +// param.put("nature", nature);
  2534 +// param.put("type", "query");
  2535 +// List<Map<String, Object>> list = countByList(param);
  2536 + List<Map<String, Object>> listAll = calcWaybillService.getLineMileage("", "", "", date, date2, "", "", "", "query");
  2537 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  2538 + Map<String, Boolean> lineMap=lineService.lineNature();
  2539 + if(nature.equals("0")){
  2540 + list=listAll;
  2541 + }else{
  2542 + for (Map<String, Object> m : listAll) {
  2543 + if(m.get("xl") != null && m.get("xl").toString().trim().length() > 0){
  2544 + if(nature.equals("1")){
  2545 + if(lineMap.get(m.get("xl").toString())){
  2546 + list.add(m);
  2547 + }
  2548 + }else{
  2549 + if(!lineMap.get(m.get("xl").toString())){
  2550 + list.add(m);
  2551 + }
  2552 + }
  2553 + }
  2554 + }
  2555 + }
  2556 +
  2557 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  2558 + Map<String, Object> temp = new HashMap<String, Object>();
  2559 + temp.put("gsName", "杨高");temp.put("fgsName", "杨高分");temp.put("key", "05_5");
  2560 + resList.add(temp);keyMap.put("05_5", temp);
  2561 + temp = new HashMap<String, Object>();
  2562 + temp.put("gsName", "杨高");temp.put("fgsName", "金桥分");temp.put("key", "05_2");
  2563 + resList.add(temp);keyMap.put("05_2", temp);
  2564 + temp = new HashMap<String, Object>();
  2565 + temp.put("gsName", "杨高");temp.put("fgsName", "川沙分");temp.put("key", "05_1");
  2566 + resList.add(temp);keyMap.put("05_1", temp);
  2567 + temp = new HashMap<String, Object>();
  2568 + temp.put("gsName", "杨高");temp.put("fgsName", "周浦分");temp.put("key", "05_6");
  2569 + resList.add(temp);keyMap.put("05_6", temp);
  2570 + temp = new HashMap<String, Object>();
  2571 + temp.put("gsName", "杨高");temp.put("fgsName", "小计");temp.put("key", "05_sum");
  2572 + resList.add(temp);keyMap.put("05_sum", temp);
  2573 +
  2574 + temp = new HashMap<String, Object>();
  2575 + temp.put("gsName", "上南");temp.put("fgsName", "一分");temp.put("key", "55_4");
  2576 + resList.add(temp);keyMap.put("55_4", temp);
  2577 + temp = new HashMap<String, Object>();
  2578 + temp.put("gsName", "上南");temp.put("fgsName", "二分");temp.put("key", "55_1");
  2579 + resList.add(temp);keyMap.put("55_1", temp);
  2580 + temp = new HashMap<String, Object>();
  2581 + temp.put("gsName", "上南");temp.put("fgsName", "三分");temp.put("key", "55_2");
  2582 + resList.add(temp);keyMap.put("55_2", temp);
  2583 + temp = new HashMap<String, Object>();
  2584 + temp.put("gsName", "上南");temp.put("fgsName", "六分");temp.put("key", "55_3");
  2585 + resList.add(temp);keyMap.put("55_3", temp);
  2586 + temp = new HashMap<String, Object>();
  2587 + temp.put("gsName", "上南");temp.put("fgsName", "小计");temp.put("key", "55_sum");
  2588 + resList.add(temp);keyMap.put("55_sum", temp);
  2589 +
  2590 + temp = new HashMap<String, Object>();
  2591 + temp.put("gsName", "金高");temp.put("fgsName", "一分");temp.put("key", "22_5");
  2592 + resList.add(temp);keyMap.put("22_5", temp);
  2593 + temp = new HashMap<String, Object>();
  2594 + temp.put("gsName", "金高");temp.put("fgsName", "二分");temp.put("key", "22_2");
  2595 + resList.add(temp);keyMap.put("22_2", temp);
  2596 + temp = new HashMap<String, Object>();
  2597 + temp.put("gsName", "金高");temp.put("fgsName", "三分");temp.put("key", "22_3");
  2598 + resList.add(temp);keyMap.put("22_3", temp);
  2599 + temp = new HashMap<String, Object>();
  2600 + temp.put("gsName", "金高");temp.put("fgsName", "四分");temp.put("key", "22_1");
  2601 + resList.add(temp);keyMap.put("22_1", temp);
  2602 + temp = new HashMap<String, Object>();
  2603 + temp.put("gsName", "金高");temp.put("fgsName", "小计");temp.put("key", "22_sum");
  2604 + resList.add(temp);keyMap.put("22_sum", temp);
  2605 +
  2606 + temp = new HashMap<String, Object>();
  2607 + temp.put("gsName", "南汇");temp.put("fgsName", "一分");temp.put("key", "26_1");
  2608 + resList.add(temp);keyMap.put("26_1", temp);
  2609 + temp = new HashMap<String, Object>();
  2610 + temp.put("gsName", "南汇");temp.put("fgsName", "二分");temp.put("key", "26_2");
  2611 + resList.add(temp);keyMap.put("26_2", temp);
  2612 + temp = new HashMap<String, Object>();
  2613 + temp.put("gsName", "南汇");temp.put("fgsName", "三分");temp.put("key", "26_3");
  2614 + resList.add(temp);keyMap.put("26_3", temp);
  2615 + temp = new HashMap<String, Object>();
  2616 + temp.put("gsName", "南汇");temp.put("fgsName", "六分");temp.put("key", "26_6");
  2617 + resList.add(temp);keyMap.put("26_6", temp);
  2618 + temp = new HashMap<String, Object>();
  2619 + temp.put("gsName", "南汇");temp.put("fgsName", "小计");temp.put("key", "26_sum");
  2620 + resList.add(temp);keyMap.put("26_sum", temp);
  2621 +
  2622 + temp = new HashMap<String, Object>();
  2623 + temp.put("gsName", "浦交");temp.put("fgsName", " ");temp.put("key", "88");
  2624 + resList.add(temp);keyMap.put("88", temp);
  2625 +
  2626 + for(Map<String, Object> m : list){
  2627 + m.put("gsBm", m.get("gsdm"));
  2628 + m.put("fgsBm", m.get("fgsdm"));
  2629 + if(m.get("gsBm") != null && m.get("fgsBm") != null
  2630 + && m.get("gsBm").toString().trim().length() > 0
  2631 + && m.get("fgsBm").toString().trim().length() > 0){
  2632 + String gsBm = m.get("gsBm").toString().trim();
  2633 + String fgsBm = m.get("fgsBm").toString().trim();
  2634 + String key = gsBm + "_" + fgsBm;
  2635 + if(keyMap.containsKey(key)){
  2636 + Map<String, Object> t = keyMap.get(key);
  2637 + for(String s : m.keySet()){
  2638 + if("gsName,fgsName,key".contains(s)){
  2639 + continue;
  2640 + }
  2641 + try {
  2642 + if(t.containsKey(s)){
  2643 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  2644 + } else {
  2645 + t.put(s, m.get(s).toString());
  2646 + }
  2647 + } catch (Exception e) {
  2648 + // TODO: handle exception
  2649 + continue;
  2650 + }
  2651 + }
  2652 + }
  2653 + }
  2654 + }
  2655 +
  2656 + for(Map<String, Object> m : resList){
  2657 + String key = m.get("key").toString();
  2658 + if(key.contains("_sum") || key.equals("88")){
  2659 + continue;
  2660 + }
  2661 +
  2662 + Map<String, Object> t = keyMap.get(key.split("_")[0] + "_sum");
  2663 + for(String s : m.keySet()){
  2664 + if("gsName,fgsName,key".contains(s)){
  2665 + continue;
  2666 + }
  2667 + try {
  2668 + if(t.containsKey(s)){
  2669 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  2670 + } else {
  2671 + t.put(s, m.get(s).toString());
  2672 + }
  2673 + } catch (Exception e) {
  2674 + // TODO: handle exception
  2675 + continue;
  2676 + }
  2677 + }
  2678 +
  2679 + t = keyMap.get("88");
  2680 + for(String s : m.keySet()){
  2681 + if("gsName,fgsName,key".contains(s)){
  2682 + continue;
  2683 + }
  2684 + try {
  2685 + if(t.containsKey(s)){
  2686 + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString())));
  2687 + } else {
  2688 + t.put(s, m.get(s).toString());
  2689 + }
  2690 + } catch (Exception e) {
  2691 + // TODO: handle exception
  2692 + continue;
  2693 + }
  2694 + }
  2695 + }
  2696 +
  2697 + if(type.equals("export")){
  2698 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2699 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2700 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2701 + Map<String, Object> m = new HashMap<String, Object>();
  2702 + m.put("date", date);
  2703 + String xls="countMileageSum.xls";
  2704 + ReportUtils ee = new ReportUtils();
  2705 + try {
  2706 + String dateTime = "";
  2707 + if(date.equals(date2)){
  2708 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  2709 + } else {
  2710 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  2711 + +"-"+sdfSimple.format(sdfMonth.parse(date2));
  2712 + }
  2713 + listI.add(resList.iterator());
  2714 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2715 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2716 + path + "export/"+dateTime+"-审计公里汇总表.xls");
  2717 + } catch (Exception e) {
  2718 + // TODO: handle exception
  2719 + e.printStackTrace();
  2720 + }
  2721 + }
  2722 +
  2723 + return resList;
  2724 + }
  2725 +
2512 @Override 2726 @Override
2513 public List<Map<String, Object>> countByList(Map<String, Object> map) { 2727 public List<Map<String, Object>> countByList(Map<String, Object> map) {
2514 // TODO Auto-generated method stub 2728 // TODO Auto-generated method stub
@@ -2538,6 +2752,10 @@ public class ReportServiceImpl implements ReportService{ @@ -2538,6 +2752,10 @@ public class ReportServiceImpl implements ReportService{
2538 if(map.get("xlName")!=null){ 2752 if(map.get("xlName")!=null){
2539 xlName=map.get("xlName").toString(); 2753 xlName=map.get("xlName").toString();
2540 } 2754 }
  2755 + String nature="0";
  2756 + if(map.get("nature")!=null){
  2757 + nature=map.get("nature").toString();
  2758 + }
2541 String type=""; 2759 String type="";
2542 if(map.get("type")!=null){ 2760 if(map.get("type")!=null){
2543 type=map.get("type").toString(); 2761 type=map.get("type").toString();
@@ -2545,7 +2763,9 @@ public class ReportServiceImpl implements ReportService{ @@ -2545,7 +2763,9 @@ public class ReportServiceImpl implements ReportService{
2545 //所有班次信息 2763 //所有班次信息
2546 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 2764 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
2547 line =line.trim(); 2765 line =line.trim();
2548 - if(line.equals("")){ 2766 + if(gsdm.equals("") && fgsdm.equals("") && line.equals("")){
  2767 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj3(date, date2);
  2768 + } else if(line.equals("")){
2549 //查询所有线路 2769 //查询所有线路
2550 list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm); 2770 list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
2551 }else{ 2771 }else{
@@ -2553,20 +2773,28 @@ public class ReportServiceImpl implements ReportService{ @@ -2553,20 +2773,28 @@ public class ReportServiceImpl implements ReportService{
2553 list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2); 2773 list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
2554 } 2774 }
2555 2775
  2776 + Map<String, Boolean> lineMap = lineService.lineNature();
  2777 +
  2778 + List<String> objList = new ArrayList<String>();
2556 String sql="select r.xl_bm" 2779 String sql="select r.xl_bm"
2557 + " from bsth_c_s_sp_info_real r where" 2780 + " from bsth_c_s_sp_info_real r where"
2558 - + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";  
2559 -  
2560 -  
2561 - if(line.equals("")){  
2562 - sql +="and r.gs_bm='"+gsdm+"' "  
2563 - + " and r.fgs_bm='"+fgsdm+"'"; 2781 + + " r.schedule_date_str BETWEEN ? and ?";
  2782 + objList.add(date);
  2783 + objList.add(date2);
  2784 + if("".equals(gsdm.trim()) && "".equals(fgsdm.trim()) && "".equals(line.trim())){
  2785 +
  2786 + } else if(line.equals("")){
  2787 + sql +=" and r.gs_bm=?"
  2788 + + " and r.fgs_bm like CONCAT('%',?,'%')";
  2789 + objList.add(gsdm);
  2790 + objList.add(fgsdm);
2564 }else{ 2791 }else{
2565 - sql += " and r.xl_bm = '"+line+"'"; 2792 + sql += " and r.xl_bm = ?";
  2793 + objList.add(line);
2566 } 2794 }
2567 sql += " group by r.xl_bm"; 2795 sql += " group by r.xl_bm";
2568 2796
2569 - List<String> listLine=jdbcTemplate.query(sql, new RowMapper<String>() { 2797 + List<String> listLine=jdbcTemplate.query(sql, objList.toArray(), new RowMapper<String>() {
2570 @Override 2798 @Override
2571 public String mapRow(ResultSet arg0, int arg1) throws SQLException { 2799 public String mapRow(ResultSet arg0, int arg1) throws SQLException {
2572 String ve = arg0.getString("xl_bm"); 2800 String ve = arg0.getString("xl_bm");
@@ -2576,6 +2804,18 @@ public class ReportServiceImpl implements ReportService{ @@ -2576,6 +2804,18 @@ public class ReportServiceImpl implements ReportService{
2576 for (int i = 0; i < listLine.size(); i++) { 2804 for (int i = 0; i < listLine.size(); i++) {
2577 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 2805 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2578 String lineStr=listLine.get(i); 2806 String lineStr=listLine.get(i);
  2807 + if("0".equals(nature)){ // 全部
  2808 +
  2809 + } else if("1".equals(nature)){ // 营运
  2810 + if(!(lineMap.containsKey(lineStr) && lineMap.get(lineStr))){
  2811 + continue;
  2812 + }
  2813 + } else { // 非营运
  2814 + if(lineMap.containsKey(lineStr) && lineMap.get(lineStr)){
  2815 + continue;
  2816 + }
  2817 + }
  2818 +
2579 for (int j = 0; j < list.size(); j++) { 2819 for (int j = 0; j < list.size(); j++) {
2580 ScheduleRealInfo s=list.get(j); 2820 ScheduleRealInfo s=list.get(j);
2581 if(s.getXlBm().equals(lineStr)){ 2821 if(s.getXlBm().equals(lineStr)){
@@ -2756,6 +2996,8 @@ public class ReportServiceImpl implements ReportService{ @@ -2756,6 +2996,8 @@ public class ReportServiceImpl implements ReportService{
2756 map.put("fgs", ""); 2996 map.put("fgs", "");
2757 }else{ 2997 }else{
2758 map.put("xlName", list.get(0).getXlName()); 2998 map.put("xlName", list.get(0).getXlName());
  2999 + map.put("gsBm", list.get(0).getGsBm());
  3000 + map.put("fgsBm", list.get(0).getFgsBm());
2759 map.put("gs", list.get(0).getGsName()); 3001 map.put("gs", list.get(0).getGsName());
2760 map.put("fgs", list.get(0).getFgsName()); 3002 map.put("fgs", list.get(0).getFgsName());
2761 map.put("jGh", list.get(0).getjGh()); 3003 map.put("jGh", list.get(0).getjGh());
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
@@ -30,8 +30,8 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo, @@ -30,8 +30,8 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo,
30 void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 30 void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
31 // 验证售票员是否停用 31 // 验证售票员是否停用
32 void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 32 void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
33 - // 获取线路人员配置停用信息描述  
34 - List<String> validate_get_destroy_info(List<CompanyAuthority> companyAuthorityList); 33 + // 获取人员停用信息(使用排班信息辅助判定)
  34 + List<String> validate_get_destory_info();
35 35
36 void toggleCancel(Long id) throws ScheduleException; 36 void toggleCancel(Long id) throws ScheduleException;
37 Long getMaxDbbm(Integer xlId); 37 Long getMaxDbbm(Integer xlId);
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
@@ -34,6 +34,36 @@ public interface TTInfoDetailService extends BService&lt;TTInfoDetail, Long&gt; { @@ -34,6 +34,36 @@ public interface TTInfoDetailService extends BService&lt;TTInfoDetail, Long&gt; {
34 DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos, DataToolsFileType type) throws ScheduleException; 34 DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos, DataToolsFileType type) throws ScheduleException;
35 35
36 /** 36 /**
  37 + * 导出时刻表预览视图信息。
  38 + * @param ttInfoId 时刻表Id
  39 + * @return
  40 + * @throws ScheduleException
  41 + */
  42 + DataToolsFile exportPvInfo(Long ttInfoId) throws ScheduleException;
  43 +
  44 + /**
  45 + * 添加路牌(默认添加一个班次)。
  46 + * @param ttInfoId 时刻表Id
  47 + * @param lpId 路牌Id
  48 + */
  49 + void addLp(Long ttInfoId, Long lpId);
  50 +
  51 + /**
  52 + * 删除指定路牌的所有班次。
  53 + * @param ttInfoId 时刻表Id
  54 + * @param lpId 路牌Id
  55 + */
  56 + void removeBcByLp(Long ttInfoId, Long lpId);
  57 +
  58 + /**
  59 + * 将路牌A的班次和路牌B的班次调换。
  60 + * @param ttInfoId 时刻表Id
  61 + * @param lpAId 路牌AId
  62 + * @param lpBId 路牌BId
  63 + */
  64 + void switchBcByLp(Long ttInfoId, Long lpAId, Long lpBId);
  65 +
  66 + /**
37 * 获取时刻表最大发车顺序号 67 * 获取时刻表最大发车顺序号
38 * @param xlid 线路id 68 * @param xlid 线路id
39 * @param ttinfoid 时刻表id 69 * @param ttinfoid 时刻表id
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
@@ -4,6 +4,7 @@ import com.bsth.entity.Personnel; @@ -4,6 +4,7 @@ import com.bsth.entity.Personnel;
4 import com.bsth.entity.schedule.EmployeeConfigInfo; 4 import com.bsth.entity.schedule.EmployeeConfigInfo;
5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
6 import com.bsth.entity.sys.CompanyAuthority; 6 import com.bsth.entity.sys.CompanyAuthority;
  7 +import com.bsth.entity.sys.Module;
7 import com.bsth.repository.PersonnelRepository; 8 import com.bsth.repository.PersonnelRepository;
8 import com.bsth.service.schedule.EmployeeConfigInfoService; 9 import com.bsth.service.schedule.EmployeeConfigInfoService;
9 import com.bsth.service.schedule.EmployeeService; 10 import com.bsth.service.schedule.EmployeeService;
@@ -11,11 +12,15 @@ import com.bsth.service.schedule.ScheduleRule1FlatService; @@ -11,11 +12,15 @@ import com.bsth.service.schedule.ScheduleRule1FlatService;
11 import com.bsth.service.schedule.exception.ScheduleException; 12 import com.bsth.service.schedule.exception.ScheduleException;
12 import com.bsth.service.schedule.utils.DataToolsFile; 13 import com.bsth.service.schedule.utils.DataToolsFile;
13 import com.bsth.service.schedule.utils.DataToolsService; 14 import com.bsth.service.schedule.utils.DataToolsService;
  15 +import com.bsth.service.sys.ModuleService;
  16 +import com.bsth.util.DateUtils;
  17 +import org.apache.commons.lang3.time.DateFormatUtils;
14 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.beans.factory.annotation.Qualifier; 19 import org.springframework.beans.factory.annotation.Qualifier;
16 import org.springframework.dao.DataAccessException; 20 import org.springframework.dao.DataAccessException;
17 import org.springframework.jdbc.core.JdbcTemplate; 21 import org.springframework.jdbc.core.JdbcTemplate;
18 import org.springframework.jdbc.core.ResultSetExtractor; 22 import org.springframework.jdbc.core.ResultSetExtractor;
  23 +import org.springframework.jdbc.core.RowMapper;
19 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
20 import org.springframework.transaction.annotation.Transactional; 25 import org.springframework.transaction.annotation.Transactional;
21 import org.springframework.util.CollectionUtils; 26 import org.springframework.util.CollectionUtils;
@@ -277,51 +282,67 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -277,51 +282,67 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
277 } 282 }
278 } 283 }
279 284
  285 + @Autowired
  286 + private ModuleService moduleService;
280 @Transactional 287 @Transactional
281 @Override 288 @Override
282 - public List<String> validate_get_destroy_info(List<CompanyAuthority> companyAuthorityList) {  
283 - // 获取公司分公司权限代码  
284 - List<String> gs_fgs_dms = new ArrayList<>();  
285 - for (CompanyAuthority companyAuthority : companyAuthorityList) {  
286 - gs_fgs_dms.add(companyAuthority.getCompanyCode() + "_" + companyAuthority.getSubCompanyCode());  
287 - }  
288 -  
289 - // 查询所有人员配置,不用in操作符,n+1查询慢,程序过滤  
290 - Map<String, Object> params = new HashMap<>();  
291 - List<EmployeeConfigInfo> employeeConfigInfoList_all = (List<EmployeeConfigInfo>) this.list(params);  
292 - List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>();  
293 - for (EmployeeConfigInfo employeeConfigInfo : employeeConfigInfoList_all) {  
294 - if (gs_fgs_dms.contains(employeeConfigInfo.getXl().getCgsbm())) {  
295 - employeeConfigInfoList.add(employeeConfigInfo); 289 + public List<String> validate_get_destory_info() {
  290 + // 1、查找当前用户是否有运营计划管理,没有的话不分析是否有停用人鱼信息
  291 + List<Module> moduleList = this.moduleService.findByCurrentUser();
  292 + boolean hasPlanModule = false;
  293 + for (Module module : moduleList) {
  294 + if ("运营计划管理".equals(module.getName())) {
  295 + hasPlanModule = true;
  296 + break;
296 } 297 }
297 } 298 }
  299 + if (!hasPlanModule) {
  300 + return null;
  301 + }
298 302
299 - // 停用信息  
300 - List<String> destroy_infos = new ArrayList<>();  
301 - String info_format = "线路[%s]中人员配置有停用人员,请处理!";  
302 - String info = "";  
303 - Integer xlId = null;  
304 - for (EmployeeConfigInfo employeeConfigInfo : employeeConfigInfoList) {  
305 - if (employeeConfigInfo.getJsy() != null &&  
306 - employeeConfigInfo.getJsy().getDestroy() != null &&  
307 - employeeConfigInfo.getJsy().getDestroy() == 1) { // 驾驶员判定是否停用  
308 - info = String.format(info_format, employeeConfigInfo.getXl().getName());  
309 - if (!destroy_infos.contains(info)) {  
310 - destroy_infos.add(info);  
311 - }  
312 - }  
313 -  
314 - if (employeeConfigInfo.getSpy() != null &&  
315 - employeeConfigInfo.getSpy().getDestroy() != null &&  
316 - employeeConfigInfo.getSpy().getDestroy() == 1) {  
317 - info = String.format(info_format, employeeConfigInfo.getXl().getName());  
318 - if (!destroy_infos.contains(info)) {  
319 - destroy_infos.add(info);  
320 - } 303 + // 2、计算从当前时间开始的排班计划中是否有停用人员
  304 + String sql =
  305 + "select distinct " +
  306 + "plan.xl_name xlName " +
  307 + ", plan.schedule_date scheduleDate " +
  308 + "from bsth_c_s_sp_info plan " +
  309 + "left join bsth_c_personnel jsy on jsy.id = plan.j " +
  310 + "left join bsth_c_personnel spy on spy.id = plan.s " +
  311 + "where plan.schedule_date >= ? " +
  312 + "and (jsy.destroy = 1 || spy.destroy = 1) " +
  313 + "group by plan.xl_name, plan.schedule_date " +
  314 + "order by plan.xl_name, plan.schedule_date ";
  315 +
  316 +// String sql =
  317 +// "select distinct " +
  318 +// "pinfo.xl_name xlName " +
  319 +// ", pinfo.schedule_date scheduleDate " +
  320 +// "from " +
  321 +// "(" +
  322 +// "select plan.xl_name, plan.schedule_date " +
  323 +// "from bsth_c_s_sp_info plan " +
  324 +// "left join bsth_c_personnel jsy on plan.j = jsy.id " +
  325 +// "left join bsth_c_personnel spy on plan.s = spy.id " +
  326 +// "where schedule_date >= ? " +
  327 +// "and (jsy.destroy = 1 || spy.destroy = 1) " +
  328 +// "order by plan.xl_name asc, plan.schedule_date asc " +
  329 +// ") pinfo " +
  330 +// "group by pinfo.xl_name, pinfo.schedule_date ";
  331 +
  332 +
  333 + Date currentDate = new Date(DateUtils.getTimestamp());
  334 + System.out.println(currentDate);
  335 + String info_format = "线路[%s][%s]排班中有人员已经停用,请及时处理!";
  336 + List<String> infoList = this.jdbcTemplate.query(sql, new Object[] {currentDate}, new RowMapper<String>() {
  337 + @Override
  338 + public String mapRow(ResultSet resultSet, int i) throws SQLException {
  339 + String xlName = resultSet.getString("xlName");
  340 + Date scheduleDate = new Date(resultSet.getDate("scheduleDate").getTime());
  341 + return String.format(info_format, xlName, DateFormatUtils.format(scheduleDate, "yyyy年MM月dd日"));
321 } 342 }
322 - } 343 + });
323 344
324 - return destroy_infos; 345 + return infoList;
325 } 346 }
326 347
327 @Transactional 348 @Transactional
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -1518,18 +1518,18 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1518,18 +1518,18 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1518 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 1518 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1519 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1519 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1520 1520
1521 - String sfyy = "", company = "", subCompany = ""; 1521 + String sfyy = "", company = "", subCompany = "", line = "";
1522 if(map.get("sfyy")!=null) 1522 if(map.get("sfyy")!=null)
1523 - sfyy = map.get("sfyy").toString(); 1523 + sfyy = map.get("sfyy").toString().trim();
1524 if(map.get("company")!=null) 1524 if(map.get("company")!=null)
1525 - company = map.get("company").toString(); 1525 + company = map.get("company").toString().trim();
1526 if(map.get("subCompany")!=null) 1526 if(map.get("subCompany")!=null)
1527 - subCompany = map.get("subCompany").toString();  
1528 - String line = map.get("line").toString();  
1529 -// String date = map.get("date").toString();  
1530 - String startDate = map.get("startDate").toString();  
1531 - String endDate = map.get("endDate").toString();  
1532 - String type = map.get("type").toString(); 1527 + subCompany = map.get("subCompany").toString().trim();
  1528 + if(map.get("line")!=null)
  1529 + line = map.get("line").toString().trim();
  1530 + String startDate = map.get("startDate").toString().trim();
  1531 + String endDate = map.get("endDate").toString().trim();
  1532 + String type = map.get("type").toString().trim();
1533 1533
1534 if(startDate.length() == 0) 1534 if(startDate.length() == 0)
1535 startDate = sdf.format(new Date()); 1535 startDate = sdf.format(new Date());
@@ -1547,20 +1547,31 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1547,20 +1547,31 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1547 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日"; 1547 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日";
1548 } 1548 }
1549 1549
  1550 + List<String> objList = new ArrayList<String>();
  1551 + objList.add(startDate);
  1552 + objList.add(endDate);
  1553 +
1550 try { 1554 try {
1551 - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"  
1552 - + " a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = "  
1553 - + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt"  
1554 - + " from bsth_c_s_sp_info_real a where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'" 1555 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, "
  1556 + + " a.gs_name, a.fgs_name, a.gs_bm, a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = "
  1557 + + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt "
  1558 + + " from bsth_c_s_sp_info_real a where schedule_date_str >= ? and schedule_date_str <= ? "
1555 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; 1559 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
1556 - if(line.length() != 0)  
1557 - sql += " and xl_bm = '"+line+"'";  
1558 - if(company.length() != 0)  
1559 - sql += " and gs_bm = '"+company+"'";  
1560 - if(subCompany.length() != 0)  
1561 - sql += " and fgs_bm = '"+subCompany+"'"; 1560 + if(line.length() != 0){
  1561 + sql += " and xl_bm = ? ";
  1562 + objList.add(line);
  1563 + }
  1564 + if(company.length() != 0){
  1565 + sql += " and gs_bm = ? ";
  1566 + objList.add(company);
  1567 + }
  1568 + if(subCompany.length() != 0){
  1569 + sql += " and fgs_bm = ? ";
  1570 + objList.add(subCompany);
  1571 + }
1562 1572
1563 list = jdbcTemplate.query(sql, 1573 list = jdbcTemplate.query(sql,
  1574 + objList.toArray(),
1564 new RowMapper<ScheduleRealInfo>(){ 1575 new RowMapper<ScheduleRealInfo>(){
1565 @Override 1576 @Override
1566 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 1577 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -1579,6 +1590,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1579,6 +1590,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1579 schedule.setStatus(rs.getInt("status")); 1590 schedule.setStatus(rs.getInt("status"));
1580 schedule.setGsName(rs.getString("gs_name")); 1591 schedule.setGsName(rs.getString("gs_name"));
1581 schedule.setFgsName(rs.getString("fgs_name")); 1592 schedule.setFgsName(rs.getString("fgs_name"));
  1593 + schedule.setGsBm(rs.getString("gs_bm"));
1582 schedule.setFgsBm(rs.getString("fgs_bm")); 1594 schedule.setFgsBm(rs.getString("fgs_bm"));
1583 schedule.setCcService(rs.getBoolean("cc_service")); 1595 schedule.setCcService(rs.getBoolean("cc_service"));
1584 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):""); 1596 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):"");
@@ -1646,7 +1658,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1646,7 +1658,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1646 continue; 1658 continue;
1647 } 1659 }
1648 1660
1649 - String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm(); 1661 + String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm() + "/" + s.getGsBm();
1650 String date = s.getScheduleDateStr(); 1662 String date = s.getScheduleDateStr();
1651 if(!keyMap.containsKey(key)){ 1663 if(!keyMap.containsKey(key)){
1652 keyMap.put(key, new HashMap<String, List<ScheduleRealInfo>>()); 1664 keyMap.put(key, new HashMap<String, List<ScheduleRealInfo>>());
@@ -1664,7 +1676,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1664,7 +1676,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1664 Map<Long, String> longMap = new HashMap<Long, String>(); 1676 Map<Long, String> longMap = new HashMap<Long, String>();
1665 for(String key : keyMap.keySet()){ 1677 for(String key : keyMap.keySet()){
1666 String[] keys = key.split("/"); 1678 String[] keys = key.split("/");
1667 - Long l = Long.valueOf(keys[2]) * 10000000000l + Long.valueOf(keys[1]); 1679 + Long l = Long.valueOf(keys[3] + keys[2]) * 10000000000l + Long.valueOf(keys[1]);
1668 longMap.put(l, key); 1680 longMap.put(l, key);
1669 longList.add(l); 1681 longList.add(l);
1670 } 1682 }
@@ -1890,11 +1902,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1890,11 +1902,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1890 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); 1902 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%");
1891 for(Map<String, Object> m : mapList){ 1903 for(Map<String, Object> m : mapList){
1892 m.put("no", ++i); 1904 m.put("no", ++i);
1893 -// m.put("company", companyName);  
1894 -// m.put("subCompany", subCompanyName);  
1895 } 1905 }
  1906 + tempMap.put("company", "");
  1907 + tempMap.put("subCompany", "");
  1908 + tempMap.put("line", "");
1896 tempMap.put("map", mapList); 1909 tempMap.put("map", mapList);
1897 - if(!type.equals("export")) 1910 + if(!type.contains("export"))
1898 resList.add(tempMap); 1911 resList.add(tempMap);
1899 } 1912 }
1900 1913
@@ -1957,190 +1970,59 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1957,190 +1970,59 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1957 // TODO: handle exception 1970 // TODO: handle exception
1958 e.printStackTrace(); 1971 e.printStackTrace();
1959 } 1972 }
1960 - }  
1961 -  
1962 - return resList;  
1963 - }  
1964 - /*@Override  
1965 - public List<Map<String, Object>> commandState(Map<String, Object> map) {  
1966 - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();  
1967 - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();  
1968 - Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>();  
1969 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
1970 -  
1971 - String company = map.get("company").toString();  
1972 - String subCompany = map.get("subCompany").toString();  
1973 - String line = map.get("line").toString();  
1974 - String date = map.get("date").toString();  
1975 - String code = map.get("code").toString();  
1976 - String type = map.get("type").toString();  
1977 -  
1978 - if(date.length() == 0)  
1979 - date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());  
1980 -  
1981 - try {  
1982 -  
1983 - String sql =  
1984 - "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " +  
1985 - "FROM bsth_c_s_sp_info_real as r left join bsth_v_directive_60 as d on r.id = d.sch and d.is_dispatch = 1 where schedule_date_str = '"+date+"'";  
1986 - if(line.length() != 0){  
1987 - sql += " and xl_bm = '"+line+"'";  
1988 - }  
1989 - if(code.length() != 0){  
1990 - sql += " and cl_zbh = '"+code+"'";  
1991 - }  
1992 - if(company.length() != 0){  
1993 - sql += " and gs_bm = '"+company+"'";  
1994 - }  
1995 - if(subCompany.length() != 0){  
1996 - sql += " and fgs_bm = '"+subCompany+"'";  
1997 - }  
1998 - sql += " union " +  
1999 - "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " +  
2000 - "FROM bsth_c_s_sp_info_real as r right join bsth_v_directive_60 as d on r.id = d.sch where d.is_dispatch = 1 and schedule_date_str = '"+date+"'";  
2001 - if(line.length() != 0){  
2002 - sql += " and xl_bm = '"+line+"'";  
2003 - }  
2004 - if(code.length() != 0){  
2005 - sql += " and cl_zbh = '"+code+"'";  
2006 - }  
2007 - if(company.length() != 0){  
2008 - sql += " and gs_bm = '"+company+"'"; 1973 + } else if(type.equals("exportAll")){
  1974 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1975 + Map<String, Map<String, Object>> tempKeyMap = new HashMap<String, Map<String, Object>>();
  1976 + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>();
  1977 + for(Map<String, Object> m : resList){
  1978 + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0
  1979 + && m.get("gsName").toString().trim().contains("临港")){
  1980 + removeList.add(m);
  1981 + }
2009 } 1982 }
2010 - if(subCompany.length() != 0){  
2011 - sql += " and fgs_bm = '"+subCompany+"'"; 1983 + for(Map<String, Object> m : removeList){
  1984 + resList.remove(m);
2012 } 1985 }
2013 - sql += " order by xl_name, fcsj";  
2014 -  
2015 - list = jdbcTemplate.query(sql,  
2016 - new RowMapper<Map<String, Object>>(){  
2017 - @Override  
2018 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
2019 - Map<String, Object> map = new HashMap<String, Object>();  
2020 - map.put("id", rs.getString("id"));  
2021 - map.put("date", rs.getString("schedule_date_str"));  
2022 - map.put("line", rs.getString("xl_name"));  
2023 - map.put("clZbh", rs.getString("cl_zbh"));  
2024 - map.put("jGh", rs.getString("j_gh"));  
2025 - map.put("jName", rs.getString("j_name"));  
2026 - map.put("fcsj", rs.getString("fcsj"));  
2027 - map.put("timestamp", rs.getString("timestamp"));  
2028 - map.put("reply46", rs.getString("reply46"));  
2029 - map.put("reply47", rs.getString("reply47"));  
2030 - map.put("reply46time", rs.getString("reply46time"));  
2031 - map.put("reply47time", rs.getString("reply47time"));  
2032 - map.put("company", rs.getObject("gs_name"));  
2033 - map.put("subCompany", rs.getObject("fgs_name"));  
2034 - return map; 1986 + for(Map<String, Object> m : resList){
  1987 + if(m.get("company")!=null && m.get("company").toString().trim().length() > 0){
  1988 + Map<String, Object> temp = new HashMap<String, Object>();
  1989 + String gsName = m.get("company").toString().trim();
  1990 + if(tempKeyMap.containsKey(gsName)){
  1991 + temp = tempKeyMap.get(gsName);
  1992 + temp.put("jhbc", Long.valueOf(m.get("jhbc")!=null?m.get("jhbc").toString():"0")
  1993 + + Long.valueOf(temp.get("jhbc")!=null?temp.get("jhbc").toString():"0"));
  1994 + temp.put("sjbc", Long.valueOf(m.get("sjbc")!=null?m.get("sjbc").toString():"0")
  1995 + + Long.valueOf(temp.get("sjbc")!=null?temp.get("sjbc").toString():"0"));
  1996 + } else {
  1997 + temp.put("date", "");
  1998 + temp.put("company", gsName);
  1999 + temp.put("subCompany", "小计");
  2000 + temp.put("line", "");
  2001 + temp.put("jhbc", m.get("jhbc")!=null?m.get("jhbc").toString()+"":"0");
  2002 + temp.put("sjbc", m.get("sjbc")!=null?m.get("sjbc").toString()+"":"0");
  2003 + tempList.add(temp);
  2004 + tempKeyMap.put(gsName, temp);
  2005 + }
2035 } 2006 }
2036 - });  
2037 -  
2038 - } catch (Exception e) {  
2039 - // TODO Auto-generated catch block  
2040 - e.printStackTrace();  
2041 - }  
2042 -  
2043 - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();  
2044 - List<String> keyList = new ArrayList<String>();  
2045 - for(Map<String, Object> m : list){  
2046 - String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName");  
2047 - if(!keyList.contains(m.get("line").toString())){  
2048 - keyList.add(m.get("line").toString());  
2049 - }  
2050 - if(!keyMap.containsKey(key))  
2051 - keyMap.put(key, new ArrayList<Map<String, Object>>());  
2052 - keyMap.get(key).add(m);  
2053 - }  
2054 - String companyName = "", subCompanyName = "";  
2055 - for(String key : keyMap.keySet()){  
2056 - Map<String, Object> tempMap = new HashMap<String, Object>();  
2057 - Set<String> tempSet = new HashSet<String>();  
2058 - int sjf = 0;  
2059 - int wqr = 0;  
2060 - for(Map<String, Object> m : keyMap.get(key)){  
2061 - if(m.containsKey("company") && m.get("company")!=null && m.get("company").toString().length()!=0 && companyName.length()==0)  
2062 - companyName = m.get("company").toString();  
2063 - if(m.containsKey("subCompany") && m.get("subCompany")!=null && m.get("subCompany").toString().length()!=0 && subCompanyName.length()==0)  
2064 - subCompanyName = m.get("subCompany").toString();  
2065 - tempSet.add(m.get("id").toString());  
2066 - if(m.get("timestamp") != null){  
2067 - sjf++;  
2068 - if(m.get("reply47").toString().equals("-1"))  
2069 - wqr++;  
2070 - m.put("time", sdf.format(new Date(Long.valueOf(m.get("timestamp").toString()))));  
2071 - } else  
2072 - m.put("time", "/");  
2073 -  
2074 - if(m.get("reply46time") != null)  
2075 - m.put("time46", sdf.format(new Date(Long.valueOf(m.get("reply46time").toString()))));  
2076 - else  
2077 - m.put("time46", "/");  
2078 -  
2079 - if(m.get("reply47time") != null)  
2080 - m.put("time47", sdf.format(new Date(Long.valueOf(m.get("reply47time").toString()))));  
2081 - else  
2082 - m.put("time47", "/");  
2083 -  
2084 } 2007 }
2085 - tempMap.put("company", companyName);  
2086 - tempMap.put("subCompany", subCompanyName);  
2087 - String[] split = key.split("/");  
2088 - tempMap.put("date", date);  
2089 - tempMap.put("line", split[0]);  
2090 - tempMap.put("clZbh", split[1]);  
2091 - tempMap.put("jsy", split[2] + "/" + split[3]);  
2092 - tempMap.put("jhf", tempSet.size());  
2093 - tempMap.put("sjf", sjf);  
2094 - tempMap.put("wqr", wqr);  
2095 - tempMap.put("workList", keyMap.get(key));  
2096 - tempList.add(tempMap);  
2097 - }  
2098 -  
2099 - for(String key : keyList){ 2008 +
2100 for(Map<String, Object> m : tempList){ 2009 for(Map<String, Object> m : tempList){
2101 - if(key.equals(m.get("line").toString())){  
2102 - resList.add(m); 2010 + if(m.get("jhbc")!=null && Long.valueOf(m.get("jhbc").toString()) > 0l){
  2011 + m.put("zdl", nf.format((float) Long.valueOf(m.get("sjbc").toString()) / Long.valueOf(m.get("jhbc").toString()) * 100) + "%");
  2012 + }else{
  2013 + m.put("zdl", "0.00%");
2103 } 2014 }
  2015 + resList.add(m);
2104 } 2016 }
2105 - }  
2106 -  
2107 - if(type.equals("export")){  
2108 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
2109 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 2017 +
2110 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 2018 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
2111 Map<String,Object> m = new HashMap<String, Object>(); 2019 Map<String,Object> m = new HashMap<String, Object>();
2112 ReportUtils ee = new ReportUtils(); 2020 ReportUtils ee = new ReportUtils();
2113 try { 2021 try {
2114 listI.add(resList.iterator()); 2022 listI.add(resList.iterator());
2115 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 2023 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
2116 - ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState.xls",  
2117 - path+"export/指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");  
2118 - } catch (Exception e) {  
2119 - // TODO: handle exception  
2120 - e.printStackTrace();  
2121 - }  
2122 - }  
2123 -  
2124 - if(type.equals("export1")){  
2125 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
2126 - sdfSimple = new SimpleDateFormat("yyyyMMdd");  
2127 - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();  
2128 - Map<String,Object> m = new HashMap<String, Object>();  
2129 - ReportUtils ee = new ReportUtils();  
2130 - String jsy = map.get("jsy").toString();  
2131 - try {  
2132 - for(Map<String, Object> map1 : resList){  
2133 - if(jsy.equals(map1.get("jsy").toString())){  
2134 - List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList");  
2135 - listI.add(temp.iterator());  
2136 - m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company")  
2137 - + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line")  
2138 - + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy"));  
2139 - }  
2140 - }  
2141 - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";  
2142 - ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState1.xls",  
2143 - path+"export/指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); 2024 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_sum.xls",
  2025 + path+"export/" + dateTime + "-全部公司-线路首末班准点率.xls");
2144 } catch (Exception e) { 2026 } catch (Exception e) {
2145 // TODO: handle exception 2027 // TODO: handle exception
2146 e.printStackTrace(); 2028 e.printStackTrace();
@@ -2149,7 +2031,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -2149,7 +2031,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
2149 2031
2150 return resList; 2032 return resList;
2151 } 2033 }
2152 -*/  
2153 2034
2154 @Override 2035 @Override
2155 public List<Map<String, Object>> commandState(Map<String, Object> map) { 2036 public List<Map<String, Object>> commandState(Map<String, Object> map) {