| | |
| | | private final DappNftActivationDao dappNftActivationDao; |
| | | private final DappMemberService dappMemberService; |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | private final IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemdao; |
| | | |
| | | private final RedisTemplate<String, Object> redisTemplate; |
| | | |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | | //判断内部转账规则 |
| | | DataDictionaryCustom withdrawTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_TIMES.getType(), DataDictionaryEnum.WITHDRAW_TIMES.getCode()); |
| | | // |
| | | // DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode()); |
| | | // //todo 获取用户的总收益 |
| | | // BigDecimal totalProfitOut = new BigDecimal("0.3"); |
| | | // BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()); |
| | | // if(outAccountProfit.compareTo(totalProfitOut) > 0){ |
| | | // return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004")); |
| | | // } |
| | | |
| | | |
| | | DataDictionaryCustom accountRelationDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.ACCOUNT_RELATION.getType(), DataDictionaryEnum.ACCOUNT_RELATION.getCode()); |
| | | Integer accountRelation = Integer.parseInt(accountRelationDic.getValue()); |
| | | if(1 == accountRelation){ |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_005")); |
| | | } |
| | | } |
| | | // DataDictionaryCustom serviceFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SERVICE_FEE.getType(), DataDictionaryEnum.SERVICE_FEE.getCode()); |
| | | // Integer serviceFee = Integer.parseInt(serviceFeeDic.getValue()); |
| | | //查询转出会员 |
| | | //转出会员当前余额要大于等于划转金额 |
| | | 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(!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()); |
| | | //todo 获取用户的总收益 |
| | | BigDecimal totalProfitOut = new BigDecimal("0.3"); |
| | | BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()); |
| | | if(outAccountProfit.compareTo(totalProfitOut) > 0){ |
| | | if(divide.compareTo(outAccountProfit) < 0){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004")); |
| | | } |
| | | } |
| | | |
| | | //余额减少冻结增加 |
| | | Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance); |
| | | if(1 != count){ |