Kaynağa Gözat

Merge remote-tracking branch 'origin/feature_installment_v1' into feature_installment_v1

zengchao 8 yıl önce
ebeveyn
işleme
e508b58053

+ 15 - 1
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/InstallmentServiceImpl.java

@@ -1,12 +1,15 @@
 package com.uas.platform.b2c.fa.payment.service.impl;
 
 import com.uas.platform.b2c.core.constant.Status;
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.fa.payment.dao.InstallmentDao;
 import com.uas.platform.b2c.fa.payment.dao.InstallmentStoreDao;
+import com.uas.platform.b2c.fa.payment.model.BankInfo;
 import com.uas.platform.b2c.fa.payment.model.Installment;
 import com.uas.platform.b2c.fa.payment.model.InstallmentDetail;
 import com.uas.platform.b2c.fa.payment.model.InstallmentStore;
+import com.uas.platform.b2c.fa.payment.service.BankInfoService;
 import com.uas.platform.b2c.fa.payment.service.InstallmentService;
 import com.uas.platform.b2c.trade.order.dao.OrderDao;
 import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
@@ -36,12 +39,15 @@ public class InstallmentServiceImpl implements InstallmentService{
 
     private final InstallmentDao installmentDao;
 
+    private final BankInfoService bankInfoService;
+
     @Autowired
-    public InstallmentServiceImpl(InstallmentStoreDao installmentStoreDao, PurchaseDao purchaseDao, OrderDao orderDao, InstallmentDao installmentDao) {
+    public InstallmentServiceImpl(InstallmentStoreDao installmentStoreDao, PurchaseDao purchaseDao, OrderDao orderDao, InstallmentDao installmentDao, BankInfoService bankInfoService) {
         this.installmentStoreDao = installmentStoreDao;
         this.purchaseDao = purchaseDao;
         this.orderDao = orderDao;
         this.installmentDao = installmentDao;
+        this.bankInfoService = bankInfoService;
     }
 
     @Override
@@ -59,6 +65,10 @@ public class InstallmentServiceImpl implements InstallmentService{
         if (installmentStore == null)
             throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
 
+        List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
+        if (CollectionUtils.isEmpty(bankInfos))
+            throw new IllegalOperatorException("当前企业没有设置收款账户,请在 结算中心--收款账户信息 管理您的收款账户信息");
+
         List<InstallmentDetail> installmentDetails = installment.getInstallmentDetails();
         if (CollectionUtils.isEmpty(installmentDetails))
             throw new IllegalOperatorException("分期详情为空,请您设置分期详情");
@@ -108,6 +118,10 @@ public class InstallmentServiceImpl implements InstallmentService{
         if (installmentStore == null)
             throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
 
+        List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
+        if (CollectionUtils.isEmpty(bankInfos))
+            throw new IllegalOperatorException("当前企业没有设置收款账户,请在 结算中心--收款账户信息 管理您的收款账户信息");
+
         List<InstallmentDetail> installmentDetails = installment.getInstallmentDetails();
         if (CollectionUtils.isEmpty(installmentDetails))
             throw new IllegalOperatorException("分期详情为空,请您设置分期详情");