From 6e4e1e694ea78ea69eef56936bbab0164a96c006 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Tue, 19 Dec 2023 10:31:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=91=8A=E7=BB=93=E6=9E=84=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wps/service/impl/WpsServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 ca79a90..cf26ae1 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 @@ -548,7 +548,7 @@ public class WpsServiceImpl implements WpsService { String url = ""; String dataJson = ""; String callBackUrl = ""; - byte[] b = getFileByFileId(in.getFileId()); + byte[] b = getFileByFileId(in.getFileId(),in.getFileName()); String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); try { callBackUrl = kswdownloadUrl+"?key="+URLEncoder.encode(getDownloadEncrypt(in.getFileId(),in.getUserToken()), "utf-8"); @@ -686,25 +686,33 @@ public class WpsServiceImpl implements WpsService { String fileId = downloadDecrypt(key); - return getFileByFileId(fileId); + return getFileByFileId(fileId,fileId); } - private byte[] getFileByFileId(String id){ + private byte[] getFileByFileId(String id,String fileName){ + String text = " "; + byte buf[] = text.getBytes(); List businessIdList = new ArrayList<>(); businessIdList.add(id); Optional optional = attachmentClient.findByBusinessId(businessIdList); + //上传文件 + Boolean uploadB = true; if(optional!=null&&optional.get()!=null) { AttachmentDetail detail = optional.get(); List entityList = detail.get(id); if(entityList!=null&&entityList.size()>0) { Optional optional1 = attachmentClient.downloadFileByObjectId(entityList.get(0).getId()); - return optional1.get(); + uploadB = false; + buf = optional1.get(); } } - return new byte[0]; + if(uploadB){ + Optional op=attachmentClient.upload(id,fileName,buf); + } + return buf; } @Override