Helius
2021-04-15 629f5bdc2982e83fe13812f3a44a910ced630a00
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
@@ -1114,31 +1114,28 @@
    }
   
   
    @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;
    }
}