Commit 02dba335a0d13b5450df6468596278cbec7b9d6b

Authored by 娄高锋
1 parent 512c3cb7

油量表导出

src/main/java/com/bsth/controller/oil/YlbController.java
@@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{ @@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{
209 return maps; 209 return maps;
210 } 210 }
211 @RequestMapping(value="/oilListMonth") 211 @RequestMapping(value="/oilListMonth")
212 - public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date){  
213 - return yblService.oilListMonth(line, date); 212 + public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date,@RequestParam String type){
  213 + return yblService.oilListMonth(line, date, type);
214 } 214 }
215 215
216 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) 216 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
src/main/java/com/bsth/service/oil/YlbService.java
@@ -19,7 +19,7 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{ @@ -19,7 +19,7 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
19 19
20 Map<String, Object> sumYlb(Map<String, Object> map); 20 Map<String, Object> sumYlb(Map<String, Object> map);
21 String checkJsy(Map<String, Object> map); 21 String checkJsy(Map<String, Object> map);
22 - List<Ylb> oilListMonth(String line,String date); 22 + List<Ylb> oilListMonth(String line,String date,String type);
23 List<Ylb> listYlb(Map<String, Object> map); 23 List<Ylb> listYlb(Map<String, Object> map);
24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx); 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
25 25
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -45,6 +45,7 @@ import com.bsth.service.oil.YlbService; @@ -45,6 +45,7 @@ import com.bsth.service.oil.YlbService;
45 import com.bsth.service.realcontrol.ScheduleRealInfoService; 45 import com.bsth.service.realcontrol.ScheduleRealInfoService;
46 import com.bsth.util.Arith; 46 import com.bsth.util.Arith;
47 import com.bsth.util.BatchSaveUtils; 47 import com.bsth.util.BatchSaveUtils;
  48 +import com.bsth.util.ReportUtils;
48 import com.github.abel533.echarts.code.Y; 49 import com.github.abel533.echarts.code.Y;
49 50
50 @Service 51 @Service
@@ -949,7 +950,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -949,7 +950,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
949 950
950 951
951 @Override 952 @Override
952 - public List<Ylb> oilListMonth(String line, String date) { 953 + public List<Ylb> oilListMonth(String line, String date, String type) {
953 String date2=date.substring(0, 8)+"01"; 954 String date2=date.substring(0, 8)+"01";
954 String lineStr=""; 955 String lineStr="";
955 if(line !=null && !line.equals("")){ 956 if(line !=null && !line.equals("")){
@@ -979,6 +980,34 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -979,6 +980,34 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
979 return s; 980 return s;
980 } 981 }
981 }); 982 });
  983 +
  984 + if(type != null && type.equals("export")){
  985 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  986 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  987 +
  988 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  989 + for(Ylb ylb : list){
  990 + Map<String, Object> m = new HashMap<String, Object>();
  991 + m.put("nbbm", ylb.getNbbm()!=null?ylb.getNbbm():"");
  992 + m.put("rq", ylb.getRq()!=null?sdfMonth.format(ylb.getRq()):"");
  993 + m.put("jzyl", ylb.getJzyl()!=null?ylb.getJzyl():"");
  994 + mapList.add(m);
  995 + }
  996 +
  997 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  998 + Map<String, Object> m = new HashMap<String, Object>();
  999 + ReportUtils ee = new ReportUtils();
  1000 + try {
  1001 + listI.add(mapList.iterator());
  1002 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  1003 + ee.excelReplace(listI, new Object[] { m }, path+"mould/oilListMonth.xls",
  1004 + path+"export/月存油报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1005 + } catch (Exception e) {
  1006 + // TODO: handle exception
  1007 + e.printStackTrace();
  1008 + }
  1009 + }
  1010 +
982 return list; 1011 return list;
983 } 1012 }
984 1013
src/main/resources/static/pages/forms/mould/oilListMonth.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/mforms/shiftuehiclemanths/shiftuehiclemanth.html
@@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
7 .table-bordered > tbody > tr > td, 7 .table-bordered > tbody > tr > td,
8 .table-bordered > tfoot > tr > th, 8 .table-bordered > tfoot > tr > th,
9 .table-bordered > tfoot > tr > td { 9 .table-bordered > tfoot > tr > td {
10 - border: 1px solid; } 10 + border: 1px solid;
  11 + text-align: center; }
11 .table-bordered > thead > tr > th, 12 .table-bordered > thead > tr > th,
12 .table-bordered > thead > tr > td { 13 .table-bordered > thead > tr > td {
13 border-bottom-width: 2px; 14 border-bottom-width: 2px;
@@ -22,11 +23,11 @@ @@ -22,11 +23,11 @@
22 <h1>班次车辆人员月报表</h1> 23 <h1>班次车辆人员月报表</h1>
23 </div> 24 </div>
24 </div> 25 </div>
25 -  
26 -<div class="row">  
27 - <div class="col-md-12">  
28 - <div class="portlet light porttlet-fit bordered">  
29 - <div class="portlet-title"> 26 +
  27 +<div class="row">
  28 + <div class="col-md-12">
  29 + <div class="portlet light porttlet-fit bordered">
  30 + <div class="portlet-title">
30 <form class="form-inline" action=""> 31 <form class="form-inline" action="">
31 <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth"> 32 <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth">
32 <span class="item-label" style="width: 80px;">公司: </span> 33 <span class="item-label" style="width: 80px;">公司: </span>
@@ -35,7 +36,7 @@ @@ -35,7 +36,7 @@
35 <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth"> 36 <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth">
36 <span class="item-label" style="width: 80px;">分公司: </span> 37 <span class="item-label" style="width: 80px;">分公司: </span>
37 <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select> 38 <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select>
38 - </div> 39 + </div>
39 <div style="display: inline-block;margin-left: 10px"> 40 <div style="display: inline-block;margin-left: 10px">
40 <span class="item-label" style="width: 150px;">线路: </span> 41 <span class="item-label" style="width: 150px;">线路: </span>
41 <select class="form-control" name="line" id="line" style="width: 136px;"></select> 42 <select class="form-control" name="line" id="line" style="width: 136px;"></select>
@@ -62,10 +63,10 @@ @@ -62,10 +63,10 @@
62 <div class="form-group"> 63 <div class="form-group">
63 <input class="btn btn-default" type="button" id="query" value="筛选"/> 64 <input class="btn btn-default" type="button" id="query" value="筛选"/>
64 <input class="btn btn-default" type="button" id="export" value="导出"/> 65 <input class="btn btn-default" type="button" id="export" value="导出"/>
65 - </div>  
66 - </form>  
67 - </div>  
68 - <div class="portlet-body"> 66 + </div>
  67 + </form>
  68 + </div>
  69 + <div class="portlet-body">
69 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> 70 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
70 <table class="table table-bordered table-hover table-checkable" id="forms"> 71 <table class="table table-bordered table-hover table-checkable" id="forms">
71 <thead> 72 <thead>
@@ -86,29 +87,38 @@ @@ -86,29 +87,38 @@
86 87
87 </tbody> 88 </tbody>
88 </table> 89 </table>
89 - </div>  
90 - </div>  
91 - </div>  
92 - </div>  
93 -</div>  
94 -  
95 -<script>  
96 - $(function(){  
97 - // 关闭左侧栏  
98 - if (!$('body').hasClass('page-sidebar-closed')) 90 + </div>
  91 + </div>
  92 + </div>
  93 + </div>
  94 +</div>
  95 +
  96 +<script>
  97 + $(function(){
  98 + // 关闭左侧栏
  99 + if (!$('body').hasClass('page-sidebar-closed'))
99 $('.menu-toggler.sidebar-toggler').click(); 100 $('.menu-toggler.sidebar-toggler').click();
100 -  
101 - $("#startDate,#endDate").datetimepicker({  
102 - format : 'YYYY-MM-DD',  
103 - locale : 'zh-cn' 101 +
  102 + $("#startDate,#endDate").datetimepicker({
  103 + format : 'YYYY-MM-DD',
  104 + locale : 'zh-cn'
104 }); 105 });
  106 + var d = new Date();
  107 + var year = d.getFullYear();
  108 + var month = d.getMonth() + 1;
  109 + var day = d.getDate();
  110 + if(month < 10)
  111 + month = "0" + month;
  112 + if(day < 10)
  113 + day = "0" + day;
  114 + $("#startDate,#endDate").val(year + "-" + month + "-" + day);
  115 +
105 var fage=false; 116 var fage=false;
106 var obj = []; 117 var obj = [];
107 var xlList; 118 var xlList;
108 $.get('/report/lineList',function(result){ 119 $.get('/report/lineList',function(result){
109 xlList=result; 120 xlList=result;
110 $.get('/user/companyData', function(result){ 121 $.get('/user/companyData', function(result){
111 -  
112 obj = result; 122 obj = result;
113 var options = ''; 123 var options = '';
114 for(var i = 0; i < obj.length; i++){ 124 for(var i = 0; i < obj.length; i++){
@@ -218,7 +228,7 @@ @@ -218,7 +228,7 @@
218 window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD")); 228 window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD"));
219 }); 229 });
220 }); 230 });
221 - 231 +
222 }); 232 });
223 233
224 // $("#empnames").change(function(){ 234 // $("#empnames").change(function(){
@@ -226,12 +236,12 @@ @@ -226,12 +236,12 @@
226 // // $("#query").click(); 236 // // $("#query").click();
227 237
228 // }); 238 // });
229 -  
230 -</script>  
231 -<script type="text/html" id="list_shiftuehiclemanth">  
232 - {{each list as obj i}} 239 +
  240 +</script>
  241 +<script type="text/html" id="list_shiftuehiclemanth">
  242 + {{each list as obj i}}
233 <tr> 243 <tr>
234 - <td>{{i+1}}</td> 244 + <td>{{i+1}}</td>
235 <td>{{obj.jName}}</td> 245 <td>{{obj.jName}}</td>
236 <td>{{obj.jhlc}}</td> 246 <td>{{obj.jhlc}}</td>
237 <td>{{obj.emptMileage}}</td> 247 <td>{{obj.emptMileage}}</td>
@@ -240,12 +250,12 @@ @@ -240,12 +250,12 @@
240 <td>{{obj.totalm}}</td> 250 <td>{{obj.totalm}}</td>
241 <td>{{obj.cjbc}}</td> 251 <td>{{obj.cjbc}}</td>
242 <td>{{obj.ljbc}}</td> 252 <td>{{obj.ljbc}}</td>
243 - <td>{{obj.sjbc}}</td>  
244 - </tr> 253 + <td>{{obj.sjbc}}</td>
  254 + </tr>
245 {{/each}} 255 {{/each}}
246 {{if list.length == 0}} 256 {{if list.length == 0}}
247 <tr> 257 <tr>
248 <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td> 258 <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
249 </tr> 259 </tr>
250 - {{/if}} 260 + {{/if}}
251 </script> 261 </script>
252 \ No newline at end of file 262 \ No newline at end of file