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,7 +30,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI
30 30
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)") 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 List<ScheduleRealInfo> queryUserInfo2(String line,String date); 32 List<ScheduleRealInfo> queryUserInfo2(String line,String date);
33 - 33 +
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 ") 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 List<ScheduleRealInfo> queryUserInfo3(String line,String date); 35 List<ScheduleRealInfo> queryUserInfo3(String line,String date);
36 36
@@ -119,6 +119,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -119,6 +119,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
119 119
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") 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 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); 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 @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") 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 List<Map<String,Object>> yesterdayDataList(String line,String date); 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,6 +525,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
525 map.put("fast", ""); 525 map.put("fast", "");
526 map.put("slow", ""); 526 map.put("slow", "");
527 } 527 }
  528 + System.out.println(map);
528 listMap.add(map); 529 listMap.add(map);
529 } catch (Exception e) { 530 } catch (Exception e) {
530 e.printStackTrace(); 531 e.printStackTrace();
@@ -1386,7 +1387,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1386,7 +1387,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1386 @Override 1387 @Override
1387 public List<Map<String, Object>> statisticsDaily(String line, String date, 1388 public List<Map<String, Object>> statisticsDaily(String line, String date,
1388 String xlName, String type) { 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 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 1396 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1392 DecimalFormat format = new DecimalFormat("0.00"); 1397 DecimalFormat format = new DecimalFormat("0.00");
@@ -2563,7 +2568,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2563,7 +2568,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2563 map.put("fast", ""); 2568 map.put("fast", "");
2564 map.put("slow", ""); 2569 map.put("slow", "");
2565 } 2570 }
2566 - listMap.add(map); 2571 + System.out.println(map);
  2572 + listMap.add(map);
2567 } catch (Exception e) { 2573 } catch (Exception e) {
2568 e.printStackTrace(); 2574 e.printStackTrace();
2569 } 2575 }
@@ -2591,13 +2597,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2591,13 +2597,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2591 map.put("jzl", jzl); 2597 map.put("jzl", jzl);
2592 map.put("jhlc", format.format(jhlc+jcclc)); 2598 map.put("jhlc", format.format(jhlc+jcclc));
2593 map.put("yygljh", format.format(jhlc)); 2599 map.put("yygljh", format.format(jhlc));
2594 - map.put("ssgl", format.format(remgl)); 2600 + map.put("ssgl", format.format(remMileage));
2595 map.put("ksgl", format.format(ksgl)); 2601 map.put("ksgl", format.format(ksgl));
2596 map.put("yyglsj", format.format(yygl)); 2602 map.put("yyglsj", format.format(yygl));
2597 map.put("jhbc", jhbc); 2603 map.put("jhbc", jhbc);
2598 map.put("jcclc", jcclc); 2604 map.put("jcclc", jcclc);
2599 2605
2600 - map.put("ljgl", format.format(addgl)); 2606 + map.put("ljgl", format.format(addMileage));
2601 map.put("ssbc", cjbc); 2607 map.put("ssbc", cjbc);
2602 map.put("ysgl", format.format(yygl)); 2608 map.put("ysgl", format.format(yygl));
2603 map.put("sjbc", jhbc-cjbc+ljbc); 2609 map.put("sjbc", jhbc-cjbc+ljbc);
@@ -3114,7 +3120,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3114,7 +3120,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3114 listI.add(dataList2.iterator()); 3120 listI.add(dataList2.iterator());
3115 listI.add(dataList3.iterator()); 3121 listI.add(dataList3.iterator());
3116 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 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 path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls"); 3130 path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
3119 } catch (Exception e) { 3131 } catch (Exception e) {
3120 // TODO: handle exception 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,6 +37,7 @@
37 </div> 37 </div>
38 <div class="form-group"> 38 <div class="form-group">
39 <input class="btn btn-default" type="button" id="query" value="查询"/> 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
  40 + <input class="btn btn-default" type="button" id="month" value="按月查询"/>
40 <input class="btn btn-default" type="button" id="export" value="导出"/> 41 <input class="btn btn-default" type="button" id="export" value="导出"/>
41 </div> 42 </div>
42 </form> 43 </form>
@@ -51,8 +52,8 @@ @@ -51,8 +52,8 @@
51 </tr> 52 </tr>
52 <tr> 53 <tr>
53 <td rowspan="3">路线别</td> 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 <td colspan="9">大间隔情况</td> 57 <td colspan="9">大间隔情况</td>
57 </tr> 58 </tr>
58 <tr> 59 <tr>
@@ -83,22 +84,22 @@ @@ -83,22 +84,22 @@
83 <td>气候</td> 84 <td>气候</td>
84 <td>援外</td> 85 <td>援外</td>
85 <td>其他</td> 86 <td>其他</td>
86 - <td>全日</td> 87 + <td><c>全日</c></td>
87 <td>早高峰</td> 88 <td>早高峰</td>
88 <td>晚高峰</td> 89 <td>晚高峰</td>
89 - <td>全日</td> 90 + <td><c>全日</c></td>
90 <td>早高峰</td> 91 <td>早高峰</td>
91 <td>晚高峰</td> 92 <td>晚高峰</td>
92 - <td>全日</td> 93 + <td><c>全日</c></td>
93 <td>早高峰</td> 94 <td>早高峰</td>
94 <td>晚高峰</td> 95 <td>晚高峰</td>
95 - <td>全日</td> 96 + <td><c>全日</c></td>
96 <td>早高峰</td> 97 <td>早高峰</td>
97 <td>晚高峰</td> 98 <td>晚高峰</td>
98 - <td>全日</td> 99 + <td><c>全日</c></td>
99 <td>早高峰</td> 100 <td>早高峰</td>
100 <td>晚高峰</td> 101 <td>晚高峰</td>
101 - <td>全日</td> 102 + <td><c>全日</c></td>
102 <td>早高峰</td> 103 <td>早高峰</td>
103 <td>晚高峰</td> 104 <td>晚高峰</td>
104 </tr> 105 </tr>
@@ -273,15 +274,24 @@ @@ -273,15 +274,24 @@
273 initPinYinSelect2('#line',data,''); 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 $("#query").on('click',function(){ 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 if(date == null || date.length == 0){ 289 if(date == null || date.length == 0){
282 layer.msg("请选择时间"); 290 layer.msg("请选择时间");
283 return; 291 return;
284 } 292 }
  293 + $("c").html("全日");
  294 + $("#export").removeAttr("disabled");
285 $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){ 295 $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
286 var scheduleDaily_1 = template('scheduleDaily_1',{list:result}); 296 var scheduleDaily_1 = template('scheduleDaily_1',{list:result});
287 $('#forms .scheduleDaily_1').html(scheduleDaily_1); 297 $('#forms .scheduleDaily_1').html(scheduleDaily_1);
@@ -298,22 +308,43 @@ @@ -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 $("#export").on("click",function(){ 332 $("#export").on("click",function(){
302 var params = {}; 333 var params = {};
303 - var line = $("#line").val();  
304 - var xlName = $("#select2-line-container").html();  
305 - var date = $("#date").val();  
306 if(date == null || date.length == 0){ 334 if(date == null || date.length == 0){
307 layer.msg("请选择时间"); 335 layer.msg("请选择时间");
308 return; 336 return;
309 } 337 }
310 params['line'] = line; 338 params['line'] = line;
311 params['date'] = date; 339 params['date'] = date;
312 - params['xlName'] = "xlName"; 340 + params['xlName'] = xlName;
313 params['type'] = "export"; 341 params['type'] = "export";
314 params['state'] = '2'; 342 params['state'] = '2';
315 $get('/realSchedule/scheduleDailyExport', params, function(result){ 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