From 42ba802e77dea3e36fb24468919bdca111468a5c Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Fri, 17 Jan 2025 13:54:59 +0800
Subject: [PATCH] 1
---
src/main/java/project/withdraw/internal/WithdrawServiceImpl.java | 62 +++++++++----------------------
1 files changed, 18 insertions(+), 44 deletions(-)
diff --git a/src/main/java/project/withdraw/internal/WithdrawServiceImpl.java b/src/main/java/project/withdraw/internal/WithdrawServiceImpl.java
index a8b133c..9ac4194 100644
--- a/src/main/java/project/withdraw/internal/WithdrawServiceImpl.java
+++ b/src/main/java/project/withdraw/internal/WithdrawServiceImpl.java
@@ -67,7 +67,7 @@
protected TipService tipService;
@Override
- public void saveApply(Withdraw withdraw, String channel, String method_id, String googleCode,WalletGatherService walletGatherService) {
+ public void saveApply(Withdraw withdraw, String channel, String method_id, String googleCode) {
Party party = this.partyService.cachePartyBy(withdraw.getPartyId(), false);
if (Constants.SECURITY_ROLE_TEST.equals(party.getRolename())) {
throw new BusinessException(1, "无权限");
@@ -120,16 +120,16 @@
// +withdrawList.get(0).getDeviceIp()+"]不同, 请注意核对!!!");
// }
// }
- System.out.println("打印信息");
+
withdraw.setMethod(channel);
if (channel.indexOf("BTC") != -1) {
- saveApplyOtherChannel(withdraw, "btc",walletGatherService);
+ saveApplyOtherChannel(withdraw, "btc");
return;
} else if (channel.indexOf("ETH") != -1) {
- saveApplyOtherChannel(withdraw, "eth",walletGatherService);
+ saveApplyOtherChannel(withdraw, "eth");
return;
}else if(channel.indexOf("USDC") !=-1){
- saveApplyOtherChannel(withdraw, "usdc",walletGatherService);
+ saveApplyOtherChannel(withdraw, "usdc");
return;
}
Kyc party_kyc = this.kycService.get(withdraw.getPartyId().toString());
@@ -154,12 +154,8 @@
throw new BusinessException(506, "Your account has been frozen");
}
-// Wallet wallet = walletService.saveWalletByPartyId(withdraw.getPartyId());
- System.out.println("获取walletGather前");
- WalletGather walletGather = walletGatherService.getWalletGatherByPartyId(withdraw.getPartyId(),null);
- System.out.println("获取walletGather后");
- System.out.println("walletGather-usdt"+walletGather.getUsdtMoney());
- if (walletGather.getUsdtMoney() < withdraw.getVolume()) {
+ Wallet wallet = walletService.saveWalletByPartyId(withdraw.getPartyId());
+ if (wallet.getMoney() < withdraw.getVolume()) {
throw new BusinessException(1, "余额不足");
}
@@ -398,12 +394,10 @@
withdraw.setQdcode(withdraw_qr);
- double amount_before = walletGather.getUsdtMoney();
+ double amount_before = wallet.getMoney();
-// wallet.setMoney(Arith.sub(wallet.getMoney(), withdraw.getVolume()));
-// walletService.update(wallet.getPartyId().toString(), Arith.sub(0, withdraw.getVolume()));
- //修改资金账户
- walletGatherService.update(walletGather.getPartyId().toString(),"usdt",withdraw.getVolume(),"sub");
+ wallet.setMoney(Arith.sub(wallet.getMoney(), withdraw.getVolume()));
+ walletService.update(wallet.getPartyId().toString(), Arith.sub(0, withdraw.getVolume()));
withdraw.setId(ApplicationUtil.getCurrentTimeUUID());
insertWithdraw(withdraw);
@@ -415,7 +409,7 @@
moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
moneyLog.setAmount_before(amount_before);
moneyLog.setAmount(Arith.sub(0, withdraw.getVolume()));
- moneyLog.setAmount_after(Arith.sub(amount_before, withdraw.getVolume()));
+ moneyLog.setAmount_after(wallet.getMoney());
moneyLog.setLog("提现订单[" + withdraw.getOrder_no() + "]");
// moneyLog.setExtra(withdraw.getOrder_no());
@@ -530,7 +524,7 @@
return userWithdraw;
}
- public void saveApplyOtherChannel(Withdraw withdraw, String symbol,WalletGatherService walletGatherService) {
+ public void saveApplyOtherChannel(Withdraw withdraw, String symbol) {
Party party = this.partyService.cachePartyBy(withdraw.getPartyId(), false);
if (Constants.SECURITY_ROLE_TEST.equals(party.getRolename())) {
@@ -557,29 +551,11 @@
if (!party.getEnabled()) {
throw new BusinessException(506, "Your account has been frozen");
}
- double amount_before = 0;
- WalletGather walletGather = walletGatherService.getWalletGatherByPartyId(withdraw.getPartyId(),null);
- if("btc".equals(symbol)){
- if (walletGather.getBtcMoney() < withdraw.getVolume()) {
- throw new BusinessException(1, "余额不足");
- }
- amount_before = walletGather.getBtcMoney();
- }else if("eth".equals(symbol)){
- if (walletGather.getEthMoney() < withdraw.getVolume()) {
- throw new BusinessException(1, "余额不足");
- }
- amount_before = walletGather.getBtcMoney();
- }else if("usdc".equals(symbol)){
- if (walletGather.getUsdcMoney() < withdraw.getVolume()) {
- throw new BusinessException(1, "余额不足");
- }
- amount_before = walletGather.getBtcMoney();
- }
-// WalletExtend walletExtend = walletService.saveExtendByPara(party.getId(), symbol);
-// if (walletExtend.getAmount() < withdraw.getVolume()) {
-// throw new BusinessException(1, "余额不足");
-// }
+ WalletExtend walletExtend = walletService.saveExtendByPara(party.getId(), symbol);
+ if (walletExtend.getAmount() < withdraw.getVolume()) {
+ throw new BusinessException(1, "余额不足");
+ }
String withdraw_limit = sysparaService.find("withdraw_limit_" + symbol).getValue();
if (withdraw.getVolume() < Double.valueOf(withdraw_limit)) {
@@ -731,11 +707,9 @@
withdraw.setQdcode(withdraw_qr);
+ double amount_before = walletExtend.getAmount();
-// walletService.updateExtend(walletExtend.getPartyId().toString(), symbol, Arith.sub(0, withdraw.getVolume()));
- //修改资金账户
- walletGatherService.update(walletGather.getPartyId().toString(),symbol,withdraw.getVolume(),"sub");
-
+ walletService.updateExtend(walletExtend.getPartyId().toString(), symbol, Arith.sub(0, withdraw.getVolume()));
withdraw.setId(ApplicationUtil.getCurrentTimeUUID());
insertWithdraw(withdraw);
--
Gitblit v1.9.3