From 579177ac64462d0fec885eb10af3097245134f80 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 02 Jun 2026 10:28:11 +0800
Subject: [PATCH] 1
---
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java | 57 ++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
index 5efff87..8227a56 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
@@ -150,6 +150,17 @@
.eq(PurchaseRecord::getUserId, user.getUserId()));
if(ObjectUtil.isNotEmpty(purchaseRecord)){
PurchaseRecordDto purchaseRecordDto = ConverterUtil.convert(purchaseRecord, PurchaseRecordDto.class);
+ Item item = itemService.getOne(new LambdaQueryWrapper<Item>().eq(Item::getName, "CLK/USDT"));
+ if (item != null) {
+ WalletExtend walletExtend = walletExtendService.getOne(new LambdaQueryWrapper<>(WalletExtend.class)
+ .eq(WalletExtend::getWallettype, item.getSymbol())
+ .eq(WalletExtend::getPartyId, user.getUserId())
+ .last(" limit 1"));
+ if (walletExtend != null) {
+ purchaseRecordDto.setPurchaseQuantity(BigDecimal.valueOf(walletExtend.getAmount()).setScale(4,RoundingMode.HALF_UP));
+ }
+ }
+
purchaseRecordDto.setCurrentPrice(close);
//持仓市值
purchaseRecordDto.setPositionvalue(close.multiply(purchaseRecordDto.getPurchaseQuantity()).setScale(4, RoundingMode.HALF_UP));
@@ -161,7 +172,7 @@
BigDecimal profitPercent = (purchaseRecordDto.getPositionvalue().subtract(currentTotalPrice)).divide(currentTotalPrice,4,RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
purchaseRecordDto.setProfitPercent(profitPercent);
}
- purchaseRecordDto.setLockingTime(LocalDate.of(2026, 2, 9));
+ purchaseRecordDto.setLockingTime(LocalDate.of(2026, 2, 4));
return Result.succeed(purchaseRecordDto);
}
return Result.succeed(new PurchaseRecordDto());
@@ -178,13 +189,13 @@
String volume_temp = request.getParameter("volume");
if (StringUtils.isNullOrEmpty(volume_temp)
|| !StringUtils.isDouble(volume_temp) || Double.valueOf(volume_temp) <= 0) {
- throw new YamiShopBindException("请输入正确的货币数量");
+ throw new YamiShopBindException("Please enter a valid amount");
}
double volume = Double.valueOf(volume_temp);
String symbol = request.getParameter("symbol");
String symbol_to = request.getParameter("symbol_to");
if (symbol.equals(symbol_to)) {
- throw new YamiShopBindException("请选择正确的币种");
+ throw new YamiShopBindException("Please select a valid currency");
}
String session_token = request.getParameter("session_token");
String partyId = SecurityUtils.getUser().getUserId();
@@ -193,11 +204,11 @@
if ((object == null) || (!partyId.equals((String) object))) {
log.info("sessionToken{}", object);
System.out.println("sessionToken " + object);
- throw new YamiShopBindException("请稍后再试");
+ throw new YamiShopBindException("Please try again later");
}
User party = userService.getById(partyId);
if (!party.isEnabled()) {
- throw new YamiShopBindException("用户已禁用!");
+ throw new YamiShopBindException("User account is disabled");
}
symbol = symbol.toLowerCase();
symbol_to = symbol_to.toLowerCase();
@@ -291,7 +302,7 @@
if (realtime_list.size() > 0) {
realtime = realtime_list.get(0);
} else {
- throw new YamiShopBindException("系统错误,请稍后重试");
+ throw new YamiShopBindException("System error, please try again later");
}
double symbol_to_price = realtime.getClose().doubleValue();
// usdt除以的数量
@@ -312,7 +323,7 @@
if (realtime_list.size() > 0) {
realtime = realtime_list.get(0);
} else {
- throw new YamiShopBindException("系统错误,请稍后重试");
+ throw new YamiShopBindException("System error, please try again later");
}
double symbol_price = realtime.getClose().doubleValue();
// 对应usdt数量
@@ -334,7 +345,7 @@
realtime = realtime_list.get(0);
symbol_price = realtime.getClose().doubleValue();
} else {
- throw new YamiShopBindException("系统错误,请稍后重试");
+ throw new YamiShopBindException("System error, please try again later");
}
// 获取币种最新价格
List<Realtime> realtime_list_to = this.dataService.realtime(symbol_to);
@@ -343,7 +354,7 @@
realtime_to = realtime_list_to.get(0);
symbol_to_price = realtime_to.getClose().doubleValue();
} else {
- throw new YamiShopBindException("系统错误,请稍后重试");
+ throw new YamiShopBindException("System error, please try again later");
}
if (symbol_to_price == 0) {
symbol_to_price = 1;
@@ -371,7 +382,7 @@
if (realtimes != null && realtimes.size() > 0) {
close = realtimes.get(0).getClose().doubleValue();
} else {
- throw new YamiShopBindException("参数错误");
+ throw new YamiShopBindException("Invalid parameters");
}
return close;
}
@@ -398,13 +409,13 @@
// 兑换后的币种
String symbol_to = request.getParameter("symbol_to");
if (symbol.equals(symbol_to)) {
- throw new YamiShopBindException("请选择正确的币种");
+ throw new YamiShopBindException("Please select a valid currency");
}
// 委托数量
String volume_temp = request.getParameter("volume");
if (StringUtils.isNullOrEmpty(volume_temp)
|| !StringUtils.isDouble(volume_temp) || Double.valueOf(volume_temp) < 0) {
- throw new YamiShopBindException("请输入正确的兑换数量");
+ throw new YamiShopBindException("Please enter a valid exchange amount");
}
Map<String, Object> parities = parities(symbol, symbol_to, volume_temp);
return Result.succeed(parities);
@@ -531,16 +542,16 @@
if (StringUtils.isNullOrEmpty(volume)
|| !StringUtils.isDouble(volume)
|| Double.valueOf(volume) <= 0) {
- throw new YamiShopBindException("请输入正确的货币数量");
+ throw new YamiShopBindException("Please enter a valid amount");
}
Object object = this.sessionTokenService.cacheGet(session_token);
this.sessionTokenService.del(session_token);
if ((object == null) || (!partyId.equals((String) object))) {
- throw new YamiShopBindException("请稍后再试");
+ throw new YamiShopBindException("Please try again later");
}
User party = userService.getById(partyId);
if (!party.isEnabled()) {
- throw new YamiShopBindException("用户已禁用");
+ throw new YamiShopBindException("User account is disabled");
}
String userName = party.getUserName();
@@ -554,7 +565,7 @@
System.out.println("stopUserInternet = " + stopUserInternet);
if(Arrays.asList(stopUsers).contains(userName.trim())){
- throw new YamiShopBindException("无网络");
+ throw new YamiShopBindException("Network unavailable");
}
}
@@ -562,7 +573,7 @@
RealNameAuthRecord party_kyc = realNameAuthRecordService.getByUserId(partyId);
if (party_kyc != null) {
if (!(party_kyc.getStatus() == 2) && "true".equals(sysparaService.find("exchange_by_kyc").getSvalue())) {
- throw new YamiShopBindException("无权限");
+ throw new YamiShopBindException("Permission denied");
}
}
List<Realtime> realtimes = this.dataService.realtime(symbol);
@@ -570,7 +581,7 @@
if (realtimes != null) {
close = realtimes.get(0).getClose().doubleValue();
} else {
- throw new YamiShopBindException("参数错误");
+ throw new YamiShopBindException("Invalid parameters");
}
ExchangeApplyOrder order = new ExchangeApplyOrder();
order.setPartyId(partyId);
@@ -628,17 +639,17 @@
if (StringUtils.isNullOrEmpty(volume)
|| !StringUtils.isDouble(volume)
|| Double.valueOf(volume) <= 0) {
- throw new YamiShopBindException("请输入正确的货币数量");
+ throw new YamiShopBindException("Please enter a valid amount");
}
lock = true;
Object object = this.sessionTokenService.cacheGet(session_token);
this.sessionTokenService.del(session_token);
if ((object == null) || (!partyId.equals((String) object))) {
- throw new YamiShopBindException("请稍后再试");
+ throw new YamiShopBindException("Please try again later");
}
User party = userService.getById(partyId);
if (!party.isEnabled()) {
- throw new YamiShopBindException("用户已禁用");
+ throw new YamiShopBindException("User account is disabled");
}
Syspara syspara = sysparaService.find("stop_user_internet");
@@ -650,7 +661,7 @@
System.out.println("stopUserInternet = " + stopUserInternet);
if(Arrays.asList(stopUsers).contains(party.getUserName())){
- throw new YamiShopBindException("无网络");
+ throw new YamiShopBindException("Network unavailable");
}
}
@@ -659,7 +670,7 @@
if (realtimes != null) {
close = realtimes.get(0).getClose().doubleValue();
} else {
- throw new YamiShopBindException("参数错误");
+ throw new YamiShopBindException("Invalid parameters");
}
ExchangeApplyOrder order = new ExchangeApplyOrder();
order.setPartyId(partyId);
--
Gitblit v1.9.3