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/AdminWithdrawServiceImpl.java |   80 ++++++++++++++++++++++++----------------
 1 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java b/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
index e1796a8..0c6f10e 100644
--- a/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
+++ b/src/main/java/project/withdraw/internal/AdminWithdrawServiceImpl.java
@@ -48,7 +48,7 @@
 	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());
@@ -117,6 +132,7 @@
 		tipService.deleteTip(withdraw.getId().toString());
 	}
 
+
 	@Override
 	public void saveSucceeded(String id, String safeword, String userName, String partyId) {
 		SecUser var5 = this.secUserService.findUserByLoginName(userName);

--
Gitblit v1.9.3