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