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); + } + } + /** * 发送房间号短信