From 743040d813d3b6c0828b6a4e50c0f93156ae5a63 Mon Sep 17 00:00:00 2001 From: qitz <18810291185@163.com> Date: Mon, 25 Dec 2023 16:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BDzip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 43d0ba8..2df1ac4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -345,13 +345,39 @@ public class CaseApplicationController extends BaseController { /** * 下载案件压缩包 */ - @PostMapping("/downloadCaseZipFile") - public AjaxResult downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication) { + @PostMapping("/downloadCaseZipFile1") + public AjaxResult downloadCaseZipFile1(@Validated @RequestBody CaseApplication caseApplication) { CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication); return success(caseAttach); } + /** + * 下载案件压缩包 + */ + @PostMapping("/downloadCaseZipFile") + public void downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication,HttpServletResponse response) { + + CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication); + String annexPath = caseAttach.getAnnexPath(); + String annexName = caseAttach.getAnnexName(); + String urlstr = "http://121.40.189.20:8000/API" + annexPath; + try { + InputStream fileInputStream = new URL(urlstr).openStream(); + response.setHeader("content-type", "application/octet-stream"); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(annexName,"UTF-8")); + byte[] buffer = new byte[1024]; + int length; + while ((length = fileInputStream.read(buffer)) > 0) { + response.getOutputStream().write(buffer, 0, length); + } + + } catch (IOException e) { + throw new RuntimeException(e); + } + } + /** * 发送房间号短信