瀏覽代碼

1、修改导出excel

zhoux 1 年之前
父節點
當前提交
5ff7fdffc6
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/main/java/com/dk/common/util/ExcelPoiUtils.java

+ 2 - 2
src/main/java/com/dk/common/util/ExcelPoiUtils.java

@@ -32,7 +32,7 @@ public class ExcelPoiUtils {
     /**
     /**
      * 将 List<Map<String,Object>> 类型的数据导出为 Excel
      * 将 List<Map<String,Object>> 类型的数据导出为 Excel
      */
      */
-    public static String createExcel(List<Map<String, Object>> mapList, String filename, String title) {
+    public static String createExcel(List<Map<String, Object>> mapList, String filename, String title,String dirName) {
         //获取数据源的 key, 用于获取列数及设置标题
         //获取数据源的 key, 用于获取列数及设置标题
         Map<String, Object> map = mapList.get(0);
         Map<String, Object> map = mapList.get(0);
         Set<String> stringSet = map.keySet();
         Set<String> stringSet = map.keySet();
@@ -125,7 +125,7 @@ public class ExcelPoiUtils {
 //        bytes = os.toByteArray();
 //        bytes = os.toByteArray();
         // 判断路径是否存在  类型 + 年月+ 日期
         // 判断路径是否存在  类型 + 年月+ 日期
         LocalDate currentDate = LocalDate.now();
         LocalDate currentDate = LocalDate.now();
-        String returnPath = title + "/" + currentDate.getYear()
+        String returnPath = dirName + "/" + currentDate.getYear()
                 + "-" + currentDate.getMonthValue() + "/" + currentDate.getDayOfMonth();
                 + "-" + currentDate.getMonthValue() + "/" + currentDate.getDayOfMonth();
         String dirPath = ConfigStatic.getExcelFolder() + "/" + returnPath;
         String dirPath = ConfigStatic.getExcelFolder() + "/" + returnPath;
         File dir = new File(dirPath);
         File dir = new File(dirPath);