Просмотр исходного кода

e签宝单文件下-单方多签署支持

zhangchenm дней назад: 5
Родитель
Сommit
b2ff3ec21e

+ 4 - 4
trade-client/src/main/java/com/trade/client/enterprise/customer/service/impl/EnterpriseServiceImpl.java

@@ -340,7 +340,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         List<ContractSeal> sealInfoList = new ArrayList<>();
         ContractSeal companySeal = new ContractSeal();
         // companySeal.setSigner(signer); 不设置时取singleSigner
-        companySeal.setKeyword(ESignConstant.KEYWORD_COMPANY);
+        companySeal.setKeywords(Collections.singletonList(ESignConstant.KEYWORD_COMPANY));
         companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         companySeal.setSealName(enterpriseName);
         companySeal.setSealIdNo(EnterpriseCertNo);
@@ -348,7 +348,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         sealInfoList.add(companySeal);
         ContractSeal legalSeal = new ContractSeal();
         // legalSeal.setSigner(signer); 不设置时以签署人作为签章人
-        legalSeal.setKeyword(ESignConstant.KEYWORD_PERSONAL);
+        legalSeal.setKeywords(Collections.singletonList(ESignConstant.KEYWORD_PERSONAL));
         legalSeal.setWithTime(true);
         sealInfoList.add(legalSeal);
         contractSignInfo.setSealInfoList(sealInfoList);
@@ -482,7 +482,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         partyAsigner.setMobile(legalPerson.getMobile());
         ContractSeal partyASeal = new ContractSeal();
         partyASeal.setSigner(partyAsigner);
-        partyASeal.setKeyword(ESignConstant.KEYWORD_PARTY_A);
+        partyASeal.setKeywords(Arrays.asList(ESignConstant.KEYWORD_PARTY_A, ESignConstant.KEYWORD_PARTY_3));
         partyASeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         partyASeal.setSealName(enterpriseName);
         partyASeal.setSealIdNo(EnterpriseCertNo);
@@ -491,7 +491,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         // 乙方签字(上海银颗科技服务有限公司)
         ContractSeal partyBSeal = new ContractSeal();
         partyBSeal.setAutoSign(true);
-        partyBSeal.setKeyword(ESignConstant.KEYWORD_PARTY_B);
+        partyBSeal.setKeywords(Arrays.asList(ESignConstant.KEYWORD_PARTY_B, ESignConstant.KEYWORD_PARTY_4));
         partyBSeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         partyBSeal.setSealName(customizeConfiguration.getTaxRebateServiceFeePayeeName());
         partyBSeal.setSealIdNo(customizeConfiguration.getTaxRebateServiceFeePayeeCertNo());

+ 7 - 5
trade-service/src/main/java/com/trade/service/contract/dto/ContractSeal.java

@@ -1,5 +1,7 @@
 package com.trade.service.contract.dto;
 
+import java.util.List;
+
 /**
  * 合同盖章信息
  */
@@ -7,7 +9,7 @@ public class ContractSeal implements java.io.Serializable {
 
     private static final long serialVersionUID = 6921381284566382387L;
     private Boolean autoSign; // 是否为静默签章
-    private String keyword;// 盖章关键字
+    private List<String> keywords;// 盖章关键字
     // 定义最高级别的证件类型,所有系统都以此类型传值
     // 统一社会信用代码、组织机构代码等
     private String sealIdType;// 盖章企业证件类型
@@ -26,12 +28,12 @@ public class ContractSeal implements java.io.Serializable {
         this.autoSign = autoSign;
     }
 
-    public String getKeyword() {
-        return keyword;
+    public List<String> getKeywords() {
+        return keywords;
     }
 
-    public void setKeyword(String keyword) {
-        this.keyword = keyword;
+    public void setKeywords(List<String> keywords) {
+        this.keywords = keywords;
     }
 
     public String getSealName() {

+ 33 - 32
trade-service/src/main/java/com/trade/service/contract/service/impl/ESignContractServiceImpl.java

@@ -295,7 +295,7 @@ public class ESignContractServiceImpl implements SignPlatformService, SignAccoun
      * @param signFieldList 签署文档列表
      * @param signInfo 签章信息
      * @param eSignFileId e签宝文件id
-     * @param accountMap
+     * @param accountMap 账号信息
      */
     private void addSignField(List<ESignDoc> signFieldList, String flowId, ContractSignInfo signInfo,
             String eSignFileId, List<String> willTypes, Map<String, String> accountMap) {
@@ -306,39 +306,41 @@ public class ESignContractServiceImpl implements SignPlatformService, SignAccoun
         for (ContractSeal sealInfo : sealInfoList) {
             // 签章里的签署人信息未传,则使用签署信息中的签署人信息
             ContractSigner signer = null == sealInfo.getSigner() ? signInfo.getSingleSigner() : sealInfo.getSigner();
-            ESignDocPosition posBean = ESignRequest.searchWordsPosition(flowId, eSignFileId, sealInfo.getKeyword());
-            if (Boolean.TRUE.equals(sealInfo.getWithTime())) {
-                posBean.setAddSignTime(true);
-                posBean.setSignTimeFormat(ESignConstant.SIGN_DATE_FORMAT);
-            }
-            ESignDoc signField = null;
-            // 企业
-            if (ESignConstant.isOrgSealType(sealInfo.getSealIdType())) {
-                // 机构签约类别,当签约主体为机构时必传
-                String actorIdentityType = Boolean.TRUE.equals(sealInfo.getSignLegal()) ? "3" : "2";// 2企业 3法人
-                if (Boolean.TRUE.equals(sealInfo.getAutoSign())) {
-                    signField = new ESignDoc(eSignFileId, accountMap.get(sealInfo.getSealIdNo()), null, posBean, null,
-                            null);
-                    handleAutoSign(flowId, sealInfo, signField);
-                    continue;
-                } else {
-                    signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), actorIdentityType,
-                            accountMap.get(sealInfo.getSealIdNo()), null, 1, posBean, null, null, null);
+            for (String keyword : sealInfo.getKeywords()) {
+                ESignDocPosition posBean = ESignRequest.searchWordsPosition(flowId, eSignFileId, keyword);
+                if (Boolean.TRUE.equals(sealInfo.getWithTime())) {
+                    posBean.setAddSignTime(true);
+                    posBean.setSignTimeFormat(ESignConstant.SIGN_DATE_FORMAT);
                 }
-            } else if (ESignConstant.isIndividualSealType(signer.getSignerIdType())) {
-                if (Boolean.TRUE.equals(sealInfo.getAutoSign())) {
-                    throw new ServiceException("签署任务-个人签章暂不支持自动签章", HttpStatus.BAD_REQUEST);
+                ESignDoc signField = null;
+                // 企业
+                if (ESignConstant.isOrgSealType(sealInfo.getSealIdType())) {
+                    // 机构签约类别,当签约主体为机构时必传
+                    String actorIdentityType = Boolean.TRUE.equals(sealInfo.getSignLegal()) ? "3" : "2";// 2企业 3法人
+                    if (Boolean.TRUE.equals(sealInfo.getAutoSign())) {
+                        signField = new ESignDoc(eSignFileId, accountMap.get(sealInfo.getSealIdNo()), null, posBean,
+                                null, null);
+                        handleAutoSign(flowId, sealInfo, signField);
+                        continue;
+                    } else {
+                        signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), actorIdentityType,
+                                accountMap.get(sealInfo.getSealIdNo()), null, 1, posBean, null, null, null);
+                    }
+                } else if (ESignConstant.isIndividualSealType(signer.getSignerIdType())) {
+                    if (Boolean.TRUE.equals(sealInfo.getAutoSign())) {
+                        throw new ServiceException("签署任务-个人签章暂不支持自动签章", HttpStatus.BAD_REQUEST);
+                    }
+                    signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), null, null, null, 1,
+                            posBean, "1", null, null);
                 }
-                signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), null, null, null, 1,
-                        posBean, "1", null, null);
-            }
-            if (null == signField) {
-                log.error("签署任务-获取签章位置出错fileId:{},sealIdType:{},keyword:{}", signInfo.getFileId(),
-                        sealInfo.getSealIdType(), sealInfo.getKeyword());
-                throw new ServiceException("签署任务-获取签章位置出错,请检查签章传参是否正确", HttpStatus.ERROR);
+                if (null == signField) {
+                    log.error("签署任务-获取签章位置出错fileId:{},sealIdType:{},keyword:{}", signInfo.getFileId(),
+                            sealInfo.getSealIdType(), keyword);
+                    throw new ServiceException("签署任务-获取签章位置出错,请检查签章传参是否正确", HttpStatus.ERROR);
+                }
+                signField.setWillTypes(willTypes);
+                signFieldList.add(signField);
             }
-            signField.setWillTypes(willTypes);
-            signFieldList.add(signField);
         }
         // 保存 流程签署方记录表
         saveSignFlowSigner(flowId, accountMap);
@@ -350,7 +352,6 @@ public class ESignContractServiceImpl implements SignPlatformService, SignAccoun
      * @param flowId 签署流程id
      * @param sealInfo 签章信息
      * @param signField e签宝签署任务对象
-     * @return 是否自动签章
      */
     private void handleAutoSign(String flowId, ContractSeal sealInfo, ESignDoc signField) {
         String sealId = contractConfigProperties.getESignSealIdByIdNo(sealInfo.getSealIdNo());

+ 2 - 2
trade-service/src/main/java/com/trade/service/credit/service/impl/BizEntityCreditAuthServiceImpl.java

@@ -103,13 +103,13 @@ public class BizEntityCreditAuthServiceImpl extends ServiceImpl<BizEntityCreditA
         List<ContractSeal> sealInfoList = new ArrayList<>();
         ContractSeal companySeal = new ContractSeal();
         // companySeal.setSigner(signer); 不设置时取singleSigner
-        companySeal.setKeyword(ESignConstant.KEYWORD_COMPANY);
+        companySeal.setKeywords(Collections.singletonList(ESignConstant.KEYWORD_COMPANY));
         companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         companySeal.setSealName(enterprise.getName());
         companySeal.setSealIdNo(enterprise.getCertNo());
         ContractSeal legalSeal = new ContractSeal();
         // legalSeal.setSigner(signer); 不设置时以签署人作为签章人
-        legalSeal.setKeyword(ESignConstant.KEYWORD_PERSONAL);
+        legalSeal.setKeywords(Collections.singletonList(ESignConstant.KEYWORD_PERSONAL));
         sealInfoList.add(companySeal);
         sealInfoList.add(legalSeal);
         contractSignInfo.setSealInfoList(sealInfoList);

+ 13 - 3
trade-service/src/main/java/com/trade/service/filestorage/service/impl/OSSFileServiceImpl.java

@@ -21,6 +21,7 @@ import com.trade.service.filestorage.util.TextConverterPdfUtil;
 import com.trade.service.filestorage.util.watermark.MakeWaterMark;
 import com.trade.service.filestorage.util.watermark.PreviewUtil;
 import com.trade.service.filestorage.util.watermark.TextMark;
+import org.apache.commons.io.FileUtils;
 import org.apache.tomcat.util.codec.binary.Base64;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.Model;
@@ -187,8 +188,9 @@ public class OSSFileServiceImpl implements OSSFileService {
                         } catch (FileNotFoundException e) {
                             e.printStackTrace();
                         }
-                        // 加水印
-                        makeWaterMark.textMarkForHtml(fileHtml, new TextMark(watermarkText));
+                        if (StringUtil.isNotEmpty(watermarkText)) {// 加水印
+                            makeWaterMark.textMarkForHtml(fileHtml, new TextMark(watermarkText));
+                        }
                         PreviewUtil.previewHtmlFile(response, fileHtml);
                     } else
                 if (fileSuffix.equalsIgnoreCase(".pdf")) {
@@ -200,7 +202,15 @@ public class OSSFileServiceImpl implements OSSFileService {
                     // 添加水印
                     String fileNameP = fileStorage.getName();
                     String destFile = FileUtil.getAbsolutePreviewPicturePath() + File.separator + fileNameP;
-                    makeWaterMark.textMarkForPicture(downloadPath, destFile, new TextMark(watermarkText));
+                    if (StringUtil.isNotEmpty(watermarkText)) {
+                        makeWaterMark.textMarkForPicture(downloadPath, destFile, new TextMark(watermarkText));
+                    } else {
+                        try {
+                            FileUtils.copyFile(FileUtils.getFile(downloadPath), FileUtils.getFile(destFile));
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                    }
                     // 由于预览的图片不能立即删除,故用定时任务去删除
                     return FileUtil.getPreviewPicturePath(fileNameP);
                 }