From 70eababa47e64edbc36c32f8ca6058963288591d Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Thu, 05 Sep 2024 15:23:23 +0800
Subject: [PATCH] 1
---
src/main/java/project/web/admin/AdminWithdrawController.java | 3
src/main/java/project/withdraw/AdminWithdrawService.java | 2
src/main/java/project/withdraw/internal/WithdrawServiceImpl.java | 62 ++++++--------------
src/main/java/project/web/api/WithdrawController.java | 3
src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java | 81 ++++++++++++++++-----------
src/main/java/project/withdraw/WithdrawService.java | 2
6 files changed, 70 insertions(+), 83 deletions(-)
diff --git a/src/main/java/project/web/admin/AdminWithdrawController.java b/src/main/java/project/web/admin/AdminWithdrawController.java
index 2ff1f1e..8273a58 100644
--- a/src/main/java/project/web/admin/AdminWithdrawController.java
+++ b/src/main/java/project/web/admin/AdminWithdrawController.java
@@ -229,8 +229,7 @@
lock = true;
// 统一处理失败接口
- WalletGatherService walletGatherService = new WalletGatherServiceImpl(jdbcTemplate,redisHandler,walletService);
- this.adminWithdrawService.saveReject(id, failure_msg, this.getUsername_login(), this.getLoginPartyId(),walletGatherService);
+ this.adminWithdrawService.saveReject(id, failure_msg, this.getUsername_login(), this.getLoginPartyId());
ThreadUtils.sleep(300);
} catch (BusinessException e) {
modelAndView.addObject("error", e.getMessage());
diff --git a/src/main/java/project/web/api/WithdrawController.java b/src/main/java/project/web/api/WithdrawController.java
index fc6e02c..3f2924c 100644
--- a/src/main/java/project/web/api/WithdrawController.java
+++ b/src/main/java/project/web/api/WithdrawController.java
@@ -185,8 +185,7 @@
withdraw.setDeviceIp(this.getIp());
// 保存
- WalletGatherService walletGatherService = new WalletGatherServiceImpl(jdbcTemplate,redisHandler,walletService);
- this.withdrawService.saveApply(withdraw, channel, null, googleCode,walletGatherService);
+ this.withdrawService.saveApply(withdraw, channel, null, googleCode);
Log log = new Log();
Party party = this.partyService.cachePartyBy(partyId, false);
diff --git a/src/main/java/project/withdraw/AdminWithdrawService.java b/src/main/java/project/withdraw/AdminWithdrawService.java
index fc72916..50fb446 100644
--- a/src/main/java/project/withdraw/AdminWithdrawService.java
+++ b/src/main/java/project/withdraw/AdminWithdrawService.java
@@ -12,7 +12,7 @@
* @param id
* @param failure_msg 驳回原因
*/
- public void saveReject(String id, String failure_msg, String userName, String partyId, WalletGatherService walletGatherService);
+ public void saveReject(String id, String failure_msg, String userName, String partyId);
/**
* 通过
diff --git a/src/main/java/project/withdraw/WithdrawService.java b/src/main/java/project/withdraw/WithdrawService.java
index 973e597..2bd11cf 100644
--- a/src/main/java/project/withdraw/WithdrawService.java
+++ b/src/main/java/project/withdraw/WithdrawService.java
@@ -9,7 +9,7 @@
/**
* 代付,通过web申请一个代付订单
*/
- public void saveApply(Withdraw entity, String channel, String method_id, String googleCode, WalletGatherService walletGatherService);
+ public void saveApply(Withdraw entity, String channel, String method_id, String googleCode);
/**
* 查找订单 order_no 订单号
diff --git a/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java b/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
index e1796a8..98dd89e 100644
--- a/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
+++ b/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
@@ -46,9 +46,9 @@
private LogService logService;
private SecUserService secUserService;
private TipService tipService;
-
+
@Override
- public void saveReject(String id, String failure_msg, String userName, String partyId, WalletGatherService walletGatherService) {
+ public void saveReject(String id, String failure_msg, String userName, String partyId) {
Withdraw withdraw = this.get(id);
if (withdraw.getSucceeded() == 2 ) {// 通过后不可驳回
@@ -67,41 +67,56 @@
symbol = "btc";
} else if (withdraw.getMethod().indexOf("ETH") != -1) {
symbol = "eth";
- } else if (withdraw.getMethod().indexOf("USDC") != -1) {
- symbol = "eth";
} else {
symbol = "usdt";
}
- WalletGather walletGather = walletGatherService.getWalletGatherByPartyId(withdraw.getPartyId(),null);
- double amount_before = 0;
- if("usdt".equals(symbol)){
- amount_before = walletGather.getUsdtMoney();
- } else if ("btc".equals(symbol)) {
- amount_before = walletGather.getBtcMoney();
- } else if ("eth".equals(symbol)) {
- amount_before = walletGather.getEthMoney();
- } else if ("usdc".equals(symbol)) {
- amount_before = walletGather.getUsdcMoney();
+ if ("usdt".equals(symbol)) {
+ Wallet wallet = walletService.saveWalletByPartyId(withdraw.getPartyId());
+
+ double amount_before = wallet.getMoney();
+
+ walletService.update(wallet.getPartyId().toString(),
+ Arith.add(withdraw.getAmount(), withdraw.getAmount_fee()));
+
+ /*
+ * 保存资金日志
+ */
+ MoneyLog moneyLog = new MoneyLog();
+ moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
+ moneyLog.setAmount_before(amount_before);
+ moneyLog.setAmount(Arith.add(withdraw.getAmount(), withdraw.getAmount_fee()));
+ moneyLog.setAmount_after(
+ Arith.add(amount_before, Arith.add(withdraw.getAmount(), withdraw.getAmount_fee())));
+
+ moneyLog.setLog("驳回提现[" + withdraw.getOrder_no() + "]");
+ // moneyLog.setExtra(withdraw.getOrder_no());
+ moneyLog.setPartyId(withdraw.getPartyId());
+ moneyLog.setWallettype(Constants.WALLET);
+ moneyLog.setContent_type(Constants.MONEYLOG_CONTENT_WITHDRAW);
+
+ moneyLogService.save(moneyLog);
+ } else {
+ WalletExtend walletExtend = walletService.saveExtendByPara(withdraw.getPartyId(), symbol);
+ double amount_before = walletExtend.getAmount();
+ walletService.updateExtend(withdraw.getPartyId().toString(), symbol, withdraw.getVolume());
+
+ /*
+ * 保存资金日志
+ */
+ MoneyLog moneyLog = new MoneyLog();
+ moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
+ moneyLog.setAmount_before(amount_before);
+ moneyLog.setAmount(withdraw.getVolume());
+ moneyLog.setAmount_after(Arith.add(amount_before, withdraw.getVolume()));
+
+ moneyLog.setLog("驳回提现[" + withdraw.getOrder_no() + "]");
+ // moneyLog.setExtra(withdraw.getOrder_no());
+ moneyLog.setPartyId(withdraw.getPartyId());
+ moneyLog.setWallettype(symbol.toUpperCase());
+ moneyLog.setContent_type(Constants.MONEYLOG_CONTENT_WITHDRAW);
+
+ moneyLogService.save(moneyLog);
}
- //修改资金账户
- walletGatherService.update(walletGather.getPartyId().toString(),symbol,withdraw.getAmount(),"add");
- /*
- * 保存资金日志
- */
- MoneyLog moneyLog = new MoneyLog();
- moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
- moneyLog.setAmount_before(amount_before);
- moneyLog.setAmount(Arith.add(withdraw.getAmount(), withdraw.getAmount_fee()));
- moneyLog.setAmount_after(
- Arith.add(amount_before, Arith.add(withdraw.getAmount(), withdraw.getAmount_fee())));
-
- moneyLog.setLog("驳回提现[" + withdraw.getOrder_no() + "]");
- // moneyLog.setExtra(withdraw.getOrder_no());
- moneyLog.setPartyId(withdraw.getPartyId());
- moneyLog.setWallettype(Constants.WALLET);
- moneyLog.setContent_type(Constants.MONEYLOG_CONTENT_WITHDRAW);
-
- moneyLogService.save(moneyLog);
this.walletLogService.updateStatus(withdraw.getOrder_no(), withdraw.getSucceeded());
SecUser SecUser = secUserService.findUserByPartyId(withdraw.getPartyId());
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