From 13e7349e643408a1d1cb6f820ae629400d0efa58 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 09 Dec 2022 09:38:18 +0800
Subject: [PATCH] 20221130

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |   68 ++++++++++++++++++++++++++--------
 1 files changed, 52 insertions(+), 16 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 f0876bf..0d97b5a 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
@@ -604,18 +604,18 @@
          * 否则,计算收益占本金的比例。符合条件允许提现
          */
         //获取用户的总收益
-        BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2);
-        if(balance.compareTo(totalProfitOut) > 0){
-            BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
-            //用户总收益率
-            BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
-            //提现条件收益率
-            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"));
-            }
-        }
+//        BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2);
+//        if(balance.compareTo(totalProfitOut) > 0){
+//            BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
+//            //用户总收益率
+//            BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
+//            //提现条件收益率
+//            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()).multiply(new BigDecimal(0.01));
+//            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());
@@ -711,6 +711,15 @@
         DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
         Long memberId = dappMemberEntity.getId();
         DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
+        //验证旧密码是否正确
+        String transferCode = memberEntity.getTransferCode();
+        String oldTransferPassword = apiTransferPasswordDto.getOldTransferPassword();
+        oldTransferPassword = rsa.decryptStr(oldTransferPassword, KeyType.PrivateKey);
+        oldTransferPassword = SecureUtil.md5(oldTransferPassword);
+        if(!oldTransferPassword.equals(transferCode)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0018"));
+        }
+
         memberEntity.setTransferCode(SecureUtil.md5(newTransferPassword));
         dappMemberDao.updateById(memberEntity);
 
@@ -776,7 +785,7 @@
             BigDecimal divide = totalProfit.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
             //提现条件收益率
             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());
+            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()).multiply(new BigDecimal(0.01));
             if(divide.compareTo(outAccountProfit) < 0){
                 return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
             }
@@ -926,7 +935,17 @@
         memberEntity.setPassword(SecureUtil.md5(newTransferPassword));
         dappMemberDao.updateById(memberEntity);
 
+//        String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+//        redisUtils.del(redisKey);
+
         String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+        String existToken = redisUtils.getString(redisKey);
+        if (StrUtil.isNotBlank(existToken)) {
+            Object o = redisUtils.get(existToken);
+            if (ObjectUtil.isNotEmpty(o)) {
+                redisUtils.del(existToken);
+            }
+        }
         redisUtils.del(redisKey);
 
         return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
@@ -960,13 +979,23 @@
         memberEntity.setPassword(SecureUtil.md5(newPassword));
         dappMemberDao.updateById(memberEntity);
 
+//        String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+//        redisUtils.del(redisKey);
+
         String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
+        String existToken = redisUtils.getString(redisKey);
+        if (StrUtil.isNotBlank(existToken)) {
+            Object o = redisUtils.get(existToken);
+            if (ObjectUtil.isNotEmpty(o)) {
+                redisUtils.del(existToken);
+            }
+        }
         redisUtils.del(redisKey);
 
         return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
     }
     @Override
-    public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit,long id) {
+    public BigDecimal updateLSYJ(List<String> refererIdList,BigDecimal totalProfit,long id) {
         //计算盈利分成
         BigDecimal profitSharingTotal = BigDecimal.ZERO;
         if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
@@ -1178,10 +1207,17 @@
                     profitSharingTotal = profitSharingTotal.add(multiply);
                 }
             }
-
-
         }
+        return profitSharingTotal;
+    }
+
+    @Override
+    public BigDecimal updateYLFC(List<String> refererIdList, BigDecimal totalProfit, long id) {
         //计算流水佣金
+        BigDecimal profitSharingTotal = BigDecimal.ZERO;
+        if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
+            return profitSharingTotal;
+        }
         if(CollUtil.isNotEmpty(refererIdList)){
             String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode());
             if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){

--
Gitblit v1.9.1