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);