From 03bd618f5f3055f0a558a65b28a67fd604b27a1e Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Sat, 22 Oct 2022 23:49:46 +0800
Subject: [PATCH] fxi

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |  729 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 710 insertions(+), 19 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index e4f7b59..5d0d33e 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -1,27 +1,52 @@
 package cc.mrbird.febs.dapp.service.impl;
 
+import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils;
 import cc.mrbird.febs.common.contants.AppContants;
+import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
 import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.utils.FebsUtil;
 import cc.mrbird.febs.common.utils.LoginUserUtil;
-import cc.mrbird.febs.dapp.dto.RecordInPageDto;
-import cc.mrbird.febs.dapp.dto.WalletOperateDto;
+import cc.mrbird.febs.common.utils.RedisUtils;
+import cc.mrbird.febs.dapp.chain.ChainEnum;
+import cc.mrbird.febs.dapp.chain.ChainService;
+import cc.mrbird.febs.dapp.chain.ContractChainService;
+import cc.mrbird.febs.dapp.dto.*;
 import cc.mrbird.febs.dapp.entity.*;
+import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
 import cc.mrbird.febs.dapp.mapper.*;
+import cc.mrbird.febs.dapp.service.DappMemberService;
+import cc.mrbird.febs.dapp.service.DappSystemService;
 import cc.mrbird.febs.dapp.service.DappWalletService;
+import cc.mrbird.febs.dapp.utils.BoxUtil;
+import cc.mrbird.febs.dapp.vo.ActiveNftListVo;
+import cc.mrbird.febs.dapp.vo.ApiMemberWalletCoinVo;
 import cc.mrbird.febs.dapp.vo.WalletInfoVo;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.crypto.SecureUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.List;
+import java.math.RoundingMode;
+import java.util.*;
 
 /**
- * @author wzy
+ * @author
  * @date 2022-03-18
  **/
 @Slf4j
@@ -34,18 +59,35 @@
     private final DappWalletCoinDao dappWalletCoinDao;
     private final DappFundFlowDao dappFundFlowDao;
     private final DappAccountMoneyChangeDao dappAccountMoneyChangeDao;
+    private final RedisUtils redisUtils;
+    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
+    private final DappSystemService dappSystemService;
+    private final DappNftActivationDao dappNftActivationDao;
+    private final DappMemberService dappMemberService;
+    private final MemberCoinWithdrawDao memberCoinWithdrawDao;
+    private final IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemdao;
+
+    private final RedisTemplate<String, Object> redisTemplate;
 
     @Override
     public WalletInfoVo walletInfo() {
         DappMemberEntity member = LoginUserUtil.getAppUser();
 
-        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
-        DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId());
-
+        Map<String, BigDecimal> map = dappFundFlowDao.selectAmountTotalByType(member.getId());
         WalletInfoVo walletInfo = new WalletInfoVo();
-        walletInfo.setTotalMine(walletMine.getTotalAmount());
-        walletInfo.setAvailableMine(walletMine.getAvailableAmount());
-        walletInfo.setAvailableWallet(walletCoin.getAvailableAmount());
+        List<DappMemberEntity> direct = dappMemberDao.selectChildMemberDirectOrNot(member.getInviteId(), 1);
+        List<DappMemberEntity> notDirect = dappMemberDao.selectChildMemberDirectOrNot(member.getInviteId(), 2);
+        BigDecimal childHoldAmount = dappMemberDao.selectChildHoldAmount(member.getInviteId());
+
+        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
+
+        walletInfo.setTotalChild(notDirect.size());
+        walletInfo.setDirectCnt(direct.size());
+        walletInfo.setTotalChildCoin(childHoldAmount);
+        walletInfo.setTeamReward(map.get("teamReward"));
+        walletInfo.setMiningAmount(map.get("mine"));
+        walletInfo.setInviteId(member.getInviteId());
+        walletInfo.setBoxCnt(walletCoin.getBoxCnt());
         return walletInfo;
     }
 
@@ -54,14 +96,14 @@
     public void change(WalletOperateDto walletOperateDto) {
         DappMemberEntity member = LoginUserUtil.getAppUser();
 
-        BigDecimal ethUsdtPrice = new BigDecimal("1234");
+        BigDecimal ethUsdtPrice = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_ETH_NEW_PRICE);
 
         DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId());
         if (walletOperateDto.getAmount().compareTo(walletMine.getAvailableAmount()) > 0) {
             throw new FebsException("可用金额不足");
         }
 
-        DappFundFlowEntity fund = new DappFundFlowEntity(member.getId(), walletOperateDto.getAmount().negate(), AppContants.MONEY_TYPE_CHANGE, null);
+        DappFundFlowEntity fund = new DappFundFlowEntity(member.getId(), walletOperateDto.getAmount(), AppContants.MONEY_TYPE_CHANGE, null, null);
         dappFundFlowDao.insert(fund);
 
         BigDecimal preEthAmount = walletMine.getAvailableAmount();
@@ -69,7 +111,6 @@
         // TODO 并发加悲观锁
         // 更新eth金额
         walletMine.setAvailableAmount(walletMine.getAvailableAmount().subtract(walletOperateDto.getAmount()));
-        walletMine.setTotalAmount(walletMine.getTotalAmount().subtract(walletOperateDto.getAmount()));
         dappWalletMineDao.updateById(walletMine);
 
         DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
@@ -81,8 +122,8 @@
         walletCoin.setTotalAmount(walletCoin.getTotalAmount().add(usdt));
         dappWalletCoinDao.updateById(walletCoin);
 
-        DappAccountMoneyChangeEntity ethChange = new DappAccountMoneyChangeEntity(member.getId(), preEthAmount, walletOperateDto.getAmount(), walletMine.getTotalAmount(), "ETH兑换USDT-ETH", AppContants.MONEY_TYPE_CHANGE);
-        DappAccountMoneyChangeEntity usdtChange = new DappAccountMoneyChangeEntity(member.getId(), preUsdtAmount, usdt, walletCoin.getTotalAmount(), "ETH兑换USDT-USDT", AppContants.MONEY_TYPE_CHANGE);
+        DappAccountMoneyChangeEntity ethChange = new DappAccountMoneyChangeEntity(member.getId(), preEthAmount, walletOperateDto.getAmount(), walletMine.getAvailableAmount(), "ETH兑换USDT-ETH, 兑换价格为:" + ethUsdtPrice, AppContants.MONEY_TYPE_CHANGE);
+        DappAccountMoneyChangeEntity usdtChange = new DappAccountMoneyChangeEntity(member.getId(), preUsdtAmount, usdt, walletCoin.getAvailableAmount(), "ETH兑换USDT-USDT, 兑换价格为:" + ethUsdtPrice, AppContants.MONEY_TYPE_CHANGE);
         dappAccountMoneyChangeDao.insert(ethChange);
         dappAccountMoneyChangeDao.insert(usdtChange);
     }
@@ -92,18 +133,25 @@
     public void withdraw(WalletOperateDto walletOperateDto) {
         DappMemberEntity member = LoginUserUtil.getAppUser();
 
+        List<DappFundFlowEntity> fundFlows = dappFundFlowDao.selectListForMemberAndDay(member.getId(), 2);
+        if (CollUtil.isNotEmpty(fundFlows)) {
+            throw new FebsException("一天只能提现一次");
+        }
+
         DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
         if (walletOperateDto.getAmount().compareTo(walletCoin.getAvailableAmount()) > 0) {
             throw new FebsException("可用金额不足");
         }
 
-        // TODO 并发加悲观锁
+        Integer fee = (Integer) redisUtils.get(AppContants.REDIS_KEY_CHANGE_FEE);
+
+        //TODO 并发加悲观锁
         BigDecimal preAmount = walletCoin.getAvailableAmount();
         walletCoin.setAvailableAmount(walletCoin.getAvailableAmount().subtract(walletOperateDto.getAmount()));
-        walletCoin.setFrozenAmount(walletCoin.getFrozenAmount().subtract(walletOperateDto.getAmount()));
+        walletCoin.setFrozenAmount(walletCoin.getFrozenAmount().add(walletOperateDto.getAmount()));
         dappWalletCoinDao.updateById(walletCoin);
 
-        DappFundFlowEntity fund = new DappFundFlowEntity(member.getId(), walletOperateDto.getAmount().negate(), AppContants.MONEY_TYPE_WITHDRAWAL, 1);
+        DappFundFlowEntity fund = new DappFundFlowEntity(member.getId(), walletOperateDto.getAmount(), AppContants.MONEY_TYPE_WITHDRAWAL, 1, new BigDecimal(fee));
         dappFundFlowDao.insert(fund);
 
         DappAccountMoneyChangeEntity usdtChange = new DappAccountMoneyChangeEntity(member.getId(), preAmount, walletOperateDto.getAmount(), walletCoin.getAvailableAmount(), "USDT申请提现", AppContants.MONEY_TYPE_WITHDRAWAL);
@@ -114,8 +162,14 @@
     public List<DappFundFlowEntity> recordInPage(RecordInPageDto recordInPageDto) {
         Page<DappFundFlowEntity> page = new Page<>(recordInPageDto.getPageNum(), recordInPageDto.getPageSize());
 
+        DappMemberEntity member = LoginUserUtil.getAppUser();
         DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity();
-        dappFundFlowEntity.setType(recordInPageDto.getType());
+        if (recordInPageDto.getType() != null && recordInPageDto.getType() != 0) {
+            dappFundFlowEntity.setType(recordInPageDto.getType());
+        }
+        dappFundFlowEntity.setMemberId(member.getId());
+        dappFundFlowEntity.setStatus(2);
+
         IPage<DappFundFlowEntity> records = dappFundFlowDao.selectInPage(page, dappFundFlowEntity);
         return records.getRecords();
     }
@@ -127,20 +181,33 @@
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void withdrawAgreeOrNot(Long id, int type) {
         DappFundFlowEntity fundFlow = dappFundFlowDao.selectById(id);
         if (fundFlow == null) {
             throw new FebsException("数据不存在");
         }
 
+        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(fundFlow.getMemberId());
         if (type == 1) {
+            walletCoin.setFrozenAmount(walletCoin.getFrozenAmount().subtract(fundFlow.getAmount()));
+            walletCoin.setTotalAmount(walletCoin.getTotalAmount().subtract(fundFlow.getAmount()));
             fundFlow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
         } else if (type == 2) {
+            BigDecimal preAmount = walletCoin.getAvailableAmount();
+
+            walletCoin.setFrozenAmount(walletCoin.getFrozenAmount().subtract(fundFlow.getAmount()));
+            walletCoin.setAvailableAmount(walletCoin.getAvailableAmount().add(fundFlow.getAmount()));
+
+            DappAccountMoneyChangeEntity accountMoneyChange = new DappAccountMoneyChangeEntity(walletCoin.getMemberId(), preAmount, fundFlow.getAmount(), walletCoin.getAvailableAmount(), "提现申请被驳回", 2);
             fundFlow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_DISAGREE);
+
+            dappAccountMoneyChangeDao.insert(accountMoneyChange);
         } else {
             throw new FebsException("参数错误");
         }
 
+        dappWalletCoinDao.updateById(walletCoin);
         dappFundFlowDao.updateById(fundFlow);
     }
 
@@ -161,4 +228,628 @@
         Page<DappAccountMoneyChangeEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
         return dappAccountMoneyChangeDao.selectInPage(change, page);
     }
+
+    @Override
+    public Long transfer(TransferDto transferDto) {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+
+        if (member.getActiveStatus() == 2) {
+            throw new FebsException("请联系邀请人转币激活");
+        }
+
+        // 每日出U剩余量(卖币)
+        BigDecimal usdtRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN);
+        // 用户24小时可出售量
+        BigDecimal saleCoinRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress());
+
+        // 用户24小时可购买USDT
+        BigDecimal buyUsdtMax = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_IDO_USDT_MAX_BUY_DAILY + member.getAddress());
+
+        BigDecimal buyCoinRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_TRANSFER_POOL_VOL_REMAIN);
+        // 铸池中的币的剩余量
+        BigDecimal makeCoinRemain = (BigDecimal) redisUtils.get(AppContants.REDIS_KEY_MAKE_POOL_CNT);
+
+        DateTime tomorrow = DateUtil.beginOfDay(DateUtil.tomorrow());
+        long time = DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, true);
+
+        String hasStart = redisUtils.getString(AppContants.SYSTEM_START_FLAG);
+        if (transferDto.getId() == null) {
+            if (DappFundFlowEntity.TYPE_SALE == transferDto.getType()) {
+                if (!"start".equals(hasStart)) {
+                    throw new FebsException(MessageSourceUtils.getString("transfer_msg_001"));
+                }
+
+//                if (transferDto.getAmount().multiply(transferDto.getPrice()).compareTo(usdtRemain) > 0) {
+//                    throw new FebsException(MessageSourceUtils.getString("transfer_msg_002"));
+//                }
+//
+//                if (transferDto.getAmount().compareTo(saleCoinRemain) > 0) {
+//                    throw new FebsException(MessageSourceUtils.getString("transfer_msg_003"));
+//                }
+//
+//                usdtRemain = usdtRemain.subtract(transferDto.getAmount().multiply(transferDto.getPrice()));
+//                saleCoinRemain = saleCoinRemain.subtract(transferDto.getAmount());
+//
+//                // 修改当日U剩余量
+//                redisUtils.set(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN, usdtRemain);
+//                // 修改用户24小时可售量
+//                redisUtils.set(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress(), saleCoinRemain, time);
+            } else if (DappFundFlowEntity.TYPE_BUY == transferDto.getType()) {
+                // 购买时,前端传来的amount是USDT,卖出amount是TFC
+                BigDecimal usdtAmount = transferDto.getAmount();
+                BigDecimal coinAmount = transferDto.getAmount().divide(transferDto.getPrice(), 6, RoundingMode.HALF_UP);
+                transferDto.setAmount(coinAmount);
+
+                if ("start".equals(hasStart)) {
+                    if (transferDto.getAmount().compareTo(buyCoinRemain) > 0) {
+                        throw new FebsException(MessageSourceUtils.getString("transfer_msg_004"));
+                    }
+                    buyCoinRemain = buyCoinRemain.subtract(transferDto.getAmount());
+
+                    // 修改当日可购买量
+                    redisUtils.set(AppContants.REDIS_KEY_TRANSFER_POOL_VOL_REMAIN, buyCoinRemain);
+                    // 如果系统还没有启动,则判断铸池中的剩余量
+                } else {
+                    // 最少购买
+//                    DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_MAKER_MIN_LIMIT);
+//                    if (transferDto.getAmount().compareTo(new BigDecimal(dic.getValue())) < 0) {
+//                        throw new FebsException(MessageSourceUtils.getString("transfer_msg_005"));
+//                    }
+
+                    if (buyUsdtMax.compareTo(usdtAmount) < 0) {
+                        throw new FebsException(MessageSourceUtils.getString("transfer_msg_007"));
+                    }
+
+                    if (transferDto.getAmount().compareTo(makeCoinRemain) > 0) {
+                        throw new FebsException(MessageSourceUtils.getString("transfer_msg_006"));
+                    }
+                    makeCoinRemain = makeCoinRemain.subtract(transferDto.getAmount());
+                    buyUsdtMax = buyUsdtMax.subtract(usdtAmount);
+
+
+                    // 修改每日最大购买USDT量
+                    redisUtils.set(AppContants.REDIS_KEY_IDO_USDT_MAX_BUY_DAILY + member.getAddress(), buyUsdtMax, time);
+
+                    // 修改铸池量
+                    redisUtils.set(AppContants.REDIS_KEY_MAKE_POOL_CNT, makeCoinRemain);
+                }
+            }
+
+            DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), transferDto.getAmount(), transferDto.getType(), 1, transferDto.getFee(), transferDto.getTxHash());
+            fundFlow.setNewestPrice(transferDto.getPrice());
+            dappFundFlowDao.insert(fundFlow);
+            return fundFlow.getId();
+        }
+
+        if ("success".equals(transferDto.getFlag())) {
+            DappFundFlowEntity flow = dappFundFlowDao.selectById(transferDto.getId());
+
+            flow.setFromHash(transferDto.getTxHash());
+            dappFundFlowDao.updateById(flow);
+        } else {
+            DappFundFlowEntity flow = dappFundFlowDao.selectById(transferDto.getId());
+            if (flow.getStatus() == 1) {
+                if (DappFundFlowEntity.TYPE_BUY == flow.getType()) {
+                    // 购买时,前端传来的amount是USDT,卖出amount是TFC
+                    BigDecimal usdtAmount = transferDto.getAmount();
+                    BigDecimal coinAmount = transferDto.getAmount().divide(flow.getNewestPrice(), 6, RoundingMode.HALF_UP);
+                    transferDto.setAmount(coinAmount);
+
+                    if ("start".equals(hasStart)) {
+                        buyCoinRemain = buyCoinRemain.add(flow.getAmount());
+
+                        // 修改当日可购买量
+                        redisUtils.set(AppContants.REDIS_KEY_TRANSFER_POOL_VOL_REMAIN, buyCoinRemain);
+                    } else {
+                        makeCoinRemain = makeCoinRemain.add(flow.getAmount());
+                        buyUsdtMax = buyUsdtMax.add(usdtAmount);
+
+                        // 修改铸池量
+                        redisUtils.set(AppContants.REDIS_KEY_MAKE_POOL_CNT, makeCoinRemain);
+                        redisUtils.set(AppContants.REDIS_KEY_IDO_USDT_MAX_BUY_DAILY + member.getAddress(), buyUsdtMax, time);
+                    }
+                } else {
+                    usdtRemain = usdtRemain.add(transferDto.getAmount().multiply(transferDto.getPrice()));
+                    saleCoinRemain = saleCoinRemain.add(transferDto.getAmount());
+
+                    // 修改当日U剩余量
+                    redisUtils.set(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN, usdtRemain);
+                    // 修改用户24小时可售量
+                    redisUtils.set(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress(), saleCoinRemain, time);
+                }
+                dappFundFlowDao.deleteById(transferDto.getId());
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, BigDecimal> calPrice(PriceDto priceDto) {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+
+        if (!dappSystemService.systemHasStart()) {
+            HashMap<String, BigDecimal> map = new HashMap<>();
+            map.put("x", new BigDecimal("0.05"));
+            map.put("y", new BigDecimal("0.05"));
+            return map;
+        }
+
+        ContractChainService tfcInstance = ChainService.getInstance(ChainEnum.BSC_TFC.name());
+        // u剩余数量
+        BigDecimal sourceU = ChainService.getInstance(ChainEnum.BSC_USDT.name()).balanceOf(ChainEnum.BSC_USDT_SOURCE.getAddress());
+        // 源池代币剩余数量
+        BigDecimal sourceCoin = tfcInstance.balanceOf(ChainEnum.BSC_USDT_SOURCE.getAddress());
+        // 用户卖出数量
+        BigDecimal coin = priceDto.getAmount();
+        BigDecimal x = sourceU.divide(sourceCoin, tfcInstance.decimals(), RoundingMode.HALF_UP);
+        BigDecimal y = sourceU.divide(sourceCoin.add(coin), tfcInstance.decimals(), RoundingMode.HALF_UP);
+
+//        log.info("购买价格:{}, 出卖价格:{}", x, y);
+        HashMap<String, BigDecimal> map = new HashMap<>();
+        map.put("x", x);
+        map.put("y", y);
+        return map;
+    }
+
+    @Override
+    public ActiveNftListVo boxSurprise() {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+
+        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
+        if (walletCoin.getBoxCnt() < 1) {
+            throw new FebsException(MessageSourceUtils.getString("box_surprise_001"));
+        }
+
+        walletCoin.setBoxCnt(walletCoin.getBoxCnt() - 1);
+        dappWalletCoinDao.updateById(walletCoin);
+
+        BoxUtil.Box box = BoxUtil.openBox();
+
+        Date time = new Date();
+        Date expire = DateUtil.offset(time, DateField.HOUR, 48);
+        DappNftActivation nftActivation = new DappNftActivation();
+        nftActivation.setMemberId(member.getId());
+        nftActivation.setCount(box.getIndex());
+        nftActivation.setOpenTime(time);
+        nftActivation.setExpireTime(expire);
+        nftActivation.setStatus(1);
+        dappNftActivationDao.insert(nftActivation);
+
+        ActiveNftListVo nft = new ActiveNftListVo();
+        nft.setCount(box.getIndex());
+        nft.setId(nftActivation.getId());
+        nft.setRemain(DateUtil.between(time, expire, DateUnit.SECOND));
+        return nft;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public synchronized void activeNft(ActiveDto activeDto) {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+
+        DappNftActivation nftActive = dappNftActivationDao.selectById(activeDto.getId());
+        if (nftActive == null) {
+            throw new FebsException(MessageSourceUtils.getString("nft_active_003"));
+        }
+
+        if (nftActive.getCount() < activeDto.getCount()) {
+            throw new FebsException(MessageSourceUtils.getString("nft_active_004"));
+        }
+
+        if (DateUtil.between(new Date(), nftActive.getExpireTime(), DateUnit.SECOND) < 0) {
+            throw new FebsException(MessageSourceUtils.getString("nft_active_005"));
+        }
+
+        if (nftActive.getStatus() != 1) {
+            throw new FebsException(MessageSourceUtils.getString("nft_active_001"));
+        }
+
+        PriceDto priceDto = new PriceDto();
+        priceDto.setAmount(BigDecimal.ZERO);
+        Map<String, BigDecimal> price = calPrice(priceDto);
+        DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), new BigDecimal(activeDto.getCount()), 8, 1, BigDecimal.ZERO, activeDto.getTxHash());
+
+        fundFlow.setTargetAmount(AppContants.NFT_ACTIVE_PRICE.multiply(BigDecimal.valueOf(nftActive.getCount())).multiply(price.get("x")));
+        fundFlow.setNewestPrice(price.get("x"));
+        dappFundFlowDao.insert(fundFlow);
+
+        int count = nftActive.getCount() - activeDto.getCount();
+        if (count == 0) {
+            nftActive.setStatus(3);
+        }
+
+        nftActive.setCount(count);
+        nftActive.setHash(activeDto.getTxHash());
+        dappNftActivationDao.updateById(nftActive);
+    }
+
+    @Override
+    public List<ActiveNftListVo> findUnActiveNftList() {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+        List<ActiveNftListVo> list = new ArrayList<>();
+
+        UpdateWrapper<DappNftActivation> query = new UpdateWrapper<>();
+        query.eq("status", 1);
+        query.eq("member_id", member.getId());
+        query.ge("expire_time", new Date());
+        List<DappNftActivation> nftActivations = dappNftActivationDao.selectList(query);
+
+        if (CollUtil.isEmpty(nftActivations)) {
+            return list;
+        }
+
+        Date now = new Date();
+        nftActivations.forEach(nft -> {
+            ActiveNftListVo nftVo = new ActiveNftListVo();
+            nftVo.setId(nft.getId());
+            nftVo.setRemain(DateUtil.between(now, nft.getExpireTime(), DateUnit.SECOND, false));
+            nftVo.setCount(nft.getCount());
+            list.add(nftVo);
+        });
+
+        return list;
+    }
+
+    @Override
+    public FebsResponse findMemberWalletCoin() {
+        DappMemberEntity member = LoginUserUtil.getAppUser();
+        Long memberId = member.getId();
+
+        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
+        DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
+        ApiMemberWalletCoinVo apiMemberWalletCoinVo = new ApiMemberWalletCoinVo();
+        if(ObjectUtil.isNotEmpty(dappWalletCoinEntity)){
+            apiMemberWalletCoinVo.setTotalAmount(dappWalletCoinEntity.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN));
+            apiMemberWalletCoinVo.setFrozenAmount(dappWalletCoinEntity.getFrozenAmount().setScale(4,BigDecimal.ROUND_DOWN));
+            apiMemberWalletCoinVo.setAvailableAmount(dappWalletCoinEntity.getAvailableAmount().setScale(4,BigDecimal.ROUND_DOWN));
+        }
+        return new FebsResponse().success().data(apiMemberWalletCoinVo);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public FebsResponse transferInside(ApiTransferInsideDto apiTransferInsideDto) {
+        //判断入参
+        BigDecimal balance = apiTransferInsideDto.getBalance() == null ? BigDecimal.ZERO : apiTransferInsideDto.getBalance().setScale(4,BigDecimal.ROUND_DOWN);
+        if(BigDecimal.ZERO.compareTo(balance) >= 0){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_001"));
+        }
+//        if(ObjectUtil.isEmpty(apiTransferInsideDto.getInviteId())){
+//            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_001"));
+//        }
+        if(ObjectUtil.isEmpty(apiTransferInsideDto.getUsername())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0011"));
+        }
+        if(ObjectUtil.isEmpty(apiTransferInsideDto.getTransferCode())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
+        }
+        //每日挂机时间段内禁止内转
+        DataDictionaryCustom startTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.START_TIME.getType(), DataDictionaryEnum.START_TIME.getCode());
+        DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.END_TIME.getType(), DataDictionaryEnum.END_TIME.getCode());
+        //获取时间对应的秒数
+        Integer dateNow = DateUtil.timeToSecond(DateUtil.formatTime(DateUtil.date()));
+        Integer startTime = DateUtil.timeToSecond(startTimeDic.getValue());
+        Integer endTime = DateUtil.timeToSecond(endTimeDic.getValue());
+        if(startTime <= dateNow && endTime >= dateNow){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0012"));
+        }
+
+
+        DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser();
+        Long memberIdOut = dappMemberEntityOut.getId();
+        //判断双方是否是会员
+        if(ObjectUtil.isEmpty(dappMemberEntityOut.getInviteId())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_002"));
+        }
+        String inviteIdOut = dappMemberEntityOut.getInviteId();
+        Boolean isMemberOut = dappMemberService.isMember(inviteIdOut);
+        if(!isMemberOut){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_002"));
+        }
+        String username = apiTransferInsideDto.getUsername();
+        DappMemberEntity memberEntityIn = dappMemberDao.selectMemberInfoByUsername(username);
+        if (ObjectUtil.isEmpty(memberEntityIn)) {
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
+        }
+
+        String inviteIdIn = memberEntityIn.getInviteId();
+        Boolean isMemberIn = dappMemberService.isMember(inviteIdIn);
+//        Boolean isMemberIn = dappMemberService.isMember(apiTransferInsideDto.getInviteId());
+        if(!isMemberIn){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
+        }
+        //验证资金密码
+        Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferInsideDto.getTransferCode(), dappMemberEntityOut.getId());
+        if(!aBoolean){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
+        }
+        //判断内部转账规则
+
+
+        DataDictionaryCustom accountRelationDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.ACCOUNT_RELATION.getType(), DataDictionaryEnum.ACCOUNT_RELATION.getCode());
+        Integer accountRelation = Integer.parseInt(accountRelationDic.getValue());
+        if(1 == accountRelation){
+            Boolean relationShip = dappMemberService.isRelationShip(inviteIdOut, inviteIdIn);
+            if(!relationShip){
+                return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_005"));
+            }
+        }
+        //查询转出会员
+        //转出会员当前余额要大于等于划转金额
+        DappWalletCoinEntity dappWalletCoinEntityOut = dappWalletCoinDao.selectByMemberId(memberIdOut);
+        BigDecimal availableAmountOut = dappWalletCoinEntityOut.getAvailableAmount().setScale(4,BigDecimal.ROUND_DOWN);
+        if(availableAmountOut.compareTo(balance) < 0){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_002"));
+        }
+        /**
+         * 提取金额小于收益,则不受限制
+         * 否则,计算收益占本金的比例。符合条件允许提现
+         */
+        //获取用户的总收益
+        BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,1,2);
+        if(balance.compareTo(totalProfitOut) > 0){
+            BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
+            //用户总收益率
+            BigDecimal divide = totalProfitOut.divide(totalAmount);
+            //提现条件收益率
+            DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
+            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
+            if(divide.compareTo(outAccountProfit) < 0){
+                return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
+            }
+        }
+        //提现次数
+        DataDictionaryCustom withdrawTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_TIMES.getType(), DataDictionaryEnum.WITHDRAW_TIMES.getCode());
+        Integer withdrawTimes = Integer.parseInt(withdrawTimesDic.getValue());
+        Integer withdrawTimesReal = memberCoinWithdrawDao.selectByMemberIdAndCreateTime(memberIdOut,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"));
+        if(withdrawTimesReal >= withdrawTimes){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
+        }
+        //转出账户,余额减少,冻结增加
+        Integer countOut = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntityOut.getId(), balance);
+        if(1 != countOut){
+            throw new FebsException(MessageSourceUtils.getString("balance_err_002"));
+        }
+        //转出账户生成一条内部转账记录
+        MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
+        memberCoinWithdrawEntity.setAddress(inviteIdIn);
+        memberCoinWithdrawEntity.setAmount(balance);
+        memberCoinWithdrawEntity.setFeeAmount(BigDecimal.ZERO);
+        memberCoinWithdrawEntity.setSymbol("USDT");
+        memberCoinWithdrawEntity.setMemberId(memberIdOut);
+        memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING);
+        memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES);
+        memberCoinWithdrawDao.insert(memberCoinWithdrawEntity);
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public FebsResponse transferPasswordSet(ApiTransferPasswordDto apiTransferPasswordDto) {
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getOldTransferPassword())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_007"));
+        }
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPassword())
+                || ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPasswordAgain())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
+        }
+        String newTransferPassword = apiTransferPasswordDto.getNewTransferPassword();
+        String newTransferPasswordAgain = apiTransferPasswordDto.getNewTransferPasswordAgain();
+        if(!newTransferPassword.equals(newTransferPasswordAgain)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
+        }
+
+        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
+        Long memberId = dappMemberEntity.getId();
+        DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
+        memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword()));
+        dappMemberDao.updateById(memberEntity);
+
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public FebsResponse transferOutside(ApiTransferOutsideDto apiTransferOutsideDto) {
+        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
+        Long memberId = dappMemberEntity.getId();
+
+        if(ObjectUtil.isEmpty(apiTransferOutsideDto.getAddress())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0010"));
+        }
+        String address = apiTransferOutsideDto.getAddress();
+
+        if(ObjectUtil.isEmpty(apiTransferOutsideDto.getBalance())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_001"));
+        }
+
+        BigDecimal balance = apiTransferOutsideDto.getBalance();
+        if(BigDecimal.ZERO.compareTo(balance) >= 0){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_001"));
+        }
+        DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
+        BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount();
+        if(balance.compareTo(availableAmount) > 0){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_002"));
+        }
+
+        //验证资金密码
+        Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferOutsideDto.getTransferCode(), memberId);
+        if(!aBoolean){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
+        }
+
+        /**
+         * 提取金额小于收益,则不受限制
+         * 否则,计算收益占本金的比例。符合条件允许提现
+         */
+        //获取用户的总收益
+        BigDecimal totalProfit = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberId,1,2);
+        if(balance.compareTo(totalProfit) >= 0){
+            BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount();
+            //用户总收益率
+            BigDecimal divide = totalProfit.divide(totalAmount);
+            //提现条件收益率
+            DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
+            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
+            if(divide.compareTo(outAccountProfit) < 0){
+                return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
+            }
+        }
+
+        //余额减少冻结增加
+        Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance);
+        if(1 != count){
+            throw new FebsException(MessageSourceUtils.getString("balance_err_002"));
+        }
+        DataDictionaryCustom serviceFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SERVICE_FEE.getType(), DataDictionaryEnum.SERVICE_FEE.getCode());
+        BigDecimal serviceFee = new BigDecimal(serviceFeeDic.getValue());
+
+        //转出账户生成一条内部转账记录
+        MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
+        memberCoinWithdrawEntity.setAddress(address);
+        memberCoinWithdrawEntity.setAmount(balance);
+        memberCoinWithdrawEntity.setFeeAmount(serviceFee);
+        if(1 == apiTransferOutsideDto.getType()){
+            memberCoinWithdrawEntity.setTag("银行卡");
+            memberCoinWithdrawEntity.setSymbol("$");
+        }else{
+            memberCoinWithdrawEntity.setTag("钱包");
+            memberCoinWithdrawEntity.setSymbol("USDT");
+        }
+        memberCoinWithdrawEntity.setMemberId(memberId);
+        memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING);
+        memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO);
+        memberCoinWithdrawDao.insert(memberCoinWithdrawEntity);
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
+    @Override
+    public FebsResponse transferPassword(ApiTransferPasswordDto apiTransferPasswordDto) {
+        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
+        Long memberId = dappMemberEntity.getId();
+
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getRealname())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0013"));
+        }
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getPhone())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0013"));
+        }
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getEmail())
+                && ObjectUtil.isEmpty(apiTransferPasswordDto.getWahtsApp())
+                && ObjectUtil.isEmpty(apiTransferPasswordDto.getTelegram())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0013"));
+        }
+        if(ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPassword())
+                || ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPasswordAgain())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
+        }
+        String newTransferPassword = apiTransferPasswordDto.getNewTransferPassword();
+        String newTransferPasswordAgain = apiTransferPasswordDto.getNewTransferPasswordAgain();
+        if(!newTransferPassword.equals(newTransferPasswordAgain)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
+        }
+        DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
+
+        String realname = apiTransferPasswordDto.getRealname();
+        String phone = apiTransferPasswordDto.getPhone();
+        String email = apiTransferPasswordDto.getEmail();
+        String wahtsApp = apiTransferPasswordDto.getWahtsApp();
+        String telegram = apiTransferPasswordDto.getTelegram();
+        memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword()));
+        memberEntity.setRealname(realname);
+        memberEntity.setPhone(phone);
+        memberEntity.setEmail(email);
+        memberEntity.setWahtsApp(wahtsApp);
+        memberEntity.setTelegram(telegram);
+        dappMemberDao.updateById(memberEntity);
+
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
+    @Override
+    public FebsResponse updatePassword(ApiUpdatePasswordDto apiUpdatePasswordDto) {
+        //验证验证码是否正确
+        // 根据前端传回的token在redis中找对应的value
+        ValueOperations<String, Object> valueOperations = redisTemplate.opsForValue();
+        if(ObjectUtil.isEmpty(apiUpdatePasswordDto.getCodeToken()) || ObjectUtil.isEmpty(apiUpdatePasswordDto.getCodeValue())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("verification_code_err_001"));
+        }
+        String codeToken = apiUpdatePasswordDto.getCodeToken();
+        String codeValue = apiUpdatePasswordDto.getCodeValue();
+        if (redisTemplate.hasKey(codeToken)) {
+            //验证通过, 删除对应的key
+            if (valueOperations.get(codeToken).equals(codeValue)) {
+                redisTemplate.delete(codeToken);
+            } else {
+                return new FebsResponse().fail().message(MessageSourceUtils.getString("verification_code_err_002"));
+            }
+        } else {
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("verification_code_err_003"));
+        }
+        String username = apiUpdatePasswordDto.getUsername();
+        DappMemberEntity memberEntity = dappMemberDao.selectMemberInfoByUsername(username);
+        if (ObjectUtil.isEmpty(memberEntity)) {
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
+        }
+
+        String inviteIdIn = memberEntity.getInviteId();
+        Boolean isMemberIn = dappMemberService.isMember(inviteIdIn);
+        if(!isMemberIn){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
+        }
+        //验证资金密码
+        Boolean aBoolean = dappMemberService.validateTransferCode(apiUpdatePasswordDto.getTransferCode(), memberEntity.getId());
+        if(!aBoolean){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
+        }
+
+        if(ObjectUtil.isEmpty(apiUpdatePasswordDto.getNewTransferPassword())
+                || ObjectUtil.isEmpty(apiUpdatePasswordDto.getNewTransferPasswordAgain())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
+        }
+        String newTransferPassword = apiUpdatePasswordDto.getNewTransferPassword();
+        String newTransferPasswordAgain = apiUpdatePasswordDto.getNewTransferPasswordAgain();
+        if(!newTransferPassword.equals(newTransferPasswordAgain)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
+        }
+
+        memberEntity.setPassword(SecureUtil.md5(apiUpdatePasswordDto.getNewTransferPassword()));
+        dappMemberDao.updateById(memberEntity);
+
+        String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+        redisUtils.del(redisKey);
+
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
+    @Override
+    public FebsResponse rebitTest() {
+        return null;
+    }
+
+    @Override
+    public FebsResponse resetPassword(ApiResetPasswordDto apiResetPasswordDto) {
+        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
+        Long memberId = dappMemberEntity.getId();
+
+        if(ObjectUtil.isEmpty(apiResetPasswordDto.getNewPassword())
+                || ObjectUtil.isEmpty(apiResetPasswordDto.getNewPasswordAgain())){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
+        }
+        String newPassword = apiResetPasswordDto.getNewPassword();
+        String newPasswordAgain = apiResetPasswordDto.getNewPasswordAgain();
+        if(!newPassword.equals(newPasswordAgain)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
+        }
+        DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
+        memberEntity.setPassword(SecureUtil.md5(apiResetPasswordDto.getNewPassword()));
+        dappMemberDao.updateById(memberEntity);
+
+        String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+        redisUtils.del(redisKey);
+
+        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
+    }
+
 }

--
Gitblit v1.9.1