| | |
| | | MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, symbol);
|
| | | BigDecimal availableBalance = walletContract.getAvailableBalance();
|
| | |
|
| | | BigDecimal canReduce = BigDecimal.ZERO;
|
| | | BigDecimal canReduce = availableBalance;
|
| | | //可用减去盈亏
|
| | | if(totalProfitOrLess.compareTo(BigDecimal.ZERO) < 0){
|
| | | canReduce = availableBalance.add(totalProfitOrLess);
|
| | |
| | | return Result.fail(MessageSourceUtils.getString("member_controller_0005"));
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
|
| | |
|
| | | @Override
|
| | | public BigDecimal getAllWalletAmount(Long memberId) {
|
| | | List<MemberWalletCoinEntity> memberWalletCoinList = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
|
| | | BigDecimal total = BigDecimal.ZERO;
|
| | | if (CollUtil.isNotEmpty(memberWalletCoinList)) {
|
| | | for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinList) {
|
| | | if (memberWalletCoinEntity.getWalletCode().equals(CoinTypeEnum.USDT.name())) {
|
| | | total = total.add(memberWalletCoinEntity.getTotalBalance());
|
| | | } else {
|
| | | BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(memberWalletCoinEntity.getWalletCode() + "/USDT")));
|
| | | total = total.add(memberWalletCoinEntity.getTotalBalance().multiply(newPrice));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | MemberWalletContractEntity contractWallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, CoinTypeEnum.USDT.name());
|
| | | total = total.add(contractWallet.getTotalBalance());
|
| | |
|
| | | MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, CoinTypeEnum.USDT.name());
|
| | | if (walletAgent != null) {
|
| | | total = total.add(walletAgent.getTotalBalance());
|
| | | }
|
| | | return total;
|
| | | }
|
| | | }
|