Commit 1b49b3fab59d34eb88add00325587e689a2dc800
1 parent
df4d320a
LGF 导出
Showing
5 changed files
with
114 additions
and
50 deletions
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import java.util.Collections; |
| 11 | 11 | import java.util.Comparator; |
| 12 | 12 | import java.util.Date; |
| 13 | 13 | import java.util.HashMap; |
| 14 | +import java.util.Iterator; | |
| 14 | 15 | import java.util.List; |
| 15 | 16 | import java.util.Map; |
| 16 | 17 | import java.util.Set; |
| ... | ... | @@ -25,6 +26,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 25 | 26 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 26 | 27 | import com.bsth.service.BusIntervalService; |
| 27 | 28 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 29 | +import com.bsth.util.ReportUtils; | |
| 28 | 30 | |
| 29 | 31 | |
| 30 | 32 | @Service |
| ... | ... | @@ -514,6 +516,24 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 514 | 516 | } |
| 515 | 517 | } |
| 516 | 518 | } |
| 519 | + | |
| 520 | + if(type != null && type.length() != 0 && type.equals("export")){ | |
| 521 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 522 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 523 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 524 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 525 | + ReportUtils ee = new ReportUtils(); | |
| 526 | + try { | |
| 527 | + listI.add(resList.iterator()); | |
| 528 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 529 | + ee.excelReplace(listI, new Object[] { m }, path+"mould\\interval.xls", | |
| 530 | + path+"export\\班次间隔统计表" + sdfSimple.format(sdfMonth.parse(startDate)) | |
| 531 | + + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); | |
| 532 | + } catch (Exception e) { | |
| 533 | + // TODO: handle exception | |
| 534 | + e.printStackTrace(); | |
| 535 | + } | |
| 536 | + } | |
| 517 | 537 | |
| 518 | 538 | return resList; |
| 519 | 539 | } |
| ... | ... | @@ -672,8 +692,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 672 | 692 | String[] date1 = startDate.split("-"); |
| 673 | 693 | String[] date2 = endDate.split("-"); |
| 674 | 694 | String date = ""; |
| 675 | - startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | |
| 676 | - endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | |
| 695 | +// startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | |
| 696 | +// endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | |
| 677 | 697 | if(startDate.equals(endDate)){ |
| 678 | 698 | date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; |
| 679 | 699 | } else { |
| ... | ... | @@ -1044,6 +1064,27 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1044 | 1064 | modelMap.put("dataList", dataList); |
| 1045 | 1065 | } |
| 1046 | 1066 | |
| 1067 | + if(type != null && type.length() != 0 && type.equals("export")){ | |
| 1068 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1069 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1070 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1071 | + ReportUtils ee = new ReportUtils(); | |
| 1072 | + if(statu.equals("0")) | |
| 1073 | + modelMap.put("lpType", "路牌数量"); | |
| 1074 | + else if(statu.equals("1")) | |
| 1075 | + modelMap.put("lpType", "路牌名"); | |
| 1076 | + try { | |
| 1077 | + listI.add(((List<Map<String, Object>>)modelMap.get("dataList")).iterator()); | |
| 1078 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 1079 | + ee.excelReplace(listI, new Object[] { modelMap }, path+"mould\\timeAndSpeed.xls", | |
| 1080 | + path+"export\\行驶时间及车速统计表" + sdfSimple.format(sdfMonth.parse(startDate)) | |
| 1081 | + + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); | |
| 1082 | + } catch (Exception e) { | |
| 1083 | + // TODO: handle exception | |
| 1084 | + e.printStackTrace(); | |
| 1085 | + } | |
| 1086 | + } | |
| 1087 | + | |
| 1047 | 1088 | return modelMap; |
| 1048 | 1089 | } |
| 1049 | 1090 | ... | ... |
src/main/resources/static/pages/forms/mould/timeAndSpeed.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/busInterval.html
| ... | ... | @@ -261,11 +261,22 @@ |
| 261 | 261 | }); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | -// $("#export").on("click",function(){ | |
| 265 | -// $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | |
| 266 | -// window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | |
| 267 | -// }); | |
| 268 | -// }); | |
| 264 | + $("#export").on("click", function(){ | |
| 265 | + var params = {}; | |
| 266 | + params['line'] = line; | |
| 267 | + params['statu'] = statu; | |
| 268 | + params['startDate'] = startDate; | |
| 269 | + params['endDate'] = endDate; | |
| 270 | + params['model'] = model; | |
| 271 | + params['company'] = company; | |
| 272 | + params['subCompany'] = subCompany; | |
| 273 | + params['type'] = "export"; | |
| 274 | + $get('/busInterval/interval', params, function(result){ | |
| 275 | + window.open("/downloadFile/download?fileName=班次间隔统计表" | |
| 276 | + +moment(startDate).format("YYYYMMDD")+"-" | |
| 277 | + +moment(endDate).format("YYYYMMDD")); | |
| 278 | + }); | |
| 279 | + }); | |
| 269 | 280 | |
| 270 | 281 | |
| 271 | 282 | $("#lp1").hide(); | ... | ... |
src/main/resources/static/pages/forms/statement/statisticsDaily .html
| ... | ... | @@ -21,12 +21,12 @@ |
| 21 | 21 | <h1>统计日报</h1> |
| 22 | 22 | </div> |
| 23 | 23 | </div> |
| 24 | - | |
| 25 | -<div class="row"> | |
| 26 | - <div class="col-md-12"> | |
| 27 | - <div class="portlet light porttlet-fit bordered"> | |
| 28 | - <div class="portlet-title"> | |
| 29 | - <form class="form-inline" action=""> | |
| 24 | + | |
| 25 | +<div class="row"> | |
| 26 | + <div class="col-md-12"> | |
| 27 | + <div class="portlet light porttlet-fit bordered"> | |
| 28 | + <div class="portlet-title"> | |
| 29 | + <form class="form-inline" action=""> | |
| 30 | 30 | <div style="display: inline-block;"> |
| 31 | 31 | <span class="item-label" style="width: 80px;">线路: </span> |
| 32 | 32 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| ... | ... | @@ -38,10 +38,10 @@ |
| 38 | 38 | <div class="form-group"> |
| 39 | 39 | <input class="btn btn-default" type="button" id="query" value="查询"/> |
| 40 | 40 | <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> |
| 41 | - </div> | |
| 42 | - </form> | |
| 43 | - </div> | |
| 44 | - <div class="portlet-body"> | |
| 41 | + </div> | |
| 42 | + </form> | |
| 43 | + </div> | |
| 44 | + <div class="portlet-body"> | |
| 45 | 45 | <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> |
| 46 | 46 | <label>早高峰:6:31~8:30 晚高峰:16:01~18:00</label> |
| 47 | 47 | <table class="table table-bordered table-hover table-checkable" id="forms"> |
| ... | ... | @@ -148,21 +148,21 @@ |
| 148 | 148 | <td colspan="35"> </td> |
| 149 | 149 | </tr> |
| 150 | 150 | </table> |
| 151 | - </div> | |
| 152 | - </div> | |
| 153 | - </div> | |
| 154 | - </div> | |
| 155 | -</div> | |
| 156 | - | |
| 157 | -<script> | |
| 158 | - $(function(){ | |
| 159 | - // 关闭左侧栏 | |
| 160 | - if (!$('body').hasClass('page-sidebar-closed')) | |
| 151 | + </div> | |
| 152 | + </div> | |
| 153 | + </div> | |
| 154 | + </div> | |
| 155 | +</div> | |
| 156 | + | |
| 157 | +<script> | |
| 158 | + $(function(){ | |
| 159 | + // 关闭左侧栏 | |
| 160 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 161 | 161 | $('.menu-toggler.sidebar-toggler').click(); |
| 162 | - | |
| 163 | - $("#date").datetimepicker({ | |
| 164 | - format : 'YYYY-MM-DD', | |
| 165 | - locale : 'zh-cn' | |
| 162 | + | |
| 163 | + $("#date").datetimepicker({ | |
| 164 | + format : 'YYYY-MM-DD', | |
| 165 | + locale : 'zh-cn' | |
| 166 | 166 | }); |
| 167 | 167 | $.get('/basic/lineCode2Name',function(result){ |
| 168 | 168 | var data=[]; |
| ... | ... | @@ -186,11 +186,11 @@ |
| 186 | 186 | // 把渲染好的模版html文本追加到表格中 |
| 187 | 187 | $('#forms .statisticsDaily').html(tbodyHtml); |
| 188 | 188 | }); |
| 189 | - }); | |
| 190 | - }); | |
| 191 | -</script> | |
| 192 | -<script type="text/html" id="statisticsDaily"> | |
| 193 | - {{each list as obj i}} | |
| 189 | + }); | |
| 190 | + }); | |
| 191 | +</script> | |
| 192 | +<script type="text/html" id="statisticsDaily"> | |
| 193 | + {{each list as obj i}} | |
| 194 | 194 | <tr> |
| 195 | 195 | <td>{{obj.xlName}}</td> |
| 196 | 196 | <td>{{obj.jhlc}}</td> |
| ... | ... | @@ -227,12 +227,12 @@ |
| 227 | 227 | <td>{{obj.djg_m}}</td> |
| 228 | 228 | <td>{{obj.djg_a}}</td> |
| 229 | 229 | <td>{{obj.djg_time}}</td> |
| 230 | - <td> </td> | |
| 231 | - </tr> | |
| 230 | + <td> </td> | |
| 231 | + </tr> | |
| 232 | 232 | {{/each}} |
| 233 | 233 | {{if list.length == 0}} |
| 234 | 234 | <tr> |
| 235 | 235 | <td colspan="36"><h6 class="muted">没有找到相关数据</h6></td> |
| 236 | 236 | </tr> |
| 237 | - {{/if}} | |
| 237 | + {{/if}} | |
| 238 | 238 | </script> |
| 239 | 239 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | </div> |
| 83 | 83 | <div class="form-group" style="margin-left: 14px"> |
| 84 | 84 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 85 | -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | |
| 85 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 86 | 86 | </div> |
| 87 | 87 | </form> |
| 88 | 88 | </div> |
| ... | ... | @@ -252,11 +252,23 @@ |
| 252 | 252 | }); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -// $("#export").on("click",function(){ | |
| 256 | -// $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){ | |
| 257 | -// window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD")); | |
| 258 | -// }); | |
| 259 | -// }); | |
| 255 | + $("#export").on("click", function(){ | |
| 256 | + var params = {}; | |
| 257 | + params['lp'] = lp; | |
| 258 | + params['line'] = line; | |
| 259 | + params['statu'] = statu; | |
| 260 | + params['startDate'] = startDate; | |
| 261 | + params['endDate'] = endDate; | |
| 262 | + params['model'] = model; | |
| 263 | + params['company'] = company; | |
| 264 | + params['subCompany'] = subCompany; | |
| 265 | + params['type'] = "export"; | |
| 266 | + $get('/busInterval/timeAndSpeed', params, function(result){ | |
| 267 | + window.open("/downloadFile/download?fileName=行驶时间及车速统计表" | |
| 268 | + +moment(startDate).format("YYYYMMDD")+"-" | |
| 269 | + +moment(endDate).format("YYYYMMDD")); | |
| 270 | + }); | |
| 271 | + }); | |
| 260 | 272 | |
| 261 | 273 | |
| 262 | 274 | $("#lp1").hide(); |
| ... | ... | @@ -368,8 +380,8 @@ |
| 368 | 380 | <th style='text-align:center;'>公司</th> |
| 369 | 381 | <th style='text-align:center;'>分公司</th> |
| 370 | 382 | <th style='text-align:center;'>线路</th> |
| 371 | - {{if list.statu == 0}}<th style='text-align:center;'>路牌数</th>{{/if}} | |
| 372 | - {{if list.statu == 1}}<th style='text-align:center;'>路牌</th>{{/if}} | |
| 383 | + {{if list.statu == 0}}<th style='text-align:center;'>路牌数量</th>{{/if}} | |
| 384 | + {{if list.statu == 1}}<th style='text-align:center;'>路牌名</th>{{/if}} | |
| 373 | 385 | <th>计划营运时间(小时)</th> |
| 374 | 386 | <th>计划营运车速(公里/小时)</th> |
| 375 | 387 | <th>实际营运时间(小时)</th> |
| ... | ... | @@ -399,7 +411,7 @@ |
| 399 | 411 | <td>{{obj.sjyscs}}</td> |
| 400 | 412 | </tr> |
| 401 | 413 | {{/each}} |
| 402 | - {{if list.dataList.length > 1}} | |
| 414 | + {{if list.dataList.length > 0}} | |
| 403 | 415 | <tr> |
| 404 | 416 | <td style='vertical-align:middle;' colspan='5'>合计平均值</td> |
| 405 | 417 | <td>{{list.jhyysj}}</td> |
| ... | ... | @@ -426,7 +438,7 @@ |
| 426 | 438 | <th style='text-align:center;'>公司</th> |
| 427 | 439 | <th style='text-align:center;'>分公司</th> |
| 428 | 440 | <th style='text-align:center;'>线路</th> |
| 429 | - <th style='text-align:center;'>路牌</th> | |
| 441 | + <th style='text-align:center;'>路牌名</th> | |
| 430 | 442 | <th>计划营运时间(小时)</th> |
| 431 | 443 | <th>计划营运车速(公里/小时)</th> |
| 432 | 444 | <th>实际营运时间(小时)</th> |
| ... | ... | @@ -455,7 +467,7 @@ |
| 455 | 467 | <td>{{obj.sjyscs}}</td> |
| 456 | 468 | </tr> |
| 457 | 469 | {{/each}} |
| 458 | - {{if list.work.length > 1}} | |
| 470 | + {{if list.work.length > 0}} | |
| 459 | 471 | <tr> |
| 460 | 472 | <td style='vertical-align:middle;' colspan='5'>合计平均值</td> |
| 461 | 473 | <td>{{list.jhyysj}}</td> | ... | ... |