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 | 55 ++++++++++++++++++++++++++-----------------------------
1 files changed, 26 insertions(+), 29 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 9ae4435..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
@@ -454,7 +454,7 @@
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);
@@ -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