1. 程式人生 > >把資料量大匯出 放入多個excel 然後壓縮成zip檔案,匯出

把資料量大匯出 放入多個excel 然後壓縮成zip檔案,匯出

前臺頁面:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.pactera.com/powerweb" prefix="p"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<p:include codeTypeIds="systag,staffclient_operation_type" />

</head>
<body class="easyui-layout">
	<div data-options="region:'center',border:false" style="padding: 1px;">
		<form id="Form_StaffclientLogSearch" action="" method="post">
			<table border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
				<tr><td nowrap="nowrap" width="1%" align="right"><label>開戶開始日期</label></td>
					<td nowrap="nowrap" width="1%" align="left"><input id="bclientopendate" name="bclientopendate" class="easyui-datebox" editable="false"></input></td>
					<td nowrap="nowrap" width="1%" align="right"><label>開戶結束日期</label></td>
					<td nowrap="nowrap" width="1%" align="left"><input id="eclientopendate" name="eclientopendate" class="easyui-datebox" editable="false"></input></td>
					<td nowrap="nowrap" width="1%" align="right"><label>營業部名稱</label></td>
					<td nowrap="nowrap" width="1%" align="left"><input id="jgjc" name="jgjc" class="easyui-combobox" style="width:220px"/></td>
					<td nowrap="nowrap" width="1%" align="right"><label>客戶歸屬系統</label></td>
					<td nowrap="nowrap" width="1%" align="left"><input id="systag2" name="systag" class="easyui-combobox" /></td>
					<td nowrap="nowrap" width="90%" align="left"></td>
				</tr>
			</table>
		</form>
		<table id="Datagrid_StaffclientLog" data-options="iconCls:'icon-grid',title:'員工客戶關係列表'"></table>
	</div>

	<script type="text/javascript">
		
	
		// 匯出Excel
		function doExport() {
			$('#Form_StaffclientLogSearch').form('submit', {
				url:'<c:url value="/comm/staffclientLog.do?method=exportfgs" />',
				onSubmit: function(){
					$.messager.alert("操作提示", "檔案正在匯出中,請稍後...", "info");
			    }   
			});
		}

	</script>
</body>
</html>

後臺action

WriteExcelToZip wetz = new WriteExcelToZip();
		Date date = new Date();
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
		String f = "SJDZSY-" + format.format(date);
		wetz.setResponseHeader(f, response);
		OutputStream out = null;
		try {
			out = response.getOutputStream();
			String bclientopendate = commStaffclientLogVo.getBclientopendate();
			String eclientopendate = commStaffclientLogVo.getEclientopendate();
			if (bclientopendate == null || "".equals(bclientopendate)) {
				commStaffclientLogVo.setBclientopendate("0");
				commStaffclientLogVo.setEclientopendate("99999999");
			} else {
				bclientopendate = bclientopendate.replaceAll("-", "");
				eclientopendate = eclientopendate.replaceAll("-", "");
				commStaffclientLogVo.setBclientopendate(bclientopendate);
				commStaffclientLogVo.setEclientopendate(eclientopendate);

			}
			String staffno = commStaffclientLogVo.getStaffno();
			if (staffno == null || "".equals(staffno)) {
				staffno = null;
			}
			String fundid = commStaffclientLogVo.getFundid();
			if (fundid == null || "".equals(fundid)) {
				fundid = null;
			}
			String orgid = commStaffclientLogVo.getJgjc();
			if (orgid == null || "".equals(orgid)) {
				orgid = null;
			}
			String opflag = commStaffclientLogVo.getOpflag();
			if (opflag == null || "".equals(opflag)) {
				opflag = null;
			}
			String systag = commStaffclientLogVo.getSystag();
			if (systag == null || "".equals(systag)) {
				systag = null;
			}
			List list = wetz.querySqlRun("{call commision.[dbo].p_comm_staffclient_get_export(" + commStaffclientLogVo.getBclientopendate() + "," + commStaffclientLogVo.getEclientopendate() + "," + staffno + "," + fundid + "," + orgid + "," + opflag
					+ "," + systag + ",'staffclient_fgs','" + getSessionObject().getSysUser().getUserId() + "')}", request);
			System.out.println(list.size());
			wetz.toExcel(list, request, 50000, f, out);

呼叫工具類。工具l類可以去我共享資源下載,謝謝

相關推薦

料量匯出 excel 然後壓縮zip檔案匯出

前臺頁面:<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/

Java實現匯出excel表打包到zip檔案中->供客戶端下載

業務需求:將需求方要的資料匯出excel表中。                 1.只發出一次請求                

Android ViewPagerXML。如何監聽其的控制元件?

我在一個Activity裡面加入了ViewPager。 ViewPager裡面放了兩個XML。XML裡面有幾個TextView控制元件。我想在這個Activity裡面加入ViewPager中XML裡面的控制元件監聽,並且響應點選TextView之後彈出提示框的事件。但是卻一直苦於無法通過findById()

jar包壓縮一個

介紹兩種方式實現。一:Linux命令實現1:將要合併的jar包解壓到同一目錄。例如解壓 test.jarjar xvf test.jar2:合併多個包。例如當面目下解壓了兩個資料夾。com 與 org  。將合併後的包命名為 all.jarjar cvf all.jar  c

excel表格打包一個壓縮檔案

上一篇文章講解了如何生成excel檔案,name這一章我們來談談如何將多個excel檔案打包成壓縮包的形式 首先看一下主函式: public static void main(String[] args) throws IOException { try { Fi

oracle sql條資料合併一條,料量,用逗號隔開

SELECTxmlagg(XMLPARSE (CONTENT TRANSLATE (unique_id USING CHAR_CS) || ',' WELLFORMED)).getclobval()FROMBIM_ELEMENTCODEWHEREpj_id = '0305'

ASP.NET MVC匯出excel料量非常耗時的非同步匯出

要在ASP.NET MVC站點上做excel匯出功能,但是要匯出的excel檔案比較大,有幾十M,所以匯出比較費時,為了不影響對介面的其它操作,我就採用非同步的方式,後臺開闢一個執行緒將excel匯出到指定目錄,然後提供下載。匯出的excel涉及到了多個sheet(工作簿),表格合併,格式設定等,所以採用了N

PL/SQL Developer匯出大量料到excel的快速方法解決料量匯出慢的問題

當需要從sql查詢l中匯出大量資料到excel時,用copy to excel 會執行得很慢,使用Export Query Results...功能則會快速很多。 1.直接執行查詢,顯示完所有資料耗時22分37秒,此時也需佔用>100m記憶體空間。隨後選擇copy t

資料庫設計規範(適用併發量料量的網際網路業務)

一、基礎規範 (1)必須使用InnoDB儲存引擎 解讀:支援事務、行級鎖、併發效能更好、CPU及記憶體快取頁優化使得資源利用率更高 (2)必須使用UTF8字符集 解讀:萬國碼,無需轉碼,無亂碼風險,節省空間 (3)資料表、資料欄位必須加入中文註釋 解讀:N年後誰tm知道這個r1,r2,r

Mysql分頁料量時limit優化

MYSQL的優化是非常重要的。其他最常用也最需要優化的就是limit。mysql的limit給分頁帶來了極大的方便,但資料量一大的時候,limit的效能就急劇下降。 同樣是取10條資料 select * from order limit 10000,10 select * from or

資料結構實驗之棧與佇列六:下一較值(二)(因為料量所以用棧來操作)

資料結構實驗之棧與佇列六:下一較大值(二) Time Limit: 150 ms Memory Limit: 8000 KiB Problem Description 對於包含n(1<=n<=100000)個整數的序列,對於序列中的每一元素,在序列中查詢

DB2 插入刪除料量怎麼辦

      1)插入資料量太大,會造成日誌空間滿,最終插入不了,應當設定一段數量後的提交:         db2 "import from 'E:\TG_DEBT_IMPAWN_UNTRADE.del' of del commitcount 1000          in

mysql主從複製料量 高併發時出現數據不一致

mysql5.7的並行複製就可以解決資料延遲的問題。 MySQL 5.7並行複製時代 眾所周知,MySQL的複製延遲是一直被詬病的問題之一,然而在Inside君之前的兩篇部落格中(1,2)中都已經提到了MySQL 5.7版本已經支援“真正”的並行複製功能,官方稱為

使用流讀取料量檔案並存到mysql資料庫中

import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import jav

vue + Echarts 填坑記(Echarts料量導致瀏覽器卡頓)

最近使用vue + Echarts 實現vue專案的資料視覺化功能的時候,發現隨著元件的增多,元件裡Echarts繪圖的增多,頁面操作越來越卡頓,點選資料比較大的元件時,Echarts繪圖渲染頁面的速度倒是挺快,但是當我點選切換其他元件統計圖時,出現了讓人難以忍受的卡頓,有

Mysql料量提高查詢速度

由於在參與的實際專案中發現當mysql表的資料量達到百萬級時,普通SQL查詢效率呈直線下降,而且如果where中的查詢條件較多時,其查詢速度簡直無法容忍。曾經測試對一個包含400多萬條記錄(有索引)的表執行一條條件查詢,其查詢時間竟然高達40幾秒,相信這麼高的查詢延時,任何

java使用POI將資料匯出Excel

本文主要是將資料庫取出的資料按照自定義的行列格式匯出到excel中,POI則是實現我們需求所用到的技術。 POI介紹 使用spring boot匯入相關依賴 獲取資料(自行處理) 完整程式碼例項:建立excel,將資料寫入excel ####1.PO

ajax和form方式提交表單料量的問題

ajax和form方式提交表單資料量大後臺request中的paramMap只有9999的資料,有一部分資料沒有了.在form中新增屬性enctype="multipart/form-data"使用檔案上傳的方式,不過這樣後臺取表單資料的方法就需要修改.只能迴圈fileIte

關於dedecms料量以後生成目錄緩慢的問題解決

修改的檔案:Include/arc.listview.class.php 查詢  //初始化列表模板,並統計頁面總數 在此句的上面新增一小段程式碼:         if($this->TotalResult > 100)         {         $this->TotalRes