Browse Source

C端预览调整

zhangchenm 5 days ago
parent
commit
74a0f39577

+ 4 - 5
trade-client/src/main/java/com/trade/client/trade/purchasecontract/service/impl/PurchaseContractServiceImpl.java

@@ -832,7 +832,7 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
             contractSignInfo.setSingleSigner(signer);
             contractSignInfo.setSingleSigner(signer);
             List<ContractSeal> sealInfoList = new ArrayList<>();
             List<ContractSeal> sealInfoList = new ArrayList<>();
             ContractSeal companySeal = new ContractSeal();
             ContractSeal companySeal = new ContractSeal();
-            companySeal.setKeyword(ESignConstant.KEYWORD_COMPANY);
+            companySeal.setKeywords(Collections.singletonList(ESignConstant.KEYWORD_COMPANY));
             companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
             companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
             companySeal.setSealName(enterprise.getName());
             companySeal.setSealName(enterprise.getName());
             companySeal.setSealIdNo(enterprise.getCertNo());
             companySeal.setSealIdNo(enterprise.getCertNo());
@@ -895,12 +895,11 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
     private List<ContractSeal> getContractSeals(SignPartyInfo signPartyInfo, String companySignKeyword,
     private List<ContractSeal> getContractSeals(SignPartyInfo signPartyInfo, String companySignKeyword,
             String personalSignKeyword) {
             String personalSignKeyword) {
         boolean autoSign = CollUtil.isNotEmpty(contractConfigProperties.getESignSealIdMap())
         boolean autoSign = CollUtil.isNotEmpty(contractConfigProperties.getESignSealIdMap())
-                && contractConfigProperties.getESignSealIdMap()
-                        .containsKey(signPartyInfo.getEnterpriseCertNo());
+                && contractConfigProperties.getESignSealIdMap().containsKey(signPartyInfo.getEnterpriseCertNo());
         List<ContractSeal> sealInfoList = new ArrayList<>();
         List<ContractSeal> sealInfoList = new ArrayList<>();
         ContractSeal companySeal = new ContractSeal();
         ContractSeal companySeal = new ContractSeal();
         companySeal.setAutoSign(autoSign);
         companySeal.setAutoSign(autoSign);
-        companySeal.setKeyword(companySignKeyword);
+        companySeal.setKeywords(Collections.singletonList(companySignKeyword));
         companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         companySeal.setSealName(signPartyInfo.getEnterpriseName());
         companySeal.setSealName(signPartyInfo.getEnterpriseName());
         companySeal.setSealIdNo(signPartyInfo.getEnterpriseCertNo());
         companySeal.setSealIdNo(signPartyInfo.getEnterpriseCertNo());
@@ -915,7 +914,7 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
             companySeal.setSigner(signer);
             companySeal.setSigner(signer);
             ContractSeal legalSeal = new ContractSeal();
             ContractSeal legalSeal = new ContractSeal();
             legalSeal.setSigner(signer);
             legalSeal.setSigner(signer);
-            legalSeal.setKeyword(personalSignKeyword);
+            legalSeal.setKeywords(Collections.singletonList(personalSignKeyword));
             legalSeal.setWithTime(true);
             legalSeal.setWithTime(true);
             sealInfoList.add(legalSeal);
             sealInfoList.add(legalSeal);
         }
         }

+ 16 - 10
trade-service/src/main/java/com/trade/service/filestorage/util/watermark/PreviewUtil.java

@@ -38,7 +38,8 @@ public class PreviewUtil {
     /**
     /**
      * 以流的方式在浏览器上查看pdf文件
      * 以流的方式在浏览器上查看pdf文件
      */
      */
-    public static void previewPdf(HttpServletResponse response, File pdfFile, String fileName, String sourceType, String waterMarkText) {
+    public static void previewPdf(HttpServletResponse response, File pdfFile, String fileName, String sourceType,
+            String waterMarkText) {
         File tempFile = null;
         File tempFile = null;
         try {
         try {
             if (StringUtil.isNotEmpty(fileName)) {
             if (StringUtil.isNotEmpty(fileName)) {
@@ -50,16 +51,21 @@ public class PreviewUtil {
                 }
                 }
             }
             }
             response.setContentType("application/pdf;charset=gb2312");
             response.setContentType("application/pdf;charset=gb2312");
-            // 加水印
-            String strTargetPdf = FileUtil.getFileOnlinePreviewPath() + File.separator
-                    + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_FORMAT) + ".pdf";
-            tempFile = new File(strTargetPdf);
-            if (!tempFile.exists()) {
-                tempFile.createNewFile();
+            if (StringUtil.isNotEmpty(waterMarkText)) {
+                // 加水印
+                String strTargetPdf = FileUtil.getFileOnlinePreviewPath() + File.separator
+                        + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_FORMAT) + ".pdf";
+                tempFile = new File(strTargetPdf);
+                if (!tempFile.exists()) {
+                    tempFile.createNewFile();
+                }
+                getWaterMarkInstance().textMarkForPdf(pdfFile.getPath(), strTargetPdf, new TextMark(waterMarkText));
+                // 通过文件路径获得File对象
+                readFileWithInputStream(response, tempFile);
+            } else {
+                // 不加水印
+                readFileWithInputStream(response, pdfFile);
             }
             }
-            getWaterMarkInstance().textMarkForPdf(pdfFile.getPath(), strTargetPdf, new TextMark(waterMarkText));
-            // 通过文件路径获得File对象
-            readFileWithInputStream(response, tempFile);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("预览PDF文件出错:" + e.getMessage());
             log.error("预览PDF文件出错:" + e.getMessage());
         } finally {
         } finally {