소스 검색

卖家新增分期信息删除已有分期信息

wangyc 8 년 전
부모
커밋
146f703869
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      src/main/java/com/uas/platform/b2c/fa/payment/service/impl/InstallmentServiceImpl.java

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

@@ -64,13 +64,20 @@ public class InstallmentServiceImpl implements InstallmentService{
             throw new IllegalOperatorException("此订单状态不为待付款,不可设置分期");
 
         InstallmentStore installmentStore = installmentStoreDao.findByEnuuAndEnable(SystemSession.getUser().getEnterprise().getUu(), (short) 1);
-//        if (installmentStore == null)
-//            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
+        if (installmentStore == null)
+            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
 
         List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
         if (CollectionUtils.isEmpty(bankInfos))
             throw new IllegalOperatorException("当前企业没有设置收款账户,请在 结算中心--收款账户信息 管理您的收款账户信息");
 
+        // 如果之前具有分期信息,删除分期信息
+        if (purchase.getInstallmentId() != null) {
+            Installment oldInstallment = installmentDao.findOne(purchase.getInstallmentId());
+            if (oldInstallment != null)
+                installmentDao.delete(oldInstallment.getId());
+        }
+
         List<InstallmentDetail> installmentDetails = installment.getInstallmentDetails();
         if (CollectionUtils.isEmpty(installmentDetails))
             throw new IllegalOperatorException("分期详情为空,请您设置分期详情");