Browse Source

贸易采购合同静默签署

liangbo.huang 2 weeks ago
parent
commit
ef75e5cae6

+ 23 - 13
trade-client/src/main/java/com/trade/client/trade/purchasecontract/service/impl/PurchaseContractServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.deepoove.poi.config.Configure;
 import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
+import com.trade.client.config.CustomizeConfiguration;
 import com.trade.client.enterprise.customer.domain.model.LoginUserInfo;
 import com.trade.client.trade.purchasecontract.dto.PurchaseContractSearchDto;
 import com.trade.client.trade.purchasecontract.dto.PurchaseContractUploadDto;
@@ -113,6 +114,8 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
     private ContractFileService contractFileService;
     @Resource
     private PurchaseOrderService purchaseOrderService;
+    @Resource
+    private CustomizeConfiguration customizeConfiguration;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -711,8 +714,8 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
         if (!DictConstants.EXPORT_TYPE_PROXY.equals(enterprise.getExportType())
                 || !DictConstants.DISTRICT_CN_MAINLAND.equals(enterprise.getProxyDistrictCode())) {
             // 自营出口或者非大陆贸易平台代理,人工录入采购单价,这里重新计算下商品金额
-            purchaseContractDto.getCommodityList().forEach(purchaseCommodityDto -> purchaseCommodityDto.setAmount(
-                    purchaseCommodityDto.getPriceUnit().multiply(purchaseCommodityDto.getNumber())));
+            purchaseContractDto.getCommodityList().forEach(purchaseCommodityDto -> purchaseCommodityDto
+                    .setAmount(purchaseCommodityDto.getPriceUnit().multiply(purchaseCommodityDto.getNumber())));
             // 含税金额 = 采购商品金额 * (1 + 增值税率)
             purchaseContractDto.getCommodityList()
                     .forEach(purchaseCommodityDto -> purchaseCommodityDto.setAmount(purchaseCommodityDto.getAmount()
@@ -891,25 +894,32 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
      */
     private List<ContractSeal> getContractSeals(SignPartyInfo signPartyInfo, String companySignKeyword,
             String personalSignKeyword) {
-        ContractSigner signer = new ContractSigner();
-        signer.setSigner(signPartyInfo.getLegalPersonName());
-        signer.setSignerIdNo(signPartyInfo.getLegalPersonCertNo());
-        signer.setSignerIdType(ESignConstant.CRED_PSN_CH_IDCARD);
-        signer.setMobile(signPartyInfo.getLegalPersonPhone());
+        boolean autoSign = CollUtil.isNotEmpty(customizeConfiguration.getAutoSignEnterpriseCertNoList())
+                && customizeConfiguration.getAutoSignEnterpriseCertNoList()
+                        .contains(signPartyInfo.getEnterpriseCertNo());
         List<ContractSeal> sealInfoList = new ArrayList<>();
         ContractSeal companySeal = new ContractSeal();
-        companySeal.setSigner(signer);
+        companySeal.setAutoSign(autoSign);
         companySeal.setKeyword(companySignKeyword);
         companySeal.setSealIdType(ESignConstant.CRED_ORG_USCC);
         companySeal.setSealName(signPartyInfo.getEnterpriseName());
         companySeal.setSealIdNo(signPartyInfo.getEnterpriseCertNo());
         companySeal.setWithTime(true);
-        ContractSeal legalSeal = new ContractSeal();
-        legalSeal.setSigner(signer);
-        legalSeal.setKeyword(personalSignKeyword);
-        legalSeal.setWithTime(true);
+        // 如果静默签署,则不考虑法人签署
+        if (autoSign) {
+            ContractSigner signer = new ContractSigner();
+            signer.setSigner(signPartyInfo.getLegalPersonName());
+            signer.setSignerIdNo(signPartyInfo.getLegalPersonCertNo());
+            signer.setSignerIdType(ESignConstant.CRED_PSN_CH_IDCARD);
+            signer.setMobile(signPartyInfo.getLegalPersonPhone());
+            companySeal.setSigner(signer);
+            ContractSeal legalSeal = new ContractSeal();
+            legalSeal.setSigner(signer);
+            legalSeal.setKeyword(personalSignKeyword);
+            legalSeal.setWithTime(true);
+            sealInfoList.add(legalSeal);
+        }
         sealInfoList.add(companySeal);
-        sealInfoList.add(legalSeal);
         return sealInfoList;
     }