From cbc26f3f148e9f328f4fa1536c30b16946360a81 Mon Sep 17 00:00:00 2001
From: peternameyakj <908253177@qq.com>
Date: Thu, 08 Aug 2024 18:36:51 +0800
Subject: [PATCH] 新增资金账户以及与交易账户的互转

---
 src/main/java/project/wallet/internal/WalletGatherServiceImpl.java |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/main/java/project/wallet/internal/WalletGatherServiceImpl.java b/src/main/java/project/wallet/internal/WalletGatherServiceImpl.java
index 6ed7d3f..f79b557 100644
--- a/src/main/java/project/wallet/internal/WalletGatherServiceImpl.java
+++ b/src/main/java/project/wallet/internal/WalletGatherServiceImpl.java
@@ -231,8 +231,12 @@
             return resultObject;
         }else {
             //交易账户=>资金账户
-            WalletExtend walletExtend = walletService.saveExtendByPara(partyId, currency);
-            resultObject.setData(walletExtend.getAmount());
+            if("usdt".equals(currency)){
+                resultObject.setData(walletService.saveWalletByPartyId(partyId).getMoney());
+            }else {
+                WalletExtend walletExtend = walletService.saveExtendByPara(partyId, currency);
+                resultObject.setData(walletExtend.getAmount());
+            }
             return resultObject;
         }
     }
@@ -258,7 +262,11 @@
 
         ApplicationUtil.executeUpdate(walletGather);
         redisHandler.setAsyn(WalletRedisKeys.WALLET_GATHER_PARTY_ID + walletGather.getPartyId().toString(),walletGather);
-        walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), -amount);
+        if("usdt".equals(currency)){
+            walletService.update(walletGather.getPartyId().toString(),-amount);
+        }else {
+            walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), -amount);
+        }
         resultObject.setMsg("划转成功");
         return resultObject;
     }
@@ -301,7 +309,11 @@
         }
         ApplicationUtil.executeUpdate(walletGather);
         redisHandler.setAsyn(WalletRedisKeys.WALLET_GATHER_PARTY_ID + walletGather.getPartyId().toString(),walletGather);
-        walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), amount);
+        if("usdt".equals(currency)){
+            walletService.update(walletGather.getPartyId().toString(),amount);
+        }else {
+            walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), amount);
+        }
         resultObject.setMsg("划转成功");
         return resultObject;
     }

--
Gitblit v1.9.3