Commit e217b290ef9ae71cecf63c01564b389d3f798c51

Authored by 娄高锋
1 parent 2cb12b36

报表-线路首末班准点率:导出单日4家公司合计excel

src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -1518,18 +1518,18 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1518,18 +1518,18 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1518 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 1518 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1519 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1519 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1520 1520
1521 - String sfyy = "", company = "", subCompany = ""; 1521 + String sfyy = "", company = "", subCompany = "", line = "";
1522 if(map.get("sfyy")!=null) 1522 if(map.get("sfyy")!=null)
1523 - sfyy = map.get("sfyy").toString(); 1523 + sfyy = map.get("sfyy").toString().trim();
1524 if(map.get("company")!=null) 1524 if(map.get("company")!=null)
1525 - company = map.get("company").toString(); 1525 + company = map.get("company").toString().trim();
1526 if(map.get("subCompany")!=null) 1526 if(map.get("subCompany")!=null)
1527 - subCompany = map.get("subCompany").toString();  
1528 - String line = map.get("line").toString();  
1529 -// String date = map.get("date").toString();  
1530 - String startDate = map.get("startDate").toString();  
1531 - String endDate = map.get("endDate").toString();  
1532 - String type = map.get("type").toString(); 1527 + subCompany = map.get("subCompany").toString().trim();
  1528 + if(map.get("line")!=null)
  1529 + line = map.get("line").toString().trim();
  1530 + String startDate = map.get("startDate").toString().trim();
  1531 + String endDate = map.get("endDate").toString().trim();
  1532 + String type = map.get("type").toString().trim();
1533 1533
1534 if(startDate.length() == 0) 1534 if(startDate.length() == 0)
1535 startDate = sdf.format(new Date()); 1535 startDate = sdf.format(new Date());
@@ -1547,20 +1547,31 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1547,20 +1547,31 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1547 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日"; 1547 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日";
1548 } 1548 }
1549 1549
  1550 + List<String> objList = new ArrayList<String>();
  1551 + objList.add(startDate);
  1552 + objList.add(endDate);
  1553 +
1550 try { 1554 try {
1551 - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"  
1552 - + " a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = "  
1553 - + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt"  
1554 - + " from bsth_c_s_sp_info_real a where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'" 1555 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, "
  1556 + + " a.gs_name, a.fgs_name, a.gs_bm, a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = "
  1557 + + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt "
  1558 + + " from bsth_c_s_sp_info_real a where schedule_date_str >= ? and schedule_date_str <= ? "
1555 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; 1559 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
1556 - if(line.length() != 0)  
1557 - sql += " and xl_bm = '"+line+"'";  
1558 - if(company.length() != 0)  
1559 - sql += " and gs_bm = '"+company+"'";  
1560 - if(subCompany.length() != 0)  
1561 - sql += " and fgs_bm = '"+subCompany+"'"; 1560 + if(line.length() != 0){
  1561 + sql += " and xl_bm = ? ";
  1562 + objList.add(line);
  1563 + }
  1564 + if(company.length() != 0){
  1565 + sql += " and gs_bm = ? ";
  1566 + objList.add(company);
  1567 + }
  1568 + if(subCompany.length() != 0){
  1569 + sql += " and fgs_bm = ? ";
  1570 + objList.add(subCompany);
  1571 + }
1562 1572
1563 list = jdbcTemplate.query(sql, 1573 list = jdbcTemplate.query(sql,
  1574 + objList.toArray(),
1564 new RowMapper<ScheduleRealInfo>(){ 1575 new RowMapper<ScheduleRealInfo>(){
1565 @Override 1576 @Override
1566 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 1577 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -1579,6 +1590,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1579,6 +1590,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1579 schedule.setStatus(rs.getInt("status")); 1590 schedule.setStatus(rs.getInt("status"));
1580 schedule.setGsName(rs.getString("gs_name")); 1591 schedule.setGsName(rs.getString("gs_name"));
1581 schedule.setFgsName(rs.getString("fgs_name")); 1592 schedule.setFgsName(rs.getString("fgs_name"));
  1593 + schedule.setGsBm(rs.getString("gs_bm"));
1582 schedule.setFgsBm(rs.getString("fgs_bm")); 1594 schedule.setFgsBm(rs.getString("fgs_bm"));
1583 schedule.setCcService(rs.getBoolean("cc_service")); 1595 schedule.setCcService(rs.getBoolean("cc_service"));
1584 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):""); 1596 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):"");
@@ -1646,7 +1658,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1646,7 +1658,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1646 continue; 1658 continue;
1647 } 1659 }
1648 1660
1649 - String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm(); 1661 + String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm() + "/" + s.getGsBm();
1650 String date = s.getScheduleDateStr(); 1662 String date = s.getScheduleDateStr();
1651 if(!keyMap.containsKey(key)){ 1663 if(!keyMap.containsKey(key)){
1652 keyMap.put(key, new HashMap<String, List<ScheduleRealInfo>>()); 1664 keyMap.put(key, new HashMap<String, List<ScheduleRealInfo>>());
@@ -1664,7 +1676,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1664,7 +1676,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1664 Map<Long, String> longMap = new HashMap<Long, String>(); 1676 Map<Long, String> longMap = new HashMap<Long, String>();
1665 for(String key : keyMap.keySet()){ 1677 for(String key : keyMap.keySet()){
1666 String[] keys = key.split("/"); 1678 String[] keys = key.split("/");
1667 - Long l = Long.valueOf(keys[2]) * 10000000000l + Long.valueOf(keys[1]); 1679 + Long l = Long.valueOf(keys[3] + keys[2]) * 10000000000l + Long.valueOf(keys[1]);
1668 longMap.put(l, key); 1680 longMap.put(l, key);
1669 longList.add(l); 1681 longList.add(l);
1670 } 1682 }
@@ -1890,11 +1902,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1890,11 +1902,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1890 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); 1902 tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%");
1891 for(Map<String, Object> m : mapList){ 1903 for(Map<String, Object> m : mapList){
1892 m.put("no", ++i); 1904 m.put("no", ++i);
1893 -// m.put("company", companyName);  
1894 -// m.put("subCompany", subCompanyName);  
1895 } 1905 }
  1906 + tempMap.put("company", "");
  1907 + tempMap.put("subCompany", "");
  1908 + tempMap.put("line", "");
1896 tempMap.put("map", mapList); 1909 tempMap.put("map", mapList);
1897 - if(!type.equals("export")) 1910 + if(!type.contains("export"))
1898 resList.add(tempMap); 1911 resList.add(tempMap);
1899 } 1912 }
1900 1913
@@ -1957,190 +1970,49 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1957,190 +1970,49 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1957 // TODO: handle exception 1970 // TODO: handle exception
1958 e.printStackTrace(); 1971 e.printStackTrace();
1959 } 1972 }
1960 - }  
1961 -  
1962 - return resList;  
1963 - }  
1964 - /*@Override  
1965 - public List<Map<String, Object>> commandState(Map<String, Object> map) {  
1966 - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();  
1967 - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();  
1968 - Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>();  
1969 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
1970 -  
1971 - String company = map.get("company").toString();  
1972 - String subCompany = map.get("subCompany").toString();  
1973 - String line = map.get("line").toString();  
1974 - String date = map.get("date").toString();  
1975 - String code = map.get("code").toString();  
1976 - String type = map.get("type").toString();  
1977 -  
1978 - if(date.length() == 0)  
1979 - date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());  
1980 -  
1981 - try {  
1982 -  
1983 - String sql =  
1984 - "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " +  
1985 - "FROM bsth_c_s_sp_info_real as r left join bsth_v_directive_60 as d on r.id = d.sch and d.is_dispatch = 1 where schedule_date_str = '"+date+"'";  
1986 - if(line.length() != 0){  
1987 - sql += " and xl_bm = '"+line+"'";  
1988 - }  
1989 - if(code.length() != 0){  
1990 - sql += " and cl_zbh = '"+code+"'";  
1991 - }  
1992 - if(company.length() != 0){  
1993 - sql += " and gs_bm = '"+company+"'";  
1994 - }  
1995 - if(subCompany.length() != 0){  
1996 - sql += " and fgs_bm = '"+subCompany+"'";  
1997 - }  
1998 - sql += " union " +  
1999 - "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " +  
2000 - "FROM bsth_c_s_sp_info_real as r right join bsth_v_directive_60 as d on r.id = d.sch where d.is_dispatch = 1 and schedule_date_str = '"+date+"'";  
2001 - if(line.length() != 0){  
2002 - sql += " and xl_bm = '"+line+"'";  
2003 - }  
2004 - if(code.length() != 0){  
2005 - sql += " and cl_zbh = '"+code+"'";  
2006 - }  
2007 - if(company.length() != 0){  
2008 - sql += " and gs_bm = '"+company+"'";  
2009 - }  
2010 - if(subCompany.length() != 0){  
2011 - sql += " and fgs_bm = '"+subCompany+"'";  
2012 - }  
2013 - sql += " order by xl_name, fcsj";  
2014 -  
2015 - list = jdbcTemplate.query(sql,  
2016 - new RowMapper<Map<String, Object>>(){  
2017 - @Override  
2018 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
2019 - Map<String, Object> map = new HashMap<String, Object>();  
2020 - map.put("id", rs.getString("id"));  
2021 - map.put("date", rs.getString("schedule_date_str"));  
2022 - map.put("line", rs.getString("xl_name"));  
2023 - map.put("clZbh", rs.getString("cl_zbh"));  
2024 - map.put("jGh", rs.getString("j_gh"));  
2025 - map.put("jName", rs.getString("j_name"));  
2026 - map.put("fcsj", rs.getString("fcsj"));  
2027 - map.put("timestamp", rs.getString("timestamp"));  
2028 - map.put("reply46", rs.getString("reply46"));  
2029 - map.put("reply47", rs.getString("reply47"));  
2030 - map.put("reply46time", rs.getString("reply46time"));  
2031 - map.put("reply47time", rs.getString("reply47time"));  
2032 - map.put("company", rs.getObject("gs_name"));  
2033 - map.put("subCompany", rs.getObject("fgs_name"));  
2034 - return map; 1973 + } else if(type.equals("exportAll")){
  1974 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1975 + Map<String, Map<String, Object>> tempKeyMap = new HashMap<String, Map<String, Object>>();
  1976 + for(Map<String, Object> m : resList){
  1977 + if(m.get("company")!=null && m.get("company").toString().trim().length() > 0){
  1978 + Map<String, Object> temp = new HashMap<String, Object>();
  1979 + String gsName = m.get("company").toString().trim();
  1980 + if(tempKeyMap.containsKey(gsName)){
  1981 + temp = tempKeyMap.get(gsName);
  1982 + temp.put("jhbc", Long.valueOf(m.get("jhbc")!=null?m.get("jhbc").toString():"0")
  1983 + + Long.valueOf(temp.get("jhbc")!=null?temp.get("jhbc").toString():"0"));
  1984 + temp.put("sjbc", Long.valueOf(m.get("sjbc")!=null?m.get("sjbc").toString():"0")
  1985 + + Long.valueOf(temp.get("sjbc")!=null?temp.get("sjbc").toString():"0"));
  1986 + } else {
  1987 + temp.put("date", "");
  1988 + temp.put("company", gsName);
  1989 + temp.put("subCompany", "小计");
  1990 + temp.put("line", "");
  1991 + temp.put("jhbc", m.get("jhbc")!=null?m.get("jhbc").toString()+"":"0");
  1992 + temp.put("sjbc", m.get("sjbc")!=null?m.get("sjbc").toString()+"":"0");
  1993 + tempList.add(temp);
  1994 + tempKeyMap.put(gsName, temp);
  1995 + }
2035 } 1996 }
2036 - });  
2037 -  
2038 - } catch (Exception e) {  
2039 - // TODO Auto-generated catch block  
2040 - e.printStackTrace();  
2041 - }  
2042 -  
2043 - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();  
2044 - List<String> keyList = new ArrayList<String>();  
2045 - for(Map<String, Object> m : list){  
2046 - String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName");  
2047 - if(!keyList.contains(m.get("line").toString())){  
2048 - keyList.add(m.get("line").toString());  
2049 - }  
2050 - if(!keyMap.containsKey(key))  
2051 - keyMap.put(key, new ArrayList<Map<String, Object>>());  
2052 - keyMap.get(key).add(m);  
2053 - }  
2054 - String companyName = "", subCompanyName = "";  
2055 - for(String key : keyMap.keySet()){  
2056 - Map<String, Object> tempMap = new HashMap<String, Object>();  
2057 - Set<String> tempSet = new HashSet<String>();  
2058 - int sjf = 0;  
2059 - int wqr = 0;  
2060 - for(Map<String, Object> m : keyMap.get(key)){  
2061 - if(m.containsKey("company") && m.get("company")!=null && m.get("company").toString().length()!=0 && companyName.length()==0)  
2062 - companyName = m.get("company").toString();  
2063 - if(m.containsKey("subCompany") && m.get("subCompany")!=null && m.get("subCompany").toString().length()!=0 && subCompanyName.length()==0)  
2064 - subCompanyName = m.get("subCompany").toString();  
2065 - tempSet.add(m.get("id").toString());  
2066 - if(m.get("timestamp") != null){  
2067 - sjf++;  
2068 - if(m.get("reply47").toString().equals("-1"))  
2069 - wqr++;  
2070 - m.put("time", sdf.format(new Date(Long.valueOf(m.get("timestamp").toString()))));  
2071 - } else  
2072 - m.put("time", "/");  
2073 -  
2074 - if(m.get("reply46time") != null)  
2075 - m.put("time46", sdf.format(new Date(Long.valueOf(m.get("reply46time").toString()))));  
2076 - else  
2077 - m.put("time46", "/");  
2078 -  
2079 - if(m.get("reply47time") != null)  
2080 - m.put("time47", sdf.format(new Date(Long.valueOf(m.get("reply47time").toString()))));  
2081 - else  
2082 - m.put("time47", "/");  
2083 -  
2084 } 1997 }
2085 - tempMap.put("company", companyName);  
2086 - tempMap.put("subCompany", subCompanyName);  
2087 - String[] split = key.split("/");  
2088 - tempMap.put("date", date);  
2089 - tempMap.put("line", split[0]);  
2090 - tempMap.put("clZbh", split[1]);  
2091 - tempMap.put("jsy", split[2] + "/" + split[3]);  
2092 - tempMap.put("jhf", tempSet.size());  
2093 - tempMap.put("sjf", sjf);  
2094 - tempMap.put("wqr", wqr);  
2095 - tempMap.put("workList", keyMap.get(key));  
2096 - tempList.add(tempMap);  
2097 - }  
2098 -  
2099 - for(String key : keyList){ 1998 +
2100 for(Map<String, Object> m : tempList){ 1999 for(Map<String, Object> m : tempList){
2101 - if(key.equals(m.get("line").toString())){  
2102 - resList.add(m); 2000 + if(m.get("jhbc")!=null && Long.valueOf(m.get("jhbc").toString()) > 0l){
  2001 + m.put("zdl", nf.format((float) Long.valueOf(m.get("sjbc").toString()) / Long.valueOf(m.get("jhbc").toString()) * 100) + "%");
  2002 + }else{
  2003 + m.put("zdl", "0.00%");
2103 } 2004 }
  2005 + resList.add(m);
2104 } 2006 }
2105 - }  
2106 -  
2107 - if(type.equals("export")){  
2108 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
2109 - sdfSimple = new SimpleDateFormat("yyyyMMdd"); 2007 +
2110 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 2008 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
2111 Map<String,Object> m = new HashMap<String, Object>(); 2009 Map<String,Object> m = new HashMap<String, Object>();
2112 ReportUtils ee = new ReportUtils(); 2010 ReportUtils ee = new ReportUtils();
2113 try { 2011 try {
2114 listI.add(resList.iterator()); 2012 listI.add(resList.iterator());
2115 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 2013 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
2116 - ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState.xls",  
2117 - path+"export/指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");  
2118 - } catch (Exception e) {  
2119 - // TODO: handle exception  
2120 - e.printStackTrace();  
2121 - }  
2122 - }  
2123 -  
2124 - if(type.equals("export1")){  
2125 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
2126 - sdfSimple = new SimpleDateFormat("yyyyMMdd");  
2127 - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();  
2128 - Map<String,Object> m = new HashMap<String, Object>();  
2129 - ReportUtils ee = new ReportUtils();  
2130 - String jsy = map.get("jsy").toString();  
2131 - try {  
2132 - for(Map<String, Object> map1 : resList){  
2133 - if(jsy.equals(map1.get("jsy").toString())){  
2134 - List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList");  
2135 - listI.add(temp.iterator());  
2136 - m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company")  
2137 - + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line")  
2138 - + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy"));  
2139 - }  
2140 - }  
2141 - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";  
2142 - ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState1.xls",  
2143 - path+"export/指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); 2014 + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_sum.xls",
  2015 + path+"export/" + dateTime + "-全部公司-线路首末班准点率.xls");
2144 } catch (Exception e) { 2016 } catch (Exception e) {
2145 // TODO: handle exception 2017 // TODO: handle exception
2146 e.printStackTrace(); 2018 e.printStackTrace();
@@ -2149,7 +2021,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -2149,7 +2021,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
2149 2021
2150 return resList; 2022 return resList;
2151 } 2023 }
2152 -*/  
2153 2024
2154 @Override 2025 @Override
2155 public List<Map<String, Object>> commandState(Map<String, Object> map) { 2026 public List<Map<String, Object>> commandState(Map<String, Object> map) {
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
@@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
60 <div class="form-group" style="margin-left: 10px;"> 60 <div class="form-group" style="margin-left: 10px;">
61 <input class="btn btn-default" type="button" id="query" value="筛选"/> 61 <input class="btn btn-default" type="button" id="query" value="筛选"/>
62 <input class="btn btn-default" type="button" id="export" value="导出"/> 62 <input class="btn btn-default" type="button" id="export" value="导出"/>
  63 + <input class="btn btn-default" type="button" id="exportAll" value="导出全部公司" style="display: none;"/>
63 </div> 64 </div>
64 </form> 65 </form>
65 </div> 66 </div>
@@ -418,6 +419,40 @@ @@ -418,6 +419,40 @@
418 }); 419 });
419 420
420 421
  422 + $.get('/user/getCurrentUser', function(result){
  423 + var roleName = "";
  424 + $(result.roles).each(function(i, e){
  425 + roleName += e.roleName + "、";
  426 + });
  427 + if(roleName.indexOf("浦交") > -1 || roleName.indexOf("拓华") > -1){
  428 + $("#exportAll").show();
  429 + }
  430 + });
  431 + $("#exportAll").on("click",function(){
  432 + var params = {};
  433 + sfyy = $("#sfyy").val();
  434 + startDate = $("#startDate").val();
  435 + endDate = $("#endDate").val();
  436 + params['sfyy'] = sfyy;
  437 + params['startDate'] = startDate;
  438 + params['endDate'] = endDate;
  439 + params['type'] = "exportAll";
  440 + var i = layer.load(2);
  441 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  442 + var dateTime = "";
  443 + if(startDate == endDate){
  444 + dateTime = moment(startDate).format("YYYYMMDD");
  445 + } else {
  446 + dateTime = moment(startDate).format("YYYYMMDD")
  447 + +"-"+moment(endDate).format("YYYYMMDD");
  448 + }
  449 + window.open("/downloadFile/download?fileName="
  450 + +dateTime+"-全部公司-线路首末班准点率");
  451 + layer.close(i);
  452 + });
  453 + });
  454 +
  455 +
421 }); 456 });
422 457
423 </script> 458 </script>