wenhongquan 3 ani în urmă
părinte
comite
f254df22f0

+ 3 - 3
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java

@@ -200,11 +200,11 @@ public class BaseController
     public void exportExcel(String fileName, String excelTemplateName, Map<String, Object> map,
                                     HttpServletResponse resp) {
         String path = "./" + fileName + ".xlsx";
-        String tpath = "/Users/wenhongquan/gitdata/nnbp/ruoyi-admin/src/main/resources/"+excelTemplateName+".xlsx";
-        File filex = new File(tpath);
+//        String tpath = "/Users/wenhongquan/gitdata/nnbp/ruoyi-admin/src/main/resources/"+excelTemplateName+".xlsx";
+//        File filex = new File(tpath);
         //this.getClass().getResourceAsStream("/" + excelTemplateName + ".xlsx")
 //        InputStream is =  new FileInputStream(filex)
-        try (InputStream is =  new FileInputStream(filex) ) {
+        try (InputStream is =  this.getClass().getResourceAsStream("/" + excelTemplateName + ".xlsx") ) {
             try (OutputStream os = new FileOutputStream(path)) {
                 Context context = new Context();
                 // context.putVar("list", map.get("list"));