easyexcel结合zip 导出压缩文件(包含多个excel)
直接上代码… 分批次查询处理示例代码
int limit = 1;int pageNum = 500;ByteArrayOutputStream bos = new ByteArrayOutputStream();ZipOutputStream out = new ZipOutputStream(bos);try {while (true) {params.put("limit", limit);params.put("pageNum", pageNum);List<GoodsSpecExportExcel> excelList = goodsSpecService.findSkuListByParams(params);ByteArrayOutputStream out1 = new ByteArrayOutputStream();EasyExcel.write(out1, GoodsSpecExportExcel.class).sheet().doWrite(excelList);out1.close();out.putNextEntry(new ZipEntry(System.currentTimeMillis() + ".xls"));byte[] excelStream = out1.toByteArray();out.write(excelStream);limit++;if (excelList.size()<500) {break;}}} catch (Exception e) {e.printStackTrace();} finally {out.close();bos.close();}