fileParamList中为每个模板的参数,参数包括filePath模板文件路径(templates下面的),downloadFileName为带后缀的文件名
public static void batchDownLoadExcelForZip(List<Map<String, Object>> fileParamList, HttpServletResponse response)
throws Exception {
OutputStream os = null;
ZipOutputStream zipOutputStream = null;
try{
response.setHeader("Content-disposition", "attachment; filename=" + "test.zip");
response.setContentType("application/zip; charset=utf-8");
os = new BufferedOutputStream(response.getOutputStream());
zipOutputStream = new ZipOutputStream(os);
for(Map<String, Object> paramMap:fileParamList){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if("word".equals(paramMap.get("fileType"))){
InputStream is = TemplateExcelUtils.class.getClassLoader().getResourceAsStream("templates/"+paramMap.get("filePath"));
if(null!=is){
XWPFTemplate template = XWPFTemplate.compile(is).