新版仿ok交易所-后端
zyy
2025-10-09 98b0d601d0bd777660ae57529f31ccdd0abbcabb
trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java
@@ -50,6 +50,9 @@
    @Autowired
    ItemService itemService;
    @Autowired
    CapitaltWalletMapper capitaltWalletMapper;
    @Override
    public CapitaltWallet getUserIdWallet(String userId) {
        return getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
@@ -128,14 +131,23 @@
        if (accountType == 1 && moneyRevise.compareTo(BigDecimal.ZERO) <= 0) { //充值
            throw new YamiShopBindException("请输入大于0的数量");
        }
        if (accountType == 2 && moneyRevise.compareTo(BigDecimal.ZERO) >= 0) {
            throw new YamiShopBindException("请输入小于0的数量");
        if (accountType == 2) {
            moneyRevise = moneyRevise.negate();
        }
        if ("usdt".equals(coinType)) {
            double amount1 = moneyRevise.doubleValue();
            CapitaltWallet capitaltWallet = getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
                    .eq(CapitaltWallet::getUserId, userId).last(" limit 1 "));
            if (capitaltWallet == null) {
                capitaltWallet = new CapitaltWallet();
                capitaltWallet.setUserId(userId);
                capitaltWalletMapper.insert(capitaltWallet);
                throw new YamiShopBindException("请重试");
            }
            double amount_before = capitaltWallet.getMoney().doubleValue();
            if (accountType == 2 && capitaltWallet.getMoney().subtract(moneyRevise).compareTo(BigDecimal.ZERO) < 0) {
                throw new YamiShopBindException("账号资金不足");
            }
            update(capitaltWallet, amount1);
            // 保存资金日志
@@ -162,6 +174,10 @@
            double amount_before = walletExtend.getAmount();
            if (accountType == 2 && Arith.sub(amount_before, volume) < 0) {
                throw new YamiShopBindException("账号资金不足");
            }
            // walletExtend = walletService.saveWalletExtendByParaAndUpdate(String.valueOf(recharge.getPartyId()), recharge.getSymbol(), volume);
            walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), volume);