From c51c656bb90a3b6b644a688d3b7bffc8cdf48379 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Wed, 13 Aug 2025 15:43:05 +0800
Subject: [PATCH] app充值列表,提现修改
---
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 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..bbfb131 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);
@@ -1809,9 +1809,9 @@
BigDecimal newBuyAmt = buyAmt;
//如果不是默认货币需要转换金额
- if (!stock.getStockType().equals(EStockType.getDefault().getCode())) {
+ /*if (!stock.getStockType().equals(EStockType.getDefault().getCode())) {
newBuyAmt = userAssetsServices.exchangeAmountByRate(stock.getStockType(), buyAmt);
- }
+ }*/
if(newBuyAmt.compareTo(userAssets.getAvailableBalance()) > 0){
return ServerResponse.createByErrorMsg("可用余额不足" + userAssets.getAvailableBalance(), request);
}
@@ -1829,9 +1829,9 @@
UserPosition userPosition = getUserPosition(dzId,num, user, stockDz, nowPrice, stock, buyAmt);
userPositionMapper.insert(userPosition);
BigDecimal buy_fee_amt = siteSettingBuyFee.multiply(newBuyAmt);
- //已经转化 直接传默认类型
- userAssetsServices.availablebalanceChange(EStockType.getDefault().getCode(), user.getId(), EUserAssets.BUY, newBuyAmt.negate(),"","");
- iUserAssetsServices.availablebalanceChange(EStockType.getDefault().getCode(), userAssets.getUserId(), EUserAssets.HANDLING_CHARGE, buy_fee_amt, "", "");
+
+ userAssetsServices.availablebalanceChange(stock.getStockType(), user.getId(), EUserAssets.BUY, newBuyAmt.negate(),"","");
+ iUserAssetsServices.availablebalanceChange(stock.getStockType(), userAssets.getUserId(), EUserAssets.HANDLING_CHARGE, buy_fee_amt, "", "");
return ServerResponse.createBySuccess("购买成功", request);
} catch (Exception e) {
log.error("大宗下单异常{}", e.getMessage());
--
Gitblit v1.9.3