Commit 945ba3abc94358daff6a97ebd5f8fa1a3f7cc555

Authored by 廖磊
1 parent 1fe557a5

新报表导出

src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -44,6 +44,7 @@ import com.bsth.service.report.CulateMileageService;
44 44 import com.bsth.service.report.ReportService;
45 45 import com.bsth.util.Arith;
46 46 import com.bsth.util.ComparableJob;
  47 +import com.bsth.util.ReportUtils;
47 48 import com.bsth.util.db.DBUtils_MS;
48 49  
49 50 @Service
... ... @@ -1459,7 +1460,6 @@ public class ReportServiceImpl implements ReportService{
1459 1460 }
1460 1461 //所有班次信息
1461 1462 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1462   -
1463 1463 line =line.trim();
1464 1464 if(line.equals("")){
1465 1465 //查询所有线路
... ... @@ -1469,7 +1469,6 @@ public class ReportServiceImpl implements ReportService{
1469 1469 list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
1470 1470 }
1471 1471  
1472   -
1473 1472 String sql="select r.xl_bm"
1474 1473 + " from bsth_c_s_sp_info_real r where"
1475 1474 + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
... ... @@ -1490,7 +1489,6 @@ public class ReportServiceImpl implements ReportService{
1490 1489 return ve;
1491 1490 }
1492 1491 });
1493   -
1494 1492 for (int i = 0; i < listLine.size(); i++) {
1495 1493 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
1496 1494 String lineStr=listLine.get(i);
... ... @@ -1511,6 +1509,22 @@ public class ReportServiceImpl implements ReportService{
1511 1509 Map<String, Object> newMap=staticTj(list,"f");
1512 1510 lMap.add(newMap);
1513 1511 }
  1512 + if(type.equals("export")){
  1513 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1514 + Map<String, Object> m = new HashMap<String, Object>();
  1515 + m.put("date", date);
  1516 + m.put("date1", date2);
  1517 + ReportUtils ee = new ReportUtils();
  1518 + try {
  1519 + listI.add(lMap.iterator());
  1520 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1521 + ee.excelReplace(listI, new Object[]{m}, path + "mould/countByLine.xls",
  1522 + path + "export/线路公里统计表.xls");
  1523 + } catch (Exception e) {
  1524 + // TODO: handle exception
  1525 + e.printStackTrace();
  1526 + }
  1527 + }
1514 1528 return lMap;
1515 1529 }
1516 1530  
... ... @@ -1533,6 +1547,8 @@ public class ReportServiceImpl implements ReportService{
1533 1547 if(list.size()>0){
1534 1548 if(status.equals("f")){
1535 1549 map.put("xlName","合计");
  1550 + map.put("gs", "");
  1551 + map.put("fgs", "");
1536 1552 }else{
1537 1553 map.put("xlName", list.get(0).getXlName());
1538 1554 map.put("gs", list.get(0).getGsName());
... ... @@ -1591,6 +1607,8 @@ public class ReportServiceImpl implements ReportService{
1591 1607 double zrwjcclc=culateService.culateZrwJccLc(list, "");
1592 1608  
1593 1609 map.put("zrwjcclc", zrwjcclc);
  1610 + map.put("zrwjcclc1", 0);
  1611 + map.put("zrwjcclc2", 0);
1594 1612  
1595 1613 double kfks=culateService.culateKfksLc(lists);
1596 1614 map.put("kfks", kfks);
... ... @@ -1659,7 +1677,6 @@ public class ReportServiceImpl implements ReportService{
1659 1677 ylbSql += " and xlbm = '"+line+"'";
1660 1678 }
1661 1679 List<Ylb> ylbList=ylbList(ylbSql);
1662   -
1663 1680 String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+date+"' and '"+date2+"'";
1664 1681 if(line.equals("")){
1665 1682 dlbSql +="and ssgsdm='"+gsdm+"' "
... ... @@ -1668,7 +1685,6 @@ public class ReportServiceImpl implements ReportService{
1668 1685 dlbSql += " and xlbm = '"+line+"'";
1669 1686 }
1670 1687 List<Dlb> dlbList=dlbList(dlbSql);
1671   -
1672 1688 String sql="select r.xl_bm,r.schedule_date_str,r.cl_zbh,r.j_gh,r.s_gh"
1673 1689 + " from bsth_c_s_sp_info_real r where"
1674 1690 + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
... ... @@ -1692,7 +1708,6 @@ public class ReportServiceImpl implements ReportService{
1692 1708 return map;
1693 1709 }
1694 1710 });
1695   -
1696 1711 for (int i = 0; i < listGroupBy.size(); i++) {
1697 1712 Map<String, Object> m=listGroupBy.get(i);
1698 1713 String xl_bm=m.get("line")==null?"":m.get("line").toString();
... ... @@ -1795,7 +1810,6 @@ public class ReportServiceImpl implements ReportService{
1795 1810 }
1796 1811  
1797 1812 }
1798   -
1799 1813 if(!zt.equals("zbh")){
1800 1814 String sqls="select r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh"
1801 1815 + " from bsth_c_s_sp_info_real r where"
... ... @@ -1822,6 +1836,28 @@ public class ReportServiceImpl implements ReportService{
1822 1836 lMap=lists(listGroupBys, lMaps, gsdm, fgsdm, date, date2);
1823 1837  
1824 1838 }
  1839 + if(type.equals("export")){
  1840 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1841 + Map<String, Object> m = new HashMap<String, Object>();
  1842 + m.put("date", date);
  1843 + m.put("date1", date2);
  1844 + String xls="";
  1845 + if(zt.equals("zbh")){
  1846 + xls="countByBus1.xls";
  1847 + }else{
  1848 + xls="countByBus2.xls";
  1849 + }
  1850 + ReportUtils ee = new ReportUtils();
  1851 + try {
  1852 + listI.add(lMap.iterator());
  1853 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1854 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  1855 + path + "export/路单数据统计表.xls");
  1856 + } catch (Exception e) {
  1857 + // TODO: handle exception
  1858 + e.printStackTrace();
  1859 + }
  1860 + }
1825 1861  
1826 1862 return lMap;
1827 1863 }
... ... @@ -1831,6 +1867,7 @@ public class ReportServiceImpl implements ReportService{
1831 1867 @Override
1832 1868 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
1833 1869 Ylb y = new Ylb();
  1870 + y.setRq(arg0.getDate("rq"));
1834 1871 y.setXlbm(arg0.getString("xlbm"));
1835 1872 y.setNbbm(arg0.getString("nbbm"));
1836 1873 y.setJzl(arg0.getDouble("jzl"));
... ... @@ -1847,6 +1884,7 @@ public class ReportServiceImpl implements ReportService{
1847 1884 @Override
1848 1885 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
1849 1886 Dlb y = new Dlb();
  1887 + y.setRq(arg0.getDate("rq"));
1850 1888 y.setXlbm(arg0.getString("xlbm"));
1851 1889 y.setNbbm(arg0.getString("nbbm"));
1852 1890 y.setCdl(arg0.getDouble("cdl"));
... ...
src/main/resources/static/pages/report/countMileage/countBus/countBusMileage.html
... ... @@ -37,7 +37,7 @@
37 37 <div class="portlet light porttlet-fit bordered">
38 38 <div class="portlet-title">
39 39 <form class="form-inline" action="">
40   - <div style="display: inline-block; " id="gsdmDiv">
  40 + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv">
41 41 <span class="item-label" style="width: 80px;">公司: </span>
42 42 <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
43 43 </div>
... ... @@ -45,7 +45,7 @@
45 45 <span class="item-label" style="width: 80px;">分公司: </span>
46 46 <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
47 47 </div>
48   - <div style="display: inline-block;margin-left: 29px;">
  48 + <div style="display: inline-block;margin-left: 43px;">
49 49 <span class="item-label" style="width: 80px;">线路: </span>
50 50 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
51 51 </div>
... ... @@ -66,7 +66,7 @@
66 66 <option value="js">驾/售</option>
67 67 </select>
68 68 </div>
69   - <div class="form-group">
  69 + <div class="form-group" style="margin-left: 55px;">
70 70 <input class="btn btn-default" type="button" id="query" value="查询"/>
71 71 <input class="btn btn-default" type="button" id="export" value="导出"/>
72 72 </div>
... ... @@ -241,9 +241,10 @@
241 241 params['date'] = date;
242 242 params['date2'] = date2;
243 243 params['xlName'] = xlName;
  244 + params['zt']=zt;
244 245 params['type'] = "export";
245   - $get('/realSchedule/statisticsDailyTj',params,function(result){
246   - window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD"));
  246 + $get('/report/countBusMileage',params,function(result){
  247 + window.open("/downloadFile/download?fileName=路单数据统计表");
247 248 });
248 249 });
249 250  
... ...
src/main/resources/static/pages/report/countMileage/countLine/countLineMileage.html
... ... @@ -272,7 +272,7 @@
272 272 params['date2'] = date2;
273 273 params['xlName'] = xlName;
274 274 params['type'] = "export";
275   - $get('/realSchedule/countLineMileage',params,function(result){
  275 + $get('/report/countLineMileage',params,function(result){
276 276 window.open("/downloadFile/download?fileName=线路公里统计表");
277 277 });
278 278 });
... ...