Jinquan_Ou
2023-03-19 b81665cdfa0681b8377bfc1e6fbf82a10cb2a166
plus
3个文件已修改
10 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/DownLoadFileService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -73,8 +73,8 @@
    }
    @GetMapping("/downLoadFile")
    public AjaxResult downLoadFile(@PathParam("path") String path, HttpServletResponse response) throws Exception {
        return downLoadFileService.downLoadFile(path,response);
    public void downLoadFile(@PathParam("path") String path, HttpServletResponse response) throws Exception {
        downLoadFileService.downLoadFile(path,response);
    }
zhang-content/src/main/java/com/ruoyi/service/DownLoadFileService.java
@@ -10,5 +10,5 @@
 * @Date 2023-03-19 17:32
 */
public interface DownLoadFileService {
    AjaxResult downLoadFile(String path, HttpServletResponse response);
    void downLoadFile(String path, HttpServletResponse response);
}
zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java
@@ -20,7 +20,7 @@
    private String basePath;
    @Override
    public AjaxResult downLoadFile(String path, HttpServletResponse response) {
    public void downLoadFile(String path, HttpServletResponse response) {
        path=basePath+path.substring(8);
        File file = new File(path);
@@ -40,7 +40,6 @@
                while(bis.read(buffer) != -1){
                    os.write(buffer);
                }
                return AjaxResult.success("操作成功");
            }
        }catch (Exception e) {
            e.printStackTrace();
@@ -57,6 +56,5 @@
                e.printStackTrace();
            }
        }
        return AjaxResult.error("操作失败");
    }
}