From 231a1f3f8787a8bb29395faa56ef57353426d917 Mon Sep 17 00:00:00 2001 From: Jinquan_Ou <Jinquan@gdut.com> Date: 星期日, 19 三月 2023 21:52:33 +0800 Subject: [PATCH] 888 --- zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java index 96a331b..5d280dc 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java @@ -2,6 +2,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.service.DownLoadFileService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; @@ -14,9 +15,14 @@ */ @Service public class DownLoadFileServiceImpl implements DownLoadFileService { + + @Value("${ruoyi.profile}") + private String basePath; + @Override public AjaxResult downLoadFile(String path, HttpServletResponse response) { + path=basePath+path.substring(8); File file = new File(path); byte[] buffer = new byte[1024]; BufferedInputStream bis = null; @@ -34,6 +40,7 @@ while(bis.read(buffer) != -1){ os.write(buffer); } + return AjaxResult.success("鎿嶄綔鎴愬姛"); } }catch (Exception e) { e.printStackTrace(); @@ -50,6 +57,6 @@ e.printStackTrace(); } } - return AjaxResult.success("鎿嶄綔鎴愬姛"); + return AjaxResult.error("鎿嶄綔澶辫触"); } } -- Gitblit v1.9.1