Commit 7757aa5b91bdf2752808d6e4bd4e5223e60f71b8

Authored by yiming
1 parent c72c8e25

纯电量报表添加按人、按车查询项

src/main/java/com/bsth/repository/RefuelRepository.java
@@ -34,12 +34,12 @@ public interface RefuelRepository extends BaseRepository<Refuel, Long> { @@ -34,12 +34,12 @@ public interface RefuelRepository extends BaseRepository<Refuel, Long> {
34 List<ScheduleRealInfo> scheduleByDate(String date, String clZbh, String jGh); 34 List<ScheduleRealInfo> scheduleByDate(String date, String clZbh, String jGh);
35 35
36 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 36 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
37 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh like ?2 and s.xlBm = ?3 order by s.clZbh asc")  
38 - List<ScheduleRealInfo> scheduleByDateAndLine(String date, String clZbh, String xlBm); 37 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh like ?2 and s.xlBm = ?3 and s.jGh like ?4 order by s.clZbh asc")
  38 + List<ScheduleRealInfo> scheduleByDateAndLine(String date, String clZbh, String xlBm, String jGh);
39 39
40 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 40 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
41 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh like ?2 order by s.xlBm asc, s.clZbh asc")  
42 - List<ScheduleRealInfo> scheduleByDateAndCar(String date, String clZbh); 41 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh like ?2 and s.jGh like ?3 order by s.xlBm asc, s.clZbh asc")
  42 + List<ScheduleRealInfo> scheduleByDateAndCar(String date, String clZbh, String jGh);
43 43
44 @Transactional 44 @Transactional
45 @Modifying 45 @Modifying
src/main/java/com/bsth/service/impl/RefuelServiceImpl.java
@@ -394,7 +394,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -394,7 +394,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
394 // TODO Auto-generated method stub 394 // TODO Auto-generated method stub
395 DecimalFormat df = new DecimalFormat("0.##"); 395 DecimalFormat df = new DecimalFormat("0.##");
396 396
397 - String date = "", car = "%%", xlbm = ""; 397 + String date = "", car = "%%", xlbm = "", driver = "%%";
  398 + if(map.get("driver") != null){
  399 + driver = "%" + map.get("driver").toString() + "%";
  400 + }
398 if(map.get("date") != null){ 401 if(map.get("date") != null){
399 date = map.get("date").toString(); 402 date = map.get("date").toString();
400 } 403 }
@@ -420,10 +423,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -420,10 +423,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
420 if(xlbm.length() > 0){ 423 if(xlbm.length() > 0){
421 String[] split = xlbm.split(","); 424 String[] split = xlbm.split(",");
422 for(String s : split){ 425 for(String s : split){
423 - scheList.addAll(repository.scheduleByDateAndLine(date, car, s)); 426 + scheList.addAll(repository.scheduleByDateAndLine(date, car, s,driver));
424 } 427 }
425 } else { 428 } else {
426 - scheList = repository.scheduleByDateAndCar(date, car); 429 + scheList = repository.scheduleByDateAndCar(date, car,null);
427 } 430 }
428 List<Cars> findCarsBySfdc = repository.findCarsBySfdc(false); 431 List<Cars> findCarsBySfdc = repository.findCarsBySfdc(false);
429 432
@@ -777,7 +780,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -777,7 +780,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
777 // TODO Auto-generated method stub 780 // TODO Auto-generated method stub
778 DecimalFormat df = new DecimalFormat("0.##"); 781 DecimalFormat df = new DecimalFormat("0.##");
779 782
780 - String date = "", car = "%%", xlbm = ""; 783 + String date = "", car = "%%", xlbm = "", driver = "%%";
  784 + if(map.get("driver") != null){
  785 + driver = "%" + map.get("driver").toString() + "%";
  786 + }
781 if(map.get("date") != null){ 787 if(map.get("date") != null){
782 date = map.get("date").toString(); 788 date = map.get("date").toString();
783 } 789 }
@@ -799,10 +805,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -799,10 +805,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
799 if(xlbm.length() > 0){ 805 if(xlbm.length() > 0){
800 String[] split = xlbm.split(","); 806 String[] split = xlbm.split(",");
801 for(String s : split){ 807 for(String s : split){
802 - scheList.addAll(repository.scheduleByDateAndLine(date, car, s)); 808 + scheList.addAll(repository.scheduleByDateAndLine(date, car, s,driver));
803 } 809 }
804 } else { 810 } else {
805 - scheList = repository.scheduleByDateAndCar(date, car); 811 + scheList = repository.scheduleByDateAndCar(date, car,driver);
806 } 812 }
807 List<Cars> findCarsBySfdc = repository.findCarsBySfdc(true); 813 List<Cars> findCarsBySfdc = repository.findCarsBySfdc(true);
808 814
@@ -1059,7 +1065,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -1059,7 +1065,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
1059 // TODO Auto-generated method stub 1065 // TODO Auto-generated method stub
1060 DecimalFormat df = new DecimalFormat("0.##"); 1066 DecimalFormat df = new DecimalFormat("0.##");
1061 1067
1062 - String date = "", car = "%%", xlbm = ""; 1068 + String date = "", car = "%%", xlbm = "", driver = "%%";
  1069 + if(map.get("driver") != null){
  1070 + driver = "%" + map.get("driver").toString() + "%";
  1071 + }
1063 if(map.get("date") != null){ 1072 if(map.get("date") != null){
1064 date = map.get("date").toString(); 1073 date = map.get("date").toString();
1065 } 1074 }
@@ -1081,10 +1090,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements @@ -1081,10 +1090,10 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
1081 if(xlbm.length() > 0){ 1090 if(xlbm.length() > 0){
1082 String[] split = xlbm.split(","); 1091 String[] split = xlbm.split(",");
1083 for(String s : split){ 1092 for(String s : split){
1084 - scheList.addAll(repository.scheduleByDateAndLine(date, car, s)); 1093 + scheList.addAll(repository.scheduleByDateAndLine(date, car, s, driver));
1085 } 1094 }
1086 } else { 1095 } else {
1087 - scheList = repository.scheduleByDateAndCar(date, car); 1096 + scheList = repository.scheduleByDateAndCar(date, car,null);
1088 } 1097 }
1089 List<Cars> findCarsByHydrogen = repository.findCarsByHydrogen(true); 1098 List<Cars> findCarsByHydrogen = repository.findCarsByHydrogen(true);
1090 1099
src/main/resources/static/pages/forms/statement/refuelDc.html
@@ -38,6 +38,14 @@ @@ -38,6 +38,14 @@
38 <span class="item-label" style="width: 80px;">线路: </span> 38 <span class="item-label" style="width: 80px;">线路: </span>
39 <select class="form-control" name="line" id="line" style="width: 180px;" multiple="multiple"></select> 39 <select class="form-control" name="line" id="line" style="width: 180px;" multiple="multiple"></select>
40 </div> 40 </div>
  41 + <div style="display: inline-block;margin-left: 6px;">
  42 + <span class="item-label" style="width: 80px;">&nbsp;车号: </span>
  43 + <input class="form-control" type="text" id="car" style="width: 180px;"/>
  44 + </div>
  45 + <div style="display: inline-block;margin-left: 6px;">
  46 + <span class="item-label" style="width: 80px;">&nbsp;驾驶员: </span>
  47 + <input class="form-control" type="text" id="driver" style="width: 180px;"/>
  48 + </div>
41 <div class="form-group"> 49 <div class="form-group">
42 <input class="btn btn-default" type="button" id="query" value="筛选"/> 50 <input class="btn btn-default" type="button" id="query" value="筛选"/>
43 <input class="btn btn-default" type="button" id="export" value="导出"/> 51 <input class="btn btn-default" type="button" id="export" value="导出"/>
@@ -170,7 +178,7 @@ @@ -170,7 +178,7 @@
170 } 178 }
171 179
172 180
173 - var line = "", date = "", car = ""; 181 + var line = "", date = "", car = "", driver = "";
174 $("#query").on("click",function(){ 182 $("#query").on("click",function(){
175 if($("#date").val() == null || $("#date").val().trim().length == 0){ 183 if($("#date").val() == null || $("#date").val().trim().length == 0){
176 layer.msg("请选择日期"); 184 layer.msg("请选择日期");
@@ -187,9 +195,10 @@ @@ -187,9 +195,10 @@
187 return; 195 return;
188 } 196 }
189 date = $("#date").val(); 197 date = $("#date").val();
190 - car = $("#code").val(); 198 + car = $("#car").val();
  199 + driver = $("#driver").val();
191 var i = layer.load(2); 200 var i = layer.load(2);
192 - $get('/refuel/queryDc',{line:line,date:date,car:car,type:'query'},function(result){ 201 + $get('/refuel/queryDc',{line:line,date:date,car:car,driver:driver,type:'query'},function(result){
193 // 把数据填充到模版中 202 // 把数据填充到模版中
194 var tbodyHtml = template('refuel_dc',{list:result}); 203 var tbodyHtml = template('refuel_dc',{list:result});
195 // 把渲染好的模版html文本追加到表格中 204 // 把渲染好的模版html文本追加到表格中
@@ -205,6 +214,7 @@ @@ -205,6 +214,7 @@
205 params['line'] = line; 214 params['line'] = line;
206 params['date'] = date; 215 params['date'] = date;
207 params['car'] = car; 216 params['car'] = car;
  217 + params['driver'] = driver;
208 $get('/refuel/exportQueryDc', params, function(result){ 218 $get('/refuel/exportQueryDc', params, function(result){
209 layer.close(i); 219 layer.close(i);
210 window.open("/downloadFile/download?fileName=" 220 window.open("/downloadFile/download?fileName="