From 14c1946eae86a86f8d1edee6cf3bdaf7572fc966 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Thu, 30 Oct 2025 19:44:38 +0800
Subject: [PATCH] 1
---
trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java | 48 +++++++++++++++++++++++++++++-------------------
1 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java
index c31b132..919fc6a 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java
@@ -124,7 +124,7 @@
Withdraw withdraw = getById(id);
if (withdraw.getStatus() == 2 ) {// 通过后不可驳回
- return;
+ throw new YamiShopBindException("订单已操作,请不要重复操作!");
}
Date date = new Date();
withdraw.setReviewTime(date);
@@ -135,10 +135,12 @@
String symbol = "";
if (withdraw.getMethod().indexOf("BTC") != -1) {
- symbol = "btc";
+ symbol = "btcusdt";
} else if (withdraw.getMethod().indexOf("ETH") != -1) {
- symbol = "eth";
- } else {
+ symbol = "ethusdt";
+ } else if(withdraw.getMethod().indexOf("USDC") != -1){
+ symbol = "usdcusdt";
+ }else {
symbol = "usdt";
}
if ("usdt".equals(symbol)) {
@@ -149,14 +151,16 @@
// walletService.update(wallet.getUserId().toString(),
// Arith.add(withdraw.getAmount(), withdraw.getAmountFee()));
- CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
- .eq(CapitaltWallet::getUserId, wallet.getUserId().toString()).last(" limit 1 "));
+// CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+// .eq(CapitaltWallet::getUserId, wallet.getUserId().toString()).last(" limit 1 "));
+ Wallet capitaltWallet = walletService.getOne(new LambdaQueryWrapper<>(Wallet.class)
+ .eq(Wallet::getUserId, wallet.getUserId().toString()).last(" limit 1 "));
if(ObjectUtil.isEmpty(capitaltWallet)){
throw new YamiShopBindException("用户资金账户不存在!");
}
- capitaltWalletService.update(new LambdaUpdateWrapper<CapitaltWallet>()
- .set(CapitaltWallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney().doubleValue(), amount_before)))
- .eq(CapitaltWallet::getUserId,wallet.getUserId()));
+ walletService.update(new LambdaUpdateWrapper<Wallet>()
+ .set(Wallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney(), withdraw.getVolume())))
+ .eq(Wallet::getUserId,wallet.getUserId()));
/*
@@ -210,7 +214,6 @@
logService.save(log);
tipService.deleteTip(withdraw.getUuid().toString());
}
-
@Override
public long waitCount() {
return count(Wrappers.<Withdraw>query().lambda().eq(Withdraw::getStatus, 0));
@@ -436,6 +439,9 @@
} else if (channel.indexOf("ETH") != -1) {
saveApplyOtherChannel(withdraw, "ethusdt");
return;
+ }else if(channel.indexOf("USDC") != -1){
+ saveApplyOtherChannel(withdraw, "usdcusdt");
+ return;
}
User party = userService.getById(withdraw.getUserId());
if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) {
@@ -478,10 +484,10 @@
throw new YamiShopBindException("Your account has been frozen");
}
-// Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId());
-
- CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
- .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 "));
+ Wallet capitaltWallet = walletService.saveWalletByPartyId(withdraw.getUserId());
+//
+// CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+// .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 "));
if (capitaltWallet.getMoney().doubleValue() < withdraw.getVolume().doubleValue()) {
throw new YamiShopBindException("not sufficient funds");
}
@@ -645,6 +651,8 @@
}
}
}
+ //固定手续费10u
+ fee = 10;
withdraw.setAmountFee(new BigDecimal(fee));
withdraw.setAmount(new BigDecimal(Arith.sub(withdraw.getVolume().doubleValue(), fee)));
if (channel.indexOf("USDT") != -1) {
@@ -677,7 +685,9 @@
if(ObjectUtil.isEmpty(capitaltWallet)){
throw new YamiShopBindException("The user's funds account does not exist!");
}
- capitaltWalletService.update(capitaltWallet,-withdraw.getAmount().doubleValue());
+// walletService.update(capitaltWallet,-withdraw.getVolume().doubleValue());
+ walletService.update(capitaltWallet.getUserId(),-withdraw.getVolume().doubleValue());
+
save(withdraw);
@@ -780,11 +790,11 @@
}
String withdraw_limit = sysparaService.find("withdraw_limit_" + symbol).getSvalue();
if (amount.doubleValue() < Double.valueOf(withdraw_limit)) {
- throw new YamiShopBindException("提现不得小于限额");
+ throw new YamiShopBindException("Withdrawal amount must not be less than the limit.");
}
String withdraw_limit_max = sysparaService.find("withdraw_limit_max").getSvalue();
if (amount.doubleValue() > Double.valueOf(withdraw_limit_max)) {
- throw new YamiShopBindException("提现不得大于限额");
+ throw new YamiShopBindException("Withdrawal amount cannot exceed the limit.");
}
/**
* 当日提现次数是否超过
@@ -793,7 +803,7 @@
List<Withdraw> withdraw_days = findAllByDate(withdraw.getUserId().toString());
if (withdraw_limit_num > 0 && withdraw_days != null) {
if (withdraw_days.size() >= withdraw_limit_num) {
- throw new YamiShopBindException("当日可提现次数不足");
+ throw new YamiShopBindException("The number of times funds can be withdrawn on the same day is insufficient.");
}
}
/**
@@ -808,7 +818,7 @@
//
String dateString = sdf.format(date);
if (dateString.compareTo(withdraw_time[0]) < 0 || dateString.compareTo(withdraw_time[1]) > 0) {
- throw new YamiShopBindException("不在可提现时间内");
+ throw new YamiShopBindException("Not within the available withdrawal periodNot within the available withdrawal period");
}
}
WithdrawFeeVo withdrawFeeVo = getFee(withdraw.getMethod(), withdraw.getAmount().doubleValue());
--
Gitblit v1.9.3