From 41a00dd31fed18068d716e84299c0287d1c387cb Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Fri, 22 Dec 2023 10:48:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BF=E4=BC=81WPS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/wps/controller/WpsController.java | 18 +++++++++++++----- .../wps/service/impl/WpsServiceImpl.java | 1 - 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java index 7322d01..bad26ef 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java @@ -66,6 +66,8 @@ public class WpsController { @Value("${KingSoftWps.kswpsurl}") private String kswpsurl; + @Value("${KingSoftWps.tempDocFileId}") + private String tempDocFileId; /* 附件工具 */ @Autowired @@ -287,9 +289,7 @@ public class WpsController { log.info(" file2 fileId"+fileId); List businessIdList = new ArrayList<>(); - businessIdList.add(fileId[0]); - Optional optional = attachmentClient.findByBusinessId(businessIdList); String fileName = fileIdName; @@ -312,10 +312,18 @@ public class WpsController { } } } + //没有上传过文件 使用临时文件显示 if(uploadB){ - buf = this.wpsService.uploadTempFile(fileId[0]); - fileLength = String.valueOf(buf.length); - //Optional op=attachmentClient.upload(fileId[0],fileName,buf); + List businessIdList2 = new ArrayList<>(); + businessIdList2.add(tempDocFileId); + Optional optional2 = attachmentClient.findByBusinessId(businessIdList2); + AttachmentDetail detail = optional2.get(); + List entityList = detail.get(fileId[0]); + Optional optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId()); + if(optional1!=null&&optional1.isPresent()) { + fileLength = String.valueOf(optional1.get().length); + buf = optional1.get(); + } } try{ diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java index 343d586..7b5445b 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java @@ -718,7 +718,6 @@ public class WpsServiceImpl implements WpsService { } if(uploadB){ buf = uploadTempFile(fileExtension); - //Optional op=attachmentClient.upload(id,fileName,buf); } return buf; }