From e9dcc8a875f8758000932cdf46479a74c3e6ccfc Mon Sep 17 00:00:00 2001 From: wxyclub Date: Thu, 16 Nov 2023 14:02:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../att/controller/AttFileEOController.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java index 1b094c90..de94953a 100644 --- a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java +++ b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java @@ -363,6 +363,43 @@ public class AttFileEOController { } } + @ApiOperation(value = "|File|在线编辑防止加密的接口下载文件") + @GetMapping("/downloadFileForSarNewOnlyOffice") + // @RequiresPermissions("sys:file:downloadFileForSar") + public void downloadFileForSarNewOnlyOffice(String fileId, HttpServletResponse response, HttpServletRequest request) throws Exception { + if(StringUtils.isNotBlank(fileId)){ + if(!fileId.contains("ATT_FILE_")){ + Map bussMap = new HashMap<>(); + bussMap.put("ONLINEID",fileId); + String id = createOnlineAttIdFileMQUtil.CreateOnlineAttIdFileMQ(bussMap); + if(StringUtils.isNotBlank(id)) { + fileId = id; + } + } + } + + AttFileEO attFileEO = attFileEOService.getFileInfo(fileId); + InputStream is = null; + OutputStream os = null; + response.reset(); + try { + String fileOldName = fileNameEncoding(attFileEO.getOldFileName(),request); + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\""); + response.setContentType("application/octet-stream"); + File file = new File(filePath+attFileEO.getFilePath()+attFileEO.getFileName()); + is = new FileInputStream(file); + os = response.getOutputStream(); + IOUtils.copy(is, os); + os.flush(); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } finally { + IOUtils.closeQuietly(is); + IOUtils.closeQuietly(os); + } + } + @ApiOperation(value = "|File|下载文件加水印") @GetMapping("/downloadFileForSarWaterMark") // @RequiresPermissions("sys:file:downloadFileForSar")