| 
					
				 | 
			
			
				@ -30,6 +30,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import cn.afterturn.easypoi.excel.entity.ImportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import cn.hutool.core.io.FileUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import cn.hutool.core.util.ObjectUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import cn.hutool.log.Log; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.poi.ss.usermodel.Workbook; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -50,6 +51,8 @@ import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static final Log log = Log.get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 使用流的方式导出excel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -60,7 +63,7 @@ public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param pojoClass Excel实体类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param data 要导出的数据集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public static void exportExcelWithStream(String excelName, Class pojoClass, Collection data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public static void exportExcelWithStream(String excelName, Class<?> pojoClass, Collection<?> data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpServletResponse response = HttpServletUtil.getResponse(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String fileName = URLEncoder.encode(excelName, "UTF-8"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -72,7 +75,7 @@ public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            workbook.write(outputStream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            log.error(">>> 导出数据异常:{}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -97,7 +100,7 @@ public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            workbook.write(fos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fos.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            log.error(">>> 导出数据异常:{}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -125,8 +128,7 @@ public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            log.error(">>> 导入数据异常:{}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -153,7 +155,7 @@ public class PoiUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            log.error(">>> 导入数据异常:{}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |