From dfd766139d37b0bd038288952cb24df76f4289f9 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 11 Dec 2025 17:38:56 +0800
Subject: [PATCH] feat(redis): 添加带延迟的Redis读取方法以提高数据一致性

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
index 2f51d39..a6604ff 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
@@ -28,6 +28,10 @@
             log.warn("止损了,下次再战...");
             return;
         }
+        String live = (String) redisUtils.getWithDelay(ORDERWS_CHANNEL + ":" + CoinEnums.HE_YUE.getCode() + ":state");
+        if (!CoinEnums.ORDER_LIVE.getCode().equals( live)){
+            log.warn("正在下单中,等待下单结束...");
+        }
 
         String buyCnt = null;
         String ctval = getRedisValue(redisUtils, InstrumentsWs.INSTRUMENTSWS_CHANNEL, ":ctVal");
@@ -51,7 +55,7 @@
             buyCnt = pos;
         } else if (OrderParamEnums.BUY.getValue().equals(side)){
             side = OrderParamEnums.BUY.getValue();
-            if (StrUtil.isNotBlank(buyCntNormal) && BigDecimal.ZERO.compareTo(new BigDecimal(buyCntNormal)) > 0) {
+            if (StrUtil.isNotBlank(buyCntNormal) && new BigDecimal(buyCntNormal).compareTo(BigDecimal.ZERO) > 0) {
                 buyCnt = buyCntNormal;
             }else{
                 buyCnt = ctval;

--
Gitblit v1.9.1