Commit 7757aa5b91bdf2752808d6e4bd4e5223e60f71b8
1 parent
c72c8e25
纯电量报表添加按人、按车查询项
Showing
3 changed files
with
35 additions
and
16 deletions
src/main/java/com/bsth/repository/RefuelRepository.java
| ... | ... | @@ -34,12 +34,12 @@ public interface RefuelRepository extends BaseRepository<Refuel, Long> { |
| 34 | 34 | List<ScheduleRealInfo> scheduleByDate(String date, String clZbh, String jGh); |
| 35 | 35 | |
| 36 | 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 | 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 | 44 | @Transactional |
| 45 | 45 | @Modifying | ... | ... |
src/main/java/com/bsth/service/impl/RefuelServiceImpl.java
| ... | ... | @@ -394,7 +394,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 394 | 394 | // TODO Auto-generated method stub |
| 395 | 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 | 401 | if(map.get("date") != null){ |
| 399 | 402 | date = map.get("date").toString(); |
| 400 | 403 | } |
| ... | ... | @@ -420,10 +423,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 420 | 423 | if(xlbm.length() > 0){ |
| 421 | 424 | String[] split = xlbm.split(","); |
| 422 | 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 | 428 | } else { |
| 426 | - scheList = repository.scheduleByDateAndCar(date, car); | |
| 429 | + scheList = repository.scheduleByDateAndCar(date, car,null); | |
| 427 | 430 | } |
| 428 | 431 | List<Cars> findCarsBySfdc = repository.findCarsBySfdc(false); |
| 429 | 432 | |
| ... | ... | @@ -777,7 +780,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 777 | 780 | // TODO Auto-generated method stub |
| 778 | 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 | 787 | if(map.get("date") != null){ |
| 782 | 788 | date = map.get("date").toString(); |
| 783 | 789 | } |
| ... | ... | @@ -799,10 +805,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 799 | 805 | if(xlbm.length() > 0){ |
| 800 | 806 | String[] split = xlbm.split(","); |
| 801 | 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 | 810 | } else { |
| 805 | - scheList = repository.scheduleByDateAndCar(date, car); | |
| 811 | + scheList = repository.scheduleByDateAndCar(date, car,driver); | |
| 806 | 812 | } |
| 807 | 813 | List<Cars> findCarsBySfdc = repository.findCarsBySfdc(true); |
| 808 | 814 | |
| ... | ... | @@ -1059,7 +1065,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 1059 | 1065 | // TODO Auto-generated method stub |
| 1060 | 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 | 1072 | if(map.get("date") != null){ |
| 1064 | 1073 | date = map.get("date").toString(); |
| 1065 | 1074 | } |
| ... | ... | @@ -1081,10 +1090,10 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements |
| 1081 | 1090 | if(xlbm.length() > 0){ |
| 1082 | 1091 | String[] split = xlbm.split(","); |
| 1083 | 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 | 1095 | } else { |
| 1087 | - scheList = repository.scheduleByDateAndCar(date, car); | |
| 1096 | + scheList = repository.scheduleByDateAndCar(date, car,null); | |
| 1088 | 1097 | } |
| 1089 | 1098 | List<Cars> findCarsByHydrogen = repository.findCarsByHydrogen(true); |
| 1090 | 1099 | ... | ... |
src/main/resources/static/pages/forms/statement/refuelDc.html
| ... | ... | @@ -38,6 +38,14 @@ |
| 38 | 38 | <span class="item-label" style="width: 80px;">线路: </span> |
| 39 | 39 | <select class="form-control" name="line" id="line" style="width: 180px;" multiple="multiple"></select> |
| 40 | 40 | </div> |
| 41 | + <div style="display: inline-block;margin-left: 6px;"> | |
| 42 | + <span class="item-label" style="width: 80px;"> 车号: </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;"> 驾驶员: </span> | |
| 47 | + <input class="form-control" type="text" id="driver" style="width: 180px;"/> | |
| 48 | + </div> | |
| 41 | 49 | <div class="form-group"> |
| 42 | 50 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 43 | 51 | <input class="btn btn-default" type="button" id="export" value="导出"/> |
| ... | ... | @@ -170,7 +178,7 @@ |
| 170 | 178 | } |
| 171 | 179 | |
| 172 | 180 | |
| 173 | - var line = "", date = "", car = ""; | |
| 181 | + var line = "", date = "", car = "", driver = ""; | |
| 174 | 182 | $("#query").on("click",function(){ |
| 175 | 183 | if($("#date").val() == null || $("#date").val().trim().length == 0){ |
| 176 | 184 | layer.msg("请选择日期"); |
| ... | ... | @@ -187,9 +195,10 @@ |
| 187 | 195 | return; |
| 188 | 196 | } |
| 189 | 197 | date = $("#date").val(); |
| 190 | - car = $("#code").val(); | |
| 198 | + car = $("#car").val(); | |
| 199 | + driver = $("#driver").val(); | |
| 191 | 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 | 203 | var tbodyHtml = template('refuel_dc',{list:result}); |
| 195 | 204 | // 把渲染好的模版html文本追加到表格中 |
| ... | ... | @@ -205,6 +214,7 @@ |
| 205 | 214 | params['line'] = line; |
| 206 | 215 | params['date'] = date; |
| 207 | 216 | params['car'] = car; |
| 217 | + params['driver'] = driver; | |
| 208 | 218 | $get('/refuel/exportQueryDc', params, function(result){ |
| 209 | 219 | layer.close(i); |
| 210 | 220 | window.open("/downloadFile/download?fileName=" | ... | ... |