优化下载zip
This commit is contained in:
+28
-2
@@ -345,13 +345,39 @@ public class CaseApplicationController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 下载案件压缩包
|
* 下载案件压缩包
|
||||||
*/
|
*/
|
||||||
@PostMapping("/downloadCaseZipFile")
|
@PostMapping("/downloadCaseZipFile1")
|
||||||
public AjaxResult downloadCaseZipFile(@Validated @RequestBody CaseApplication caseApplication) {
|
public AjaxResult downloadCaseZipFile1(@Validated @RequestBody CaseApplication caseApplication) {
|
||||||
|
|
||||||
CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication);
|
CaseAttach caseAttach = caseApplicationService.downloadCaseZipFile(caseApplication);
|
||||||
return success(caseAttach);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送房间号短信
|
* 发送房间号短信
|
||||||
|
|||||||
Reference in New Issue
Block a user