| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferInsideDto.getTransferCode(), dappMemberEntityOut.getId()); |
| | | |
| | | //RSA解密 |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String transferPassword = apiTransferInsideDto.getTransferCode(); |
| | | transferPassword = rsa.decryptStr(transferPassword, KeyType.PrivateKey); |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(transferPassword, dappMemberEntityOut.getId()); |
| | | if(!aBoolean){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | |
| | | * 否则,计算收益占本金的比例。符合条件允许提现 |
| | | */ |
| | | //获取用户的总收益 |
| | | 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()); |
| | |
| | | || 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")); |
| | | } |
| | |
| | | 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")); |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferOutsideDto.getTransferCode(), memberId); |
| | | //RSA解密 |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String transferPassword = apiTransferOutsideDto.getTransferCode(); |
| | | transferPassword = rsa.decryptStr(transferPassword, KeyType.PrivateKey); |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(transferPassword, memberId); |
| | | if(!aBoolean){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | |
| | | 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")); |
| | | } |
| | |
| | | || 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")); |
| | | } |
| | |
| | | String email = apiTransferPasswordDto.getEmail(); |
| | | String wahtsApp = apiTransferPasswordDto.getWahtsApp(); |
| | | String telegram = apiTransferPasswordDto.getTelegram(); |
| | | memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword())); |
| | | memberEntity.setTransferCode(SecureUtil.md5(newTransferPassword)); |
| | | memberEntity.setRealname(realname); |
| | | memberEntity.setPhone(phone); |
| | | memberEntity.setEmail(email); |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(apiUpdatePasswordDto.getTransferCode(), memberEntity.getId()); |
| | | |
| | | //RSA解密 |
| | | String transferCode = apiUpdatePasswordDto.getTransferCode(); |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | transferCode = rsa.decryptStr(transferCode, KeyType.PrivateKey); |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(transferCode, memberEntity.getId()); |
| | | if(!aBoolean){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | |
| | | || ObjectUtil.isEmpty(apiUpdatePasswordDto.getNewTransferPasswordAgain())){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008")); |
| | | } |
| | | |
| | | String newTransferPassword = apiUpdatePasswordDto.getNewTransferPassword(); |
| | | newTransferPassword = rsa.decryptStr(newTransferPassword, KeyType.PrivateKey); |
| | | String newTransferPasswordAgain = apiUpdatePasswordDto.getNewTransferPasswordAgain(); |
| | | newTransferPasswordAgain = rsa.decryptStr(newTransferPasswordAgain, KeyType.PrivateKey); |
| | | if(!newTransferPassword.equals(newTransferPasswordAgain)){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009")); |
| | | } |
| | | |
| | | memberEntity.setPassword(SecureUtil.md5(apiUpdatePasswordDto.getNewTransferPassword())); |
| | | 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(); |
| | | redisUtils.del(redisKey); |
| | | 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")); |
| | | } |
| | |
| | | || ObjectUtil.isEmpty(apiResetPasswordDto.getNewPasswordAgain())){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008")); |
| | | } |
| | | |
| | | //RSA解密 |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String newPassword = apiResetPasswordDto.getNewPassword(); |
| | | newPassword = rsa.decryptStr(newPassword, KeyType.PrivateKey); |
| | | String newPasswordAgain = apiResetPasswordDto.getNewPasswordAgain(); |
| | | newPasswordAgain = rsa.decryptStr(newPasswordAgain, KeyType.PrivateKey); |
| | | 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())); |
| | | 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(); |
| | | redisUtils.del(redisKey); |
| | | 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){ |
| | |
| | | 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)){ |