From bdb57962dba08b4177d500639ec56fbd74306c67 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Fri, 06 Feb 2026 17:39:04 +0800
Subject: [PATCH] 提现

---
 trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java |   67 ++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 30 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 b659dc8..95d428f 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
@@ -95,6 +95,8 @@
                 symbol = "btc";
             } else if (withdraw.getMethod().indexOf("ETH") != -1) {
                 symbol = "eth";
+            } else if (withdraw.getMethod().indexOf("USDC") != -1) {
+                symbol = "usdc";
             } else {
                 symbol = "usdt";
             }
@@ -124,7 +126,7 @@
         Withdraw withdraw = getById(id);
 
         if (withdraw.getStatus() == 2 ) {// 通过后不可驳回
-            return;
+            throw new YamiShopBindException("订单已操作,请不要重复操作!");
         }
         Date date = new Date();
         withdraw.setReviewTime(date);
@@ -135,11 +137,15 @@
 
         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 if (withdraw.getMethod().indexOf("USDT") != -1) {
             symbol = "usdt";
+        } else {
+            return;
         }
         if ("usdt".equals(symbol)) {
             Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId());
@@ -155,7 +161,7 @@
                 throw new YamiShopBindException("用户资金账户不存在!");
             }
             capitaltWalletService.update(new LambdaUpdateWrapper<CapitaltWallet>()
-                    .set(CapitaltWallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney().doubleValue(), amount_before)))
+                    .set(CapitaltWallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney(), withdraw.getVolume())))
                     .eq(CapitaltWallet::getUserId,wallet.getUserId()));
 
 
@@ -219,7 +225,7 @@
     public void saveApplyOtherChannel(Withdraw withdraw, String symbol) {
         User party = userService.getById(withdraw.getUserId());
         if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) {
-            throw new YamiShopBindException("无权限");
+            throw new YamiShopBindException("no access");
         }
         RealNameAuthRecord party_kyc = realNameAuthRecordService.getByUserId(withdraw.getUserId());
         HighLevelAuthRecord party_kycHighLevel = highLevelAuthRecordService.findByUserId(withdraw.getUserId());
@@ -230,12 +236,12 @@
             party_kyc=new  RealNameAuthRecord();
         }
         if (!(party_kyc.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) {
-            throw new YamiShopBindException("未基础认证");
+            throw new YamiShopBindException("Not yet certified at the basic level");
         }
         double withdraw_by_high_kyc = Double.valueOf(sysparaService.find("withdraw_by_high_kyc").getSvalue());
         if (withdraw_by_high_kyc > 0 && withdraw.getVolume().doubleValue() > withdraw_by_high_kyc
                 && !(party_kycHighLevel.getStatus() == 2)) {
-            throw new YamiShopBindException("请先通过高级认证");
+            throw new YamiShopBindException("Please go through the advanced certification process first.");
         }
 //        if (!party.isWithdrawAuthority()) {
 //            throw new YamiShopBindException("无权限");
@@ -245,15 +251,15 @@
         }
         WalletExtend walletExtend = walletService.saveExtendByPara(party.getUserId(), symbol);
         if (walletExtend.getAmount() < withdraw.getVolume().doubleValue()) {
-            throw new YamiShopBindException("余额不足");
+            throw new YamiShopBindException("not sufficient funds");
         }
         String withdraw_limit = sysparaService.find("withdraw_limit_" + symbol).getSvalue();
         if (withdraw.getVolume().doubleValue() < Double.valueOf(withdraw_limit)) {
-            throw new YamiShopBindException("提现不得小于限额");
+            throw new YamiShopBindException("Withdrawal amount must not be less than the limit.");
         }
         String withdraw_limit_max = sysparaService.find("withdraw_limit_max").getSvalue();
         if (withdraw.getVolume().doubleValue() > Double.valueOf(withdraw_limit_max)) {
-            throw new YamiShopBindException("提现不得大于限额");
+            throw new YamiShopBindException("Withdrawal amount cannot exceed the limit.");
         }
         /**
          * 当日提现次数是否超过
@@ -262,7 +268,7 @@
         List<Withdraw> withdraw_days = findAllByDate(withdraw.getUserId().toString());
         if (withdraw_limit_num > 0 && withdraw_days != null) {
             if (withdraw_days.size() >= withdraw_limit_num) {
-                throw new YamiShopBindException("当日可提现次数不足");
+                throw new YamiShopBindException("The number of times funds can be withdrawn on the same day is insufficient.");
             }
         }
         /**
@@ -277,7 +283,7 @@
             //
             String dateString = sdf.format(date);
             if (dateString.compareTo(withdraw_time[0]) < 0 || dateString.compareTo(withdraw_time[1]) > 0) {
-                throw new YamiShopBindException("不在可提现时间内");
+                throw new YamiShopBindException("Not within the available withdrawal period");
             }
         }
         /**
@@ -431,10 +437,13 @@
     public void saveApply(Withdraw withdraw, String channel, String method_id) {
         withdraw.setMethod(channel);
         if (channel.indexOf("BTC") != -1) {
-            saveApplyOtherChannel(withdraw, "btc");
+            saveApplyOtherChannel(withdraw, "btcusdt");
             return;
         } else if (channel.indexOf("ETH") != -1) {
-            saveApplyOtherChannel(withdraw, "eth");
+            saveApplyOtherChannel(withdraw, "ethusdt");
+            return;
+        } else if (channel.indexOf("USDC") != -1) {
+            saveApplyOtherChannel(withdraw, "usdcusdt");
             return;
         }
         User party = userService.getById(withdraw.getUserId());
@@ -483,7 +492,7 @@
         CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
                 .eq(CapitaltWallet::getUserId, withdraw.getUserId()).last(" limit 1 "));
         if (capitaltWallet.getMoney().doubleValue() < withdraw.getVolume().doubleValue()) {
-            throw new YamiShopBindException("余额不足");
+            throw new YamiShopBindException("not sufficient funds");
         }
         // 手续费(USDT)
         /**
@@ -520,11 +529,11 @@
         }
         String withdraw_limit = sysparaService.find("withdraw_limit").getSvalue();
         if (withdraw.getVolume().doubleValue() < Double.valueOf(withdraw_limit)) {
-            throw new YamiShopBindException("提现不得小于限额");
+            throw new YamiShopBindException("Withdrawal amount must not be less than the limit.");
         }
         String withdraw_limit_max = sysparaService.find("withdraw_limit_max").getSvalue();
         if (withdraw.getVolume().doubleValue() > Double.valueOf(withdraw_limit_max)) {
-            throw new YamiShopBindException("提现不得大于限额");
+            throw new YamiShopBindException("Withdrawal amount must not be less than the withdrawal limit and must not exceed the withdrawal limit.");
         }
         /**
          * 当日提现次数是否超过
@@ -533,7 +542,7 @@
         List<Withdraw> withdraw_days = findAllByDate(withdraw.getUserId().toString());
         if (withdraw_limit_num > 0 && withdraw_days != null) {
             if (withdraw_days.size() >= withdraw_limit_num) {
-                throw new YamiShopBindException("当日可提现次数不足");
+                throw new YamiShopBindException("The number of times funds can be withdrawn on the same day is insufficient.");
             }
         }
         /**
@@ -548,7 +557,7 @@
             //
             String dateString = sdf.format(date);
             if (dateString.compareTo(withdraw_time[0]) < 0 || dateString.compareTo(withdraw_time[1]) > 0) {
-                throw new YamiShopBindException("不在可提现时间内");
+                throw new YamiShopBindException("Not within the available withdrawal period");
             }
         }
         /**
@@ -651,9 +660,9 @@
             withdraw.setMethod(channel);
         }
         else if ("OTC".equals(channel)) {
-            throw new YamiShopBindException("渠道未开通");
+            throw new YamiShopBindException("Channel not activated");
         } else {
-            throw new YamiShopBindException("渠道未开通");
+            throw new YamiShopBindException("Channel not activated");
         }
         log.info("========================getOrderNo=======11111111=============================================");
 
@@ -675,11 +684,9 @@
 
 
         if(ObjectUtil.isEmpty(capitaltWallet)){
-            throw new YamiShopBindException("用户资金账户不存在!");
+            throw new YamiShopBindException("The user's funds account does not exist!");
         }
-        capitaltWalletService.update(new LambdaUpdateWrapper<CapitaltWallet>()
-                .set(CapitaltWallet::getMoney,new BigDecimal(Arith.sub(capitaltWallet.getMoney().doubleValue(), amount_before)))
-                .eq(CapitaltWallet::getUserId,capitaltWallet.getUserId()));
+        capitaltWalletService.update(capitaltWallet,-withdraw.getVolume().doubleValue());
 
         save(withdraw);
 
@@ -782,11 +789,11 @@
         }
         String withdraw_limit = sysparaService.find("withdraw_limit_" + symbol).getSvalue();
         if (amount.doubleValue() < Double.valueOf(withdraw_limit)) {
-            throw new YamiShopBindException("提现不得小于限额");
+            throw new YamiShopBindException("Withdrawal amount must not be less than the limit.");
         }
         String withdraw_limit_max = sysparaService.find("withdraw_limit_max").getSvalue();
         if (amount.doubleValue() > Double.valueOf(withdraw_limit_max)) {
-            throw new YamiShopBindException("提现不得大于限额");
+            throw new YamiShopBindException("Withdrawal amount cannot exceed the limit.");
         }
         /**
          * 当日提现次数是否超过
@@ -795,7 +802,7 @@
         List<Withdraw> withdraw_days = findAllByDate(withdraw.getUserId().toString());
         if (withdraw_limit_num > 0 && withdraw_days != null) {
             if (withdraw_days.size() >= withdraw_limit_num) {
-                throw new YamiShopBindException("当日可提现次数不足");
+                throw new YamiShopBindException("The number of times funds can be withdrawn on the same day is insufficient.");
             }
         }
         /**
@@ -810,7 +817,7 @@
             //
             String dateString = sdf.format(date);
             if (dateString.compareTo(withdraw_time[0]) < 0 || dateString.compareTo(withdraw_time[1]) > 0) {
-                throw new YamiShopBindException("不在可提现时间内");
+                throw new YamiShopBindException("Not within the available withdrawal periodNot within the available withdrawal period");
             }
         }
         WithdrawFeeVo withdrawFeeVo = getFee(withdraw.getMethod(), withdraw.getAmount().doubleValue());

--
Gitblit v1.9.3