From 111db69735c90b3fa6a6e4d09c0b41bacb96234d Mon Sep 17 00:00:00 2001 From: caihaohan Date: Sat, 12 Oct 2024 16:11:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3onlyoffice=E4=B8=80?= =?UTF-8?q?=E8=BF=9B=E5=8E=BB=E5=B0=B1=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OnlyOfficeController.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java b/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java index b9254aa8..8073123b 100644 --- a/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java +++ b/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java @@ -49,6 +49,12 @@ public class OnlyOfficeController { @Resource private IOSSFileService ossFileService; + @ApiOperation(value = "|onlyOffice接收文件") + @PostMapping("/receiveFileBefore") + public void receiveFileBefore(HttpServletRequest request, HttpServletResponse response, String key, String fileNm, String standNo, String pid, String taskId, String standName) { + System.out.println("123"); + } + @ApiOperation(value = "onlyOffice接收文件") @PostMapping("/receiveFile") public void receiveFileBefore(HttpServletRequest request, HttpServletResponse response, String fileId, String fileNm) throws IOException { @@ -77,7 +83,9 @@ public class OnlyOfficeController { log.info("**********onlyoffice接收文档接口获得结果body************" + body); String downloadUri = (String) jsonObj.get("url"); + int saved = 0; if (StrUtil.isBlank(downloadUri)) { + writer.write("{\"error\":" + saved + "}"); return; } @@ -100,7 +108,7 @@ public class OnlyOfficeController { ossFile.setOnlId(dbFile.getOnlId()); ossFileService.updateById(ossFile); } - int saved = 0; + writer.write("{\"error\":" + saved + "}"); } catch (Exception e) { log.error("onlyOffice接收文档接口异常", e); @@ -149,7 +157,7 @@ public class OnlyOfficeController { public void downLoadFileRoma(@RequestParam(name = "id") String fileId, HttpServletResponse response) { OSSFile file = ossFileService.getById(fileId); if (file == null) { - log.error("文件不存在"); + log.error("文件不存在,文件Id: {}", fileId); throw new RuntimeException("文件不存在"); } response.reset(); @@ -205,9 +213,10 @@ public class OnlyOfficeController { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(OSSFile::getOnlId, file.getOnlId()); wrapper.orderByDesc(OSSFile::getCreateTime); - wrapper.last("limit 10"); + wrapper.last("limit 11"); List ossFileList = ossFileService.list(wrapper); if (!ossFileList.isEmpty()) { + ossFileList.remove(ossFileList.size() - 1); for (OSSFile ossFile : ossFileList) { Map map = new HashMap<>(); map.put("id", ossFile.getId());