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