From 02002fe33ff468fa933d1de5ce5213513f986f98 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 17 Dec 2021 16:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=85=E6=B0=91excel?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=90=8E=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcResiUserImportServiceImpl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index f283ac5487..0b554c980e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -918,12 +918,21 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @throws IOException */ public void downLoadResults(HttpServletResponse response) throws IOException { - //public static final ThreadLocal>> errorRows = new ThreadLocal<>(); String fileName; - if (errorRows.get() == null || errorRows.get().size() == 0) { - fileName = "导入成功.xls"; - } else { + + // 判断是否有错误信息,以确定文件名 + boolean hasError = false; + Map> tableAndErrorRows = errorRows.get(); + for (Map.Entry> entry:tableAndErrorRows.entrySet()) { + if (entry.getValue().size() != 0) { + hasError = true; + } + } + + if (hasError) { fileName = "导入失败条目清单.xls"; + } else { + fileName = "导入成功.xls"; } response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("content-Type", "application/vnd.ms-excel");