From a37fb36daa90ab853455fd76a43cc7c5c63f0b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Mon, 23 Aug 2021 13:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=A0=B9=E6=8D=AEbid?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ExpertSignatureServiceImpl.java | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java index 28b858f..1553c98 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java @@ -8,6 +8,7 @@ import com.aspose.words.SaveFormat; import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api.AttachmentClient; import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail; import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity; +import com.chinaunicom.mall.ebtp.common.util.JsonUtils; import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; import com.chinaunicom.mall.ebtp.extend.export.service.templateFile.TemplateFileService; import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature; @@ -63,9 +64,11 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService { InputStream expertSign = getExpertSign(signature, path); //获取bid的word文件 AttachmentDetail attachmentDetail = attachmentClient.findByBusinessId(Collections.singletonList(signature.getBid())).orElse(new AttachmentDetail()); - AttachmentEntity entity = attachmentDetail.get(signature.getBid()).stream().findAny().orElseThrow(() -> new RuntimeException("文档查询失败")); - - byte[] bytes = attachmentClient.downloadFileByObjectId(signature.getBid()).orElseThrow(() -> new RuntimeException("文档下载失败")); + AttachmentEntity entity = attachmentDetail.get(signature.getBid()).stream().findAny() + .orElseGet(() -> attachmentClient.findByObjectId(signature.getBid()).orElseThrow(() -> new RuntimeException("文档查询失败"))); + log.info("----------AttachmentEntity --------: " + JsonUtils.objectToJson(entity)); + byte[] bytes = attachmentClient.downloadFileByObjectId(entity.getId()).orElseThrow(() -> new RuntimeException("文档下载失败")); + log.info("----------AttachmentEntity --------: " + bytes.length); InputStream word = new ByteArrayInputStream(bytes); //合并word 转为pdf @@ -138,22 +141,6 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService { private boolean getLicense() { boolean result = false; InputStream is = ExpertSignatureServiceImpl.class.getClassLoader().getResourceAsStream("/license/aspose-license.xml"); -// String licenseStr = -// "\n" + -// " \n" + -// " \n" + -// " Aspose.Total for Java\n" + -// " Aspose.Words for Java\n" + -// " \n" + -// " Enterprise\n" + -// " 20991231\n" + -// " 20991231\n" + -// " 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7\n" + -// " \n" + -// " sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=\n" + -// ""; -// InputStream is = null; -// is = new ByteArrayInputStream(licenseStr.getBytes(StandardCharsets.UTF_8)); License license = new License(); try { license.setLicense(is);