新版仿ok交易所-后端
1
zj
2025-10-14 7ff2bf07924915fc12612c9fd8cae5915dca2560
trading-order-service/src/main/java/com/yami/trading/service/exchange/impl/ExchangeApplyOrderServiceImpl.java
@@ -111,11 +111,11 @@
        double amount = Arith.mul(sub, realtime.getClose().doubleValue());
        order.setCloseTime(new Date());
        order.setClosePrice(realtime.getClose().doubleValue());
//        Wallet wallet = this.walletService.saveWalletByPartyId(order.getPartyId());
        CapitaltWallet capitaltWallet = capitaltWalletService.getUserIdWallet(order.getPartyId());
        Wallet capitaltWallet = this.walletService.saveWalletByPartyId(order.getPartyId());
//        CapitaltWallet capitaltWallet = capitaltWalletService.getUserIdWallet(order.getPartyId());
        double amount_before = capitaltWallet.getMoney().doubleValue();
//        this.walletService.update(userIdWallet.getUserId().toString(), amount);
        this.capitaltWalletService.update(capitaltWallet, amount);
        this.walletService.update(capitaltWallet.getUserId(), amount);
        /*
         * 保存资金日志
@@ -183,6 +183,7 @@
        List<ExchangeApplyOrder> list = list(lambdaQueryWrapper);
        return getDataList(list);
    }
    private static List<ExchangeApplyOrder> getData() {
@@ -614,8 +615,8 @@
        // 可以买的数量
        double amount = Arith.div(sub, order.getClosePrice(), 8);
        order.setSymbolValue(amount);
//        Wallet wallet = this.walletService.saveWalletByPartyId(order.getPartyId());
        CapitaltWallet userIdWallet = capitaltWalletService.getUserIdWallet(order.getPartyId());
        Wallet userIdWallet = this.walletService.saveWalletByPartyId(order.getPartyId());
//        CapitaltWallet userIdWallet = capitaltWalletService.getUserIdWallet(order.getPartyId());
        double amount_before = userIdWallet.getMoney().doubleValue();
        // 如果是计划委托,则先不扣钱
        if (order.isTriggerOrder()) {
@@ -637,6 +638,8 @@
            save(order);
        }
        if (!order.isTriggerOrder()) {
            System.out.println("-----userIdWallet---------:"+userIdWallet.getMoney().doubleValue());
            System.out.println("-----order---------:"+order.getVolume().doubleValue());
            if (userIdWallet.getMoney().doubleValue() < order.getVolume().doubleValue()) {
                throw new YamiShopBindException("余额不足");
            }