From e71d6fa9837f74539ea6d943685668f75233d91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Fri, 28 Mar 2025 23:12:40 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81excel=E6=96=B9=E6=B3=95=E6=8A=9B=E5=87=BAjson=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dromara/common/excel/utils/ExcelUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils/ExcelUtil.java b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils/ExcelUtil.java index 0e9569677..70ab31d9c 100644 --- a/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils/ExcelUtil.java +++ b/ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils/ExcelUtil.java @@ -215,6 +215,9 @@ public class ExcelUtil { */ public static void exportTemplate(List data, String filename, String templatePath, HttpServletResponse response) { try { + if (CollUtil.isEmpty(data)) { + throw new IllegalArgumentException("数据为空"); + } resetResponse(filename, response); ServletOutputStream os = response.getOutputStream(); exportTemplate(data, templatePath, os); @@ -233,9 +236,6 @@ public class ExcelUtil { * @param os 输出流 */ public static void exportTemplate(List data, String templatePath, OutputStream os) { - if (CollUtil.isEmpty(data)) { - throw new IllegalArgumentException("数据为空"); - } ClassPathResource templateResource = new ClassPathResource(templatePath); ExcelWriter excelWriter = EasyExcel.write(os) .withTemplate(templateResource.getStream()) @@ -265,6 +265,9 @@ public class ExcelUtil { */ public static void exportTemplateMultiList(Map data, String filename, String templatePath, HttpServletResponse response) { try { + if (CollUtil.isEmpty(data)) { + throw new IllegalArgumentException("数据为空"); + } resetResponse(filename, response); ServletOutputStream os = response.getOutputStream(); exportTemplateMultiList(data, templatePath, os); @@ -285,6 +288,9 @@ public class ExcelUtil { */ public static void exportTemplateMultiSheet(List> data, String filename, String templatePath, HttpServletResponse response) { try { + if (CollUtil.isEmpty(data)) { + throw new IllegalArgumentException("数据为空"); + } resetResponse(filename, response); ServletOutputStream os = response.getOutputStream(); exportTemplateMultiSheet(data, templatePath, os); @@ -303,9 +309,6 @@ public class ExcelUtil { * @param os 输出流 */ public static void exportTemplateMultiList(Map data, String templatePath, OutputStream os) { - if (CollUtil.isEmpty(data)) { - throw new IllegalArgumentException("数据为空"); - } ClassPathResource templateResource = new ClassPathResource(templatePath); ExcelWriter excelWriter = EasyExcel.write(os) .withTemplate(templateResource.getStream()) @@ -337,9 +340,6 @@ public class ExcelUtil { * @param os 输出流 */ public static void exportTemplateMultiSheet(List> data, String templatePath, OutputStream os) { - if (CollUtil.isEmpty(data)) { - throw new IllegalArgumentException("数据为空"); - } ClassPathResource templateResource = new ClassPathResource(templatePath); ExcelWriter excelWriter = EasyExcel.write(os) .withTemplate(templateResource.getStream())