From 1e2725d0ab46e73cf21279f816f2320b626fbd3e Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 02 Jun 2020 16:16:32 +0800
Subject: [PATCH] 20200602  代码提交

---
 src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
index f942398..0136a1e 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -43,7 +43,9 @@
 import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
 import com.xcong.excoin.modules.platform.dao.TradeSettingDao;
 import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
+import com.xcong.excoin.utils.CoinTypeConvert;
 import com.xcong.excoin.utils.MessageSourceUtils;
+import com.xcong.excoin.utils.RedisUtils;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -67,6 +69,8 @@
 	OrderCoinDealDao orderCoinDealDao;
 	@Resource
 	MemberAccountFlowEntityDao memberAccountFlowEntityDao;
+    @Resource
+    RedisUtils redisUtils;
 	
 	@Override
 	public String generateSimpleSerialno(String userId) {
@@ -94,7 +98,7 @@
 	}
 
 	@Override
-	public Result enterTransactionPageOfWalletCoin(String symbol, String type) {
+	public Result enterTransactionPageOfWalletCoin(String symbol) {
 		if (StrUtil.isBlank(symbol)) {
 			return Result.fail(MessageSourceUtils.getString("order_service_0001"));
 		}
@@ -110,12 +114,8 @@
 		//获取USDT的币币账户信息
 		MemberWalletCoinEntity walletCoinUsdt = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, 
 															MemberWalletCoinEnum.WALLETCOINCODE.getValue());
-		/**
-		 * todo
-		 */
-		//获取某个币种的收盘价
-		//Double closePrice = symbolsService.getCloseSymbolsBySymbolsName(symbol+"/USDT");
-		BigDecimal closePrice = new BigDecimal("100.0000");
+		
+		BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol+"/USDT")));
 		
 		List<MemberSelectSymbolsEntity> memSymbols = memberSelectSymbolsDao.selectSymbolByMemIdAndSymbol(memberId, symbol);
 
@@ -135,11 +135,8 @@
 		// 手续费用率
 		transactionPageOfWalletCoinVo.setFeeRatio(tradeSetting.getFeeRatio().setScale(4, BigDecimal.ROUND_DOWN));
 		// 用户可用金额
-		if(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_BUY.getValue().equals(type)) {//买入
-			transactionPageOfWalletCoinVo.setAvailableBalance(walletCoinUsdt.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
-		}else {
-			transactionPageOfWalletCoinVo.setAvailableBalance(walletCoin.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
-		}
+		transactionPageOfWalletCoinVo.setAvailableBalanceBuy(walletCoinUsdt.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
+		transactionPageOfWalletCoinVo.setAvailableBalanceSell(walletCoin.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
 		//当前价
 		transactionPageOfWalletCoinVo.setCurrentPrice(closePrice.setScale(4, BigDecimal.ROUND_DOWN));
 		//比例
@@ -148,7 +145,6 @@
 		transactionPageOfWalletCoinVo.setCurrentPriceCny(cnyUsdt.multiply(closePrice).setScale(4, BigDecimal.ROUND_DOWN));
 		
 		transactionPageOfWalletCoinVo.setSymbol(symbol);
-		transactionPageOfWalletCoinVo.setType(type);
 		return Result.ok(transactionPageOfWalletCoinVo);
 	}
 
@@ -158,13 +154,9 @@
 			//获取用户ID
 			Long memberId = LoginUserUtils.getAppLoginUser().getId();
 			
-			/**
-			 * todo
-			*/
 			//查询当前价
-			//BigDecimal nowPrice = new BigDecimal(redisUtil.getString(CoinTypeConConvert.convertToKey(symbol+"/USDT")));
+			BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol+"/USDT")));
 			
-			BigDecimal nowPrice = new BigDecimal("10.0000");
 			// 获取交易管理的杠杠倍率,手续费率等信息,由平台进行设置
 			symbol = symbol.toUpperCase();
 			MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);

--
Gitblit v1.9.1