LiJun
2018-10-19 2e321a2a7185f43c31642dc3459d07360bcf9d50
表格数据上传
3个文件已修改
239 ■■■■ 已修改文件
gx_tieta/.settings/org.jboss.tools.jst.web.xml 120 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/Test.jsp 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/servlets/ExportTableServlet.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/.settings/org.jboss.tools.jst.web.xml
@@ -8,74 +8,74 @@
 <file-system NAME="lib" location="%workspace.home%/lib" model-entity="FileSystemFolder"/>
 <file-system NAME="classes" location="%workspace.home%/classes" model-entity="FileSystemFolder"/>
 <file-system NAME="fuguang" location="%eclipse.project%" model-entity="FileSystemFolder"/>
 <file-system NAME="lib-c3p0-0.9.5.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\c3p0-0.9.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-c3p0-oracle-thin-extras-0.9.5.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\c3p0-oracle-thin-extras-0.9.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-mchange-commons-java-0.2.9.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\mchange-commons-java-0.2.9.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-beanutils-1.7.0.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-beanutils-1.7.0.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-codec-1.10.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-codec-1.10.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-collections-3.1.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-collections-3.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-dbcp-1.2.1.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-dbcp-1.2.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-fileupload-1.2.2.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-fileupload-1.2.2.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-io-2.0.1.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-io-2.0.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-lang-2.5.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-lang-2.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-pool-1.2.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-pool-1.2.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-dom4j-1.6.1.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-ezmorph-1.0.3.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ezmorph-1.0.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-freemarker-2.3.16.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\freemarker-2.3.16.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-gson-2.2.4.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\gson-2.2.4.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-javassist-3.11.0.GA.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\javassist-3.11.0.GA.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-json-lib-2.1-jdk15.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\json-lib-2.1-jdk15.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-mysql-connector-java-5.1.33-bin.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.33-bin.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-ognl-3.0.1.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ognl-3.0.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-poi-3.10.1-20140818.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\poi-3.10.1-20140818.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-sqljdbc.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\sqljdbc.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-core-2.2.3.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-core-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-json-plugin-2.2.3.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-json-plugin-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-sunspoter-stream-1.0.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-sunspoter-stream-1.0.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-xwork-core-2.2.3.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\xwork-core-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-jacob.jar"
  location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\jacob.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-javaee.jar"
  location="D:\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\javaee.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\javaee.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-jsf-impl.jar"
  location="D:\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-impl.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-impl.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-jsf-api.jar"
  location="D:\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-api.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-api.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-jstl-1.2.jar"
  location="D:\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jstl-1.2.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jstl-1.2.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-c3p0-0.9.5.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\c3p0-0.9.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-c3p0-oracle-thin-extras-0.9.5.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\c3p0-oracle-thin-extras-0.9.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-mchange-commons-java-0.2.9.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\mchange-commons-java-0.2.9.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-resources.jar"
  location="D:\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\resources.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\resources.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-dnsns.jar"
  location="D:\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\dnsns.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\dnsns.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-localedata.jar"
  location="D:\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\localedata.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\localedata.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-sunjce_provider.jar"
  location="D:\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\sunjce_provider.jar" model-entity="FileSystemJar"/>
  location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\sunjce_provider.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-beanutils-1.7.0.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-beanutils-1.7.0.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-codec-1.10.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-codec-1.10.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-collections-3.1.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-collections-3.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-dbcp-1.2.1.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-dbcp-1.2.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-fileupload-1.2.2.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-fileupload-1.2.2.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-io-2.0.1.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-io-2.0.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-lang-2.5.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-lang-2.5.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-commons-pool-1.2.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-pool-1.2.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-dom4j-1.6.1.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-ezmorph-1.0.3.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ezmorph-1.0.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-freemarker-2.3.16.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\freemarker-2.3.16.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-gson-2.2.4.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\gson-2.2.4.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-javassist-3.11.0.GA.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\javassist-3.11.0.GA.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-json-lib-2.1-jdk15.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\json-lib-2.1-jdk15.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-mysql-connector-java-5.1.33-bin.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.33-bin.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-ognl-3.0.1.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ognl-3.0.1.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-poi-3.10.1-20140818.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\poi-3.10.1-20140818.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-sqljdbc.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\sqljdbc.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-core-2.2.3.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-core-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-json-plugin-2.2.3.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-json-plugin-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-struts2-sunspoter-stream-1.0.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-sunspoter-stream-1.0.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-xwork-core-2.2.3.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\xwork-core-2.2.3.jar" model-entity="FileSystemJar"/>
 <file-system NAME="lib-jacob.jar"
  location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\jacob.jar" model-entity="FileSystemJar"/>
 <web SERVLET_VERSION="2.4" model-entity="JstWeb" model-path="/web.xml">
  <module URI="/WEB-INF/faces-config.xml" model-entity="WebJSFModule"
   model-path="/faces-config.xml" src="src" web-root="WEB-ROOT"/>
gx_tieta/WebRoot/Test.jsp
@@ -48,6 +48,45 @@
            //console.info(json);
    <%    }    %>
    
    var param = {
        dev_id:910000001,
        record_datetime:'2018-01-01 00:00:00',
        record_datetime_end:'2018-03-30 23:59:59',
        station_event_type:0,                                //1:基站停电        2:基站续航    3:基站发电        4:基站开门    5:基站掉站    6:基站温度上限   7:基站温度下限    8:基站湿度上限    9:基站湿度下限
        page:{
            pageSize:10,             //每页的行数
            pageCurr:1                //当前页码数
        }
    };
    searchStationHistRecord(param);
    //查询基站详情
    function searchStationHistRecord(param){
        // 请求获取当前省下的市
        $.ajax({
            type: "post",
            url: "Bts_station_eventAction!serchByInfo",
            async:true,
            dataType:'json',
            data:"json = "+JSON.stringify(param),
            success: function(data){
                var rs = JSON.parse(data.result);
                console.info(rs);
                if(rs.code == 1) {
                }else {
                }
            }
        });
    }
    //上传logo
    $('#up-file1').click(function(){
        uploadlogo();
gx_tieta/src/com/fgkj/servlets/ExportTableServlet.java
@@ -33,6 +33,9 @@
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String pageName=req.getParameter("PageName");
        String exp_KeyWord = req.getParameter("exp_normal");            //通用到处表格标识符
        if(ServletUtils.isNotNull(pageName)){
            if("ele_statistics.jsp".equals(pageName)){
                excelTitle="电池信息统计查询";
@@ -121,6 +124,83 @@
                excelTitle="设备状态变化记录表";
                Exporttele_eleBrdwMaintTable(resp,req);
            }
        }else if(ServletUtils.isNotNull(exp_KeyWord)){
            if("1".equals(exp_KeyWord)){
                ExportGeneralExcelTable(resp,req);                    //导出通用的表格
            }
        }
    }
    private void ExportGeneralExcelTable(HttpServletResponse resp,
            HttpServletRequest req) {
        String exp_thead_str = req.getParameter("exp_thead");
        String exp_tbody_str = req.getParameter("exp_tbody");
        String exp_page_break = req.getParameter("exp_page_break");
        String exp_data_break = req.getParameter("exp_data_break");
        String exp_page_names_str =  req.getParameter("exp_page_names");
        String[] exp_page_names = new String[]{};
        try {
            //定义一个工作簿
            HSSFWorkbook workbook = new HSSFWorkbook();
            if(!ServletUtils.isNotNull(exp_page_names_str)){
                return;
                //exp_page_names[0] = "sheet1";
            }else{
                exp_page_names = exp_page_names_str.split(exp_page_break);            //分割工作簿的名称
                String[] exp_thead_sheets = exp_thead_str.split(exp_page_break);
                String[] exp_tbody_sheets = exp_tbody_str.split(exp_page_break);
                for (int i = 0; i < exp_page_names.length && exp_page_names.length >= exp_thead_sheets.length; i++) {
                    HSSFSheet sheet = workbook.createSheet(excelTitle);
                    String[] exp_thead = exp_thead_sheets[i].split(exp_data_break);
                    String[] exp_tbody = exp_tbody_sheets[i].split(exp_data_break);
                    int maxColNum = exp_thead.length;            //最大列数
                    int nowRowNum = 0;                            //当前行
                    int nowColNum = 0;                            //当前列
                    for(int j=0;j <= exp_tbody.length;j++){
                        HSSFRow row = null;
                        if(j == 0){
                            row = sheet.createRow(nowRowNum++);
                            for(int k=0;k<exp_thead.length;k++){
                                HSSFCell cell = row.createCell(k);
                                HSSFRichTextString text = new HSSFRichTextString(exp_thead[k]);
                                //System.out.print(text+"\t");
                                cell.setCellValue(text);
                            }
                            continue;
                        }else if(j%maxColNum == 1){
                            nowColNum = 0;
                            row = sheet.createRow(nowRowNum++);
                        }
                        HSSFCell cell = row.createCell(nowColNum++);
                        HSSFRichTextString text = new HSSFRichTextString(exp_tbody[j-1]);
                        //System.out.print(text+"\t");
                        cell.setCellValue(text);
                    }
                }
            }
            // 转码防止乱码
            resp.addHeader("Content-Disposition", "attachment;filename="
                    + new String(excelName.getBytes("gb2312"), "ISO8859-1")
                    + ".xls");
            OutputStream out = resp.getOutputStream();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }