| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | if(stockDz.getStartTime().getTime() > new Date().getTime() || stockDz.getEndTime().getTime() < new Date().getTime()){ |
| | | throw new YamiShopBindException("不在内幕交易时间之内"); |
| | | return Result.failed("不在内幕交易时间之内"); |
| | | } |
| | | BigDecimal nowPrice = stockDz.getNowPrice(); |
| | | |
| | |
| | | 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)); |
| | |
| | | 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)); |
| | | //手续费比率 |