zyy
2025-11-20 aaad873de7e0e0eaedc1fa86f2e6160462ec692a
trading-order-service/src/main/java/com/yami/trading/service/dz/impl/StockDzServiceImpl.java
@@ -27,6 +27,7 @@
import com.yami.trading.common.util.RandomUtil;
import com.yami.trading.dao.dz.ExchangeApplyOrderDzMapper;
import com.yami.trading.dao.dz.StockDzMapper;
import com.yami.trading.service.MarketOpenChecker;
import com.yami.trading.service.MoneyLogService;
import com.yami.trading.service.WalletService;
import com.yami.trading.service.data.DataService;
@@ -264,7 +265,7 @@
            }
            if(stockDz.getStartTime().getTime() > new Date().getTime() || stockDz.getEndTime().getTime() < new Date().getTime()){
                throw new YamiShopBindException("不在内幕交易时间之内");
                return Result.failed("不在内幕交易时间之内");
            }
            BigDecimal nowPrice = stockDz.getNowPrice();
@@ -272,8 +273,13 @@
                throw new YamiShopBindException("股票价格0,请重试");
            }
            if (stockDz.getStockNum() > num) {
                throw new YamiShopBindException("请购买最小数量");
                return Result.failed("请购买最小数量");
            }
            boolean isOpen = MarketOpenChecker.isMarketOpenBuyDz(Item.US_STOCKS);
            if (!isOpen) {
                return Result.failed("当前股市休市");
            }
            Wallet wallet = this.walletService.saveWalletByPartyId(partyId);
            BigDecimal buyAmt = nowPrice.multiply(new BigDecimal(num));
@@ -486,10 +492,15 @@
                Date resultTime = calendar.getTime();
                if(now.getTime() < resultTime.getTime()){
                    throw new YamiShopBindException("未到平仓时间");
                    return Result.failed("未到平仓时间");
                }
            }
            boolean isOpen = MarketOpenChecker.isMarketOpenByItemCloseType(Item.US_STOCKS);
            if (!isOpen) {
                return Result.failed("当前股市休市");
            }
            Wallet wallet = this.walletService.saveWalletByPartyId(order.getPartyId());
            BigDecimal sellAmt = nowPrice.multiply(new BigDecimal(num));
            //手续费比率