- 浏览: 103144 次
- 性别:
- 来自: 深圳
-
文章分类
- 全部博客 (209)
- http://docs.jpush.io/server/java_sdk/ (1)
- SpingMVC ModelAndView (1)
- Model (1)
- Control以及参数传递 (1)
- https://www.alipay.com/ (1)
- 检查指定的字符串列表是否不为空。 (1)
- 转自http://my.oschina.net/rpgmakervx/blog/505434 (1)
- 压缩js (1)
- 含包含 字母数字校验 (1)
- 判断浏览器是ie (1)
- fixbox (0)
- 转自http://www.cnblogs.com/lanzi/archive/2010/10/26/1861338.html (1)
- http://dl2.iteye.com/upload/attachment/0113/2406/afbd8d53-dcad-3afc-8d78-41c1591 (0)
- IDEA (0)
- maven搭建 (0)
- http://www.jeasyuicn.com/api/docTtml/index.htm (1)
- 给tomcat添加运行内存: (1)
- JPUSH推送 (1)
- requestScope (0)
- oracle中plsql安装client10连接数据库 (1)
- 不需要安装oracle11g (1)
- tuikuan (1)
- http://www.hjxmall.com/index.php (1)
- java (1)
- 参考 (1)
- xml签名验签模拟程序 (1)
- 技术网站收集分享 (1)
- Java NIO提供了与标准IO不同的IO工作方式 ------来源于 http://www.iteye.com/magazines/132-Java-NIO (1)
- oracle表查询语句优化 (0)
- oracle (5)
- a (1)
- TenpayHttpClient (2)
- mongodb (1)
- http://www.qcloud.com/product/cmongo.html?utm_source=pcsem1&utm_medium=bdgj46&utm_campaign=baidu (1)
- SpringMVC整合MongoDB开发 (0)
- SpringMVC整合MongoDB开发 https://www.mongodb.org (1)
- Java 语言中常见问题总结 (1)
- 数据库SQL优化大总结 (1)
- 拦截器与过滤器的区别 (1)
- Struts2中拦截器与过滤器的区别及执行顺序 (1)
- Spring声明式事务管理与配置 (0)
- oracle OPERTION (1)
- java 高并发多线程开发 (1)
- Collection 与 map 接口相关集合 (1)
- 多线程开发实践 (1)
- JVM调优总结 转自 http://www.importnew.com/18694.html (1)
- redis 五种数据类型的使用场景 转自于 http://blog.csdn.net/gaogaoshan/article/details/41039581 (1)
- HttpWatch http基础 来自于http://blog.csdn.net/gaogaoshan/article/details/21237555 (1)
- maven 远程仓库 http://blog.csdn.net/gaogaoshan/article/details/40266779 (1)
- 生成Webservice客户端的4中方法 http://blog.csdn.net/gaogaoshan/article/details/8980775 (1)
- http://fgh2011.iteye.com/blog/1564283 (1)
- sleep和wait有什么区别 http://xiaowei2002.iteye.com/blog/2174188 (1)
- JDK中常用包及其类 常见的几种RuntimeException (1)
- Java的运行原理 (1)
- mybatis缓存的使用及理解 http://my.oschina.net/dxqr/blog/123163 (1)
- 软件架构设计分析 (1)
- redis技术总结 (3)
- java面试总结知识点 (1)
- ZooKeeper技术 (1)
- Hadoop (1)
- sso单点登录 (1)
- SpringIOC (1)
- 书签ssssssssssssssssssssss (1)
- spring事务的隔离级别 http://www.cnblogs.com/yangy608/archive/2011/06/29/2093478.html (1)
- 秒杀系统架构分析与实战 http://www.importnew.com/18920.html (1)
- oracle 连接plsql配置 (1)
- maven工程集成springmvc http://blog.csdn.net/fox_lht/article/details/16952683 (1)
- java类序列化与反序列化版本唯一号serialVersionUID (1)
- spring注解用法总结 (1)
- eclipse导入maven项目找不到资源文件方法 (1)
- dubbo (0)
- socket 网络编程 服务器与客户端 编程 (1)
- Thread与Runnable实现线程利用线程插队实现求和操作 (1)
- 生产者与消费者模式 (1)
- JAXB注解 java 关于xml的注解,自动生成xml文件 - @XML*** (1)
- xml 与JAVAbean转换 (1)
- MAP (2)
- decimalToString (1)
- 反编译插件 (0)
- 反编译插件 https://sourceforge.net/projects/jadclipse/?source=typ_redirect (1)
- AWX (1)
- 官网地址Dinp (1)
- public interface ExecutorService extends Executor (1)
- MAIN (1)
- 转自于 http://blog.csdn.net/lufeng20/article/details/24314381 (1)
- JaxbUtil (1)
- HttpXmlClient (0)
- Http post 请求 (1)
- URLDecoder (1)
- spdb (0)
- 订单号生成规则 (1)
- 距离0点毫秒数 (1)
- MyBatis存储过程调用java (1)
- Banks (1)
- 学习网址 (1)
- hots配置oracle数据库配置修改 (1)
- 支付宝文档 (1)
- Jadclipse (1)
- filter (0)
- Filter过滤器 (1)
- 工具类 fixbox (1)
- java quartz (0)
- java quartz 实现定时任务,每个礼拜一到礼拜五定时执行 (1)
- Thread (4)
- getResourceAsStream (1)
- BigData (1)
- 开源架构 (17)
- 架构 (0)
- 文件操作 (2)
- tools (20)
- 测试工具 (1)
- vm (1)
- mq (1)
- blog (1)
- 开源架构搭建技术 (6)
- JAVA细节技术点总结 (1)
- 优化技术 (1)
- LINUX命令使用 (1)
- spring (2)
- 大数据 (1)
- struts2 (1)
- python (1)
- pay (1)
- linux (1)
- 压力测试 (1)
- 代码检查插件 (1)
- 游戏端开发 (1)
- 微信开发相关 (1)
- 搜索引擎 (1)
- 网络技术 (1)
- 分布式部署 (1)
- 堆栈信息 (1)
最新评论
查询分页excele
/**
* 下载商户前一日的交易对账单
* @param dateTime
* @return
* @throws TtyException
*/
@Override
public void downloadMerchantBillsTask(Date beginDate,Date endDate) throws TtyException {
List<MemberMerchant> list = memberService.queryAllMerchants();
FileOutputStream fOut = null;
InputStream fin = null;
for(int i=0;i<list.size();i++){
MemberMerchant memberMerchant = list.get(i);
log.info("循环当前商户的登录账号为{}",memberMerchant.getLoginId());
String newBeginDate = "";
if(Utils.isNull(beginDate)){
newBeginDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newBeginDate = DateUtil.format(beginDate,DateUtil.YYYY_MM_DD);
}
log.info("开始时间="+newBeginDate);
String fileName = memberMerchant.getLoginId();
//对账单结束时间
String newEndDate = "";
if(Utils.isNull(endDate)){
newEndDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newEndDate = DateUtil.format(endDate,DateUtil.YYYY_MM_DD);
}
if (!StringUtils.isEmpty(newBeginDate) && !StringUtils.isEmpty(newEndDate)) {
fileName += "(" + newBeginDate + "-" + newEndDate + ")"+"_";
}
//模板路径
String templateUrl = Property.getProperty("url.downloadMerchantBills.template", "");
//导出到指定路径
String newfilePath = Property.getProperty("url.merchantBills.path");
//根据商户登陆帐户生成目录结构
String memberId = memberMerchant.getMemberId()+"/";
newfilePath +=memberId;
File dirFile = new File(newfilePath);
log.info("----newfilePath----:" + newfilePath);
if (!dirFile.exists()) {
log.info("创建文件夹:" + newfilePath);
dirFile.mkdirs();
}
//存放对帐单数据的文件路径
newfilePath +=fileName;
//查询当前商户前一交易日的对账单数据参数
Map<String, Object> data = new HashMap<String, Object>();
data.put("beginDate", newBeginDate);
data.put("endDate", newEndDate);
data.put("mchLoginId", memberMerchant.getLoginId());
//处理大数据量的导出
String tempFilePath="";
//查询当前商户的总对帐数量
int totalRecord = this.queryMerchantBillsCountByLoginId(data);
//根据传入的分页开始与结束值查询数据
int startPageNo=0,pageSize=0,pagesTotal = 0,size=2,endPageNo=0;
if(totalRecord >0){
//此商户存在对帐单数据
startPageNo = 1;
pagesTotal=(totalRecord-1)/size+1;
}
for(int j=0;j<pagesTotal;j++){
/*startPageNo = j*size+1;
endPageNo = (j+1)*size;*/
//导出多个excele文件
IPage<SettlementOrder> pList = orderQueryService.querySettlementListByMchLoginId(data, j+1, size);
if (null != pList && null != pList.getRows()) {
List<SettlementOrder> list2 = (List<SettlementOrder>) pList.getRows();
data.put("items", list2);
}
try {
tempFilePath = newfilePath +j+".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}
}
}
}
/**
* 下载商户前一日的交易对账单
* @param dateTime
* @return
* @throws TtyException
*/
@Autowired
@Override
public void downloadMerchantBillsTask(Date beginDate,Date endDate) throws TtyException {
List<MemberMerchant> list = memberService.queryAllMerchants();
FileOutputStream fOut = null;
InputStream fin = null;
for(int i=0;i<list.size();i++){
MemberMerchant memberMerchant = list.get(i);
log.info("循环当前商户的登录账号为{}",memberMerchant.getLoginId());
String newBeginDate = "";
if(Utils.isNull(beginDate)){
newBeginDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newBeginDate = DateUtil.format(beginDate,DateUtil.YYYY_MM_DD);
}
log.info("开始时间="+newBeginDate);
String fileName = memberMerchant.getLoginId();
//对账单结束时间
String newEndDate = "";
if(Utils.isNull(endDate)){
newEndDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newEndDate = DateUtil.format(endDate,DateUtil.YYYY_MM_DD);
}
if (!StringUtils.isEmpty(newBeginDate) && !StringUtils.isEmpty(newEndDate)) {
fileName += "(" + newBeginDate + "-" + newEndDate + ")";
}
//模板路径
String templateUrl = Property.getProperty("url.downloadMerchantBills.template", "");
//导出到指定路径
String newfilePath = Property.getProperty("url.merchantBills.path");
//根据商户登陆帐户生成目录结构
String memberId = memberMerchant.getMemberId()+"/";
newfilePath +=memberId;
File dirFile = new File(newfilePath);
log.info("----newfilePath----:" + newfilePath);
if (!dirFile.exists()) {
log.info("创建文件夹:" + newfilePath);
dirFile.mkdirs();
}
//存放对帐单数据的文件路径
newfilePath +=fileName;
//查询当前商户前一交易日的对账单数据参数
Map<String, Object> data = new HashMap<String, Object>();
data.put("beginDate", newBeginDate);
data.put("endDate", newEndDate);
data.put("mchLoginId", memberMerchant.getLoginId());
String tempFilePath="";
int totalRecord = this.queryMerchantBillsCountByLoginId(data);
int pagesTotal = 0,size=2;
if(totalRecord >0){
//此商户存在对帐单数据
pagesTotal=(totalRecord-1)/size+1;
for(int j=0;j<pagesTotal;j++){
//循环导出多个excele文件
log.info("正在导出商户编号为:"+memberMerchant.getMemberId()+"第"+j+"个excel文件");
IPage<SettlementOrder> pList = orderQueryService.querySettlementListByMchLoginId(data, j+1, size);
if (null != pList && null != pList.getRows()) {
List<SettlementOrder> list2 = (List<SettlementOrder>) pList.getRows();
data.put("items", list2);
}
tempFilePath = newfilePath +"_" +j+".xls";
ExportController.reportExp(tempFilePath,templateUrl,data);
/*try {
tempFilePath = newfilePath +"_" +j+".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}*/
}
}else{
//没有对帐单数据信息.
List<SettlementOrder> list3 = new ArrayList<SettlementOrder>();
data.put("items", list3);
tempFilePath = newfilePath +".xls";
ExportController.reportExp(tempFilePath,templateUrl,data);
/*try {
List<SettlementOrder> list3 = new ArrayList<SettlementOrder>();
data.put("items", list3);
tempFilePath = newfilePath +".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}*/
}
}
}
/**
* Copyright (c) 2011-2015 All Rights Reserved.
*/
package com.kame.micropay.order.service.utils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import net.sf.jxls.transformer.XLSTransformer;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
/**
*
* @author Administrator
*
*/
@Controller
public abstract class ExportController {
private static Logger log = LoggerFactory.getLogger(ExportController.class);
/**
* 输出报表
* @param tempFilePath
* @param templateUrl
* @param data
*/
public static void reportExp(String tempFilePath, String templateUrl, Map<String, Object> data) {
OutputStream fOut = null;
InputStream fin = null;
try {
URL url = new URL(templateUrl);
URLConnection connection = url.openConnection();
fin = connection.getInputStream();
XLSTransformer transformer = new XLSTransformer();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
log.error("报表导出异常", e);
} finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("报表导出异常", ie);
}
}
}
}
* 下载商户前一日的交易对账单
* @param dateTime
* @return
* @throws TtyException
*/
@Override
public void downloadMerchantBillsTask(Date beginDate,Date endDate) throws TtyException {
List<MemberMerchant> list = memberService.queryAllMerchants();
FileOutputStream fOut = null;
InputStream fin = null;
for(int i=0;i<list.size();i++){
MemberMerchant memberMerchant = list.get(i);
log.info("循环当前商户的登录账号为{}",memberMerchant.getLoginId());
String newBeginDate = "";
if(Utils.isNull(beginDate)){
newBeginDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newBeginDate = DateUtil.format(beginDate,DateUtil.YYYY_MM_DD);
}
log.info("开始时间="+newBeginDate);
String fileName = memberMerchant.getLoginId();
//对账单结束时间
String newEndDate = "";
if(Utils.isNull(endDate)){
newEndDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newEndDate = DateUtil.format(endDate,DateUtil.YYYY_MM_DD);
}
if (!StringUtils.isEmpty(newBeginDate) && !StringUtils.isEmpty(newEndDate)) {
fileName += "(" + newBeginDate + "-" + newEndDate + ")"+"_";
}
//模板路径
String templateUrl = Property.getProperty("url.downloadMerchantBills.template", "");
//导出到指定路径
String newfilePath = Property.getProperty("url.merchantBills.path");
//根据商户登陆帐户生成目录结构
String memberId = memberMerchant.getMemberId()+"/";
newfilePath +=memberId;
File dirFile = new File(newfilePath);
log.info("----newfilePath----:" + newfilePath);
if (!dirFile.exists()) {
log.info("创建文件夹:" + newfilePath);
dirFile.mkdirs();
}
//存放对帐单数据的文件路径
newfilePath +=fileName;
//查询当前商户前一交易日的对账单数据参数
Map<String, Object> data = new HashMap<String, Object>();
data.put("beginDate", newBeginDate);
data.put("endDate", newEndDate);
data.put("mchLoginId", memberMerchant.getLoginId());
//处理大数据量的导出
String tempFilePath="";
//查询当前商户的总对帐数量
int totalRecord = this.queryMerchantBillsCountByLoginId(data);
//根据传入的分页开始与结束值查询数据
int startPageNo=0,pageSize=0,pagesTotal = 0,size=2,endPageNo=0;
if(totalRecord >0){
//此商户存在对帐单数据
startPageNo = 1;
pagesTotal=(totalRecord-1)/size+1;
}
for(int j=0;j<pagesTotal;j++){
/*startPageNo = j*size+1;
endPageNo = (j+1)*size;*/
//导出多个excele文件
IPage<SettlementOrder> pList = orderQueryService.querySettlementListByMchLoginId(data, j+1, size);
if (null != pList && null != pList.getRows()) {
List<SettlementOrder> list2 = (List<SettlementOrder>) pList.getRows();
data.put("items", list2);
}
try {
tempFilePath = newfilePath +j+".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}
}
}
}
/**
* 下载商户前一日的交易对账单
* @param dateTime
* @return
* @throws TtyException
*/
@Autowired
@Override
public void downloadMerchantBillsTask(Date beginDate,Date endDate) throws TtyException {
List<MemberMerchant> list = memberService.queryAllMerchants();
FileOutputStream fOut = null;
InputStream fin = null;
for(int i=0;i<list.size();i++){
MemberMerchant memberMerchant = list.get(i);
log.info("循环当前商户的登录账号为{}",memberMerchant.getLoginId());
String newBeginDate = "";
if(Utils.isNull(beginDate)){
newBeginDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newBeginDate = DateUtil.format(beginDate,DateUtil.YYYY_MM_DD);
}
log.info("开始时间="+newBeginDate);
String fileName = memberMerchant.getLoginId();
//对账单结束时间
String newEndDate = "";
if(Utils.isNull(endDate)){
newEndDate = DateUtil.format(new Date(), DateUtil.YYYY_MM_DD, -1);//前一日的交易对账单
}else{
newEndDate = DateUtil.format(endDate,DateUtil.YYYY_MM_DD);
}
if (!StringUtils.isEmpty(newBeginDate) && !StringUtils.isEmpty(newEndDate)) {
fileName += "(" + newBeginDate + "-" + newEndDate + ")";
}
//模板路径
String templateUrl = Property.getProperty("url.downloadMerchantBills.template", "");
//导出到指定路径
String newfilePath = Property.getProperty("url.merchantBills.path");
//根据商户登陆帐户生成目录结构
String memberId = memberMerchant.getMemberId()+"/";
newfilePath +=memberId;
File dirFile = new File(newfilePath);
log.info("----newfilePath----:" + newfilePath);
if (!dirFile.exists()) {
log.info("创建文件夹:" + newfilePath);
dirFile.mkdirs();
}
//存放对帐单数据的文件路径
newfilePath +=fileName;
//查询当前商户前一交易日的对账单数据参数
Map<String, Object> data = new HashMap<String, Object>();
data.put("beginDate", newBeginDate);
data.put("endDate", newEndDate);
data.put("mchLoginId", memberMerchant.getLoginId());
String tempFilePath="";
int totalRecord = this.queryMerchantBillsCountByLoginId(data);
int pagesTotal = 0,size=2;
if(totalRecord >0){
//此商户存在对帐单数据
pagesTotal=(totalRecord-1)/size+1;
for(int j=0;j<pagesTotal;j++){
//循环导出多个excele文件
log.info("正在导出商户编号为:"+memberMerchant.getMemberId()+"第"+j+"个excel文件");
IPage<SettlementOrder> pList = orderQueryService.querySettlementListByMchLoginId(data, j+1, size);
if (null != pList && null != pList.getRows()) {
List<SettlementOrder> list2 = (List<SettlementOrder>) pList.getRows();
data.put("items", list2);
}
tempFilePath = newfilePath +"_" +j+".xls";
ExportController.reportExp(tempFilePath,templateUrl,data);
/*try {
tempFilePath = newfilePath +"_" +j+".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}*/
}
}else{
//没有对帐单数据信息.
List<SettlementOrder> list3 = new ArrayList<SettlementOrder>();
data.put("items", list3);
tempFilePath = newfilePath +".xls";
ExportController.reportExp(tempFilePath,templateUrl,data);
/*try {
List<SettlementOrder> list3 = new ArrayList<SettlementOrder>();
data.put("items", list3);
tempFilePath = newfilePath +".xls";
//模板文件从服务器下载方式
XLSTransformer transformer = new XLSTransformer();
URL inUrl = new URL(templateUrl);
URLConnection connection = inUrl.openConnection();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("定时任务报表导出异常", ie);
}
}*/
}
}
}
/**
* Copyright (c) 2011-2015 All Rights Reserved.
*/
package com.kame.micropay.order.service.utils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import net.sf.jxls.transformer.XLSTransformer;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
/**
*
* @author Administrator
*
*/
@Controller
public abstract class ExportController {
private static Logger log = LoggerFactory.getLogger(ExportController.class);
/**
* 输出报表
* @param tempFilePath
* @param templateUrl
* @param data
*/
public static void reportExp(String tempFilePath, String templateUrl, Map<String, Object> data) {
OutputStream fOut = null;
InputStream fin = null;
try {
URL url = new URL(templateUrl);
URLConnection connection = url.openConnection();
fin = connection.getInputStream();
XLSTransformer transformer = new XLSTransformer();
fin = connection.getInputStream();
fOut = new FileOutputStream(tempFilePath);
transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
log.error("报表导出异常", e);
} finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("报表导出异常", ie);
}
}
}
}
相关推荐
使用Qtcreator实现数据库查询,记录分页显示,含有下一页,上一页,跳转等功能,此外还实现了将查询数据导出到excel
数据分页导入Excel是一项在大数据处理中常见的任务,它涉及到如何高效地从数据库中提取大量数据并将其组织成Excel格式。在这个过程中,我们通常会利用Java的Apache POI库,这是一个强大的工具,允许开发者创建、修改...
EXCEL利用VBA实现自动分页汇总 EXCEL中的自动分页汇总是指在EXCEL表格中按照一定的规则将数据分页,并对每一页的数据进行汇总和统计。这种功能可以通过VBA语言实现。 VBA语言是EXCEL中的宏语言,它允许用户编写...
在本文中,我们将详细探讨Excel表格在打印时的分页技巧,包括手动分页、自动分页以及快速插入和删除分页符的方法。 首先,我们来了解如何通过手动分页来实现对Excel表格内容的精确控制。手动分页的核心在于将一个长...
C#大量数据导出到Excel,超过65536行时自动分页导出
关于excle分页的功能, alt+f11可以进入excle进行调试
private void ToExcel(HttpContext context, string TempletFileName//模版文件, string ReportFileName//导出文件, DataTable dt2) { //模板文件 //string TempletFileName = context.Server.MapPath...
在这个场景中,"JSF+Spring+Hibernate配置以及分页查询和Excel文件导出"是一个典型的企业级应用开发组合。下面将详细阐述这些技术及其整合方式。 1. JavaServer Faces (JSF): JSF是一种Java标准的MVC(模型-视图-...
本教程将介绍如何使用这两者结合jQuery来实现数据查询、分页以及Excel导出功能。 1. **JSP基础** JSP是一种服务器端脚本语言,用于生成动态HTML页面。开发者可以在JSP文件中混合使用HTML、Java代码和自定义标签库...
本篇文章将深入探讨如何在Vue.js项目中结合`el-table`和`file-saver`库,实现前端导出分页数据到Excel的功能。 首先,我们需要了解`el-table`。它是Element UI的一部分,提供了一种灵活的方式来展示和操作表格数据...
2. 使用`mysql-connector-python`库连接MySQL数据库,执行SQL查询,特别是分页查询。 3. 通过前端框架LayUImini实现前端页面的布局和交互,包括分页组件的使用。 4. 前后端交互,利用AJAX进行异步数据请求和页面更新...
EXCEL自动分页插件,容易上手。好用。
《报表分页小计》 轻松学习excel,以后陆续上传
Excel表格如何分页打印自动分页取消分页等技巧 在Excel表格中,如何实现分页打印、自动分页、取消分页等技巧是一个非常重要的问题。特别是在制作多个表格时,我们希望将每个表格分别打印到每一张纸上面,每张纸上面...
标题中的“poi excel example,分页,行高,列宽”指的是使用Apache POI库来操作Excel文件的一些关键功能,包括设置分页、调整行高和列宽。Apache POI是一个流行的Java API,用于读取和写入Microsoft Office格式的...
在Excel中,自动分页小计是一项非常实用的功能,它能帮助用户在处理大量数据时进行有效的分组和计算,使报表更清晰易读。在标题提到的"excel 自动分页小计"中,主要涉及到以下几个关键知识点: 1. **分页符**:在...
在本资源中,我们关注的是Aspose的21.3版本,特别是其在Excel到PDF转换以及PDF的分页和合并方面的功能。 首先,Aspose.Excel API允许开发者方便地将Excel工作簿转换为PDF格式。这种转换不仅保留了原始电子表格的...
可以和datagridview合用的分页控件
在本项目中,我们将探讨如何使用Python编程语言来自动化处理Excel数据,并将其转换为结构化的Word文档,同时包含索引目录和分页功能。这样的任务对于数据报告、数据分析或者日常办公自动化具有很高的实用价值。主要...
1 advance_fenye2.0.php 一个分页的类,非常实用 2 char.php 汉字编码解决 3 class-excel-xml.inc.php excel文件生成类 4 image.php 图片缩放类