Commit 036cd2173ce1b09d8907501f78b97b46b047ec0d

Authored by 娄高锋
1 parent 832c3a08

LGF 调度日报表月统计

src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -30,7 +30,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI
30 30  
31 31 @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
32 32 List<ScheduleRealInfo> queryUserInfo2(String line,String date);
33   -
  33 +
34 34 @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ")
35 35 List<ScheduleRealInfo> queryUserInfo3(String line,String date);
36 36  
... ... @@ -119,6 +119,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
119 119  
120 120 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
121 121 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
  122 +
  123 + //按月统计
  124 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
  125 + List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
122 126  
123 127 @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY realExecDate,fcsj,xlBm,clZbh")
124 128 List<Map<String,Object>> yesterdayDataList(String line,String date);
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -525,6 +525,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
525 525 map.put("fast", "");
526 526 map.put("slow", "");
527 527 }
  528 + System.out.println(map);
528 529 listMap.add(map);
529 530 } catch (Exception e) {
530 531 e.printStackTrace();
... ... @@ -1386,7 +1387,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1386 1387 @Override
1387 1388 public List<Map<String, Object>> statisticsDaily(String line, String date,
1388 1389 String xlName, String type) {
1389   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1390 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  1391 + if(date.length() == 10)
  1392 + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1393 + else if(date.length() == 7)
  1394 + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1390 1395  
1391 1396 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1392 1397 DecimalFormat format = new DecimalFormat("0.00");
... ... @@ -2563,7 +2568,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2563 2568 map.put("fast", "");
2564 2569 map.put("slow", "");
2565 2570 }
2566   - listMap.add(map);
  2571 + System.out.println(map);
  2572 + listMap.add(map);
2567 2573 } catch (Exception e) {
2568 2574 e.printStackTrace();
2569 2575 }
... ... @@ -2591,13 +2597,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2591 2597 map.put("jzl", jzl);
2592 2598 map.put("jhlc", format.format(jhlc+jcclc));
2593 2599 map.put("yygljh", format.format(jhlc));
2594   - map.put("ssgl", format.format(remgl));
  2600 + map.put("ssgl", format.format(remMileage));
2595 2601 map.put("ksgl", format.format(ksgl));
2596 2602 map.put("yyglsj", format.format(yygl));
2597 2603 map.put("jhbc", jhbc);
2598 2604 map.put("jcclc", jcclc);
2599 2605  
2600   - map.put("ljgl", format.format(addgl));
  2606 + map.put("ljgl", format.format(addMileage));
2601 2607 map.put("ssbc", cjbc);
2602 2608 map.put("ysgl", format.format(yygl));
2603 2609 map.put("sjbc", jhbc-cjbc+ljbc);
... ... @@ -3114,7 +3120,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3114 3120 listI.add(dataList2.iterator());
3115 3121 listI.add(dataList3.iterator());
3116 3122 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3117   - ee.excelReplace(listI, new Object[] { m }, path+"mould/scheduleDaily.xls",
  3123 + String sourcePath = path+"mould/scheduleDaily.xls";
  3124 + if(date.length() == 7){
  3125 + sdfMonth = new SimpleDateFormat("yyyy-MM");
  3126 + sdfSimple = new SimpleDateFormat("yyyyMM");
  3127 + sourcePath = path+"mould/scheduleDaily_m.xls";
  3128 + }
  3129 + ee.excelReplace(listI, new Object[] { m }, sourcePath,
3118 3130 path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
3119 3131 } catch (Exception e) {
3120 3132 // TODO: handle exception
... ...
src/main/resources/static/pages/forms/mould/scheduleDaily_m.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -37,6 +37,7 @@
37 37 </div>
38 38 <div class="form-group">
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
  40 + <input class="btn btn-default" type="button" id="month" value="按月查询"/>
40 41 <input class="btn btn-default" type="button" id="export" value="导出"/>
41 42 </div>
42 43 </form>
... ... @@ -51,8 +52,8 @@
51 52 </tr>
52 53 <tr>
53 54 <td rowspan="3">路线别</td>
54   - <td colspan="16">全日营运里程(公里)</td>
55   - <td colspan="15">全日营运班次</td>
  55 + <td colspan="16"><c>全日</c>营运里程(公里)</td>
  56 + <td colspan="15"><c>全日</c>营运班次</td>
56 57 <td colspan="9">大间隔情况</td>
57 58 </tr>
58 59 <tr>
... ... @@ -83,22 +84,22 @@
83 84 <td>气候</td>
84 85 <td>援外</td>
85 86 <td>其他</td>
86   - <td>全日</td>
  87 + <td><c>全日</c></td>
87 88 <td>早高峰</td>
88 89 <td>晚高峰</td>
89   - <td>全日</td>
  90 + <td><c>全日</c></td>
90 91 <td>早高峰</td>
91 92 <td>晚高峰</td>
92   - <td>全日</td>
  93 + <td><c>全日</c></td>
93 94 <td>早高峰</td>
94 95 <td>晚高峰</td>
95   - <td>全日</td>
  96 + <td><c>全日</c></td>
96 97 <td>早高峰</td>
97 98 <td>晚高峰</td>
98   - <td>全日</td>
  99 + <td><c>全日</c></td>
99 100 <td>早高峰</td>
100 101 <td>晚高峰</td>
101   - <td>全日</td>
  102 + <td><c>全日</c></td>
102 103 <td>早高峰</td>
103 104 <td>晚高峰</td>
104 105 </tr>
... ... @@ -273,15 +274,24 @@
273 274 initPinYinSelect2('#line',data,'');
274 275  
275 276 })
  277 +
  278 + $('#export').attr('disabled', "true");
  279 +
  280 + var line = $("#line").val();
  281 + var xlName = $("#select2-line-container").html();
  282 + var date = $("#date").val();
  283 +
276 284 //查询
277 285 $("#query").on('click',function(){
278   - var line = $("#line").val();
279   - var xlName = $("#select2-line-container").html();
280   - var date = $("#date").val();
  286 + line = $("#line").val();
  287 + xlName = $("#select2-line-container").html();
  288 + date = $("#date").val();
281 289 if(date == null || date.length == 0){
282 290 layer.msg("请选择时间");
283 291 return;
284 292 }
  293 + $("c").html("全日");
  294 + $("#export").removeAttr("disabled");
285 295 $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
286 296 var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
287 297 $('#forms .scheduleDaily_1').html(scheduleDaily_1);
... ... @@ -298,22 +308,43 @@
298 308  
299 309 });
300 310  
  311 + //按月查询
  312 + $("#month").on('click',function(){
  313 + line = $("#line").val();
  314 + xlName = $("#select2-line-container").html();
  315 + date = $("#date").val();
  316 + if(date == null || date.length == 0){
  317 + layer.msg("请选择时间");
  318 + return;
  319 + }
  320 + date = date.substring(0, 7);
  321 + $("c").html("全月");
  322 + $("#export").removeAttr("disabled");
  323 + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
  324 + var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
  325 + $('#forms .scheduleDaily_1').html(scheduleDaily_1);
  326 + });
  327 + $('#forms .scheduleDaily_2').html("");
  328 + $('#forms .scheduleDaily_3').html("");
  329 +
  330 + });
  331 +
301 332 $("#export").on("click",function(){
302 333 var params = {};
303   - var line = $("#line").val();
304   - var xlName = $("#select2-line-container").html();
305   - var date = $("#date").val();
306 334 if(date == null || date.length == 0){
307 335 layer.msg("请选择时间");
308 336 return;
309 337 }
310 338 params['line'] = line;
311 339 params['date'] = date;
312   - params['xlName'] = "xlName";
  340 + params['xlName'] = xlName;
313 341 params['type'] = "export";
314 342 params['state'] = '2';
315 343 $get('/realSchedule/scheduleDailyExport', params, function(result){
316   - window.open("/downloadFile/download?fileName=调度日报"+moment(date).format("YYYYMMDD"));
  344 + if(date.length == 10)
  345 + window.open("/downloadFile/download?fileName=调度日报"+moment(date).format("YYYYMMDD"));
  346 + else
  347 + window.open("/downloadFile/download?fileName=调度日报"+moment(date).format("YYYYMM"));
317 348 });
318 349 });
319 350  
... ...