From d1db4f297660cc15a280bcc1c838d95b01187d5f Mon Sep 17 00:00:00 2001
From: peter <14100000001@qq.com>
Date: Sat, 20 Sep 2025 16:58:00 +0800
Subject: [PATCH] 地址修改
---
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java b/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java
index 28b9557..9b16eb1 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java
@@ -1,5 +1,8 @@
package com.yami.trading.api.controller;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.yami.trading.bean.model.CapitaltWallet;
+import com.yami.trading.bean.model.User;
import com.yami.trading.bean.model.Withdraw;
import com.yami.trading.common.constants.Constants;
import com.yami.trading.common.domain.Result;
@@ -8,6 +11,7 @@
import com.yami.trading.common.util.DateUtils;
import com.yami.trading.common.util.StringUtils;
import com.yami.trading.security.common.util.SecurityUtils;
+import com.yami.trading.service.CapitaltWalletService;
import com.yami.trading.service.SessionTokenService;
import com.yami.trading.service.WithdrawService;
import com.yami.trading.service.syspara.SysparaService;
@@ -44,6 +48,8 @@
private SysparaService sysparaService;
@Autowired
protected WalletLogService walletLogService;
+ @Autowired
+ CapitaltWalletService capitaltWalletService;
/**
* 首次进入页面,传递session_token
@@ -73,10 +79,13 @@
String amount, String from, String currency,
String channel){
String partyId = SecurityUtils.getUser().getUserId();
- boolean lock = false;
String error = this.verif(amount);
if (!StringUtils.isNullOrEmpty(error)) {
throw new YamiShopBindException(error);
+ }
+ User user = userService.getById(partyId);
+ if(user.isWithdrawAuthority() == false){
+ throw new YamiShopBindException("Account is abnormal and has been restricted from making withdrawals.");
}
double amount_double = Double.valueOf(amount).doubleValue();
@@ -86,24 +95,30 @@
throw new YamiShopBindException("系统参数错误");
}
- if ("true".equals(exchange_withdraw_need_safeword)) {
+// if ("true".equals(exchange_withdraw_need_safeword)) {
+//
+// if (StringUtils.isEmptyString(safeword)) {
+// throw new YamiShopBindException("资金密码不能为空");
+// }
+//
+// if (safeword.length() < 6 || safeword.length() > 12) {
+// throw new YamiShopBindException("资金密码必须6-12位");
+// }
+// if (!userService.checkLoginSafeword(SecurityUtils.getUser().getUserId(),safeword)){
+// throw new YamiShopBindException("资金密码错误");
+// }
+// }
- if (StringUtils.isEmptyString(safeword)) {
- throw new YamiShopBindException("资金密码不能为空");
- }
-
- if (safeword.length() < 6 || safeword.length() > 12) {
- throw new YamiShopBindException("资金密码必须6-12位");
- }
- if (!userService.checkLoginSafeword(SecurityUtils.getUser().getUserId(),safeword)){
- throw new YamiShopBindException("资金密码错误");
+ // 获取资金账户(capital)
+ if(channel.contains("USDT")){
+ CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+ .eq(CapitaltWallet::getUserId, partyId).last(" limit 1 "));
+ if(capitaltWallet.getMoney().compareTo(new BigDecimal(amount)) < 0){
+ throw new YamiShopBindException("Insufficient available balance for withdrawal!");
}
}
- Object object = this.sessionTokenService.cacheGet(session_token);
+
this.sessionTokenService.del(session_token);
-// if (null == object || !SecurityUtils.getUser().getUserId().equals((String) object)) {
-// throw new YamiShopBindException("请稍后再试");
-// }
Withdraw withdraw = new Withdraw();
withdraw.setUserId(partyId);
withdraw.setVolume(new BigDecimal(amount_double));
--
Gitblit v1.9.3