From 59dfc42a6cce131e63a637fc7a5afc6b1bbd27ac Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Sat, 09 Aug 2025 17:11:58 +0800
Subject: [PATCH] 类型筛选
---
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index 6275641..3f70206 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -177,20 +177,20 @@
return ServerResponse.createByErrorMsg("报价0,请稍后再试", request);
}
-
BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(buyNum)).divide(new BigDecimal(lever));
- BigDecimal finalBuyAmt = buyAmt;
- //如果不是默认货币需要转换金额
- if (!stock.getStockType().equals(EStockType.getDefault().getCode())) {
- buyAmt = userAssetsServices.exchangeAmountByRate(stock.getStockType(), buyAmt);
- }
+ //手续费
BigDecimal orderFree = siteSettingBuyFee.multiply(buyAmt);
-
+ BigDecimal needBuyAmt = buyAmt.add(orderFree);
+ //资金校验
+ if (!stock.getStockType().equals(EStockType.getDefault().getCode())) {
+ needBuyAmt = userAssetsServices.exchangeAmountByRate(stock.getStockType(), buyAmt);
+ }
BigDecimal fundratio = new BigDecimal(user.getFundRatio()).divide(new BigDecimal(100));
BigDecimal availableBalance = fundratio.multiply(userAssets.getAvailableBalance());
- if (availableBalance.compareTo(buyAmt.add(orderFree)) < 0) {
+ if (availableBalance.compareTo(needBuyAmt) < 0) {
return ServerResponse.createByErrorMsg("订单失败,配资不足", request);
}
+
UserPosition userPosition = new UserPosition();
if (profitTarget != null && profitTarget.compareTo(new BigDecimal("0")) > 0) {
userPosition.setProfitTargetPrice(profitTarget);
@@ -217,7 +217,7 @@
}
userPosition.setIsLock(Integer.valueOf(0));
userPosition.setOrderLever(lever);
- userPosition.setOrderTotalPrice(finalBuyAmt);
+ userPosition.setOrderTotalPrice(buyAmt);
// 手续费
userPosition.setOrderFee(orderFree);
--
Gitblit v1.9.3