Browse Source

【CHG】修改加载模板方法

zhaomn 3 năm trước cách đây
mục cha
commit
d3245c4211

+ 1 - 2
railway-common/src/main/java/com/railway/common/utils/poi/EasyExcelUtil.java

@@ -22,8 +22,7 @@ public class EasyExcelUtil {
   public String getExcel(Map<String, Object> params, List<?> list,
       String template, String wordName) {
     String filePath = FileUploadUtils.getAbsoluteFileEncoding(wordName);
-    try (InputStream is = Thread.currentThread().getContextClassLoader()
-        .getResourceAsStream(template);
+    try (InputStream is = new FileInputStream(template);
         OutputStream os = new FileOutputStream(filePath)) {
       WriteSheet writeSheet = EasyExcel.writerSheet().build();
       ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(is)