| | |
| | | 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; |
| | |
| | | } else { |
| | | data.put("amount", 0); |
| | | } |
| | | data.put("open", MarketOpenChecker.isMarketOpenByItemCloseType(bySymbol.getOpenCloseType())); |
| | | data.put("open", itemService.isOpen(bySymbol.getSymbol())); |
| | | return Result.succeed(data); |
| | | } |
| | | |
| | |
| | | if (bySymbol == null) { |
| | | throw new YamiShopBindException("当前币对不存在"); |
| | | } |
| | | boolean isOpen = MarketOpenChecker.isMarketOpenByItemCloseType(bySymbol.getOpenCloseType()); |
| | | if (!isOpen) { |
| | | if (!itemService.isOpen(bySymbol.getSymbol())) { |
| | | throw new YamiShopBindException("当前已经休市"); |
| | | } |
| | | |
| | |
| | | |
| | | 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("用户已锁定"); |
| | | } |
| | | realNameAuthRecordService.requireApproved(party, true); |
| | | if (null == object || !party.getUserId().equals((String) object)) { |
| | | throw new BusinessException("请稍后再试"); |
| | | 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(); |
| | |
| | | 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); |