1
zj
2 days ago 5e57de9b12ee136e45ce5754c7fe2e7eb12af05a
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiFuturesOrderController.java
@@ -18,7 +18,7 @@
import com.yami.trading.common.util.StringUtils;
import com.yami.trading.common.util.ThreadUtils;
import com.yami.trading.security.common.util.SecurityUtils;
import com.yami.trading.service.MarketOpenChecker;
import com.yami.trading.service.RealNameAuthRecordService;
import com.yami.trading.service.SessionTokenService;
import com.yami.trading.service.WalletService;
import com.yami.trading.service.future.FuturesOrderService;
@@ -72,6 +72,8 @@
    SysparaService sysparaService;
    @Autowired
    TipService tipService;
    @Autowired
    RealNameAuthRecordService realNameAuthRecordService;
//    @Autowired
//    private ExchangeRateService exchangeRateService;
@@ -130,7 +132,7 @@
        } else {
            data.put("amount", 0);
        }
        data.put("open", MarketOpenChecker.isMarketOpenByItemCloseType(bySymbol.getOpenCloseType()));
        data.put("open", itemService.isOpen(bySymbol.getSymbol()));
        return Result.succeed(data);
    }
@@ -148,8 +150,7 @@
        if (bySymbol == null) {
            throw new YamiShopBindException("当前币对不存在");
        }
        boolean isOpen = MarketOpenChecker.isMarketOpenByItemCloseType(bySymbol.getOpenCloseType());
        if (!isOpen) {
        if (!itemService.isOpen(bySymbol.getSymbol())) {
            throw new YamiShopBindException("当前已经休市");
        }
@@ -164,14 +165,20 @@
            lock = true;
            String session_token = futureOpenAction.getSession_token();
            Object object = this.sessionTokenService.cacheGet(session_token);
            String cachedPartyId = this.sessionTokenService.cacheGet(session_token);
            this.sessionTokenService.del(session_token);
            User party = this.partyService.findUserByUserCode(partyId);
            User party = this.partyService.getById(partyId);
            if (party == null) {
                throw new YamiShopBindException("用户不存在");
            }
            if (!party.isEnabled()) {
                throw new YamiShopBindException("用户已锁定");
            }
            if (null == object || !party.getUserId().equals((String) object)) {
                throw new BusinessException("请稍后再试");
            realNameAuthRecordService.requireApproved(party, true);
            if (cachedPartyId == null || !partyId.equals(cachedPartyId)) {
                log.warn("交割开仓 session_token 无效, partyId={}, token={}, cachedPartyId={}",
                        partyId, session_token, cachedPartyId);
                throw new BusinessException("操作已失效,请刷新页面后重试");
            }
            Syspara syspara = sysparaService.find("stop_user_internet");
            String stopUserInternet = syspara.getSvalue();
@@ -197,9 +204,11 @@
            data.put("order_no", order.getOrderNo());
            data.put("open_price", order.getTradeAvgPrice().toString());
            return Result.succeed(data);
        } catch (BusinessException | YamiShopBindException e) {
            throw e;
        } catch (Exception e) {
            log.error("开仓异常", e);
            throw new YamiShopBindException(e.getMessage());
            throw new YamiShopBindException(e.getMessage() != null ? e.getMessage() : "请稍后再试");
        } finally {
            if (lock) {
                ThreadUtils.sleep(100);