| | |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.utils.BoxUtil; |
| | | import cc.mrbird.febs.dapp.vo.ActiveNftListVo; |
| | | import cc.mrbird.febs.dapp.vo.ApiMemberWalletCoinVo; |
| | | import cc.mrbird.febs.dapp.vo.WalletInfoVo; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import cc.mrbird.febs.rabbit.producer.UsdtUpdateProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateField; |
| | | import cn.hutool.core.date.DateTime; |
| | |
| | | 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; |
| | |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | private final IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemdao; |
| | | private final DappBankDao dappBankDao; |
| | | private final UsdtUpdateProducer usdtUpdateProducer; |
| | | |
| | | private final RedisTemplate<String, Object> redisTemplate; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser(); |
| | | Long memberIdOut = dappMemberEntityOut.getId(); |
| | | // DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser(); |
| | | Long memberIdOut = LoginUserUtil.getAppUser().getId(); |
| | | //判断账户是否限制 |
| | | |
| | | |
| | | DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberIdOut); |
| | | Integer withdrawAble = dappMemberEntityOut.getWithdrawAble(); |
| | | if(2 == withdrawAble){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017")); |
| | | } |
| | | //判断双方是否是会员 |
| | | if(ObjectUtil.isEmpty(dappMemberEntityOut.getInviteId())){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_002")); |
| | |
| | | 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,1,2); |
| | | BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2); |
| | | if(balance.compareTo(totalProfitOut) > 0){ |
| | | BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount(); |
| | | //用户总收益率 |
| | | BigDecimal divide = totalProfitOut.divide(totalAmount); |
| | | 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()); |
| | |
| | | memberCoinWithdrawEntity.setFeeAmount(BigDecimal.ZERO); |
| | | memberCoinWithdrawEntity.setSymbol("USDT"); |
| | | memberCoinWithdrawEntity.setMemberId(memberIdOut); |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING); |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES); |
| | | memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES); |
| | | memberCoinWithdrawDao.insert(memberCoinWithdrawEntity); |
| | | |
| | | // usdtUpdateProducer.sendMemberCoinInside(memberCoinWithdrawEntity.getId()); |
| | | //转出账户,总额减少,冻结减少 |
| | | dappWalletCoinDao.delTotalAndDelFrozenById(dappWalletCoinEntityOut.getId(),balance); |
| | | |
| | | String isInside = memberCoinWithdrawEntity.getIsInside(); |
| | | String content = ""; |
| | | Integer type = 0; |
| | | if(MemberCoinWithdrawEntity.ISINSIDE_NO.equals(isInside)){ |
| | | content = "提现"; |
| | | type = 2; |
| | | }else{ |
| | | content = "转账"; |
| | | type = 4; |
| | | } |
| | | //转出账户生成一条账户资金变化记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityOut = new DappAccountMoneyChangeEntity(memberIdOut, |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | balance.negate(), |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).subtract(balance), |
| | | content, |
| | | type); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityOut); |
| | | |
| | | //转入账户,总额增加,余额增加 |
| | | //转账 |
| | | if(MemberCoinWithdrawEntity.ISINSIDE_YES.equals(isInside)){ |
| | | String addressIn = memberCoinWithdrawEntity.getAddress(); |
| | | DappMemberEntity dappMemberEntityIn = dappMemberDao.selectMemberInfoByInviteId(addressIn); |
| | | if(ObjectUtil.isEmpty(dappMemberEntityIn)){ |
| | | throw new FebsException(MessageSourceUtils.getString("Operation_002")); |
| | | } |
| | | DappWalletCoinEntity dappWalletCoinEntityIn = dappWalletCoinDao.selectByMemberId(dappMemberEntityIn.getId()); |
| | | Integer countIn = dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntityIn.getId(), memberCoinWithdrawEntity.getAmount()); |
| | | if(1 != countIn){ |
| | | throw new FebsException(MessageSourceUtils.getString("Operation_002")); |
| | | } |
| | | //生成流水记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityIn = new DappAccountMoneyChangeEntity(dappMemberEntityIn.getId(), |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | balance, |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).add(balance), |
| | | "转账", |
| | | 4); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityIn); |
| | | } |
| | | return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001")); |
| | | } |
| | | |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_002")); |
| | | } |
| | | |
| | | DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberId); |
| | | //判断账户是否限制 |
| | | Integer withdrawAble = dappMemberEntityOut.getWithdrawAble(); |
| | | if(2 == withdrawAble){ |
| | | 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 totalProfit = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberId,1,2); |
| | | BigDecimal totalProfit = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberId,2); |
| | | if(balance.compareTo(totalProfit) >= 0){ |
| | | BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount(); |
| | | //用户总收益率 |
| | | BigDecimal divide = totalProfit.divide(totalAmount); |
| | | 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()); |
| | |
| | | } |
| | | |
| | | //余额减少冻结增加 |
| | | Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance); |
| | | Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntity.getId(), balance); |
| | | if(1 != count){ |
| | | throw new FebsException(MessageSourceUtils.getString("balance_err_002")); |
| | | } |
| | |
| | | || 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(); |
| | |
| | | || 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(); |
| | |
| | | return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001")); |
| | | } |
| | | @Override |
| | | public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit) { |
| | | public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit,long id) { |
| | | //计算盈利分成 |
| | | BigDecimal profitSharingTotal = BigDecimal.ZERO; |
| | | if(BigDecimal.ZERO.compareTo(totalProfit)>=0){ |
| | |
| | | if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){ |
| | | BigDecimal multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_IB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_IB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_IB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply),"盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_FIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_FIB.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){ |
| | |
| | | |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_FIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_FIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_FIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_CIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_CIB.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_CIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_CIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_CIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_AIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_GIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_BP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_SP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_GP.getCode().equals(LEVEL_GP)){ |
| | |
| | | } |
| | | multiply = totalProfit.multiply(multiply); |
| | | DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_GP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_AIB.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB); |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_AIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | |
| | | String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode()); |
| | |
| | | BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GIB.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB); |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_GIB.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | |
| | | String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode()); |
| | |
| | | BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_BP.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP); |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_BP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | |
| | | String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode()); |
| | |
| | | BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_SP.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP); |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_SP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | |
| | | String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode()); |
| | |
| | | BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GP.getCode())); |
| | | DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP); |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId()); |
| | | if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0 |
| | | || 2 != dappMemberEntityLEVEL_GP.getIsOnHook()){ |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(), |
| | | multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | | } |
| | | } |
| | | return profitSharingTotal; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit) { |
| | | public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id) { |
| | | if(BigDecimal.ZERO.compareTo(totalProfit)>=0){ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | BigDecimal multiply = totalProfit.multiply(new BigDecimal(0.05)); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(65L, |
| | | multiply.negate(), "系统", 9); |
| | | totalProfit, "系统", 9,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | return multiply; |
| | | return totalProfit; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | private final MemberCoinChargeDao memberCoinChargeDao; |
| | | |
| | | @Override |
| | | public IPage<AdminMoneyTotalVo> moneyTotal(DappAccountMoneyChangeEntity record, QueryRequest request) { |
| | | Page<DappAccountMoneyChangeEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | //获取充值提现的所有日期 |
| | | IPage<AdminMoneyTotalVo> adminMoneyTotalVoIPage = dappAccountMoneyChangeDao.selectMoneyTotalInPage(record, page); |
| | | List<AdminMoneyTotalVo> records = adminMoneyTotalVoIPage.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminMoneyTotalVo adminMoneyTotalVo : records){ |
| | | Date createTime = adminMoneyTotalVo.getCreateTime(); |
| | | //每日充值统计 |
| | | AdminMemberChargeVo adminMemberChargeVos = memberCoinChargeDao.selectTotalAmountByCreateTimeAndInviteId(createTime,record.getDescription()); |
| | | adminMoneyTotalVo.setTotalCharge(adminMemberChargeVos.getTotalCharge().setScale(2,BigDecimal.ROUND_DOWN)); |
| | | adminMoneyTotalVo.setSheetIn(adminMemberChargeVos.getSheetIn()); |
| | | //每日提现统计 |
| | | AdminMemberWithdrawVo adminMemberWithdrawVo = memberCoinWithdrawDao.selectTotalAmountByCreateTimeAndInviteId(createTime,record.getDescription()); |
| | | adminMoneyTotalVo.setTotalWithdraw(adminMemberWithdrawVo.getTotalWithdraw().setScale(2,BigDecimal.ROUND_DOWN)); |
| | | adminMoneyTotalVo.setSheetOut(adminMemberWithdrawVo.getSheetOut()); |
| | | } |
| | | } |
| | | return adminMoneyTotalVoIPage; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | String num = StrUtil.subSuf("01234",1); |
| | | System.out.print(num); |
| | | DateTime date = DateUtil.date(); |
| | | DateTime endTime = DateUtil.parseTimeToday("09:08:03"); |
| | | if(DateUtil.compare(date,endTime)>=0){ |
| | | // |
| | | System.out.print(endTime); |
| | | } |
| | | } |
| | | |
| | | private String isIdentity(List<String> refererIds,String levelCode){ |