| | |
| | | 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")); |
| | | } |
| | | //提现条件收益率 |
| | | 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")); |
| | | |
| | | /** |
| | | * 提取金额小于收益,则不受限制 |
| | | * 否则,计算收益占本金的比例。符合条件允许提现 |
| | | */ |
| | | //获取用户的总收益 |
| | | 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){ |
| | |
| | | |
| | | @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")); |
| | |
| | | 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); |
| | | |
| | | 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")); |
| | |
| | | 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")); |
| | | } |
| | | |
| | | } |