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")