xiaoyong931011
2022-11-21 5d1fc41db9c48ca7e4beffdfeb789fd6f69f4d2f
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());
@@ -697,8 +697,13 @@
                || ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPasswordAgain())){
            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
        }
        //RSA解密
        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
        String newTransferPassword = apiTransferPasswordDto.getNewTransferPassword();
        newTransferPassword = rsa.decryptStr(newTransferPassword, KeyType.PrivateKey);
        String newTransferPasswordAgain = apiTransferPasswordDto.getNewTransferPasswordAgain();
        newTransferPasswordAgain = rsa.decryptStr(newTransferPasswordAgain, KeyType.PrivateKey);
        if(!newTransferPassword.equals(newTransferPasswordAgain)){
            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
        }
@@ -706,7 +711,16 @@
        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
        Long memberId = dappMemberEntity.getId();
        DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
        memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword()));
        //验证旧密码是否正确
        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);
        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
@@ -771,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"));
            }