From ccad384233cedb89bc5895976b2326f3d1a34f85 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 18 Dec 2024 11:23:35 +0800
Subject: [PATCH] refactor(mall): 重构会员充值相关功能

---
 src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
index 7204a35..9310a62 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
@@ -11,13 +11,15 @@
 import cc.mrbird.febs.mall.dto.ApiGoChargeDto;
 import cc.mrbird.febs.mall.dto.ApiGoChargeInfoDto;
 import cc.mrbird.febs.mall.dto.ApiMemberChargeFailDto;
-import cc.mrbird.febs.mall.entity.*;
+import cc.mrbird.febs.mall.entity.MallCharge;
+import cc.mrbird.febs.mall.entity.MallMember;
+import cc.mrbird.febs.mall.entity.MallMemberPayment;
+import cc.mrbird.febs.mall.entity.RunVip;
 import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
 import cc.mrbird.febs.mall.mapper.MallChargeMapper;
 import cc.mrbird.febs.mall.mapper.MallMemberPaymentMapper;
 import cc.mrbird.febs.mall.mapper.RunVipMapper;
 import cc.mrbird.febs.mall.service.IRunVipService;
-import cc.mrbird.febs.mall.vo.ApiChargeInfoVo;
 import cc.mrbird.febs.mall.vo.ApiChargeVo;
 import cc.mrbird.febs.mall.vo.ApiGoChargeVo;
 import cc.mrbird.febs.mall.vo.ApiRunVipVo;
@@ -36,7 +38,6 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.stream.Collectors;
 
 @Slf4j
 @Service
@@ -86,10 +87,23 @@
             return new FebsResponse().fail().message("请先绑定你的地址");
         }
 
-        String sysAddress = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-                RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS.getType(),
-                RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS.getCode()
+        //判断系统的充值地址
+        String trcType = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                RunVipDataDictionaryEnum.CHARGE_TYPE_TRC.getType(),
+                RunVipDataDictionaryEnum.CHARGE_TYPE_TRC.getCode()
         ).getValue();
+        String sysAddress = "";
+        if(trcType.equals(mallMemberPayment.getBankNo())){
+            sysAddress = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                    RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS_TRC.getType(),
+                    RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS_TRC.getCode()
+            ).getValue();
+        }else{
+            sysAddress = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                    RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS_BSC.getType(),
+                    RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS_BSC.getCode()
+            ).getValue();
+        }
         String failMinutes = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 RunVipDataDictionaryEnum.CHARGE_SYS_FAIL_TIME.getType(),
                 RunVipDataDictionaryEnum.CHARGE_SYS_FAIL_TIME.getCode()
@@ -115,6 +129,7 @@
         apiGoChargeVo.setAddress(mallCharge.getAddress());
         apiGoChargeVo.setAmount(mallCharge.getAmount());
         apiGoChargeVo.setSysAddress(mallCharge.getSysAddress());
+        apiGoChargeVo.setSysAddressType(mallCharge.getType());
 
         /**
          * 充值接口调用后,发送一个延时队列
@@ -143,23 +158,8 @@
         apiGoChargeVo.setAddress(mallCharge.getAddress());
         apiGoChargeVo.setAmount(mallCharge.getAmount());
         apiGoChargeVo.setSysAddress(mallCharge.getSysAddress());
+        apiGoChargeVo.setSysAddressType(mallCharge.getType());
         return new FebsResponse().success().data(apiGoChargeVo);
-    }
-
-    @Override
-    public FebsResponse getChargeInfo() {
-        Long memberId = LoginUserUtil.getLoginUser().getId();
-        ApiChargeInfoVo apiChargeInfoVo = new ApiChargeInfoVo();
-
-        String sysAddress = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-                RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS.getType(),
-                RunVipDataDictionaryEnum.CHARGE_SYS_ADDRESS.getCode()
-        ).getValue();
-        apiChargeInfoVo.setChargeAddress(sysAddress);
-        List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(RunVipDataDictionaryEnum.CHARGE_TYPE_TRC.getType());
-        List<String> coinTypeList = dataDictionaryCustoms.stream().map(DataDictionaryCustom::getValue).collect(Collectors.toList());
-        apiChargeInfoVo.setCoinType(coinTypeList);
-        return new FebsResponse().success().data(apiChargeInfoVo);
     }
 
     @Override

--
Gitblit v1.9.1