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 209 return maps;
210 210 }
211 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 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 19  
20 20 Map<String, Object> sumYlb(Map<String, Object> map);
21 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 23 List<Ylb> listYlb(Map<String, Object> map);
24 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 45 import com.bsth.service.realcontrol.ScheduleRealInfoService;
46 46 import com.bsth.util.Arith;
47 47 import com.bsth.util.BatchSaveUtils;
  48 +import com.bsth.util.ReportUtils;
48 49 import com.github.abel533.echarts.code.Y;
49 50  
50 51 @Service
... ... @@ -949,7 +950,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
949 950  
950 951  
951 952 @Override
952   - public List<Ylb> oilListMonth(String line, String date) {
  953 + public List<Ylb> oilListMonth(String line, String date, String type) {
953 954 String date2=date.substring(0, 8)+"01";
954 955 String lineStr="";
955 956 if(line !=null && !line.equals("")){
... ... @@ -979,6 +980,34 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
979 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 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 .table-bordered > tbody > tr > td,
8 8 .table-bordered > tfoot > tr > th,
9 9 .table-bordered > tfoot > tr > td {
10   - border: 1px solid; }
  10 + border: 1px solid;
  11 + text-align: center; }
11 12 .table-bordered > thead > tr > th,
12 13 .table-bordered > thead > tr > td {
13 14 border-bottom-width: 2px;
... ... @@ -22,11 +23,11 @@
22 23 <h1>班次车辆人员月报表</h1>
23 24 </div>
24 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 31 <form class="form-inline" action="">
31 32 <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth">
32 33 <span class="item-label" style="width: 80px;">公司: </span>
... ... @@ -35,7 +36,7 @@
35 36 <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth">
36 37 <span class="item-label" style="width: 80px;">分公司: </span>
37 38 <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select>
38   - </div>
  39 + </div>
39 40 <div style="display: inline-block;margin-left: 10px">
40 41 <span class="item-label" style="width: 150px;">线路: </span>
41 42 <select class="form-control" name="line" id="line" style="width: 136px;"></select>
... ... @@ -62,10 +63,10 @@
62 63 <div class="form-group">
63 64 <input class="btn btn-default" type="button" id="query" value="筛选"/>
64 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 70 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
70 71 <table class="table table-bordered table-hover table-checkable" id="forms">
71 72 <thead>
... ... @@ -86,29 +87,38 @@
86 87  
87 88 </tbody>
88 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 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 116 var fage=false;
106 117 var obj = [];
107 118 var xlList;
108 119 $.get('/report/lineList',function(result){
109 120 xlList=result;
110 121 $.get('/user/companyData', function(result){
111   -
112 122 obj = result;
113 123 var options = '';
114 124 for(var i = 0; i < obj.length; i++){
... ... @@ -218,7 +228,7 @@
218 228 window.open("/downloadFile/download?fileName=班次车辆人员月报表"+moment($("#startDate").val()).format("YYYYMMDD"));
219 229 });
220 230 });
221   -
  231 +
222 232 });
223 233  
224 234 // $("#empnames").change(function(){
... ... @@ -226,12 +236,12 @@
226 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 243 <tr>
234   - <td>{{i+1}}</td>
  244 + <td>{{i+1}}</td>
235 245 <td>{{obj.jName}}</td>
236 246 <td>{{obj.jhlc}}</td>
237 247 <td>{{obj.emptMileage}}</td>
... ... @@ -240,12 +250,12 @@
240 250 <td>{{obj.totalm}}</td>
241 251 <td>{{obj.cjbc}}</td>
242 252 <td>{{obj.ljbc}}</td>
243   - <td>{{obj.sjbc}}</td>
244   - </tr>
  253 + <td>{{obj.sjbc}}</td>
  254 + </tr>
245 255 {{/each}}
246 256 {{if list.length == 0}}
247 257 <tr>
248 258 <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
249 259 </tr>
250   - {{/if}}
  260 + {{/if}}
251 261 </script>
252 262 \ No newline at end of file
... ...