Commit 1008b078bd2dda862825a9a62bfc5cc34aef88d8

Authored by 游瑞烽
2 parents 59a7d519 c33e25aa

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

Showing 23 changed files with 1894 additions and 117 deletions

Too many changes to show.

To preserve performance only 23 of 96 files are displayed.

src/main/java/com/bsth/controller/calc/CalcWaybillController.java
@@ -39,6 +39,9 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> @@ -39,6 +39,9 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
39 } 39 }
40 40
41 Map<String, Object> m = new HashMap<String, Object>(); 41 Map<String, Object> m = new HashMap<String, Object>();
  42 + m.put("date", date);
  43 + m.put("line", line);
  44 + m.put("key", key);
42 try { 45 try {
43 46
44 m = calcWaybillService.generateNew(date, line); 47 m = calcWaybillService.generateNew(date, line);
@@ -53,7 +56,6 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -53,7 +56,6 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
53 m.put("status", ResponseCode.ERROR); 56 m.put("status", ResponseCode.ERROR);
54 return m; 57 return m;
55 } 58 }
56 -  
57 return m; 59 return m;
58 } 60 }
59 61
@@ -101,6 +103,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -101,6 +103,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
101 } 103 }
102 104
103 Map<String, Object> m = new HashMap<String, Object>(); 105 Map<String, Object> m = new HashMap<String, Object>();
  106 + m.put("date", date);
  107 + m.put("line", line);
104 try { 108 try {
105 109
106 m.put("status", calcWaybillService.calcDaily(date, line)); 110 m.put("status", calcWaybillService.calcDaily(date, line));
@@ -147,4 +151,130 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -147,4 +151,130 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
147 return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type); 151 return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type);
148 } 152 }
149 153
  154 + @RequestMapping(value="/generateLineMileage")
  155 + public Map<String, Object> generateLineMileage(@RequestParam Map<String, Object> map) throws Exception{
  156 + Map<String, Object> m = new HashMap<String, Object>();
  157 + String date = "", line = "";
  158 + try {
  159 +
  160 + if(map.containsKey("date") && map.get("date")!=null){
  161 + date=map.get("date").toString().trim();
  162 + }
  163 + if(map.containsKey("line") && map.get("line")!=null){
  164 + line=map.get("line").toString().trim();
  165 + }
  166 +
  167 +
  168 + return calcWaybillService.calcLineMileage(date, line);
  169 +
  170 + } catch (Exception e) {
  171 + // TODO: handle exception
  172 + e.printStackTrace();
  173 + m.put("status", ResponseCode.ERROR);
  174 + m.put("date", date);
  175 + m.put("line", line);
  176 + return m;
  177 + }
  178 + }
  179 +
  180 + @RequestMapping(value="/generateBusMileage")
  181 + public Map<String, Object> generateBusMileage(@RequestParam Map<String, Object> map) throws Exception{
  182 + Map<String, Object> m = new HashMap<String, Object>();
  183 + String date = "", line = "";
  184 + try {
  185 +
  186 + if(map.containsKey("date") && map.get("date")!=null){
  187 + date=map.get("date").toString().trim();
  188 + }
  189 + if(map.containsKey("line") && map.get("line")!=null){
  190 + line=map.get("line").toString().trim();
  191 + }
  192 +
  193 +
  194 + return calcWaybillService.calcBusMileage(date, line);
  195 +
  196 + } catch (Exception e) {
  197 + // TODO: handle exception
  198 + e.printStackTrace();
  199 + m.put("status", ResponseCode.ERROR);
  200 + m.put("date", date);
  201 + m.put("line", line);
  202 + return m;
  203 + }
  204 + }
  205 +
  206 + @RequestMapping(value="/getLineMileage")
  207 + public List<Map<String, Object>> getLineMileage(@RequestParam Map<String, Object> map){
  208 + String gsdm="";
  209 + if(map.get("gsdm")!=null){
  210 + gsdm=map.get("gsdm").toString().trim();
  211 + }
  212 + String fgsdm="";
  213 + if(map.get("fgsdm")!=null){
  214 + fgsdm=map.get("fgsdm").toString().trim();
  215 + }
  216 + String line="";
  217 + if(map.get("line")!=null){
  218 + line=map.get("line").toString().trim();
  219 + }
  220 + String date="";
  221 + if(map.get("date")!=null){
  222 + date=map.get("date").toString().trim();
  223 + }
  224 + String date2="";
  225 + if(map.get("date2")!=null){
  226 + date2=map.get("date2").toString().trim();
  227 + }
  228 + String xlName="";
  229 + if(map.get("xlName")!=null){
  230 + xlName=map.get("xlName").toString().trim();
  231 + }
  232 + String zt="";
  233 + if(map.get("zt")!=null){
  234 + zt=map.get("zt").toString();
  235 + }
  236 + String by="";
  237 + if(map.get("by")!=null){
  238 + by=map.get("by").toString();
  239 + }
  240 + String type="";
  241 + if(map.get("type")!=null){
  242 + type=map.get("type").toString().trim();
  243 + }
  244 + return calcWaybillService.getLineMileage(gsdm, fgsdm, line, date, date2, xlName, zt, by, type);
  245 + }
  246 +
  247 + @RequestMapping(value="/getBusMileage")
  248 + public List<Map<String, Object>> getBusMileage(@RequestParam Map<String, Object> map){
  249 + String line="";
  250 + if(map.get("line")!=null){
  251 + line=map.get("line").toString().trim();
  252 + }
  253 + String date="";
  254 + if(map.get("date")!=null){
  255 + date=map.get("date").toString().trim();
  256 + }
  257 + String date2="";
  258 + if(map.get("date2")!=null){
  259 + date2=map.get("date2").toString().trim();
  260 + }
  261 + String xlName="";
  262 + if(map.get("xlName")!=null){
  263 + xlName=map.get("xlName").toString().trim();
  264 + }
  265 + String zt="";
  266 + if(map.get("zt")!=null){
  267 + zt=map.get("zt").toString();
  268 + }
  269 + String by="";
  270 + if(map.get("by")!=null){
  271 + by=map.get("by").toString();
  272 + }
  273 + String type="";
  274 + if(map.get("type")!=null){
  275 + type=map.get("type").toString().trim();
  276 + }
  277 + return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type);
  278 + }
  279 +
150 } 280 }
src/main/java/com/bsth/controller/forms/ExportController.java
@@ -46,7 +46,8 @@ public class ExportController { @@ -46,7 +46,8 @@ public class ExportController {
46 @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST) 46 @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST)
47 public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) { 47 public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) {
48 List<Waybillday> waybillday = formsService.waybillday(map); 48 List<Waybillday> waybillday = formsService.waybillday(map);
49 - exportService.waybillday(map.get("date").toString(), waybillday); 49 + exportService.waybillday(map.get("date").toString(),
  50 + map.get("lineName").toString(), waybillday);
50 return waybillday; 51 return waybillday;
51 } 52 }
52 53
@@ -85,7 +86,8 @@ public class ExportController { @@ -85,7 +86,8 @@ public class ExportController {
85 // 班次车辆人员日统计 86 // 班次车辆人员日统计
86 @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET) 87 @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET)
87 public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { 88 public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) {
88 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 89 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  90 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
89 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 91 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
90 Map<String, Object> map2 = new HashMap<String, Object>(); 92 Map<String, Object> map2 = new HashMap<String, Object>();
91 ReportUtils ee = new ReportUtils(); 93 ReportUtils ee = new ReportUtils();
@@ -117,10 +119,14 @@ public class ExportController { @@ -117,10 +119,14 @@ public class ExportController {
117 } 119 }
118 120
119 try { 121 try {
  122 + String lineName = "";
  123 + if(map.containsKey("lineName"))
  124 + lineName = map.get("lineName").toString();
120 listI.add(resList.iterator()); 125 listI.add(resList.iterator());
121 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 126 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
122 ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls", 127 ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls",
123 - path + "export/班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); 128 + path + "export/" + sdfSimple.format(sdfMonth.parse(map.get("date").toString()))
  129 + + "-" + lineName + "-班次车辆人员日报表.xls");
124 } catch (Exception e) { 130 } catch (Exception e) {
125 e.printStackTrace(); 131 e.printStackTrace();
126 } 132 }
@@ -130,7 +136,8 @@ public class ExportController { @@ -130,7 +136,8 @@ public class ExportController {
130 // 班次车辆人员月统计 136 // 班次车辆人员月统计
131 @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET) 137 @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET)
132 public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) { 138 public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) {
133 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 139 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  140 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
134 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 141 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
135 ReportUtils ee = new ReportUtils(); 142 ReportUtils ee = new ReportUtils();
136 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map); 143 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map);
@@ -153,7 +160,20 @@ public class ExportController { @@ -153,7 +160,20 @@ public class ExportController {
153 } 160 }
154 161
155 try { 162 try {
156 - String mouldurl = null; 163 + String mouldurl = null, lineName = "", dateTime = ""
  164 + , startDate = "", endDate = "";
  165 + if(map.containsKey("lineName"))
  166 + lineName = map.get("lineName").toString();
  167 + if(map.containsKey("startDate"))
  168 + startDate = map.get("startDate").toString();
  169 + if(map.containsKey("endDate"))
  170 + endDate = map.get("endDate").toString();
  171 + if(startDate.equals(endDate)){
  172 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  173 + } else {
  174 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  175 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  176 + }
157 if(map.get("empnames").equals("驾驶员")){ 177 if(map.get("empnames").equals("驾驶员")){
158 mouldurl="mould/shiftuehiclemanth.xls"; 178 mouldurl="mould/shiftuehiclemanth.xls";
159 }else if(map.get("empnames").equals("售票员")){ 179 }else if(map.get("empnames").equals("售票员")){
@@ -164,7 +184,7 @@ public class ExportController { @@ -164,7 +184,7 @@ public class ExportController {
164 listI.add(resList.iterator()); 184 listI.add(resList.iterator());
165 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 185 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
166 ee.excelReplace(listI, new Object[] { map }, path +mouldurl, 186 ee.excelReplace(listI, new Object[] { map }, path +mouldurl,
167 - path + "export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); 187 + path + "export/" + dateTime + "-" + lineName + "-班次车辆人员月报表.xls");
168 } catch (Exception e) { 188 } catch (Exception e) {
169 e.printStackTrace(); 189 e.printStackTrace();
170 } 190 }
@@ -304,7 +324,8 @@ public class ExportController { @@ -304,7 +324,8 @@ public class ExportController {
304 } 324 }
305 @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET) 325 @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
306 public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) { 326 public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) {
307 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 327 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  328 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
308 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 329 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
309 ReportUtils ee = new ReportUtils(); 330 ReportUtils ee = new ReportUtils();
310 List<Singledata> singledata = formsService.singledatatj(map); 331 List<Singledata> singledata = formsService.singledatatj(map);
@@ -333,10 +354,16 @@ public class ExportController { @@ -333,10 +354,16 @@ public class ExportController {
333 } 354 }
334 355
335 try { 356 try {
  357 + String startDate = "", lineName = "";
  358 + if(map.containsKey("startDate"))
  359 + startDate = map.get("startDate").toString();
  360 + if(map.containsKey("lineName"))
  361 + lineName = map.get("lineName").toString();
336 listI.add(resList.iterator()); 362 listI.add(resList.iterator());
337 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 363 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
338 ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", 364 ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
339 - path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); 365 + path + "export/" + sdfSimple.format(sdfMonth.parse(startDate))
  366 + + "-" + lineName + "-路单数据.xls");
340 } catch (Exception e) { 367 } catch (Exception e) {
341 e.printStackTrace(); 368 e.printStackTrace();
342 } 369 }
@@ -388,7 +415,8 @@ public class ExportController { @@ -388,7 +415,8 @@ public class ExportController {
388 // 车辆加注 415 // 车辆加注
389 @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET) 416 @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET)
390 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) { 417 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
391 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 418 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  419 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
392 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 420 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
393 ReportUtils ee = new ReportUtils(); 421 ReportUtils ee = new ReportUtils();
394 List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), 422 List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(),
@@ -414,10 +442,15 @@ public class ExportController { @@ -414,10 +442,15 @@ public class ExportController {
414 } 442 }
415 443
416 try { 444 try {
  445 + String date = "", lineName = "";
  446 + if(map.containsKey("data"))
  447 + date = map.get("data").toString();
  448 + if(map.containsKey("lineName"))
  449 + lineName = map.get("lineName").toString();
417 listI.add(resList.iterator()); 450 listI.add(resList.iterator());
418 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 451 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
419 ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls", 452 ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls",
420 - path + "export/车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("data").toString())) + ".xls"); 453 + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + "-" + lineName + "-车辆加注.xls");
421 } catch (Exception e) { 454 } catch (Exception e) {
422 e.printStackTrace(); 455 e.printStackTrace();
423 } 456 }
@@ -447,10 +480,23 @@ public class ExportController { @@ -447,10 +480,23 @@ public class ExportController {
447 } 480 }
448 481
449 try { 482 try {
  483 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  484 + if(map.containsKey("startDate"))
  485 + startDate = map.get("startDate").toString();
  486 + if(map.containsKey("endDate"))
  487 + endDate = map.get("endDate").toString();
  488 + if(map.containsKey("lineName"))
  489 + lineName = map.get("lineName").toString();
  490 + if(startDate.equals(endDate)){
  491 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  492 + } else {
  493 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  494 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  495 + }
450 listI.add(resList.iterator()); 496 listI.add(resList.iterator());
451 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 497 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
452 - ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/运营服务阶段报表"  
453 - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); 498 + ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/"
  499 + + dateTime + "-" + lineName + "-运营服务阶段报表.xls");
454 } catch (Exception e) { 500 } catch (Exception e) {
455 e.printStackTrace(); 501 e.printStackTrace();
456 } 502 }
@@ -460,7 +506,8 @@ public class ExportController { @@ -460,7 +506,8 @@ public class ExportController {
460 // 换人换车情况日统计 506 // 换人换车情况日统计
461 @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST) 507 @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST)
462 public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) { 508 public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) {
463 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 509 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  510 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
464 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 511 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
465 ReportUtils ee = new ReportUtils(); 512 ReportUtils ee = new ReportUtils();
466 List<Changetochange> changetochange = formsService.changetochange(map); 513 List<Changetochange> changetochange = formsService.changetochange(map);
@@ -484,10 +531,23 @@ public class ExportController { @@ -484,10 +531,23 @@ public class ExportController {
484 } 531 }
485 532
486 try { 533 try {
  534 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  535 + if(map.containsKey("startDate"))
  536 + startDate = map.get("startDate").toString();
  537 + if(map.containsKey("endDate"))
  538 + endDate = map.get("endDate").toString();
  539 + if(map.containsKey("lineName"))
  540 + lineName = map.get("lineName").toString();
  541 + if(startDate.equals(endDate)){
  542 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  543 + } else {
  544 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  545 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  546 + }
487 listI.add(resList.iterator()); 547 listI.add(resList.iterator());
488 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 548 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
489 - ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/换人换车情况日统计"  
490 - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); 549 + ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/"
  550 + + dateTime + "-" + lineName + "-换人换车情况日统计.xls");
491 } catch (Exception e) { 551 } catch (Exception e) {
492 e.printStackTrace(); 552 e.printStackTrace();
493 } 553 }
@@ -497,7 +557,8 @@ public class ExportController { @@ -497,7 +557,8 @@ public class ExportController {
497 // 营运线路出车率统计表 557 // 营运线路出车率统计表
498 @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST) 558 @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST)
499 public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) { 559 public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) {
500 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); 560 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  561 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
501 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 562 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
502 ReportUtils ee = new ReportUtils(); 563 ReportUtils ee = new ReportUtils();
503 Map<String, Object> map1 = new HashMap<String, Object>(); 564 Map<String, Object> map1 = new HashMap<String, Object>();
@@ -517,10 +578,23 @@ public class ExportController { @@ -517,10 +578,23 @@ public class ExportController {
517 resList.remove(m); 578 resList.remove(m);
518 579
519 try { 580 try {
  581 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  582 + if(map.containsKey("startDate"))
  583 + startDate = map.get("startDate").toString();
  584 + if(map.containsKey("endDate"))
  585 + endDate = map.get("endDate").toString();
  586 + if(map.containsKey("lineName"))
  587 + lineName = map.get("lineName").toString();
  588 + if(startDate.equals(endDate)){
  589 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  590 + } else {
  591 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  592 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  593 + }
520 listI.add(resList.iterator()); 594 listI.add(resList.iterator());
521 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 595 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
522 - ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/营运线路出车率统计表"  
523 - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); 596 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/"
  597 + + dateTime + "-" + lineName + "-营运线路出车率统计表.xls");
524 } catch (Exception e) { 598 } catch (Exception e) {
525 e.printStackTrace(); 599 e.printStackTrace();
526 } 600 }
@@ -713,10 +787,13 @@ public class ExportController { @@ -713,10 +787,13 @@ public class ExportController {
713 m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString())); 787 m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString()));
714 m.put("date", map.get("date").toString()); 788 m.put("date", map.get("date").toString());
715 try { 789 try {
  790 + String lineName = map.get("lineName").toString();
  791 + String date = map.get("date").toString();
716 listI.add(resList.iterator()); 792 listI.add(resList.iterator());
717 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 793 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
718 - ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls", path + "export/班次日报表"  
719 - + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); 794 + ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls",
  795 + path + "export/" + sdfSimple.format(sdfMonth.parse(date))
  796 + + "-" + lineName + "-班次日报表.xls");
720 } catch (Exception e) { 797 } catch (Exception e) {
721 e.printStackTrace(); 798 e.printStackTrace();
722 } 799 }
src/main/java/com/bsth/controller/report/ReportController.java
1 package com.bsth.controller.report; 1 package com.bsth.controller.report;
2 2
  3 +import java.text.SimpleDateFormat;
3 import java.util.ArrayList; 4 import java.util.ArrayList;
4 import java.util.HashMap; 5 import java.util.HashMap;
5 import java.util.Iterator; 6 import java.util.Iterator;
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
15 16
16 import com.alibaba.fastjson.JSONArray; 17 import com.alibaba.fastjson.JSONArray;
17 import com.alibaba.fastjson.JSONObject; 18 import com.alibaba.fastjson.JSONObject;
  19 +import com.bsth.data.BasicData;
18 import com.bsth.entity.StationRoute; 20 import com.bsth.entity.StationRoute;
19 import com.bsth.entity.excep.ArrivalInfo; 21 import com.bsth.entity.excep.ArrivalInfo;
20 import com.bsth.entity.realcontrol.ScheduleRealInfo; 22 import com.bsth.entity.realcontrol.ScheduleRealInfo;
@@ -51,6 +53,7 @@ public class ReportController { @@ -51,6 +53,7 @@ public class ReportController {
51 Map<String, Object> m = new HashMap<String, Object>(); 53 Map<String, Object> m = new HashMap<String, Object>();
52 m.put("i", i); 54 m.put("i", i);
53 m.put("nbbm", a.getNbbm()); 55 m.put("nbbm", a.getNbbm());
  56 + m.put("pzh", a.getPzh());
54 m.put("stopName", a.getStopName()); 57 m.put("stopName", a.getStopName());
55 m.put("jzsj", a.getJzsj()); 58 m.put("jzsj", a.getJzsj());
56 m.put("czsj", a.getCzsj()); 59 m.put("czsj", a.getCzsj());
@@ -65,13 +68,15 @@ public class ReportController { @@ -65,13 +68,15 @@ public class ReportController {
65 resList.add(m); 68 resList.add(m);
66 i++; 69 i++;
67 } 70 }
68 -  
69 try { 71 try {
  72 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  73 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
70 Map<String, Object> map=new HashMap<String, Object>(); 74 Map<String, Object> map=new HashMap<String, Object>();
71 listI.add(resList.iterator()); 75 listI.add(resList.iterator());
72 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 76 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
73 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls", 77 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
74 - path + "export/班次到离站.xls"); 78 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  79 + +"-"+clzbh+"-班次到离站.xls");
75 } catch (Exception e) { 80 } catch (Exception e) {
76 e.printStackTrace(); 81 e.printStackTrace();
77 } 82 }
@@ -138,11 +143,23 @@ public class ReportController { @@ -138,11 +143,23 @@ public class ReportController {
138 } 143 }
139 144
140 try { 145 try {
  146 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  147 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  148 + String lineName = BasicData.lineCode2NameMap.get(line);
  149 + String dateTime = "", startDate = "", endDate = "";
  150 + startDate = fcsj.substring(0, 10);
  151 + endDate = ddsj.substring(0, 10);
  152 + if(startDate.equals(endDate)){
  153 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  154 + } else {
  155 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  156 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  157 + }
141 Map<String, Object> map=new HashMap<String, Object>(); 158 Map<String, Object> map=new HashMap<String, Object>();
142 listI.add(resList.iterator()); 159 listI.add(resList.iterator());
143 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 160 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
144 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls", 161 ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls",
145 - path + "export/班次到离站.xls"); 162 + path + "export/"+dateTime+"-"+lineName+"-班次到离站.xls");
146 } catch (Exception e) { 163 } catch (Exception e) {
147 e.printStackTrace(); 164 e.printStackTrace();
148 } 165 }
@@ -186,11 +203,14 @@ public class ReportController { @@ -186,11 +203,14 @@ public class ReportController {
186 lgqlList.add(newMap); 203 lgqlList.add(newMap);
187 } 204 }
188 try { 205 try {
  206 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  207 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
189 listI.add(fwqlList.iterator()); 208 listI.add(fwqlList.iterator());
190 listI.add(lgqlList.iterator()); 209 listI.add(lgqlList.iterator());
191 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 210 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
192 ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls", 211 ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls",
193 - path + "export/调度员工作汇总日报.xls"); 212 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  213 + +"-"+lineName+"-调度员工作汇总日报.xls");
194 } catch (Exception e) { 214 } catch (Exception e) {
195 e.printStackTrace(); 215 e.printStackTrace();
196 } 216 }
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
@@ -8,6 +8,7 @@ import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; @@ -8,6 +8,7 @@ import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; 8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
9 import com.bsth.service.schedule.timetable.ExcelFormatType; 9 import com.bsth.service.schedule.timetable.ExcelFormatType;
10 import com.bsth.service.schedule.utils.DataToolsFile; 10 import com.bsth.service.schedule.utils.DataToolsFile;
  11 +import com.bsth.service.schedule.utils.DataToolsFileType;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*; 13 import org.springframework.web.bind.annotation.*;
13 14
@@ -128,11 +129,19 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -128,11 +129,19 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
128 } 129 }
129 130
130 131
131 - @RequestMapping(value = "/exportDTDFile", method = RequestMethod.POST) 132 + @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST)
132 public void exportFile( 133 public void exportFile(
133 - @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, 134 + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, @PathVariable("type") String type,
134 HttpServletResponse response) throws Exception { 135 HttpServletResponse response) throws Exception {
135 - DataToolsFile dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos); 136 + DataToolsFile dataToolsFile = null;
  137 + if ("xls".equals(type)) {
  138 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLS);
  139 + } else if ("xlsx".equals(type)) {
  140 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLSX);
  141 + } else {
  142 + throw new Exception("未知的导出格式==>" + type);
  143 + }
  144 +
136 // 流输出导出文件 145 // 流输出导出文件
137 response.setHeader("content-type", "application/octet-stream"); 146 response.setHeader("content-type", "application/octet-stream");
138 response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); 147 response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
src/main/java/com/bsth/data/BasicData.java
@@ -28,7 +28,7 @@ public class BasicData { @@ -28,7 +28,7 @@ public class BasicData {
28 //公司代码和公司名对照(K: 公司编码,V:公司名) 28 //公司代码和公司名对照(K: 公司编码,V:公司名)
29 public static Map<String, String> businessCodeNameMap; 29 public static Map<String, String> businessCodeNameMap;
30 30
31 - //分公司公司代码和分公司公司名对照(K: 公司编码_分公司编码,V:分公司公司名) 31 + //分公司公司代码和分公司公司名对照(K: 分公司编码_公司编码,V:分公司公司名)
32 public static Map<String, String> businessFgsCodeNameMap; 32 public static Map<String, String> businessFgsCodeNameMap;
33 33
34 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) 34 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
@@ -37,7 +37,7 @@ public class BasicData { @@ -37,7 +37,7 @@ public class BasicData {
37 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) 37 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)
38 public static Map<String, String> nbbm2CompanyCodeMap; 38 public static Map<String, String> nbbm2CompanyCodeMap;
39 39
40 - //车辆自编号和分公司代码对照 (K: 车辆自编号 ,V:公司代码_分公司代码) 40 + //车辆自编号和分公司代码对照 (K: 车辆自编号 ,V:分公司编码_公司编码)
41 public static Map<String, String> nbbm2FgsCompanyCodeMap; 41 public static Map<String, String> nbbm2FgsCompanyCodeMap;
42 42
43 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号) 43 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号)
@@ -206,7 +206,7 @@ public class BasicData { @@ -206,7 +206,7 @@ public class BasicData {
206 car = carIterator.next(); 206 car = carIterator.next();
207 deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); 207 deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode());
208 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); 208 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());
209 - nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBusinessCode() + "_" + car.getBrancheCompanyCode()); 209 + nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() );
210 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); 210 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate());
211 } 211 }
212 212
@@ -256,6 +256,8 @@ public class BasicData { @@ -256,6 +256,8 @@ public class BasicData {
256 CarConfigInfo cci; 256 CarConfigInfo cci;
257 while (allIterator.hasNext()) { 257 while (allIterator.hasNext()) {
258 cci = allIterator.next(); 258 cci = allIterator.next();
  259 + if(cci.getIsCancel())
  260 + continue;//排除已经报废的
259 ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); 261 ccMap.put(cci.getCl().getInsideCode(), cci.getXl());
260 } 262 }
261 nbbm2LineMap = ccMap; 263 nbbm2LineMap = ccMap;
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
@@ -142,7 +142,7 @@ public class DirectivesPstThread extends Thread { @@ -142,7 +142,7 @@ public class DirectivesPstThread extends Thread {
142 142
143 tran.commit(status); 143 tran.commit(status);
144 144
145 - logger.info("64 入库成功: " + d64s.size()); 145 + //logger.info("64 入库成功: " + d64s.size());
146 }catch (Exception e){ 146 }catch (Exception e){
147 tran.rollback(status); 147 tran.rollback(status);
148 logger.error("", e); 148 logger.error("", e);
@@ -192,7 +192,7 @@ public class DirectivesPstThread extends Thread { @@ -192,7 +192,7 @@ public class DirectivesPstThread extends Thread {
192 192
193 tran.commit(status); 193 tran.commit(status);
194 194
195 - logger.info("60 更新成功: " + d60s.size()); 195 + //logger.info("60 更新成功: " + d60s.size());
196 }catch (Exception e){ 196 }catch (Exception e){
197 tran.rollback(status); 197 tran.rollback(status);
198 logger.error("", e); 198 logger.error("", e);
@@ -266,7 +266,7 @@ public class DirectivesPstThread extends Thread { @@ -266,7 +266,7 @@ public class DirectivesPstThread extends Thread {
266 266
267 tran.commit(status); 267 tran.commit(status);
268 268
269 - logger.info("60 入库成功: " + d60s.size()); 269 + //logger.info("60 入库成功: " + d60s.size());
270 }catch (Exception e){ 270 }catch (Exception e){
271 tran.rollback(status); 271 tran.rollback(status);
272 logger.error("", e); 272 logger.error("", e);
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Component; @@ -21,6 +21,8 @@ import org.springframework.stereotype.Component;
21 import java.sql.ResultSet; 21 import java.sql.ResultSet;
22 import java.sql.SQLException; 22 import java.sql.SQLException;
23 import java.util.*; 23 import java.util.*;
  24 +import java.util.concurrent.ConcurrentHashMap;
  25 +import java.util.concurrent.ConcurrentMap;
24 26
25 /** 27 /**
26 * 空间数据缓存 28 * 空间数据缓存
@@ -38,7 +40,7 @@ public class GeoCacheData { @@ -38,7 +40,7 @@ public class GeoCacheData {
38 /** 40 /**
39 * 路段编码和名称对照 41 * 路段编码和名称对照
40 */ 42 */
41 - private static Map<String, String> sectionCode2Name; 43 + private static ConcurrentMap<String, String> sectionCode2Name;
42 /** 44 /**
43 * 线路站点路由 45 * 线路站点路由
44 */ 46 */
@@ -50,15 +52,15 @@ public class GeoCacheData { @@ -50,15 +52,15 @@ public class GeoCacheData {
50 /** 52 /**
51 * 线路_上下行_站点编码 ——> 站点 53 * 线路_上下行_站点编码 ——> 站点
52 */ 54 */
53 - private static Map<String, StationRoute> routeCodeMap; 55 + private static ConcurrentMap<String, StationRoute> routeCodeMap;
54 /** 56 /**
55 * 停车场 57 * 停车场
56 */ 58 */
57 - public static Map<String, Polygon> tccMap; 59 + public static ConcurrentMap<String, Polygon> tccMap;
58 /** 60 /**
59 * 线路限速信息 61 * 线路限速信息
60 */ 62 */
61 - private static Map<String, Double> speedLimitMap; 63 + private static ConcurrentMap<String, Double> speedLimitMap;
62 64
63 @Autowired 65 @Autowired
64 JdbcTemplate jdbcTemplate; 66 JdbcTemplate jdbcTemplate;
@@ -118,7 +120,7 @@ public class GeoCacheData { @@ -118,7 +120,7 @@ public class GeoCacheData {
118 //按线路和走向分组 120 //按线路和走向分组
119 if (routeList.size() > 0) { 121 if (routeList.size() > 0) {
120 ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create(); 122 ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create();
121 - Map<String, StationRoute> codeMap = new HashMap<>(routeList.size()); 123 + ConcurrentMap<String, StationRoute> codeMap = new ConcurrentHashMap<>(routeList.size());
122 for (StationRoute sr : routeList) { 124 for (StationRoute sr : routeList) {
123 tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr); 125 tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr);
124 //站点编码 ——> 和路由顺序对照 126 //站点编码 ——> 和路由顺序对照
@@ -141,7 +143,7 @@ public class GeoCacheData { @@ -141,7 +143,7 @@ public class GeoCacheData {
141 //加载停车场数据 143 //加载停车场数据
142 String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0"; 144 String sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null and destroy=0";
143 List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql); 145 List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql);
144 - Map<String, Polygon> tccTempMap = new HashMap<>(); 146 + ConcurrentMap<String, Polygon> tccTempMap = new ConcurrentHashMap<>();
145 147
146 Polygon polygon; 148 Polygon polygon;
147 for (Map<String, Object> tMap : tccList) { 149 for (Map<String, Object> tMap : tccList) {
@@ -163,7 +165,7 @@ public class GeoCacheData { @@ -163,7 +165,7 @@ public class GeoCacheData {
163 //加载线路限速信息 165 //加载线路限速信息
164 String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null"; 166 String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null";
165 List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql); 167 List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql);
166 - Map<String, Double> speedTempMap = new HashMap<>(); 168 + ConcurrentMap<String, Double> speedTempMap = new ConcurrentHashMap();
167 for (Map<String, Object> tMap : speedMap) { 169 for (Map<String, Object> tMap : speedMap) {
168 try { 170 try {
169 speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString())); 171 speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString()));
@@ -208,7 +210,7 @@ public class GeoCacheData { @@ -208,7 +210,7 @@ public class GeoCacheData {
208 if(sectionCacheTempMap.size() > 0) 210 if(sectionCacheTempMap.size() > 0)
209 sectionCacheMap = sectionCacheTempMap; 211 sectionCacheMap = sectionCacheTempMap;
210 212
211 - Map<String, String> sectionCode2NameTemp = new HashMap<>(); 213 + ConcurrentMap<String, String> sectionCode2NameTemp = new ConcurrentHashMap<>();
212 214
213 //加载全量路段编码和名称对照 215 //加载全量路段编码和名称对照
214 sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section"; 216 sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section";
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
@@ -37,8 +37,8 @@ public class SafeDrivDataLoadThread extends Thread{ @@ -37,8 +37,8 @@ public class SafeDrivDataLoadThread extends Thread{
37 httpClient = HttpClients.createDefault(); 37 httpClient = HttpClients.createDefault();
38 get = new HttpGet(url); 38 get = new HttpGet(url);
39 requestConfig = RequestConfig.custom() 39 requestConfig = RequestConfig.custom()
40 - .setConnectTimeout(2500).setConnectionRequestTimeout(2000)  
41 - .setSocketTimeout(2500).build(); 40 + .setConnectTimeout(5500).setConnectionRequestTimeout(5000)
  41 + .setSocketTimeout(5500).build();
42 get.setConfig(requestConfig); 42 get.setConfig(requestConfig);
43 } 43 }
44 44
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -38,6 +38,7 @@ import java.text.SimpleDateFormat; @@ -38,6 +38,7 @@ import java.text.SimpleDateFormat;
38 import java.util.*; 38 import java.util.*;
39 import java.util.concurrent.ConcurrentHashMap; 39 import java.util.concurrent.ConcurrentHashMap;
40 import java.util.concurrent.ConcurrentLinkedQueue; 40 import java.util.concurrent.ConcurrentLinkedQueue;
  41 +import java.util.concurrent.ConcurrentMap;
41 42
42 /** 43 /**
43 * @author PanZhao 44 * @author PanZhao
@@ -63,10 +64,10 @@ public class DayOfSchedule { @@ -63,10 +64,10 @@ public class DayOfSchedule {
63 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; 64 private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap;
64 65
65 // 班次主键映射 66 // 班次主键映射
66 - private static Map<Long, ScheduleRealInfo> id2SchedulMap; 67 + private static ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMap;
67 68
68 //车辆 ——> 当前执行班次 69 //车辆 ——> 当前执行班次
69 - private static Map<String, ScheduleRealInfo> carExecutePlanMap; 70 + private static ConcurrentMap<String, ScheduleRealInfo> carExecutePlanMap;
70 71
71 // 持久化 72 // 持久化
72 public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer; 73 public static ConcurrentLinkedQueue<ScheduleRealInfo> pstBuffer;
@@ -1098,7 +1099,7 @@ public class DayOfSchedule { @@ -1098,7 +1099,7 @@ public class DayOfSchedule {
1098 */ 1099 */
1099 public int reCalcIdMaps(){ 1100 public int reCalcIdMaps(){
1100 Collection<ScheduleRealInfo> all = findAll(); 1101 Collection<ScheduleRealInfo> all = findAll();
1101 - Map<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>(); 1102 + ConcurrentMap<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>();
1102 1103
1103 for(ScheduleRealInfo sch : all){ 1104 for(ScheduleRealInfo sch : all){
1104 id2SchedulMapCopy.put(sch.getId(), sch); 1105 id2SchedulMapCopy.put(sch.getId(), sch);
src/main/java/com/bsth/data/schedule/e_state_check/ScheduleStationCodeChecker.java
@@ -32,13 +32,17 @@ public class ScheduleStationCodeChecker { @@ -32,13 +32,17 @@ public class ScheduleStationCodeChecker {
32 @Autowired 32 @Autowired
33 JdbcTemplate jdbcTemplate; 33 JdbcTemplate jdbcTemplate;
34 34
35 - Logger logger = LoggerFactory.getLogger(this.getClass()); 35 + static Logger logger = LoggerFactory.getLogger(ScheduleStationCodeChecker.class);
36 36
37 public static List<SCodeInfo> findByLineIdx(List<String> lineArray){ 37 public static List<SCodeInfo> findByLineIdx(List<String> lineArray){
38 List<SCodeInfo> rs = new ArrayList<>(); 38 List<SCodeInfo> rs = new ArrayList<>();
39 39
40 - for(String coed : lineArray){  
41 - rs.addAll(multimap.get(coed)); 40 + try{
  41 + for(String coed : lineArray){
  42 + rs.addAll(multimap.get(coed));
  43 + }
  44 + }catch (Exception e){
  45 + logger.error("", e);
42 } 46 }
43 return rs; 47 return rs;
44 } 48 }
@@ -116,13 +120,13 @@ public class ScheduleStationCodeChecker { @@ -116,13 +120,13 @@ public class ScheduleStationCodeChecker {
116 120
117 121
118 private Map<String, SCodeInfo> allRealCodeInfo() { 122 private Map<String, SCodeInfo> allRealCodeInfo() {
119 - String sql = "select line_code,directions as up_down,station_code as real_station_code,station_name from bsth_c_stationroute where line in (select id from bsth_c_line where destroy=0)"; 123 + String sql = "select line_code,directions as up_down,station_code as real_station_code,station_name from bsth_c_stationroute where line in (select id from bsth_c_line where destroy=0) and destroy=0";
120 List<SCodeInfo> realList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SCodeInfo.class)); 124 List<SCodeInfo> realList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SCodeInfo.class));
121 Map<String, SCodeInfo> realMap = new HashMap<>(); 125 Map<String, SCodeInfo> realMap = new HashMap<>();
122 126
123 for (SCodeInfo sci : realList) { 127 for (SCodeInfo sci : realList) {
124 realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationName(), sci); 128 realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationName(), sci);
125 - realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getStationCode(), sci); 129 + realMap.put(sci.getLineCode() + "_" + sci.getUpDown() + "_" + sci.getRealStationCode(), sci);
126 } 130 }
127 131
128 return realMap; 132 return realMap;
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -9,6 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -9,6 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.util.Arith; 9 import com.bsth.util.Arith;
10 import com.bsth.websocket.handler.SendUtils; 10 import com.bsth.websocket.handler.SendUtils;
11 import com.google.common.collect.ArrayListMultimap; 11 import com.google.common.collect.ArrayListMultimap;
  12 +import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 13 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.BeansException; 15 import org.springframework.beans.BeansException;
@@ -64,12 +65,14 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -64,12 +65,14 @@ public class LateAdjustHandle implements ApplicationContextAware{
64 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ 65 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){
65 66
66 ScheduleRealInfo old = popLateSch(sch); 67 ScheduleRealInfo old = popLateSch(sch);
67 - if(null != old){ 68 +
  69 + //班次被压入
  70 + if(lateSchMaps.containsEntry(sch.getClZbh(), sch)){
  71 +
  72 + logger.info("【应发未到 -多个("+lateSchMaps.get(sch.getClZbh()).size()+")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
68 //通知客户端 73 //通知客户端
69 sch.setLate2(true); 74 sch.setLate2(true);
70 sendUtils.sendAutoWdtz(sch, old); 75 sendUtils.sendAutoWdtz(sch, old);
71 -  
72 - logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");  
73 } 76 }
74 } 77 }
75 78
@@ -84,15 +87,17 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -84,15 +87,17 @@ public class LateAdjustHandle implements ApplicationContextAware{
84 * @return 返回被移除的误点班次 87 * @return 返回被移除的误点班次
85 */ 88 */
86 private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) { 89 private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) {
87 - List<ScheduleRealInfo> list = lateSchMaps.get(sch.getXlBm()); 90 + List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh());
88 91
89 if(null == list || list.size() == 0) 92 if(null == list || list.size() == 0)
90 lateSchMaps.put(sch.getClZbh(), sch); 93 lateSchMaps.put(sch.getClZbh(), sch);
91 else { 94 else {
92 ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName()); 95 ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName());
93 96
94 - //同一个起点,保留时间最大的班次  
95 - if(null == old || old.getDfsjT() < sch.getDfsjT()){ 97 + if(null == old)
  98 + lateSchMaps.put(sch.getClZbh(), sch);
  99 + else if(old.getDfsjT() < sch.getDfsjT()){
  100 + //同一个起点,保留时间最大的班次
96 lateSchMaps.remove(old.getClZbh(), old); 101 lateSchMaps.remove(old.getClZbh(), old);
97 lateSchMaps.put(sch.getClZbh(), sch); 102 lateSchMaps.put(sch.getClZbh(), sch);
98 103
@@ -155,8 +160,12 @@ public class LateAdjustHandle implements ApplicationContextAware{ @@ -155,8 +160,12 @@ public class LateAdjustHandle implements ApplicationContextAware{
155 return; 160 return;
156 161
157 String key = gps.getStopNo(); 162 String key = gps.getStopNo();
158 - if(gps.getInstation()==1)//站点名称  
159 - key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo(); 163 + if(gps.getInstation()==1){
  164 + if(StringUtils.isNotEmpty(gps.getCarparkNo()))
  165 + key = gps.getCarparkNo();//停车场名称
  166 + else
  167 + key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo();//站点名称
  168 + }
160 169
161 gps.setStationName(BasicData.stationCode2NameMap.get(key)); 170 gps.setStationName(BasicData.stationCode2NameMap.get(key));
162 //根据起点站获取误点班次 171 //根据起点站获取误点班次
src/main/java/com/bsth/data/schedule/thread/SubmitToTrafficManage.java
@@ -25,36 +25,48 @@ public class SubmitToTrafficManage extends Thread{ @@ -25,36 +25,48 @@ public class SubmitToTrafficManage extends Thread{
25 @Override 25 @Override
26 public void run() { 26 public void run() {
27 logger.info("开始提交数据到运管处..."); 27 logger.info("开始提交数据到运管处...");
28 -  
29 - try {  
30 - //路单  
31 - trafficManageService.setLD();  
32 - } catch (Exception e) {  
33 - logger.error("提交路单到运管处失败", e); 28 + boolean isContinue = true;
  29 + // 上传路单,如果接口异常,会自动重传
  30 + while (isContinue){
  31 + try {
  32 + //路单
  33 + trafficManageService.setLD();
  34 + isContinue = false;
  35 + } catch (Exception e) {
  36 + logger.error("提交路单到运管处失败", e);
  37 + try {
  38 + // 如果出现异常,程序暂停60分钟后再重新执行
  39 + Thread.sleep(60 * 60 * 1000);
  40 + } catch (Exception ex) { }
  41 + }
34 } 42 }
35 - try {  
36 - //车辆里程、油耗  
37 - trafficManageService.setLCYH();  
38 - } catch (Exception e) {  
39 - logger.error("提交车辆里程、油耗到运管处失败", e);  
40 - }  
41 - try {  
42 - //线路调度日报  
43 - trafficManageService.setDDRB();  
44 - } catch (Exception e) {  
45 - logger.error("提交线路调度日报到运管处失败", e);  
46 - }  
47 - try {  
48 - //线路计划班次表  
49 - trafficManageService.setJHBC();  
50 - } catch (Exception e) {  
51 - logger.error("提交线路计划班次表到运管处失败", e);  
52 - }  
53 - try {  
54 - // 运管处基础数据更新  
55 - ygcBasicDataService.updateYgcBasicData();  
56 - } catch (Exception e) {  
57 - logger.error("运管处基础数据更新失败", e); 43 +
  44 + // 路单上传成功后,再上传其他数据
  45 + if(!isContinue){
  46 + try {
  47 + //车辆里程、油耗
  48 + trafficManageService.setLCYH();
  49 + } catch (Exception e) {
  50 + logger.error("提交车辆里程、油耗到运管处失败", e);
  51 + }
  52 + try {
  53 + //线路调度日报
  54 + trafficManageService.setDDRB();
  55 + } catch (Exception e) {
  56 + logger.error("提交线路调度日报到运管处失败", e);
  57 + }
  58 + try {
  59 + //线路计划班次表
  60 + trafficManageService.setJHBC();
  61 + } catch (Exception e) {
  62 + logger.error("提交线路计划班次表到运管处失败", e);
  63 + }
  64 + try {
  65 + // 运管处基础数据更新
  66 + ygcBasicDataService.updateYgcBasicData();
  67 + } catch (Exception e) {
  68 + logger.error("运管处基础数据更新失败", e);
  69 + }
58 } 70 }
59 logger.info("提交数据到运管处结束!"); 71 logger.info("提交数据到运管处结束!");
60 } 72 }
src/main/java/com/bsth/entity/calc/CalcBusMileage.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "calc_bus_mileage")
  12 +public class CalcBusMileage {
  13 + /* 主键*/
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 + /* 日期*/
  18 + private Date date;
  19 + /* 日期字符串*/
  20 + private String dateStr;
  21 + /* 线路编码*/
  22 + private String xl;
  23 + /* 线路名称*/
  24 + private String xlName;
  25 + /* 公司代码*/
  26 + private String gsdm;
  27 + /* 公司名称*/
  28 + private String gsName;
  29 + /* 分公司代码*/
  30 + private String fgsdm;
  31 + /* 分公司名称*/
  32 + private String fgsName;
  33 + /* 车号*/
  34 + private String nbbm;
  35 + /* 司机职号*/
  36 + private String jGh;
  37 + /* 司机姓名*/
  38 + private String jName;
  39 + /* 售票员职号*/
  40 + private String sGh;
  41 + /* 售票员姓名*/
  42 + private String sName;
  43 + /* 行驶里程(包括空放)*/
  44 + private Double zlc;
  45 + /* 计划内营运里程*/
  46 + private Double jhnlc;
  47 + /* 临时性多样化调度营运里程*/
  48 + private Double jhwlc;
  49 + /* 计划内进出场空驶*/
  50 + private Double jhnjcclc;
  51 + /* 计划外进出场空驶*/
  52 + private Double jhwjcclc;
  53 + /* 计划外进出场空驶_*/
  54 + private Double jhwjcclcz;
  55 + /* 空放空驶*/
  56 + private Double kfks;
  57 + /* 故障进出场空驶*/
  58 + private Double zrwjcclc;
  59 + /* 肇事进出场空驶*/
  60 + private Double zrwjcclc1;
  61 + /* 纠纷进出场空驶*/
  62 + private Double zrwjcclc2;
  63 + /* 其他进出场空驶*/
  64 + private Double zrwjcclcqt;
  65 + /* 临加营运公里*/
  66 + private Double ljyy;
  67 + /* 临加进出场空驶*/
  68 + private Double ljjcc;
  69 + /* 临加空放空驶*/
  70 + private Double ljkfks;
  71 + /* 电耗量*/
  72 + private Double dhl;
  73 + /* 加电量*/
  74 + private Double cdl;
  75 + /* 耗油量*/
  76 + private Double yhl;
  77 + /* 加注量*/
  78 + private Double jzl;
  79 + /* 非营业用油*/
  80 + private Double hyl;
  81 + /* 计划总公里*/
  82 + private Double jhzlc;
  83 + /* 备注*/
  84 + private String remark;
  85 + /* 创建时间*/
  86 + private Date createDate;
  87 +
  88 + public Long getId() {
  89 + return id;
  90 + }
  91 + public void setId(Long id) {
  92 + this.id = id;
  93 + }
  94 + public Date getDate() {
  95 + return date;
  96 + }
  97 + public void setDate(Date date) {
  98 + this.date = date;
  99 + }
  100 + public String getDateStr() {
  101 + return dateStr;
  102 + }
  103 + public void setDateStr(String dateStr) {
  104 + this.dateStr = dateStr;
  105 + }
  106 + public String getXl() {
  107 + return xl;
  108 + }
  109 + public void setXl(String xl) {
  110 + this.xl = xl;
  111 + }
  112 + public String getXlName() {
  113 + return xlName;
  114 + }
  115 + public void setXlName(String xlName) {
  116 + this.xlName = xlName;
  117 + }
  118 + public String getGsdm() {
  119 + return gsdm;
  120 + }
  121 + public void setGsdm(String gsdm) {
  122 + this.gsdm = gsdm;
  123 + }
  124 + public String getGsName() {
  125 + return gsName;
  126 + }
  127 + public void setGsName(String gsName) {
  128 + this.gsName = gsName;
  129 + }
  130 + public String getFgsdm() {
  131 + return fgsdm;
  132 + }
  133 + public void setFgsdm(String fgsdm) {
  134 + this.fgsdm = fgsdm;
  135 + }
  136 + public String getFgsName() {
  137 + return fgsName;
  138 + }
  139 + public void setFgsName(String fgsName) {
  140 + this.fgsName = fgsName;
  141 + }
  142 + public String getNbbm() {
  143 + return nbbm;
  144 + }
  145 + public void setNbbm(String nbbm) {
  146 + this.nbbm = nbbm;
  147 + }
  148 + public String getjGh() {
  149 + return jGh;
  150 + }
  151 + public void setjGh(String jGh) {
  152 + this.jGh = jGh;
  153 + }
  154 + public String getjName() {
  155 + return jName;
  156 + }
  157 + public void setjName(String jName) {
  158 + this.jName = jName;
  159 + }
  160 + public String getsGh() {
  161 + return sGh;
  162 + }
  163 + public void setsGh(String sGh) {
  164 + this.sGh = sGh;
  165 + }
  166 + public String getsName() {
  167 + return sName;
  168 + }
  169 + public void setsName(String sName) {
  170 + this.sName = sName;
  171 + }
  172 + public Double getZlc() {
  173 + return zlc;
  174 + }
  175 + public void setZlc(Double zlc) {
  176 + this.zlc = zlc;
  177 + }
  178 + public Double getJhnlc() {
  179 + return jhnlc;
  180 + }
  181 + public void setJhnlc(Double jhnlc) {
  182 + this.jhnlc = jhnlc;
  183 + }
  184 + public Double getJhwlc() {
  185 + return jhwlc;
  186 + }
  187 + public void setJhwlc(Double jhwlc) {
  188 + this.jhwlc = jhwlc;
  189 + }
  190 + public Double getJhnjcclc() {
  191 + return jhnjcclc;
  192 + }
  193 + public void setJhnjcclc(Double jhnjcclc) {
  194 + this.jhnjcclc = jhnjcclc;
  195 + }
  196 + public Double getJhwjcclc() {
  197 + return jhwjcclc;
  198 + }
  199 + public void setJhwjcclc(Double jhwjcclc) {
  200 + this.jhwjcclc = jhwjcclc;
  201 + }
  202 + public Double getJhwjcclcz() {
  203 + return jhwjcclcz;
  204 + }
  205 + public void setJhwjcclcz(Double jhwjcclcz) {
  206 + this.jhwjcclcz = jhwjcclcz;
  207 + }
  208 + public Double getKfks() {
  209 + return kfks;
  210 + }
  211 + public void setKfks(Double kfks) {
  212 + this.kfks = kfks;
  213 + }
  214 + public Double getZrwjcclc() {
  215 + return zrwjcclc;
  216 + }
  217 + public void setZrwjcclc(Double zrwjcclc) {
  218 + this.zrwjcclc = zrwjcclc;
  219 + }
  220 + public Double getZrwjcclc1() {
  221 + return zrwjcclc1;
  222 + }
  223 + public void setZrwjcclc1(Double zrwjcclc1) {
  224 + this.zrwjcclc1 = zrwjcclc1;
  225 + }
  226 + public Double getZrwjcclc2() {
  227 + return zrwjcclc2;
  228 + }
  229 + public void setZrwjcclc2(Double zrwjcclc2) {
  230 + this.zrwjcclc2 = zrwjcclc2;
  231 + }
  232 + public Double getZrwjcclcqt() {
  233 + return zrwjcclcqt;
  234 + }
  235 + public void setZrwjcclcqt(Double zrwjcclcqt) {
  236 + this.zrwjcclcqt = zrwjcclcqt;
  237 + }
  238 + public Double getLjyy() {
  239 + return ljyy;
  240 + }
  241 + public void setLjyy(Double ljyy) {
  242 + this.ljyy = ljyy;
  243 + }
  244 + public Double getLjjcc() {
  245 + return ljjcc;
  246 + }
  247 + public void setLjjcc(Double ljjcc) {
  248 + this.ljjcc = ljjcc;
  249 + }
  250 + public Double getLjkfks() {
  251 + return ljkfks;
  252 + }
  253 + public void setLjkfks(Double ljkfks) {
  254 + this.ljkfks = ljkfks;
  255 + }
  256 + public Double getDhl() {
  257 + return dhl;
  258 + }
  259 + public void setDhl(Double dhl) {
  260 + this.dhl = dhl;
  261 + }
  262 + public Double getCdl() {
  263 + return cdl;
  264 + }
  265 + public void setCdl(Double cdl) {
  266 + this.cdl = cdl;
  267 + }
  268 + public Double getYhl() {
  269 + return yhl;
  270 + }
  271 + public void setYhl(Double yhl) {
  272 + this.yhl = yhl;
  273 + }
  274 + public Double getJzl() {
  275 + return jzl;
  276 + }
  277 + public void setJzl(Double jzl) {
  278 + this.jzl = jzl;
  279 + }
  280 + public Double getHyl() {
  281 + return hyl;
  282 + }
  283 + public void setHyl(Double hyl) {
  284 + this.hyl = hyl;
  285 + }
  286 + public Double getJhzlc() {
  287 + return jhzlc;
  288 + }
  289 + public void setJhzlc(Double jhzlc) {
  290 + this.jhzlc = jhzlc;
  291 + }
  292 + public String getRemark() {
  293 + return remark;
  294 + }
  295 + public void setRemark(String remark) {
  296 + this.remark = remark;
  297 + }
  298 + public Date getCreateDate() {
  299 + return createDate;
  300 + }
  301 + public void setCreateDate(Date createDate) {
  302 + this.createDate = createDate;
  303 + }
  304 +
  305 +}
src/main/java/com/bsth/entity/calc/CalcLineMileage.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "calc_line_mileage")
  12 +public class CalcLineMileage {
  13 + /* 主键*/
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 + /* 日期*/
  18 + private Date date;
  19 + /* 日期字符串*/
  20 + private String dateStr;
  21 + /* 线路编码*/
  22 + private String xl;
  23 + /* 线路名称*/
  24 + private String xlName;
  25 + /* 公司代码*/
  26 + private String gsdm;
  27 + /* 公司名称*/
  28 + private String gsName;
  29 + /* 分公司代码*/
  30 + private String fgsdm;
  31 + /* 分公司名称*/
  32 + private String fgsName;
  33 + /* 计划总里程*/
  34 + private Double jhzlc;
  35 + /* 计划营运程*/
  36 + private Double jhlc;
  37 + /* 计划空驶程*/
  38 + private Double jcclc;
  39 + /* 实际总里程*/
  40 + private Double sjzgl;
  41 + /* 计划内里程*/
  42 + private Double jhnlc;
  43 + /* 计划外里程*/
  44 + private Double jhwlc;
  45 + /* 计划内进出场空驶*/
  46 + private Double jhnjcclc;
  47 + /* 计划外进出场空驶*/
  48 + private Double jhwjcclc;
  49 + /* 计划外进出场空驶_*/
  50 + private Double jhwjcclcz;
  51 + /* 故障进出场空驶*/
  52 + private Double zrwjcclc;
  53 + /* 肇事进出场空驶*/
  54 + private Double zrwjcclc1;
  55 + /* 纠纷进出场空驶*/
  56 + private Double zrwjcclc2;
  57 + /* 其他进出场空驶*/
  58 + private Double zrwjcclcqt;
  59 + /* 空放 空驶*/
  60 + private Double kfks;
  61 + /* 少驶营运里程*/
  62 + private Double lbss;
  63 + /* 少驶 路阻*/
  64 + private Double ssglLz;
  65 + /* 少驶 吊慢*/
  66 + private Double ssglDm;
  67 + /* 少驶 故障*/
  68 + private Double ssglGz;
  69 + /* 少驶 纠纷*/
  70 + private Double ssglJf;
  71 + /* 少驶 肇事*/
  72 + private Double ssglZs;
  73 + /* 少驶 缺人*/
  74 + private Double ssglQr;
  75 + /* 少驶 缺车*/
  76 + private Double ssglQc;
  77 + /* 少驶 客稀*/
  78 + private Double ssglKx;
  79 + /* 少驶 气候*/
  80 + private Double ssglQh;
  81 + /* 少驶 援外*/
  82 + private Double ssglYw;
  83 + /* 少驶 其他*/
  84 + private Double ssglOther;
  85 + /* 临加营运公里*/
  86 + private Double ljyy;
  87 + /* 临加进出场空驶*/
  88 + private Double ljjcc;
  89 + /* 临加空放空驶*/
  90 + private Double ljkfks;
  91 + /* 备注*/
  92 + private String remark;
  93 + /* 创建时间*/
  94 + private Date createDate;
  95 +
  96 + public Long getId() {
  97 + return id;
  98 + }
  99 + public void setId(Long id) {
  100 + this.id = id;
  101 + }
  102 + public Date getDate() {
  103 + return date;
  104 + }
  105 + public void setDate(Date date) {
  106 + this.date = date;
  107 + }
  108 + public String getDateStr() {
  109 + return dateStr;
  110 + }
  111 + public void setDateStr(String dateStr) {
  112 + this.dateStr = dateStr;
  113 + }
  114 + public String getXl() {
  115 + return xl;
  116 + }
  117 + public void setXl(String xl) {
  118 + this.xl = xl;
  119 + }
  120 + public String getXlName() {
  121 + return xlName;
  122 + }
  123 + public void setXlName(String xlName) {
  124 + this.xlName = xlName;
  125 + }
  126 + public String getGsdm() {
  127 + return gsdm;
  128 + }
  129 + public void setGsdm(String gsdm) {
  130 + this.gsdm = gsdm;
  131 + }
  132 + public String getGsName() {
  133 + return gsName;
  134 + }
  135 + public void setGsName(String gsName) {
  136 + this.gsName = gsName;
  137 + }
  138 + public String getFgsdm() {
  139 + return fgsdm;
  140 + }
  141 + public void setFgsdm(String fgsdm) {
  142 + this.fgsdm = fgsdm;
  143 + }
  144 + public String getFgsName() {
  145 + return fgsName;
  146 + }
  147 + public void setFgsName(String fgsName) {
  148 + this.fgsName = fgsName;
  149 + }
  150 + public Double getJhzlc() {
  151 + return jhzlc;
  152 + }
  153 + public void setJhzlc(Double jhzlc) {
  154 + this.jhzlc = jhzlc;
  155 + }
  156 + public Double getJhlc() {
  157 + return jhlc;
  158 + }
  159 + public void setJhlc(Double jhlc) {
  160 + this.jhlc = jhlc;
  161 + }
  162 + public Double getJcclc() {
  163 + return jcclc;
  164 + }
  165 + public void setJcclc(Double jcclc) {
  166 + this.jcclc = jcclc;
  167 + }
  168 + public Double getSjzgl() {
  169 + return sjzgl;
  170 + }
  171 + public void setSjzgl(Double sjzgl) {
  172 + this.sjzgl = sjzgl;
  173 + }
  174 + public Double getJhnlc() {
  175 + return jhnlc;
  176 + }
  177 + public void setJhnlc(Double jhnlc) {
  178 + this.jhnlc = jhnlc;
  179 + }
  180 + public Double getJhwlc() {
  181 + return jhwlc;
  182 + }
  183 + public void setJhwlc(Double jhwlc) {
  184 + this.jhwlc = jhwlc;
  185 + }
  186 + public Double getJhnjcclc() {
  187 + return jhnjcclc;
  188 + }
  189 + public void setJhnjcclc(Double jhnjcclc) {
  190 + this.jhnjcclc = jhnjcclc;
  191 + }
  192 + public Double getJhwjcclc() {
  193 + return jhwjcclc;
  194 + }
  195 + public void setJhwjcclc(Double jhwjcclc) {
  196 + this.jhwjcclc = jhwjcclc;
  197 + }
  198 + public Double getJhwjcclcz() {
  199 + return jhwjcclcz;
  200 + }
  201 + public void setJhwjcclcz(Double jhwjcclcz) {
  202 + this.jhwjcclcz = jhwjcclcz;
  203 + }
  204 + public Double getZrwjcclc() {
  205 + return zrwjcclc;
  206 + }
  207 + public void setZrwjcclc(Double zrwjcclc) {
  208 + this.zrwjcclc = zrwjcclc;
  209 + }
  210 + public Double getZrwjcclc1() {
  211 + return zrwjcclc1;
  212 + }
  213 + public void setZrwjcclc1(Double zrwjcclc1) {
  214 + this.zrwjcclc1 = zrwjcclc1;
  215 + }
  216 + public Double getZrwjcclc2() {
  217 + return zrwjcclc2;
  218 + }
  219 + public void setZrwjcclc2(Double zrwjcclc2) {
  220 + this.zrwjcclc2 = zrwjcclc2;
  221 + }
  222 + public Double getZrwjcclcqt() {
  223 + return zrwjcclcqt;
  224 + }
  225 + public void setZrwjcclcqt(Double zrwjcclcqt) {
  226 + this.zrwjcclcqt = zrwjcclcqt;
  227 + }
  228 + public Double getKfks() {
  229 + return kfks;
  230 + }
  231 + public void setKfks(Double kfks) {
  232 + this.kfks = kfks;
  233 + }
  234 + public Double getLbss() {
  235 + return lbss;
  236 + }
  237 + public void setLbss(Double lbss) {
  238 + this.lbss = lbss;
  239 + }
  240 + public Double getSsglLz() {
  241 + return ssglLz;
  242 + }
  243 + public void setSsglLz(Double ssglLz) {
  244 + this.ssglLz = ssglLz;
  245 + }
  246 + public Double getSsglDm() {
  247 + return ssglDm;
  248 + }
  249 + public void setSsglDm(Double ssglDm) {
  250 + this.ssglDm = ssglDm;
  251 + }
  252 + public Double getSsglGz() {
  253 + return ssglGz;
  254 + }
  255 + public void setSsglGz(Double ssglGz) {
  256 + this.ssglGz = ssglGz;
  257 + }
  258 + public Double getSsglJf() {
  259 + return ssglJf;
  260 + }
  261 + public void setSsglJf(Double ssglJf) {
  262 + this.ssglJf = ssglJf;
  263 + }
  264 + public Double getSsglZs() {
  265 + return ssglZs;
  266 + }
  267 + public void setSsglZs(Double ssglZs) {
  268 + this.ssglZs = ssglZs;
  269 + }
  270 + public Double getSsglQr() {
  271 + return ssglQr;
  272 + }
  273 + public void setSsglQr(Double ssglQr) {
  274 + this.ssglQr = ssglQr;
  275 + }
  276 + public Double getSsglQc() {
  277 + return ssglQc;
  278 + }
  279 + public void setSsglQc(Double ssglQc) {
  280 + this.ssglQc = ssglQc;
  281 + }
  282 + public Double getSsglKx() {
  283 + return ssglKx;
  284 + }
  285 + public void setSsglKx(Double ssglKx) {
  286 + this.ssglKx = ssglKx;
  287 + }
  288 + public Double getSsglQh() {
  289 + return ssglQh;
  290 + }
  291 + public void setSsglQh(Double ssglQh) {
  292 + this.ssglQh = ssglQh;
  293 + }
  294 + public Double getSsglYw() {
  295 + return ssglYw;
  296 + }
  297 + public void setSsglYw(Double ssglYw) {
  298 + this.ssglYw = ssglYw;
  299 + }
  300 + public Double getSsglOther() {
  301 + return ssglOther;
  302 + }
  303 + public void setSsglOther(Double ssglOther) {
  304 + this.ssglOther = ssglOther;
  305 + }
  306 + public Double getLjyy() {
  307 + return ljyy;
  308 + }
  309 + public void setLjyy(Double ljyy) {
  310 + this.ljyy = ljyy;
  311 + }
  312 + public Double getLjjcc() {
  313 + return ljjcc;
  314 + }
  315 + public void setLjjcc(Double ljjcc) {
  316 + this.ljjcc = ljjcc;
  317 + }
  318 + public Double getLjkfks() {
  319 + return ljkfks;
  320 + }
  321 + public void setLjkfks(Double ljkfks) {
  322 + this.ljkfks = ljkfks;
  323 + }
  324 + public String getRemark() {
  325 + return remark;
  326 + }
  327 + public void setRemark(String remark) {
  328 + this.remark = remark;
  329 + }
  330 + public Date getCreateDate() {
  331 + return createDate;
  332 + }
  333 + public void setCreateDate(Date createDate) {
  334 + this.createDate = createDate;
  335 + }
  336 +
  337 +}
src/main/java/com/bsth/repository/calc/CalcBusMileageRepository.java 0 → 100644
  1 +package com.bsth.repository.calc;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.transaction.Transactional;
  6 +
  7 +import com.bsth.entity.calc.CalcBusMileage;
  8 +import com.bsth.repository.BaseRepository;
  9 +
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +/**
  15 + *
  16 + */
  17 +@Repository
  18 +public interface CalcBusMileageRepository extends BaseRepository<CalcBusMileage, Integer>{
  19 +
  20 + //按照时间段统计,公司下线路
  21 + @Query(value="select DISTINCT c from CalcBusMileage c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.id")
  22 + List<CalcBusMileage> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
  23 +
  24 + //按照时间段统计,单条线路
  25 + @Query(value="select DISTINCT c from CalcBusMileage c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.id")
  26 + List<CalcBusMileage> selectByDateAndLineTj2(String line,String date,String date2);
  27 +
  28 + //按照日期和线路删除数据
  29 + @Modifying
  30 + @Transactional
  31 + @Query(value = "delete CalcBusMileage c where c.dateStr=?1 and c.xl=?2")
  32 + void deleteByDateAndLine(String date, String line);
  33 +
  34 + //按照日期删除数据
  35 + @Modifying
  36 + @Transactional
  37 + @Query(value = "delete CalcBusMileage c where c.dateStr=?1")
  38 + void deleteByDate(String date);
  39 +
  40 +}
src/main/java/com/bsth/repository/calc/CalcLineMileageRepository.java 0 → 100644
  1 +package com.bsth.repository.calc;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.transaction.Transactional;
  6 +
  7 +import com.bsth.entity.calc.CalcLineMileage;
  8 +import com.bsth.repository.BaseRepository;
  9 +
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +/**
  15 + *
  16 + */
  17 +@Repository
  18 +public interface CalcLineMileageRepository extends BaseRepository<CalcLineMileage, Integer>{
  19 +
  20 + //按照时间段统计,公司下线路
  21 + @Query(value="select DISTINCT c from CalcLineMileage c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.id")
  22 + List<CalcLineMileage> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
  23 +
  24 + //按照时间段统计,单条线路
  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);
  27 +
  28 + //按照日期和线路删除数据
  29 + @Modifying
  30 + @Transactional
  31 + @Query(value = "delete CalcLineMileage c where c.dateStr=?1 and c.xl=?2")
  32 + void deleteByDateAndLine(String date, String line);
  33 +
  34 + //按照日期删除数据
  35 + @Modifying
  36 + @Transactional
  37 + @Query(value = "delete CalcLineMileage c where c.dateStr=?1")
  38 + void deleteByDate(String date);
  39 +
  40 +}
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -59,8 +59,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -59,8 +59,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
59 .and().csrf().disable() 59 .and().csrf().disable()
60 //禁用匿名用户功能 60 //禁用匿名用户功能
61 .anonymous().disable() 61 .anonymous().disable()
62 - //允许同源 iframe  
63 - .headers().frameOptions().sameOrigin().httpStrictTransportSecurity().disable(); 62 + //允许 iframe
  63 + .headers().frameOptions().disable();
64 64
65 // 同时只保持一个回话 65 // 同时只保持一个回话
66 http.sessionManagement().maximumSessions(1) 66 http.sessionManagement().maximumSessions(1)
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -3,6 +3,8 @@ package com.bsth.service.calc; @@ -3,6 +3,8 @@ package com.bsth.service.calc;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
  6 +import com.bsth.entity.calc.CalcBusMileage;
  7 +import com.bsth.entity.calc.CalcLineMileage;
6 import com.bsth.entity.calc.CalcStatistics; 8 import com.bsth.entity.calc.CalcStatistics;
7 import com.bsth.entity.calc.CalcWaybill; 9 import com.bsth.entity.calc.CalcWaybill;
8 import com.bsth.service.BaseService; 10 import com.bsth.service.BaseService;
@@ -13,7 +15,7 @@ import com.bsth.service.BaseService; @@ -13,7 +15,7 @@ import com.bsth.service.BaseService;
13 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { 15 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> {
14 16
15 /** 17 /**
16 - * @param date 格式如:2018-03-30(留空""默认当前日期两天前 18 + * @param date 格式如:2018-03-30(留空""默认当前日期前第四天
17 * @param line (留空""默认全部线路) 19 * @param line (留空""默认全部线路)
18 */ 20 */
19 Map<String, Object> autoGenerate(String date, String line) throws Exception; 21 Map<String, Object> autoGenerate(String date, String line) throws Exception;
@@ -23,10 +25,19 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; { @@ -23,10 +25,19 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; {
23 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 25 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type);
24 26
25 /** 27 /**
26 - * @param rq 格式如:2018-03-22(留空""默认当前日期前天) 28 + * @param rq 格式如:2018-03-22(留空""默认当前日期前天)
27 * @param line (留空""默认全部线路) 29 * @param line (留空""默认全部线路)
28 */ 30 */
29 String calcDaily(String rq, String line) throws Exception; 31 String calcDaily(String rq, String line) throws Exception;
30 32
31 List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 33 List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type);
  34 +
  35 + Map<String, Object> calcLineMileage(String date, String line);
  36 +
  37 + Map<String, Object> calcBusMileage(String date, String line);
  38 +
  39 + List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line, String date, String date2, String xlName, String zt, String by, String type);
  40 +
  41 + List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type);
  42 +
32 } 43 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -18,13 +18,19 @@ import java.util.Set; @@ -18,13 +18,19 @@ import java.util.Set;
18 import javax.transaction.Transactional; 18 import javax.transaction.Transactional;
19 19
20 import com.bsth.common.ResponseCode; 20 import com.bsth.common.ResponseCode;
  21 +import com.bsth.entity.Line;
  22 +import com.bsth.entity.calc.CalcBusMileage;
21 import com.bsth.entity.calc.CalcInterval; 23 import com.bsth.entity.calc.CalcInterval;
  24 +import com.bsth.entity.calc.CalcLineMileage;
22 import com.bsth.entity.calc.CalcStatistics; 25 import com.bsth.entity.calc.CalcStatistics;
23 import com.bsth.entity.calc.CalcWaybill; 26 import com.bsth.entity.calc.CalcWaybill;
24 import com.bsth.entity.realcontrol.ChildTaskPlan; 27 import com.bsth.entity.realcontrol.ChildTaskPlan;
25 import com.bsth.entity.realcontrol.ScheduleRealInfo; 28 import com.bsth.entity.realcontrol.ScheduleRealInfo;
26 import com.bsth.entity.sys.Interval; 29 import com.bsth.entity.sys.Interval;
  30 +import com.bsth.repository.LineRepository;
  31 +import com.bsth.repository.calc.CalcBusMileageRepository;
27 import com.bsth.repository.calc.CalcIntervalRepository; 32 import com.bsth.repository.calc.CalcIntervalRepository;
  33 +import com.bsth.repository.calc.CalcLineMileageRepository;
28 import com.bsth.repository.calc.CalcStatisticsRepository; 34 import com.bsth.repository.calc.CalcStatisticsRepository;
29 import com.bsth.repository.calc.CalcWaybillRepository; 35 import com.bsth.repository.calc.CalcWaybillRepository;
30 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 36 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
@@ -32,6 +38,7 @@ import com.bsth.service.calc.CalcToolService; @@ -32,6 +38,7 @@ import com.bsth.service.calc.CalcToolService;
32 import com.bsth.service.calc.CalcWaybillService; 38 import com.bsth.service.calc.CalcWaybillService;
33 import com.bsth.service.impl.BaseServiceImpl; 39 import com.bsth.service.impl.BaseServiceImpl;
34 import com.bsth.service.report.CulateMileageService; 40 import com.bsth.service.report.CulateMileageService;
  41 +import com.bsth.service.report.ReportService;
35 import com.bsth.util.Arith; 42 import com.bsth.util.Arith;
36 import com.bsth.util.BatchSaveUtils; 43 import com.bsth.util.BatchSaveUtils;
37 import com.bsth.util.ReportUtils; 44 import com.bsth.util.ReportUtils;
@@ -62,6 +69,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -62,6 +69,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
62 private CalcStatisticsRepository calcStatisticsRepository; 69 private CalcStatisticsRepository calcStatisticsRepository;
63 70
64 @Autowired 71 @Autowired
  72 + private CalcLineMileageRepository calcLineMileageRepository;
  73 +
  74 + @Autowired
  75 + private CalcBusMileageRepository calcBusMileageRepository;
  76 +
  77 + @Autowired
65 private CalcToolService calcToolService; 78 private CalcToolService calcToolService;
66 79
67 @Autowired 80 @Autowired
@@ -69,7 +82,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -69,7 +82,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
69 82
70 @Autowired 83 @Autowired
71 private ScheduleRealInfoRepository scheduleRealInfoRepository; 84 private ScheduleRealInfoRepository scheduleRealInfoRepository;
  85 +
  86 + @Autowired
  87 + private LineRepository lineRepository;
72 88
  89 + @Autowired
  90 + private ReportService reportService;
  91 +
73 @Autowired 92 @Autowired
74 JdbcTemplate jdbcTemplate; 93 JdbcTemplate jdbcTemplate;
75 94
@@ -83,20 +102,56 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -83,20 +102,56 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
83 Date d = new Date(); 102 Date d = new Date();
84 d.setTime(d.getTime() - (4 * 1000 * 60 * 60 * 24)); 103 d.setTime(d.getTime() - (4 * 1000 * 60 * 60 * 24));
85 date = sdf.format(d); 104 date = sdf.format(d);
  105 + } else {
  106 + date = date.trim();
86 } 107 }
87 if(line == null || line.trim().length() == 0){ 108 if(line == null || line.trim().length() == 0){
88 line = ""; 109 line = "";
  110 + } else {
  111 + line = line.trim();
89 } 112 }
90 - return generateNew(date, line); 113 +
  114 + Map<String, Object> m = new HashMap<String, Object>();
  115 + try {
  116 + Map<String, Object> generateNew = generateNew(date, line);
  117 + m.put("generateNew", generateNew);
  118 + } catch (Exception e) {
  119 + // TODO: handle exception
  120 + logger.info("重新统计保存失败!");
  121 + }
  122 + try {
  123 + Map<String, Object> calcLineMileage = calcLineMileage(date, line);
  124 + m.put("lineMileage", calcLineMileage);
  125 + } catch (Exception e) {
  126 + // TODO: handle exception
  127 + logger.info("线路公里审计保存失败!");
  128 + }
  129 + try {
  130 + Map<String, Object> calcBusMileage = calcBusMileage(date, line);
  131 + m.put("busMileage", calcBusMileage);
  132 + } catch (Exception e) {
  133 + // TODO: handle exception
  134 + logger.info("路单数据审计保存失败!");
  135 + }
  136 +
  137 + return m;
91 } 138 }
92 139
93 @Transactional 140 @Transactional
94 @Override 141 @Override
95 public Map<String, Object> generateNew(String date, String line) throws Exception { 142 public Map<String, Object> generateNew(String date, String line) throws Exception {
96 Map<String, Object> newMap = new HashMap<String, Object>(); 143 Map<String, Object> newMap = new HashMap<String, Object>();
97 -  
98 try { 144 try {
99 - 145 + if(date == null){
  146 + date = "";
  147 + } else {
  148 + date = date.trim();
  149 + }
  150 + if(line == null){
  151 + line = "";
  152 + } else {
  153 + line = line.trim();
  154 + }
100 if(date.length() != 0 && line.length() != 0){ 155 if(date.length() != 0 && line.length() != 0){
101 calcRepository.deleteByDateAndLine(date, line); 156 calcRepository.deleteByDateAndLine(date, line);
102 calcIntervalRepository.deleteByDateAndLine(date, line); 157 calcIntervalRepository.deleteByDateAndLine(date, line);
@@ -414,11 +469,37 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -414,11 +469,37 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
414 resList.add(m); 469 resList.add(m);
415 } 470 }
416 471
  472 + if (type != null && type.length() != 0 && type.equals("export")) {
  473 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  474 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  475 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  476 + Map<String, Object> m = new HashMap<String, Object>();
  477 + m.put("date", date+"至"+date2);
  478 + ReportUtils ee = new ReportUtils();
  479 + try {
  480 + String dateTime = "";
  481 + if(date.equals(date2)){
  482 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  483 + } else {
  484 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  485 + +"-"+sdfSimple.format(sdfMonth.parse(date2));
  486 + }
  487 + listI.add(resList.iterator());
  488 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  489 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  490 + path + "export/" + dateTime + "-" + xlName + "-统计日报.xls");
  491 + } catch (Exception e) {
  492 + // TODO: handle exception
  493 + //e.printStackTrace();
  494 + logger.info("" , e);
  495 + }
  496 + }
  497 +
417 return resList; 498 return resList;
418 } 499 }
419 500
420 /** 501 /**
421 - * @param rq 格式如:2018-03-22(留空""默认当前日期前天) 502 + * @param rq 格式如:2018-03-22(留空""默认当前日期前天)
422 * @param line (留空""默认全部线路) 503 * @param line (留空""默认全部线路)
423 */ 504 */
424 @Transactional 505 @Transactional
@@ -432,7 +513,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -432,7 +513,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
432 Date dBefore = new Date(); 513 Date dBefore = new Date();
433 Calendar calendar = Calendar.getInstance(); //得到日历 514 Calendar calendar = Calendar.getInstance(); //得到日历
434 calendar.setTime(dNow);//把当前时间赋给日历 515 calendar.setTime(dNow);//把当前时间赋给日历
435 - calendar.add(Calendar.DAY_OF_MONTH, -2); //设置为前一天 516 + calendar.add(Calendar.DAY_OF_MONTH, -4); //设置为前一天
436 dBefore = calendar.getTime(); //得到前一天的时间 517 dBefore = calendar.getTime(); //得到前一天的时间
437 rq = sdf.format(dBefore); 518 rq = sdf.format(dBefore);
438 } else { 519 } else {
@@ -448,11 +529,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -448,11 +529,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
448 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 529 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
449 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 530 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
450 531
451 - String xlSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'"; 532 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'";
452 if(line.trim().length() > 0) 533 if(line.trim().length() > 0)
453 - xlSql += " and xl_bm = '"+line+"'";  
454 - xlSql += " group by gs_bm, fgs_bm";  
455 - List<Map<String, String>> gsList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, String>>() { 534 + gsSql += " and xl_bm = '"+line+"'";
  535 + gsSql += " group by gs_bm, fgs_bm";
  536 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
456 @Override 537 @Override
457 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { 538 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
458 Map<String, String> m = new HashMap<String, String>(); 539 Map<String, String> m = new HashMap<String, String>();
@@ -695,6 +776,78 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -695,6 +776,78 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
695 resList.add(temp); 776 resList.add(temp);
696 } 777 }
697 778
  779 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  780 + for(CalcStatistics c : resList){
  781 + Map<String, Object> m = new HashMap<String, Object>();
  782 + m.put("xlName", c.getXlName());
  783 + m.put("jhzlc", c.getJhzlc());
  784 + m.put("jhlc", c.getJhyylc());
  785 + m.put("jcclc", c.getJhkslc());
  786 + m.put("sjzgl", c.getSjzlc());
  787 + m.put("sjgl", c.getSjyylc());
  788 + m.put("sjksgl", c.getSjkslc());
  789 + m.put("ssgl", c.getSslc());
  790 + m.put("ssbc", c.getSsbc());
  791 + m.put("ssgl_lz", c.getLzlc());
  792 + m.put("ssgl_dm", c.getDmlc());
  793 + m.put("ssgl_gz", c.getGzlc());
  794 + m.put("ssgl_jf", c.getJflc());
  795 + m.put("ssgl_zs", c.getZslc());
  796 + m.put("ssgl_qr", c.getQrlc());
  797 + m.put("ssgl_qc", c.getQclc());
  798 + m.put("ssgl_kx", c.getKxlc());
  799 + m.put("ssgl_qh", c.getQhlc());
  800 + m.put("ssgl_yw", c.getYwlc());
  801 + m.put("ssgl_other", c.getQtlc());
  802 + m.put("ljgl", c.getLjlc());
  803 + m.put("jhbc", c.getJhbcq());
  804 + m.put("jhbc_m", c.getJhbcz());
  805 + m.put("jhbc_a", c.getJhbcw());
  806 + m.put("sjbc", c.getSjbcq());
  807 + m.put("sjbc_m", c.getSjbcz());
  808 + m.put("sjbc_a", c.getSjbcw());
  809 + m.put("ljbc", c.getLjbcq());
  810 + m.put("ljbc_m", c.getLjbcz());
  811 + m.put("ljbc_a", c.getLjbcw());
  812 + m.put("fzbc", c.getFzbcq());
  813 + m.put("fzbc_m", c.getFzbcz());
  814 + m.put("fzbc_a", c.getFzbcw());
  815 + m.put("dtbc", c.getDtbcq());
  816 + m.put("dtbc_m", c.getDtbcz());
  817 + m.put("dtbc_a", c.getDtbcw());
  818 + m.put("djg", c.getDjgq());
  819 + m.put("djg_m", c.getDjgz());
  820 + m.put("djg_a", c.getDjgw());
  821 + m.put("djg_time", c.getDjgsj());
  822 + mapList.add(m);
  823 + }
  824 +
  825 + if (type != null && type.length() != 0 && type.equals("export")) {
  826 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  827 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  828 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  829 + Map<String, Object> m = new HashMap<String, Object>();
  830 + m.put("date", date+"至"+date2);
  831 + ReportUtils ee = new ReportUtils();
  832 + try {
  833 + String dateTime = "";
  834 + if(date.equals(date2)){
  835 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  836 + } else {
  837 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  838 + +"-"+sdfSimple.format(sdfMonth.parse(date2));
  839 + }
  840 + listI.add(mapList.iterator());
  841 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  842 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  843 + path + "export/" + dateTime + "-" + xlName + "-统计日报.xls");
  844 + } catch (Exception e) {
  845 + // TODO: handle exception
  846 + //e.printStackTrace();
  847 + logger.info("" , e);
  848 + }
  849 + }
  850 +
698 return resList; 851 return resList;
699 } 852 }
700 853
@@ -740,5 +893,572 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -740,5 +893,572 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
740 s.setDjgsj(s.getDjgsj()>s_.getDjgsj()?s.getDjgsj():s_.getDjgsj()); 893 s.setDjgsj(s.getDjgsj()>s_.getDjgsj()?s.getDjgsj():s_.getDjgsj());
741 return s; 894 return s;
742 } 895 }
  896 +
  897 + @Transactional
  898 + @Override
  899 + public Map<String, Object> calcLineMileage(String date, String line) {
  900 + Map<String, Object> resMap = new HashMap<String, Object>();
  901 +
  902 + if(date.length() == 0){
  903 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  904 + Date d = new Date();
  905 + d.setTime(d.getTime() - 4 * 1000 * 60 * 60 * 24);
  906 + date = sdf.format(d);
  907 + }
  908 +
  909 + resMap.put("date", date);
  910 + resMap.put("line", line);
  911 + if(date == null || date.trim().length() == 0){
  912 + resMap.put("status", ResponseCode.ERROR);
  913 + resMap.put("remark", "日期不正确或为空");
  914 + return resMap;
  915 + } else {
  916 + date = date.trim();
  917 + }
  918 + if(line == null){
  919 + line = "";
  920 + } else {
  921 + line = line.trim();
  922 + }
  923 +
  924 + Map<String, Object> map = new HashMap<String, Object>();
  925 + List<CalcLineMileage> list = new ArrayList<CalcLineMileage>();
  926 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  927 + Date dateTime = new Date();
  928 +
  929 + try {
  930 +
  931 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+date+"'";
  932 + if(line.trim().length() > 0)
  933 + gsSql += " and xl_bm = '"+line+"'";
  934 + gsSql += " group by gs_bm, fgs_bm";
  935 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  936 + @Override
  937 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  938 + Map<String, String> m = new HashMap<String, String>();
  939 + m.put("gsdm", arg0.getString("gs_bm"));
  940 + m.put("fgsdm", arg0.getString("fgs_bm"));
  941 + return m;
  942 + }});
  943 +
  944 + map.put("date", date);
  945 + map.put("date2", date);
  946 + for(Map<String, String> tempMap : gsList){
  947 + map.put("gsdm", tempMap.get("gsdm").toString());
  948 + map.put("fgsdm", tempMap.get("fgsdm").toString());
  949 + List<Map<String, Object>> countByList = reportService.countByList(map);
  950 + for(Map<String, Object> m : countByList){
  951 + if(!m.containsKey("xlName") || m.get("xlName")==null
  952 + || m.get("xlName").toString().equals("合计"))
  953 + continue;
  954 + CalcLineMileage c = new CalcLineMileage();
  955 + c.setDate(sdf.parse(date));
  956 + c.setDateStr(date);
  957 + c.setGsdm(map.get("gsdm").toString());
  958 + c.setGsName(m.get("gs").toString());
  959 + c.setFgsdm(map.get("fgsdm").toString());
  960 + c.setFgsName(m.get("fgs").toString());
  961 + c.setXl(m.get("line").toString());
  962 + c.setXlName(m.get("xlName").toString());
  963 + c.setJhzlc(Double.valueOf(m.get("jhzlc").toString()));
  964 + c.setJhlc(Double.valueOf(m.get("jhlc").toString()));
  965 + c.setJcclc(Double.valueOf(m.get("jcclc").toString()));
  966 + c.setSjzgl(Double.valueOf(m.get("sjzgl").toString()));
  967 + c.setJhnlc(Double.valueOf(m.get("jhnlc").toString()));
  968 + c.setJhwlc(Double.valueOf(m.get("jhwlc").toString()));
  969 + c.setJhnjcclc(Double.valueOf(m.get("jhnjcclc").toString()));
  970 + c.setJhwjcclc(Double.valueOf(m.get("jhwjcclc").toString()));
  971 + c.setJhwjcclcz(Double.valueOf(m.get("jhwjcclc_z").toString()));
  972 + c.setZrwjcclc(Double.valueOf(m.get("zrwjcclc").toString()));
  973 + c.setZrwjcclc1(Double.valueOf(m.get("zrwjcclc1").toString()));
  974 + c.setZrwjcclc2(Double.valueOf(m.get("zrwjcclc2").toString()));
  975 + c.setZrwjcclcqt(Double.valueOf(m.get("zrwjcclcqt").toString()));
  976 + c.setKfks(Double.valueOf(m.get("kfks").toString()));
  977 + c.setLbss(Double.valueOf(m.get("lbss").toString()));
  978 + c.setSsglLz(Double.valueOf(m.get("ssgl_lz").toString()));
  979 + c.setSsglDm(Double.valueOf(m.get("ssgl_dm").toString()));
  980 + c.setSsglGz(Double.valueOf(m.get("ssgl_gz").toString()));
  981 + c.setSsglJf(Double.valueOf(m.get("ssgl_jf").toString()));
  982 + c.setSsglZs(Double.valueOf(m.get("ssgl_zs").toString()));
  983 + c.setSsglQr(Double.valueOf(m.get("ssgl_qr").toString()));
  984 + c.setSsglQc(Double.valueOf(m.get("ssgl_qc").toString()));
  985 + c.setSsglKx(Double.valueOf(m.get("ssgl_kx").toString()));
  986 + c.setSsglQh(Double.valueOf(m.get("ssgl_qh").toString()));
  987 + c.setSsglYw(Double.valueOf(m.get("ssgl_yw").toString()));
  988 + c.setSsglOther(Double.valueOf(m.get("ssgl_other").toString()));
  989 + c.setLjyy(Double.valueOf(m.get("ljyy").toString()));
  990 + c.setLjjcc(Double.valueOf(m.get("ljjcc").toString()));
  991 + c.setLjkfks(Double.valueOf(m.get("ljkfks").toString()));
  992 + c.setCreateDate(dateTime);
  993 + list.add(c);
  994 + }
  995 + }
  996 +
  997 + if(line.length() > 0){
  998 + calcLineMileageRepository.deleteByDateAndLine(date, line);
  999 + } else {
  1000 + calcLineMileageRepository.deleteByDate(date);
  1001 + }
  1002 + calcLineMileageRepository.save(list);
  1003 +
  1004 + resMap.put("status", ResponseCode.SUCCESS);
  1005 + } catch (Exception e) {
  1006 + // TODO: handle exception
  1007 + resMap.put("status", ResponseCode.ERROR);
  1008 + logger.error("save erro.", e);
  1009 + e.printStackTrace();
  1010 + }
  1011 + return resMap;
  1012 + }
  1013 +
  1014 + @Transactional
  1015 + @Override
  1016 + public Map<String, Object> calcBusMileage(String date, String line) {
  1017 + Map<String, Object> resMap = new HashMap<String, Object>();
  1018 +
  1019 + if(date.length() == 0){
  1020 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1021 + Date d = new Date();
  1022 + d.setTime(d.getTime() - 4 * 1000 * 60 * 60 * 24);
  1023 + date = sdf.format(d);
  1024 + }
  1025 +
  1026 + resMap.put("date", date);
  1027 + resMap.put("line", line);
  1028 + if(date == null || date.trim().length() == 0){
  1029 + resMap.put("status", ResponseCode.ERROR);
  1030 + resMap.put("remark", "日期不正确或为空");
  1031 + return resMap;
  1032 + } else {
  1033 + date = date.trim();
  1034 + }
  1035 + if(line == null){
  1036 + line = "";
  1037 + } else {
  1038 + line = line.trim();
  1039 + }
  1040 +
  1041 + Map<String, Object> map = new HashMap<String, Object>();
  1042 + Map<String, Object> xlmap = new HashMap<String, Object>();
  1043 + List<CalcBusMileage> list = new ArrayList<CalcBusMileage>();
  1044 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1045 + Date dateTime = new Date();
  1046 +
  1047 + try {
  1048 +
  1049 + String gsSql="select gs_bm, max(gs_name) gs_name, fgs_bm from bsth_c_s_sp_info_real"
  1050 + + " where schedule_date_str = '"+date+"'";
  1051 + if(line.trim().length() > 0)
  1052 + gsSql += " and xl_bm = '"+line+"'";
  1053 + gsSql += " group by gs_bm, fgs_bm";
  1054 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  1055 + @Override
  1056 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  1057 + Map<String, String> m = new HashMap<String, String>();
  1058 + m.put("gsdm", arg0.getString("gs_bm"));
  1059 + m.put("gsName", arg0.getString("gs_name"));
  1060 + m.put("fgsdm", arg0.getString("fgs_bm"));
  1061 + return m;
  1062 + }});
  1063 +
  1064 + List<Line> xlList = lineRepository.findAllService();
  1065 + for(Line l : xlList){
  1066 + xlmap.put(l.getName(), l.getLineCode());
  1067 + }
  1068 +
  1069 + map.put("date", date);
  1070 + map.put("date2", date);
  1071 + map.put("zs", "js");
  1072 + for(Map<String, String> tempMap : gsList){
  1073 + map.put("gsdm", tempMap.get("gsdm").toString());
  1074 + map.put("fgsdm", tempMap.get("fgsdm").toString());
  1075 + List<Map<String, Object>> countByList = reportService.countByBusList(map);
  1076 + for(Map<String, Object> m : countByList){
  1077 + if(!m.containsKey("xlName") || m.get("xlName")==null
  1078 + || m.get("xlName").toString().equals("合计"))
  1079 + continue;
  1080 + CalcBusMileage c = new CalcBusMileage();
  1081 + c.setDate(sdf.parse(date));
  1082 + c.setDateStr(date);
  1083 + c.setGsdm(map.get("gsdm").toString());
  1084 + c.setGsName(tempMap.get("gsName").toString());
  1085 + c.setFgsdm(map.get("fgsdm").toString());
  1086 + c.setFgsName(m.get("fgs").toString());
  1087 + c.setXl(xlmap.get(m.get("xlName").toString()).toString());
  1088 + c.setXlName(m.get("xlName").toString());
  1089 + c.setNbbm(m.get("nbbm").toString());
  1090 + c.setjGh(m.get("jGh").toString());
  1091 + c.setjName(m.get("jName").toString());
  1092 + c.setsGh(m.get("sGh").toString());
  1093 + c.setsName(m.get("sName").toString());
  1094 + c.setZlc(Double.valueOf(m.get("zlc").toString()));
  1095 + c.setJhnlc(Double.valueOf(m.get("jhnlc").toString()));
  1096 + c.setJhwlc(Double.valueOf(m.get("jhwlc").toString()));
  1097 + c.setJhnjcclc(Double.valueOf(m.get("jhnjcclc").toString()));
  1098 + c.setJhwjcclc(Double.valueOf(m.get("jhwjcclc").toString()));
  1099 + c.setJhwjcclcz(Double.valueOf(m.get("jhwjcclc_z").toString()));
  1100 + c.setKfks(Double.valueOf(m.get("kfks").toString()));
  1101 + c.setZrwjcclc(Double.valueOf(m.get("zrwjcclc").toString()));
  1102 + c.setZrwjcclc1(Double.valueOf(m.get("zrwjcclc1").toString()));
  1103 + c.setZrwjcclc2(Double.valueOf(m.get("zrwjcclc2").toString()));
  1104 + c.setZrwjcclcqt(Double.valueOf(m.get("zrwjcclcqt").toString()));
  1105 + c.setLjyy(Double.valueOf(m.get("ljyy").toString()));
  1106 + c.setLjjcc(Double.valueOf(m.get("ljjcc").toString()));
  1107 + if(m.containsKey("ljkfks") && m.get("ljkfks") != null){
  1108 + c.setLjkfks(Double.valueOf(m.get("ljkfks").toString()));
  1109 + } else {
  1110 + c.setLjkfks(0d);
  1111 + }
  1112 + c.setDhl(Double.valueOf(m.get("dhl").toString()));
  1113 + c.setCdl(Double.valueOf(m.get("cdl").toString()));
  1114 + c.setYhl(Double.valueOf(m.get("yhl").toString()));
  1115 + c.setJzl(Double.valueOf(m.get("jzl").toString()));
  1116 + c.setHyl(Double.valueOf(m.get("hyl").toString()));
  1117 + c.setJhzlc(Double.valueOf(m.get("jhzlc").toString()));
  1118 + c.setCreateDate(dateTime);
  1119 + list.add(c);
  1120 + }
  1121 + }
  1122 +
  1123 + if(line.length() > 0){
  1124 + calcBusMileageRepository.deleteByDateAndLine(date, line);
  1125 + } else {
  1126 + calcBusMileageRepository.deleteByDate(date);
  1127 + }
  1128 + calcBusMileageRepository.save(list);
  1129 +
  1130 + resMap.put("status", ResponseCode.SUCCESS);
  1131 + } catch (Exception e) {
  1132 + // TODO: handle exception
  1133 + resMap.put("status", ResponseCode.ERROR);
  1134 + logger.error("save erro.", e);
  1135 + e.printStackTrace();
  1136 + }
  1137 + return resMap;
  1138 + }
  1139 +
  1140 + @Override
  1141 + public List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line,
  1142 + String date, String date2, String xlName, String zt, String by, String type) {
  1143 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1144 + List<CalcLineMileage> resList = new ArrayList<CalcLineMileage>();
  1145 + List<CalcLineMileage> list = new ArrayList<CalcLineMileage>();
  1146 + List<CalcLineMileage> calcs = new ArrayList<CalcLineMileage>();
  1147 + List<String> keyList = new ArrayList<String>();
  1148 + Map<String, List<CalcLineMileage>> keyMap = new HashMap<String, List<CalcLineMileage>>();
  1149 +
  1150 + if(line == null || line.trim().length() == 0){
  1151 + list = calcLineMileageRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm);
  1152 + } else {
  1153 + list = calcLineMileageRepository.selectByDateAndLineTj2(line, date, date2);
  1154 + }
  1155 +
  1156 + for(CalcLineMileage c : list){
  1157 + String key = c.getXlName();
  1158 + if(!keyMap.containsKey(key)){
  1159 + keyMap.put(key, new ArrayList<CalcLineMileage>());
  1160 + keyList.add(key);
  1161 + }
  1162 + keyMap.get(key).add(c);
  1163 + }
  1164 +
  1165 + for(String key : keyList){
  1166 + CalcLineMileage c1 = keyMap.get(key).get(0);
  1167 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1168 + CalcLineMileage c2 = keyMap.get(key).get(i);
  1169 + c1 = addLineMileage(c1, c2);
  1170 + }
  1171 + calcs.add(c1);
  1172 + }
  1173 +
  1174 + CalcLineMileage temp = new CalcLineMileage();
  1175 + temp.setXlName("合计");
  1176 + for(CalcLineMileage c : calcs){
  1177 + temp = addLineMileage(temp, c);
  1178 + resList.add(c);
  1179 + }
  1180 + if(resList.size() > 0)
  1181 + resList.add(temp);
  1182 +
  1183 + for(CalcLineMileage c : resList){
  1184 + Map<String, Object> m = new HashMap<String, Object>();
  1185 + if(c.getXlName().equals("合计")){
  1186 + m.put("gsdm", "");
  1187 + m.put("gs", "");
  1188 + m.put("fgsdm", "");
  1189 + m.put("fgs", "");
  1190 + } else {
  1191 + m.put("gsdm", c.getGsdm());
  1192 + m.put("gs", c.getGsName());
  1193 + m.put("fgsdm", c.getFgsdm());
  1194 + m.put("fgs", c.getFgsName());
  1195 + }
  1196 + m.put("xlName", c.getXlName());
  1197 + m.put("jhzlc", c.getJhzlc());
  1198 + m.put("jhlc", c.getJhlc());
  1199 + m.put("jcclc", c.getJcclc());
  1200 + m.put("sjzgl", c.getSjzgl());
  1201 + m.put("jhnlc", c.getJhnlc());
  1202 + m.put("jhwlc", c.getJhwlc());
  1203 + m.put("jhnjcclc", c.getJhnjcclc());
  1204 + m.put("jhwjcclc", c.getJhwjcclc());
  1205 + m.put("jhwjcclc_z", c.getJhwjcclcz());
  1206 + m.put("zrwjcclc", c.getZrwjcclc());
  1207 + m.put("zrwjcclc1", c.getZrwjcclc1());
  1208 + m.put("zrwjcclc2", c.getZrwjcclc2());
  1209 + m.put("zrwjcclcqt", c.getZrwjcclcqt());
  1210 + m.put("kfks", c.getKfks());
  1211 + m.put("lbss", c.getLbss());
  1212 + m.put("ssgl_lz", c.getSsglLz());
  1213 + m.put("ssgl_dm", c.getSsglDm());
  1214 + m.put("ssgl_gz", c.getSsglGz());
  1215 + m.put("ssgl_jf", c.getSsglJf());
  1216 + m.put("ssgl_zs", c.getSsglZs());
  1217 + m.put("ssgl_qr", c.getSsglQr());
  1218 + m.put("ssgl_qc", c.getSsglQc());
  1219 + m.put("ssgl_kx", c.getSsglKx());
  1220 + m.put("ssgl_qh", c.getSsglQh());
  1221 + m.put("ssgl_yw", c.getSsglYw());
  1222 + m.put("ssgl_other", c.getSsglOther());
  1223 + m.put("ljyy", c.getLjyy());
  1224 + m.put("ljjcc", c.getLjjcc());
  1225 + m.put("ljkfks", c.getLjkfks());
  1226 + lMap.add(m);
  1227 + }
  1228 +
  1229 + if(type.equals("export")){
  1230 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1231 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1232 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1233 + Map<String, Object> m = new HashMap<String, Object>();
  1234 + m.put("date", date);
  1235 + m.put("date1", date2);
  1236 +// String by=map.get("by").toString();
  1237 + String xls="";
  1238 + if(by.equals("sj")){
  1239 + xls="countByLine.xls";
  1240 + }else{
  1241 + xls="countByLines.xls";
  1242 + }
  1243 + ReportUtils ee = new ReportUtils();
  1244 + try {
  1245 + String dateTime = "";
  1246 + if(date.equals(date2)){
  1247 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  1248 + } else {
  1249 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  1250 + +"-"+sdfSimple.format(sdfMonth.parse(date2));
  1251 + }
  1252 + listI.add(lMap.iterator());
  1253 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1254 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  1255 + path + "export/"+dateTime+"-"+xlName+"-线路公里统计表.xls");
  1256 + } catch (Exception e) {
  1257 + // TODO: handle exception
  1258 + e.printStackTrace();
  1259 + }
  1260 + }
  1261 +
  1262 + return lMap;
  1263 + }
  1264 +
  1265 + @Override
  1266 + public List<Map<String, Object>> getBusMileage(String line, String date,
  1267 + String date2, String xlName, String zt, String by, String type) {
  1268 + List<CalcBusMileage> resList = new ArrayList<CalcBusMileage>();
  1269 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1270 + List<CalcBusMileage> list = calcBusMileageRepository.selectByDateAndLineTj2(line, date, date2);
  1271 +
  1272 + if(zt.equals("zbh")){
  1273 + List<String> keyList = new ArrayList<String>();
  1274 + Map<String, List<CalcBusMileage>> keyMap = new HashMap<>();
  1275 + for(CalcBusMileage c : list){
  1276 + String nbbm = c.getNbbm();
  1277 + if(!keyMap.containsKey(nbbm)){
  1278 + keyMap.put(nbbm, new ArrayList<CalcBusMileage>());
  1279 + keyList.add(nbbm);
  1280 + }
  1281 + keyMap.get(nbbm).add(c);
  1282 + }
  1283 + for(String key : keyList){
  1284 + CalcBusMileage c1 = keyMap.get(key).get(0);
  1285 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1286 + CalcBusMileage c2 = keyMap.get(key).get(i);
  1287 + c1.setZlc(Arith.add(c1.getZlc(), c2.getZlc()));
  1288 + c1.setJhnlc(Arith.add(c1.getJhnlc(), c2.getJhnlc()));
  1289 + c1.setJhwlc(Arith.add(c1.getJhwlc(), c2.getJhwlc()));
  1290 + c1.setJhnjcclc(Arith.add(c1.getJhnjcclc(), c2.getJhnjcclc()));
  1291 + c1.setJhwjcclc(Arith.add(c1.getJhwjcclc(), c2.getJhwjcclc()));
  1292 + c1.setKfks(Arith.add(c1.getKfks(), c2.getKfks()));
  1293 + c1.setZrwjcclc(Arith.add(c1.getZrwjcclc(), c2.getZrwjcclc()));
  1294 + c1.setZrwjcclc1(Arith.add(c1.getZrwjcclc1(), c2.getZrwjcclc1()));
  1295 + c1.setZrwjcclc2(Arith.add(c1.getZrwjcclc2(), c2.getZrwjcclc2()));
  1296 + c1.setZrwjcclcqt(Arith.add(c1.getZrwjcclcqt(), c2.getZrwjcclcqt()));
  1297 + c1.setLjyy(Arith.add(c1.getLjyy(), c2.getLjyy()));
  1298 + c1.setLjjcc(Arith.add(c1.getLjjcc(), c2.getLjjcc()));
  1299 + c1.setLjkfks(Arith.add(c1.getLjkfks(), c2.getLjkfks()));
  1300 + c1.setDhl(Arith.add(c1.getDhl(), c2.getDhl()));
  1301 + c1.setCdl(Arith.add(c1.getCdl(), c2.getCdl()));
  1302 + c1.setYhl(Arith.add(c1.getYhl(), c2.getYhl()));
  1303 + c1.setJzl(Arith.add(c1.getJzl(), c2.getJzl()));
  1304 + c1.setHyl(Arith.add(c1.getHyl(), c2.getHyl()));
  1305 + c1.setJhzlc(Arith.add(c1.getJhzlc(), c2.getJhzlc()));
  1306 + }
  1307 + resList.add(c1);
  1308 + }
  1309 + } else {
  1310 + List<String> keyList = new ArrayList<String>();
  1311 + Map<String, List<CalcBusMileage>> keyMap = new HashMap<>();
  1312 + for(CalcBusMileage c : list){
  1313 + String key = c.getNbbm() + c.getjGh() + c.getjName() + c.getsGh() + c.getsName();
  1314 + if(!keyMap.containsKey(key)){
  1315 + keyMap.put(key, new ArrayList<CalcBusMileage>());
  1316 + keyList.add(key);
  1317 + }
  1318 + keyMap.get(key).add(c);
  1319 + }
  1320 + for(String key : keyList){
  1321 + CalcBusMileage c1 = keyMap.get(key).get(0);
  1322 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1323 + CalcBusMileage c2 = keyMap.get(key).get(i);
  1324 + c1.setZlc(Arith.add(c1.getZlc(), c2.getZlc()));
  1325 + c1.setJhnlc(Arith.add(c1.getJhnlc(), c2.getJhnlc()));
  1326 + c1.setJhwlc(Arith.add(c1.getJhwlc(), c2.getJhwlc()));
  1327 + c1.setJhnjcclc(Arith.add(c1.getJhnjcclc(), c2.getJhnjcclc()));
  1328 + c1.setJhwjcclc(Arith.add(c1.getJhwjcclc(), c2.getJhwjcclc()));
  1329 + c1.setKfks(Arith.add(c1.getKfks(), c2.getKfks()));
  1330 + c1.setZrwjcclc(Arith.add(c1.getZrwjcclc(), c2.getZrwjcclc()));
  1331 + c1.setZrwjcclc1(Arith.add(c1.getZrwjcclc1(), c2.getZrwjcclc1()));
  1332 + c1.setZrwjcclc2(Arith.add(c1.getZrwjcclc2(), c2.getZrwjcclc2()));
  1333 + c1.setZrwjcclcqt(Arith.add(c1.getZrwjcclcqt(), c2.getZrwjcclcqt()));
  1334 + c1.setLjyy(Arith.add(c1.getLjyy(), c2.getLjyy()));
  1335 + c1.setLjjcc(Arith.add(c1.getLjjcc(), c2.getLjjcc()));
  1336 + c1.setLjkfks(Arith.add(c1.getLjkfks(), c2.getLjkfks()));
  1337 + c1.setDhl(Arith.add(c1.getDhl(), c2.getDhl()));
  1338 + c1.setCdl(Arith.add(c1.getCdl(), c2.getCdl()));
  1339 + c1.setYhl(Arith.add(c1.getYhl(), c2.getYhl()));
  1340 + c1.setJzl(Arith.add(c1.getJzl(), c2.getJzl()));
  1341 + c1.setHyl(Arith.add(c1.getHyl(), c2.getHyl()));
  1342 + c1.setJhzlc(Arith.add(c1.getJhzlc(), c2.getJhzlc()));
  1343 + }
  1344 + resList.add(c1);
  1345 + }
  1346 + }
  1347 +
  1348 + for(CalcBusMileage c : resList){
  1349 + Map<String, Object> m = new HashMap<String, Object>();
  1350 + if(date.equals(date2)){
  1351 + m.put("rq", date);
  1352 + } else {
  1353 + m.put("rq", date + "至" + date2);
  1354 + }
  1355 + m.put("fgs", c.getFgsName());
  1356 + m.put("xlName", c.getXlName());
  1357 + m.put("nbbm", c.getNbbm());
  1358 + m.put("jGh", c.getjGh());
  1359 + m.put("jName", c.getjName());
  1360 + m.put("sGh", c.getsGh());
  1361 + m.put("sName", c.getsName());
  1362 + m.put("zlc", c.getZlc());
  1363 + m.put("jhnlc", c.getJhnlc());
  1364 + m.put("jhwlc", c.getJhwlc());
  1365 + m.put("jhnjcclc", c.getJhnjcclc());
  1366 + m.put("jhwjcclc", c.getJhwjcclc());
  1367 + m.put("jhwjcclc_z", c.getJhwjcclcz());
  1368 + m.put("kfks", c.getKfks());
  1369 + m.put("zrwjcclc", c.getZrwjcclc());
  1370 + m.put("zrwjcclc1", c.getZrwjcclc1());
  1371 + m.put("zrwjcclc2", c.getZrwjcclc2());
  1372 + m.put("zrwjcclcqt", c.getZrwjcclcqt());
  1373 + m.put("ljyy", c.getLjyy());
  1374 + m.put("ljjcc", c.getLjjcc());
  1375 + m.put("ljkfks", c.getLjkfks());
  1376 + m.put("dhl", c.getDhl());
  1377 + m.put("cdl", c.getCdl());
  1378 + m.put("yhl", c.getYhl());
  1379 + m.put("jzl", c.getJzl());
  1380 + m.put("hyl", c.getYhl());
  1381 + m.put("jhzlc", c.getJhzlc());
  1382 + lMap.add(m);
  1383 + }
  1384 +
  1385 + if(type.equals("export")){
  1386 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1387 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1388 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1389 + Map<String, Object> m = new HashMap<String, Object>();
  1390 + m.put("date", date);
  1391 + m.put("date1", date2);
  1392 + String xls="";
  1393 +// String by=map.get("by").toString();
  1394 +
  1395 + if(zt.equals("zbh")){
  1396 + if(by.equals("sj")){
  1397 + xls="countByBus1.xls";
  1398 + }else{
  1399 + xls="countByBus1s.xls";
  1400 + }
  1401 + }else{
  1402 +
  1403 + if(by.equals("sj")){
  1404 + xls="countByBus2.xls";
  1405 + }else{
  1406 + xls="countByBus2s.xls";
  1407 + }
  1408 + }
  1409 + ReportUtils ee = new ReportUtils();
  1410 + try {
  1411 + String dateTime = "";
  1412 + if(date.equals(date2)){
  1413 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  1414 + } else {
  1415 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  1416 + +"-"+sdfSimple.format(sdfMonth.parse(date2));
  1417 + }
  1418 + listI.add(lMap.iterator());
  1419 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1420 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  1421 + path + "export/"+dateTime+"-"+xlName+"-路单数据统计表.xls");
  1422 + } catch (Exception e) {
  1423 + // TODO: handle exception
  1424 + e.printStackTrace();
  1425 + }
  1426 + }
  1427 +
  1428 + return lMap;
  1429 + }
743 1430
  1431 + public CalcLineMileage addLineMileage(CalcLineMileage temp, CalcLineMileage c){
  1432 + temp.setJhzlc(Arith.add(temp.getJhzlc()!=null?temp.getJhzlc():0, c.getJhzlc()));
  1433 + temp.setJhlc(Arith.add(temp.getJhlc()!=null?temp.getJhlc():0, c.getJhlc()));
  1434 + temp.setJcclc(Arith.add(temp.getJcclc()!=null?temp.getJcclc():0, c.getJcclc()));
  1435 + temp.setSjzgl(Arith.add(temp.getSjzgl()!=null?temp.getSjzgl():0, c.getSjzgl()));
  1436 + temp.setJhnlc(Arith.add(temp.getJhnlc()!=null?temp.getJhnlc():0, c.getJhnlc()));
  1437 + temp.setJhwlc(Arith.add(temp.getJhwlc()!=null?temp.getJhwlc():0, c.getJhwlc()));
  1438 + temp.setJhnjcclc(Arith.add(temp.getJhnjcclc()!=null?temp.getJhnjcclc():0, c.getJhnjcclc()));
  1439 + temp.setJhwjcclc(Arith.add(temp.getJhwjcclc()!=null?temp.getJhwjcclc():0, c.getJhwjcclc()));
  1440 + temp.setJhwjcclcz(Arith.add(temp.getJhwjcclcz()!=null?temp.getJhwjcclcz():0, c.getJhwjcclcz()));
  1441 + temp.setZrwjcclc(Arith.add(temp.getZrwjcclc()!=null?temp.getZrwjcclc():0, c.getZrwjcclc()));
  1442 + temp.setZrwjcclc1(Arith.add(temp.getZrwjcclc1()!=null?temp.getZrwjcclc1():0, c.getZrwjcclc1()));
  1443 + temp.setZrwjcclc2(Arith.add(temp.getZrwjcclc2()!=null?temp.getZrwjcclc2():0, c.getZrwjcclc2()));
  1444 + temp.setZrwjcclcqt(Arith.add(temp.getZrwjcclcqt()!=null?temp.getZrwjcclcqt():0, c.getZrwjcclcqt()));
  1445 + temp.setKfks(Arith.add(temp.getKfks()!=null?temp.getKfks():0, c.getKfks()));
  1446 + temp.setLbss(Arith.add(temp.getLbss()!=null?temp.getLbss():0, c.getLbss()));
  1447 + temp.setSsglLz(Arith.add(temp.getSsglLz()!=null?temp.getSsglLz():0, c.getSsglLz()));
  1448 + temp.setSsglDm(Arith.add(temp.getSsglDm()!=null?temp.getSsglDm():0, c.getSsglDm()));
  1449 + temp.setSsglGz(Arith.add(temp.getSsglGz()!=null?temp.getSsglGz():0, c.getSsglGz()));
  1450 + temp.setSsglJf(Arith.add(temp.getSsglJf()!=null?temp.getSsglJf():0, c.getSsglJf()));
  1451 + temp.setSsglZs(Arith.add(temp.getSsglZs()!=null?temp.getSsglZs():0, c.getSsglZs()));
  1452 + temp.setSsglQr(Arith.add(temp.getSsglQr()!=null?temp.getSsglQr():0, c.getSsglQr()));
  1453 + temp.setSsglQc(Arith.add(temp.getSsglQc()!=null?temp.getSsglQc():0, c.getSsglQc()));
  1454 + temp.setSsglKx(Arith.add(temp.getSsglKx()!=null?temp.getSsglKx():0, c.getSsglKx()));
  1455 + temp.setSsglQh(Arith.add(temp.getSsglQh()!=null?temp.getSsglQh():0, c.getSsglQh()));
  1456 + temp.setSsglYw(Arith.add(temp.getSsglYw()!=null?temp.getSsglYw():0, c.getSsglYw()));
  1457 + temp.setSsglOther(Arith.add(temp.getSsglOther()!=null?temp.getSsglOther():0, c.getSsglOther()));
  1458 + temp.setLjyy(Arith.add(temp.getLjyy()!=null?temp.getLjyy():0, c.getLjyy()));
  1459 + temp.setLjjcc(Arith.add(temp.getLjjcc()!=null?temp.getLjjcc():0, c.getLjjcc()));
  1460 + temp.setLjkfks(Arith.add(temp.getLjkfks()!=null?temp.getLjkfks():0, c.getLjkfks()));
  1461 + return temp;
  1462 + }
  1463 +
744 } 1464 }
src/main/java/com/bsth/service/forms/ExportService.java
@@ -13,7 +13,7 @@ import com.bsth.entity.mcy_forms.Waybillday; @@ -13,7 +13,7 @@ import com.bsth.entity.mcy_forms.Waybillday;
13 13
14 public interface ExportService { 14 public interface ExportService {
15 15
16 - public void waybillday(String date, List<Waybillday> resList); 16 + public void waybillday(String date, String linaName, List<Waybillday> resList);
17 17
18 public void linepasswengerflow(String date,List<Linepasswengerflow> resList); 18 public void linepasswengerflow(String date,List<Linepasswengerflow> resList);
19 19
src/main/java/com/bsth/service/forms/impl/ExportServiceImpl.java
@@ -24,7 +24,7 @@ public class ExportServiceImpl implements ExportService{ @@ -24,7 +24,7 @@ public class ExportServiceImpl implements ExportService{
24 24
25 //行车路单日报表 25 //行车路单日报表
26 @Override 26 @Override
27 - public void waybillday(String date, List<Waybillday> list) { 27 + public void waybillday(String date, String lineName, List<Waybillday> list) {
28 28
29 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 29 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
30 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 30 sdfSimple = new SimpleDateFormat("yyyyMMdd");
@@ -50,7 +50,8 @@ public class ExportServiceImpl implements ExportService{ @@ -50,7 +50,8 @@ public class ExportServiceImpl implements ExportService{
50 listI.add(resList.iterator()); 50 listI.add(resList.iterator());
51 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 51 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
52 ee.excelReplace(listI, new Object[] { map }, path+"mould/waybillday.xls", 52 ee.excelReplace(listI, new Object[] { map }, path+"mould/waybillday.xls",
53 - path+"export/行车路单日报表.xls"); 53 + path+"export/"+sdfSimple.format(sdfMonth.parse(date))
  54 + +"-"+lineName+"-行车路单日报表.xls");
54 } catch (Exception e) { 55 } catch (Exception e) {
55 e.printStackTrace(); 56 e.printStackTrace();
56 } 57 }
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -703,17 +703,26 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -703,17 +703,26 @@ public class BusIntervalServiceImpl implements BusIntervalService {
703 } 703 }
704 704
705 if(type != null && type.length() != 0 && type.equals("export")){ 705 if(type != null && type.length() != 0 && type.equals("export")){
  706 + String lineName = "";
  707 + if(map.containsKey("lineName"))
  708 + lineName = map.get("lineName").toString();
706 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 709 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
707 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 710 sdfSimple = new SimpleDateFormat("yyyyMMdd");
708 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 711 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
709 Map<String, Object> m = new HashMap<String, Object>(); 712 Map<String, Object> m = new HashMap<String, Object>();
710 ReportUtils ee = new ReportUtils(); 713 ReportUtils ee = new ReportUtils();
711 try { 714 try {
  715 + String dateTime = "";
  716 + if(startDate.equals(endDate)){
  717 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  718 + } else {
  719 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  720 + + "-" + sdfSimple.format(sdfMonth.parse(endDate));
  721 + }
712 listI.add(resList.iterator()); 722 listI.add(resList.iterator());
713 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 723 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
714 ee.excelReplace(listI, new Object[] { m }, path+"mould/busInterval"+statu+".xls", 724 ee.excelReplace(listI, new Object[] { m }, path+"mould/busInterval"+statu+".xls",
715 - path+"export/班次间隔统计表" + sdfSimple.format(sdfMonth.parse(startDate))  
716 - + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); 725 + path+"export/" + dateTime + "-" + lineName + "-班次间隔统计表.xls");
717 } catch (Exception e) { 726 } catch (Exception e) {
718 // TODO: handle exception 727 // TODO: handle exception
719 e.printStackTrace(); 728 e.printStackTrace();
@@ -1441,6 +1450,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1441,6 +1450,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1441 } 1450 }
1442 1451
1443 if(type != null && type.length() != 0 && type.equals("export")){ 1452 if(type != null && type.length() != 0 && type.equals("export")){
  1453 + String lineName = "";
  1454 + if(map.containsKey("lineName"))
  1455 + lineName = map.get("lineName").toString();
1444 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 1456 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1445 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 1457 sdfSimple = new SimpleDateFormat("yyyyMMdd");
1446 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 1458 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
@@ -1450,11 +1462,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1450,11 +1462,17 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1450 else if(statu.equals("1")) 1462 else if(statu.equals("1"))
1451 modelMap.put("lpType", "路牌名"); 1463 modelMap.put("lpType", "路牌名");
1452 try { 1464 try {
  1465 + String dateTime = "";
  1466 + if(startDate.equals(endDate)){
  1467 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  1468 + } else {
  1469 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  1470 + + "-" + sdfSimple.format(sdfMonth.parse(endDate));
  1471 + }
1453 listI.add(((List<Map<String, Object>>)modelMap.get("dataList")).iterator()); 1472 listI.add(((List<Map<String, Object>>)modelMap.get("dataList")).iterator());
1454 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 1473 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1455 ee.excelReplace(listI, new Object[] { modelMap }, path+"mould/timeAndSpeed.xls", 1474 ee.excelReplace(listI, new Object[] { modelMap }, path+"mould/timeAndSpeed.xls",
1456 - path+"export/行驶时间及车速统计表" + sdfSimple.format(sdfMonth.parse(startDate))  
1457 - + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); 1475 + path+"export/" + dateTime + "-" + lineName + "-行驶时间及车速统计表.xls");
1458 } catch (Exception e) { 1476 } catch (Exception e) {
1459 // TODO: handle exception 1477 // TODO: handle exception
1460 e.printStackTrace(); 1478 e.printStackTrace();
@@ -2006,6 +2024,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2006,6 +2024,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2006 } 2024 }
2007 2025
2008 if(type != null && type.length() != 0 && type.equals("export")){ 2026 if(type != null && type.length() != 0 && type.equals("export")){
  2027 + String lineName = "";
  2028 + if(map.containsKey("lineName"))
  2029 + lineName = map.get("lineName").toString();
2009 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 2030 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
2010 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 2031 sdfSimple = new SimpleDateFormat("yyyyMMdd");
2011 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 2032 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
@@ -2015,8 +2036,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2015,8 +2036,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2015 listI.add(resList.iterator()); 2036 listI.add(resList.iterator());
2016 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 2037 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
2017 ee.excelReplace(listI, new Object[] { m }, path+"mould/lbStatuAnaly.xls", 2038 ee.excelReplace(listI, new Object[] { m }, path+"mould/lbStatuAnaly.xls",
2018 - path+"export/烂班情况分析表" + sdfSimple.format(sdfMonth.parse(startDate))  
2019 - + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); 2039 + path+"export/" + sdfSimple.format(sdfMonth.parse(startDate))
  2040 + + "-" + sdfSimple.format(sdfMonth.parse(endDate))
  2041 + + "-" + lineName + "-烂班情况分析表.xls");
2020 } catch (Exception e) { 2042 } catch (Exception e) {
2021 // TODO: handle exception 2043 // TODO: handle exception
2022 e.printStackTrace(); 2044 e.printStackTrace();
@@ -2408,6 +2430,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2408,6 +2430,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2408 public Map<String, Object> exportWaybillMore(Map<String, Object> map) { 2430 public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
2409 String date = map.get("date").toString(); 2431 String date = map.get("date").toString();
2410 String line = map.get("line").toString(); 2432 String line = map.get("line").toString();
  2433 + String lineName = map.get("lineName").toString();
2411 ReportUtils ee = new ReportUtils(); 2434 ReportUtils ee = new ReportUtils();
2412 List<List> strs = JSON.parseArray(map.get("strs").toString(), List.class); 2435 List<List> strs = JSON.parseArray(map.get("strs").toString(), List.class);
2413 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; 2436 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
@@ -2417,7 +2440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2417,7 +2440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2417 File file = null; 2440 File file = null;
2418 try { 2441 try {
2419 while (true) { 2442 while (true) {
2420 - String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); 2443 + String fileUrl = path + sdfSimple.format(sdfMonth.parse(date))+"-"+lineName+"-行车路单";
2421 // file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 2444 // file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹
2422 file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 2445 file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件
2423 if (file.exists()) { //判断是否已存在重名 2446 if (file.exists()) { //判断是否已存在重名
@@ -3009,19 +3032,28 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3009,19 +3032,28 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3009 } 3032 }
3010 3033
3011 if(map.containsKey("type") && map.get("type").toString().equals("export")){ 3034 if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3035 + String lineName = "";
  3036 + if(map.containsKey("lineName"))
  3037 + lineName = map.get("lineName").toString();
3012 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 3038 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3013 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 3039 sdfSimple = new SimpleDateFormat("yyyyMMdd");
3014 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 3040 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3015 Map<String,Object> m = new HashMap<String, Object>(); 3041 Map<String,Object> m = new HashMap<String, Object>();
3016 ReportUtils ee = new ReportUtils(); 3042 ReportUtils ee = new ReportUtils();
3017 try { 3043 try {
  3044 + String dateTime = "";
  3045 + if(startDate.equals(endDate)){
  3046 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  3047 + } else {
  3048 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  3049 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  3050 + }
3018 listI.add(resList.iterator()); 3051 listI.add(resList.iterator());
3019 m.put("date1", startDate); 3052 m.put("date1", startDate);
3020 m.put("date2", endDate); 3053 m.put("date2", endDate);
3021 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 3054 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3022 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime.xls", 3055 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime.xls",
3023 - path+"export/发车到站准点率" + sdfSimple.format(sdfMonth.parse(startDate)) +  
3024 - (startDate.equals(endDate)?"":"-"+sdfSimple.format(sdfMonth.parse(endDate))) + ".xls"); 3056 + path+"export/" + dateTime + "-" + lineName + "-发车到站准点率.xls");
3025 } catch (Exception e) { 3057 } catch (Exception e) {
3026 // TODO: handle exception 3058 // TODO: handle exception
3027 e.printStackTrace(); 3059 e.printStackTrace();
@@ -3058,18 +3090,28 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3058,18 +3090,28 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3058 } 3090 }
3059 3091
3060 if(map.containsKey("type") && map.get("type").toString().equals("export")){ 3092 if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3093 + String lineName = "";
  3094 + if(map.containsKey("lineName"))
  3095 + lineName = map.get("lineName").toString();
3061 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 3096 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3062 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 3097 sdfSimple = new SimpleDateFormat("yyyyMMdd");
3063 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 3098 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3064 Map<String,Object> m = new HashMap<String, Object>(); 3099 Map<String,Object> m = new HashMap<String, Object>();
3065 ReportUtils ee = new ReportUtils(); 3100 ReportUtils ee = new ReportUtils();
3066 try { 3101 try {
  3102 + String dateTime = "";
  3103 + if(startDate.equals(endDate)){
  3104 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  3105 + } else {
  3106 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  3107 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  3108 + }
3067 listI.add(resList.iterator()); 3109 listI.add(resList.iterator());
3068 m.put("date1", startDate); 3110 m.put("date1", startDate);
3069 m.put("date2", endDate); 3111 m.put("date2", endDate);
3070 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 3112 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3071 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime1.xls", 3113 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime1.xls",
3072 - path+"export/发车到站准点率明细.xls"); 3114 + path+"export/"+dateTime+"-"+lineName+"-发车到站准点率明细.xls");
3073 } catch (Exception e) { 3115 } catch (Exception e) {
3074 // TODO: handle exception 3116 // TODO: handle exception
3075 e.printStackTrace(); 3117 e.printStackTrace();
@@ -3093,18 +3135,29 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3093,18 +3135,29 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3093 } 3135 }
3094 3136
3095 if(map.containsKey("type") && map.get("type").toString().equals("export")){ 3137 if(map.containsKey("type") && map.get("type").toString().equals("export")){
  3138 + String lineName = "";
  3139 + if(map.containsKey("lineName"))
  3140 + lineName = map.get("lineName").toString();
3096 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 3141 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3097 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 3142 sdfSimple = new SimpleDateFormat("yyyyMMdd");
3098 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 3143 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3099 Map<String,Object> m = new HashMap<String, Object>(); 3144 Map<String,Object> m = new HashMap<String, Object>();
3100 ReportUtils ee = new ReportUtils(); 3145 ReportUtils ee = new ReportUtils();
3101 try { 3146 try {
  3147 + String dateTime = "";
  3148 + if(startDate.equals(endDate)){
  3149 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  3150 + } else {
  3151 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  3152 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  3153 + }
3102 listI.add(resList.iterator()); 3154 listI.add(resList.iterator());
3103 m.put("date", startDate); 3155 m.put("date", startDate);
3104 m.put("line", line); 3156 m.put("line", line);
3105 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 3157 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3106 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime2.xls", 3158 ee.excelReplace(listI, new Object[] { m }, path+"mould/onTime2.xls",
3107 - path+"export/发车到站准点率详细"+sdfSimple.format(sdfMonth.parse(startDate))+".xls"); 3159 + path+"export/"+sdfSimple.format(sdfMonth.parse(startDate))
  3160 + +"-"+lineName+"-发车到站准点率详细.xls");
3108 } catch (Exception e) { 3161 } catch (Exception e) {
3109 // TODO: handle exception 3162 // TODO: handle exception
3110 e.printStackTrace(); 3163 e.printStackTrace();
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -1047,10 +1047,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1047,10 +1047,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1047 m.put("fyyyhj", fyyyhj); 1047 m.put("fyyyhj", fyyyhj);
1048 ReportUtils ee = new ReportUtils(); 1048 ReportUtils ee = new ReportUtils();
1049 try { 1049 try {
  1050 + String lineName = "";
  1051 + if(map.containsKey("lineName"))
  1052 + lineName = map.get("lineName").toString();
1050 listI.add(mapList.iterator()); 1053 listI.add(mapList.iterator());
1051 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 1054 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1052 ee.excelReplace(listI, new Object[] { m }, path+"mould/oilListMonth.xls", 1055 ee.excelReplace(listI, new Object[] { m }, path+"mould/oilListMonth.xls",
1053 - path+"export/月存油报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); 1056 + path+"export/" + sdfSimple.format(sdfMonth.parse(date))
  1057 + + "-" + lineName + "-月存油报表.xls");
1054 } catch (Exception e) { 1058 } catch (Exception e) {
1055 // TODO: handle exception 1059 // TODO: handle exception
1056 e.printStackTrace(); 1060 e.printStackTrace();