| | |
| | | DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId()); |
| | | |
| | | walletInfo.setDirectCnt(direct.size()); |
| | | walletInfo.setInviteId(member.getInviteId()); |
| | | walletInfo.setInviteId(member.getActiveStatus() == 1 ? member.getInviteId() : "-"); |
| | | walletInfo.setBalance(walletCoin.getAvailableAmount()); |
| | | walletInfo.setHasBuy(memberInfo.getActiveStatus()); |
| | | walletInfo.setOutCnt(memberInfo.getOutCnt()); |
| | |
| | | public BigDecimal calPrice(PriceDto priceDto) { |
| | | String priceStr = redisUtils.getString(AppContants.REDIS_KEY_TFC_NEW_PRICE); |
| | | |
| | | return priceDto.getAmount().multiply(new BigDecimal("0.1")).multiply(new BigDecimal(priceStr)); |
| | | BigDecimal amount = priceDto.getAmount(); |
| | | if (priceDto.getAmount() == null) { |
| | | amount = BigDecimal.ZERO; |
| | | } |
| | | return amount.multiply(new BigDecimal("0.1")).divide(new BigDecimal(priceStr), 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | @Override |
| | | public void withdraw(WithdrawDto withdrawDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId()); |
| | | if (walletCoin.getAvailableAmount().compareTo(withdrawDto.getAmount()) < 0) { |
| | | throw new FebsException("Balance Not Enough"); |
| | | } |
| | | |
| | | updateWalletCoinWithLock(withdrawDto.getAmount().negate(), member.getId()); |
| | | updateWalletMineWithLock(withdrawDto.getFee().negate(), member.getId()); |
| | | |