From 678801b011c80c4aeb048dabe853f61fb9b27367 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Thu, 26 Dec 2024 10:14:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../importdownload/ImportDownloadController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/importdownload/ImportDownloadController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/importdownload/ImportDownloadController.java index 1f2ab82c..98916f9a 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/importdownload/ImportDownloadController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/importdownload/ImportDownloadController.java @@ -11,6 +11,8 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -62,7 +64,12 @@ public class ImportDownloadController { file = ResourceUtils.getFile("classpath:template/门诊患者信息导入表.xlsx"); break; case Constants.PATIENT_INFO_IMPORT: // 门诊患者 - file = ResourceUtils.getFile("classpath:template/OutpatientFollowUpRecords.xlsx"); + //file = ResourceUtils.getFile("classpath:template/OutpatientFollowUpRecords.xlsx"); + Resource resource = new ClassPathResource("classpath:template/OutpatientFollowUpRecords.xlsx"); + String filePath= this.getClass().getClassLoader().getResource("classpath:template/OutpatientFollowUpRecords.xlsx").getFile(); + file= new File(filePath); + // 通过流讲文件复制到file中 + FileUtils.copyToFile(resource.getInputStream(), file); break; } if (Objects.isNull(file)) {