新版仿ok交易所-后端
1
zj
yesterday f31fc9f42f78de0808e7f4bdc797c5e622df09e3
trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java
@@ -141,7 +141,7 @@
    @Transactional
    public Result updateCapitaltWallt(String userId, BigDecimal moneyRevise,  int accountType, String coinType) {
        if (accountType == 1 && moneyRevise.compareTo(BigDecimal.ZERO) <= 0) { //充值
            throw new YamiShopBindException("请输入大于0的数量");
            throw new YamiShopBindException("Please enter a quantity greater than 0");
        }
        if (accountType == 2) {
            moneyRevise = moneyRevise.negate();
@@ -150,11 +150,11 @@
            double amount1 = moneyRevise.doubleValue();
            CapitaltWallet capitaltWallet = getUserIdWallet(userId);
            if (capitaltWallet == null) {
                throw new YamiShopBindException("账号缺少资金数据");
                throw new YamiShopBindException("Account is missing fund data");
            }
            double amount_before = capitaltWallet.getMoney().doubleValue();
            if (accountType == 2 && capitaltWallet.getMoney().subtract(moneyRevise).compareTo(BigDecimal.ZERO) < 0) {
                throw new YamiShopBindException("账号资金不足");
                throw new YamiShopBindException("Insufficient account funds");
            }
            update(capitaltWallet, amount1);
@@ -182,7 +182,7 @@
                if (realtimes != null) {
                    close = realtimes.get(0).getClose().doubleValue();
                } else {
                    throw new YamiShopBindException("参数错误");
                    throw new YamiShopBindException("Invalid parameters");
                }
                PurchaseRecord purchaseRecord = purchaseRecordService.getOne(new LambdaQueryWrapper<>(PurchaseRecord.class)
                        .eq(PurchaseRecord::getUserId, userId));
@@ -206,7 +206,7 @@
                    } else {
                        purchaseRecord.setPurchaseQuantity(purchaseRecord.getPurchaseQuantity().add(new BigDecimal(volume)));
                        if (purchaseRecord.getPurchaseQuantity().compareTo(BigDecimal.ZERO) < 0) {
                            throw new YamiShopBindException("持仓数量不足");
                            throw new YamiShopBindException("Insufficient position quantity");
                        }
                        purchaseRecord.setTotalAmount(purchaseRecord.getTotalAmount().add(amount));
                        //purchaseRecord.setTotalAmount(purchaseRecord.getPurchaseQuantity().multiply(purchaseRecord.getPurchasePrice()));
@@ -219,7 +219,7 @@
                item = itemService.findBySymbol(coinType);
            }
            if (item == null) {
                throw new YamiShopBindException("暂不支持的币种");
                throw new YamiShopBindException("Unsupported currency");
            }
            WalletExtend walletExtend = new WalletExtend();
            walletExtend = walletService.saveExtendByPara(userId, coinType);
@@ -229,7 +229,7 @@
            double amount_before = walletExtend.getAmount();
            if (accountType == 2 && Arith.sub(amount_before, volume) < 0) {
                throw new YamiShopBindException("账号资金不足");
                throw new YamiShopBindException("Insufficient account funds");
            }
            // walletExtend = walletService.saveWalletExtendByParaAndUpdate(String.valueOf(recharge.getPartyId()), recharge.getSymbol(), volume);
@@ -263,7 +263,7 @@
    public void update(CapitaltWallet capitaltWallet, double amount1) {
        capitaltWallet.setMoney(new BigDecimal(Arith.add(capitaltWallet.getMoney().doubleValue(), amount1)));
        if (!updateById(capitaltWallet)) {
            throw new YamiShopBindException("操作钱包失败!");
            throw new YamiShopBindException("Wallet operation failed!");
        }
    }
}