Przeglądaj źródła

feat(对接交行):代码提交

Wangyafan 2 miesięcy temu
rodzic
commit
925d8fa3c7

+ 30 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/entity/BocomVipSilentAccountInfo.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.inkasso.factoring.common.entity.BaseEntity;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 会员账户-静默户信息表
@@ -33,6 +35,18 @@ public class BocomVipSilentAccountInfo extends BaseEntity {
     @TableField("silent_account_number")
     private String silentAccountNumber;
 
+    /**
+     * 余额
+     */
+    @TableField("balance")
+    private BigDecimal balance;
+
+    /**
+     * 账户名称
+     */
+    @TableField(exist = false)
+    private String accountName;
+
     public Long getBocomVipAccountBasicInfoId() {
         return bocomVipAccountBasicInfoId;
     }
@@ -56,6 +70,22 @@ public class BocomVipSilentAccountInfo extends BaseEntity {
         this.silentAccountNumber = silentAccountNumber;
     }
 
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
     @Override
     public String toString() {
         return "BocomVipSilentAccountInfo{" +

+ 12 - 1
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/impl/BocomVipAccountBasicInfoServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -256,6 +257,9 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
                     .eq(BocomVipSilentAccountInfo::getBocomVipAccountBasicInfoId, id)
                     .list();
             if (CollectionUtil.isNotEmpty(silentAccountInfos)) {
+                silentAccountInfos.forEach(silentAccountInfo -> {
+                    silentAccountInfo.setAccountName(basicInfo.getAccountName());
+                });
                 basicInfo.setSilentAccountInfoList(silentAccountInfos);
             }
 
@@ -309,8 +313,15 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
 
         }
         if (CollectionUtil.isNotEmpty(basicInfo.getDeleteSilentIds())) {
-            //删除会员登记簿
+            //删除静默户
             for (Long deleteSilentId : basicInfo.getDeleteSilentIds()) {
+                BocomVipSilentAccountInfo silentAccountInfo = bocomVipSilentAccoutInfoService.getById(deleteSilentId);
+                if (silentAccountInfo == null) {
+                    throw new BusinessException(CodeUtil.FAIL, "未查询到静默户!");
+                }
+                if (silentAccountInfo.getBalance().compareTo(BigDecimal.ZERO) == 1) {
+                    throw new BusinessException(CodeUtil.FAIL, "静默户余额大于0,不能删除!");
+                }
                 List<Long> ids = new ArrayList<>();
                 ids.add(deleteSilentId);
                 oldBasicInfo.setDeleteSilentIds(ids);