From d4be4cc69f18b01cc39bd3f9dc9497a828848ca8 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 30 Sep 2025 11:18:44 +0800
Subject: [PATCH] 1
---
trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java | 52 +++++++++++++++++++++++++++++++++-------------------
1 files changed, 33 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 f687e47..a883d85 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,24 @@
// 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 "));
- if(ObjectUtil.isEmpty(capitaltWallet)){
+// CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+// .eq(CapitaltWallet::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(), withdraw.getVolume())))
+// .eq(CapitaltWallet::getUserId,wallet.getUserId()));
+
+ Wallet wallet1 = walletService.getOne(new LambdaQueryWrapper<>(Wallet.class)
+ .eq(Wallet::getUserId, wallet.getUserId().toString()).last(" limit 1 "));
+ if(ObjectUtil.isEmpty(wallet1)){
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(wallet1.getMoney(), withdraw.getVolume())))
+ .eq(Wallet::getUserId,wallet.getUserId()));
+
/*
@@ -210,7 +222,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 +447,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,11 +492,11 @@
throw new YamiShopBindException("Your account has been frozen");
}
-// Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId());
+ Wallet wallet = 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()) {
+// CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+// .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 "));
+ if (wallet.getMoney().doubleValue() < withdraw.getVolume().doubleValue()) {
throw new YamiShopBindException("not sufficient funds");
}
// 手续费(USDT)
@@ -667,17 +681,17 @@
*/
String withdraw_qr = qRGenerateService.generateWithdraw(withdraw.getOrderNo(), withdraw.getAddress());
withdraw.setQdcode(withdraw_qr);
- double amount_before = capitaltWallet.getMoney().doubleValue();
+ double amount_before = wallet.getMoney().doubleValue();
// walletService.update(wallet.getUserId().toString(), Arith.sub(0, withdraw.getVolume().doubleValue()));
- if(ObjectUtil.isEmpty(capitaltWallet)){
+ if(ObjectUtil.isEmpty(wallet)){
throw new YamiShopBindException("The user's funds account does not exist!");
}
- capitaltWalletService.update(capitaltWallet,-withdraw.getAmount().doubleValue());
+ walletService.update(wallet.getUserId(),-withdraw.getVolume().doubleValue());
save(withdraw);
@@ -688,7 +702,7 @@
moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
moneyLog.setAmountBefore(new BigDecimal(amount_before));
moneyLog.setAmount(new BigDecimal(Arith.sub(0, withdraw.getVolume().doubleValue())));
- moneyLog.setAmountAfter(capitaltWallet.getMoney());
+ moneyLog.setAmountAfter(wallet.getMoney());
moneyLog.setLog("提现订单[" + withdraw.getOrderNo() + "]");
// moneyLog.setExtra(withdraw.getOrder_no());
moneyLog.setUserId(withdraw.getUserId());
--
Gitblit v1.9.3