From fb4a6bfb8cce6c5f7a6436e5918e543ff687b959 Mon Sep 17 00:00:00 2001 From: YXY <932687738@qq.com> Date: Tue, 23 May 2023 23:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=9D=99=E6=80=81=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyingbook/controller/EdiController.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/EdiController.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/EdiController.java index af73621..8ee1022 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/EdiController.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/EdiController.java @@ -13,6 +13,8 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.web.bind.annotation.*; +import java.io.File; + @Slf4j @RestController public class EdiController extends BaseController { @@ -38,11 +40,19 @@ public class EdiController extends BaseController { public void exportPdfDemo(@RequestParam("param")String param) throws Exception{ System.out.println(System.getProperty("user.dir")); ClassPathResource classPathResource = new ClassPathResource("photo/title.png"); - System.out.println(classPathResource.getPath()); - System.out.println(classPathResource.getURL()); + try { + File file = classPathResource.getFile(); + System.out.println(file.getName()); + }catch (Exception e){ + log.error("",e); + } Resource resource = resourceLoader.getResource("classpath:photo/title.png"); - System.out.println(resource.getURL()); - System.out.println(classPathResource.getURL()); + try { + File file = resource.getFile(); + System.out.println(file.getName()); + }catch (Exception e){ + log.error("",e); + } // CourseFeedbackTemplateDto resultDTO = new CourseFeedbackTemplateDto(); // resultDTO.setProgram("program"); // resultDTO.setStudentName("student");