From da4961ad26c598fc2415940a7d3139d0e8d98fe6 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Fri, 12 Sep 2025 18:33:21 +0800
Subject: [PATCH] 1

---
 trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
index bc35e06..0c175fe 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
@@ -867,8 +867,32 @@
         if (accountType == 2) { //扣除
             moneyRevise = moneyRevise.negate();
         }
-        walletService.updateMoney("", userId, moneyRevise, new BigDecimal(0), Constants.MONEYLOG_CATEGORY_COIN
-                , coinType, accountType == 1 ? Constants.MONEYLOG_CONTENT_RECHARGE : Constants.MONEYLOG_CONTENT_WITHDRAW, "后台修改账号余额");
+        if(coinType.equals("usdt")){
+            walletService.updateMoney("", userId, moneyRevise, new BigDecimal(0), Constants.MONEYLOG_CATEGORY_COIN
+                    , coinType, accountType == 1 ? Constants.MONEYLOG_CONTENT_RECHARGE : Constants.MONEYLOG_CONTENT_WITHDRAW, "后台修改账号余额");
+        } else {
+            coinType = coinType+"usdt";
+            WalletExtend walletExtend = new WalletExtend();
+            walletExtend = walletService.saveExtendByPara(user.getUserId(), coinType);
+
+            double volume = moneyRevise.doubleValue();
+
+            BigDecimal amountBefore =  new BigDecimal(walletExtend.getAmount());
+            walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), volume);
+            // 账变日志
+            MoneyLog moneyLog = new MoneyLog();
+            moneyLog.setCreateTime(new Date());
+            moneyLog.setSymbol(coinType);
+            moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN);
+            moneyLog.setAmountBefore(amountBefore);
+            moneyLog.setAmount(moneyRevise);
+            moneyLog.setAmountAfter(amountBefore.add(moneyRevise));
+            moneyLog.setUserId(userId);
+            moneyLog.setWalletType(coinType);
+            moneyLog.setContentType(accountType == 1 ? Constants.MONEYLOG_CONTENT_RECHARGE : Constants.MONEYLOG_CONTENT_WITHDRAW);
+            moneyLog.setLog("后台修改账号余额");
+            moneyLogService.save(moneyLog);
+        }
     }
 
     public void checkGooleAuthAndSefeword(User user, String googleAuthCode, String loginSafeword) {
@@ -1083,6 +1107,21 @@
             lockMoney = Double.valueOf(map.get("lockMoney").toString());
             freezeMoney = Double.valueOf(map.get("freezeMoney").toString());
             walletService.updateWithLockAndFreeze(wallet.getUserId().toString(), changeMoney, lockMoney, freezeMoney);
+        }else if("capitalusdt".equals(coinType)){
+            CapitaltWallet capitaltWallet = capitaltWalletMapper.selectOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
+                    .eq(CapitaltWallet::getUserId, partyId).last(" limit 1 "));
+            amount_before = capitaltWallet.getMoney().doubleValue();
+            lock_amount_before = capitaltWallet.getLockMoney().doubleValue();
+            freeze_amount_before = capitaltWallet.getFreezeMoney().doubleValue();
+            Map<String, Object> map = checkChangeMoney(moneyRevise, resetType, amount_before, lock_amount_before, freeze_amount_before);
+            changeMoney = Double.valueOf(map.get("changeMoney").toString());
+            lockMoney = Double.valueOf(map.get("lockMoney").toString());
+            freezeMoney = Double.valueOf(map.get("freezeMoney").toString());
+
+            capitaltWallet.setMoney(new BigDecimal(Arith.add(capitaltWallet.getMoney().doubleValue(), changeMoney)));
+            capitaltWallet.setLockMoney(new BigDecimal(Arith.add(capitaltWallet.getLockMoney().doubleValue(), lockMoney)));
+            capitaltWallet.setFreezeMoney(new BigDecimal(Arith.add(capitaltWallet.getFreezeMoney().doubleValue(), freezeMoney)));
+            capitaltWalletMapper.updateById(capitaltWallet);
         } else {
             WalletExtend walletExtend = this.walletService.saveExtendByPara(partyId, coinType);
             amount_before = walletExtend.getAmount();

--
Gitblit v1.9.3