public String download() throws Exception { LogWriter.println(this.getClass().toString() + ":download下的方法被调用了"); // 创建新的ExportExcel类以创建excel ExportExcel<YearCountTaxModel> ex = new ExportExcel<YearCountTaxModel>(new YearCountTaxModel()); // SXSSFWorkbook workbook = new SXSSFWorkbook(300); if (getSessionUser() == null) { return "noSession"; } // 获取记录总数,这里除以40000是为什么 long count = yearCountTaxService.getAllMessageCount( user.getUpperDistrict() + user.getDistrictName(), beginyear, endyear) / 40000 + 1; LogWriter.println("获取的记录数位:" + count); for (int i = 0; i < count; ++i) { getAllList(i * 40000, 40000); // 获取需要下载的数据list // 获取需要下载的数据list workbook = ex.creatExcel(workbook, analyList); } // 创建输出流 excelFile = ex.downLoadExcel(workbook); systemLogService.insertSystemLog("3", "下载按年度统计纳税征缴情况", true); return "excel"; }
public String download() throws Exception { // 创建类以确定泛型类型 ExportExcel<Cbry037> ex = new ExportExcel<Cbry037>(new Cbry037()); // 创建excel SXSSFWorkbook workbook = new SXSSFWorkbook(100); // 获取记录总数 int cbry037ListCount = (int) cbry037Service.analyse3(district, year) / 40000 + 1; // 获取需要下载的数据list for (int i = 0; i < cbry037ListCount; ++i) { cbry037List = cbry037Service.analyse3(district, year, i); workbook = ex.creatExcel(workbook, cbry037List); } excelFile = ex.downLoadExcel(workbook); return "excel"; }