fix: 添加在线编辑图片上传API

This commit is contained in:
wxyclub
2023-11-16 14:02:03 +08:00
parent d4b2f09ca9
commit b68c61ac72
@@ -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<String, String> 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")