|
@@ -113,23 +113,14 @@ public class ParseEmailController{
|
|
|
public void downloadEmailFile(@RequestBody FileIdVO fileId,HttpServletResponse response, HttpServletRequest request){
|
|
|
EmailFileInfoVO emailFileInfoVO = parseEmailService.getEmailFileById(fileId.getFileId());
|
|
|
try {
|
|
|
- throw new RuntimeException();
|
|
|
-// response.setContentType("application/octet-stream");
|
|
|
-// response.addHeader("Content-Disposition", "attachment;filename=" + EncodeUtil.encodeUTF8(emailFileInfoVO.getFileName()));
|
|
|
-// OutputStream outputStream = response.getOutputStream();
|
|
|
-// FileUtils.copyFile(new File(emailFileInfoVO.getFilePath()),outputStream);
|
|
|
-// outputStream.flush();
|
|
|
-// outputStream.close();
|
|
|
- } catch (Exception e) {
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.addHeader("Content-Disposition", "attachment;filename=" + EncodeUtil.encodeUTF8(emailFileInfoVO.getFileName()));
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ FileUtils.copyFile(new File(emailFileInfoVO.getFilePath()),outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
logger.error(e.getMessage(),e);
|
|
|
- try{
|
|
|
- OutputStream outputStream = response.getOutputStream();
|
|
|
- outputStream.write("网络链接中断,请重试".getBytes(StandardCharsets.UTF_8));
|
|
|
- outputStream.flush();
|
|
|
- outputStream.close();
|
|
|
- }catch (Exception exception){
|
|
|
- logger.error(exception.getMessage(),exception);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|