From f454fbde8d020d279de090992009cb8fa1f5c63e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 20 May 2021 18:32:44 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 53 +++++++++++++++++++++++++----------------------------
1 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
index ed5539c..225a193 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
@@ -1112,33 +1112,30 @@
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;
+ }
}
--
Gitblit v1.9.1