ipo
zyy
2025-12-30 d9430c2ed4e2bc3564f4c9057563dd5f5605f28b
ipo
1 files modified
16 ■■■■■ changed files
trading-order-admin/src/main/java/com/yami/trading/admin/task/NewSharesTask.java 16 ●●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/admin/task/NewSharesTask.java
@@ -50,7 +50,21 @@
                List<Wallet> walletList = walletService.list(queryWrapper);
                if (!walletList.isEmpty()) {
                    log.info("==================进入待补自动扣费================");
                    walletList.forEach((wallet) -> {
                        BigDecimal money = wallet.getMoney();
                        BigDecimal amountToBeCovered = wallet.getAmountToBeCovered();
                        if (money.compareTo(amountToBeCovered) >= 0) {
                            wallet.setMoney(money.subtract(amountToBeCovered));
                            log.info("用户id{}已补完待补", wallet.getUserId());
                        } else {
                            //资金不足
                            BigDecimal newAmountToBeCovered = amountToBeCovered.subtract(money);
                            wallet.setMoney(BigDecimal.ZERO);
                            wallet.setAmountToBeCovered(newAmountToBeCovered);
                            log.info("用户id{}补待补{}", wallet.getUserId(), money.toString());
                        }
                        walletService.updateById(wallet);
                    });
                }