From ef00aeb456a54c7a98b71617fb7e46e56d02aa78 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 29 Dec 2025 10:07:58 +0800
Subject: [PATCH] refactor(okxNewPrice): 重构止损订单处理逻辑

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
index 21dc07e..c00f893 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
@@ -2,8 +2,7 @@
 
 import com.xcong.excoin.modules.okxNewPrice.celue.CaoZuoService;
 import com.xcong.excoin.modules.okxNewPrice.okxWs.enums.ExchangeInfoEnum;
-import com.xcong.excoin.modules.okxNewPrice.wangge.WangGeService;
-import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
+import com.xcong.excoin.modules.okxNewPrice.okxWs.wanggeList.WangGeListService;
 import com.xcong.excoin.utils.RedisUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,12 +25,15 @@
     private CaoZuoService caoZuoService;
     @Autowired
     private RedisUtils redisUtils;
+    @Autowired
+    private WangGeListService wangGeListService;
 
     // 存储所有OkxQuantWebSocketClient实例,key为账号类型名称
     private final Map<String, OkxQuantWebSocketClient> quantClientMap = new ConcurrentHashMap<>();
     
     // 存储OkxNewPriceWebSocketClient实例
-    private OkxNewPriceWebSocketClient newPriceClient;
+    private OkxKlineWebSocketClient klinePriceClient;
+
 
     /**
      * 初始化方法,在Spring Bean构造完成后执行
@@ -43,8 +45,8 @@
         
         // 初始化价格WebSocket客户端
         try {
-            newPriceClient = new OkxNewPriceWebSocketClient(redisUtils, caoZuoService, this);
-            newPriceClient.init();
+            klinePriceClient = new OkxKlineWebSocketClient(redisUtils, caoZuoService, this, wangGeListService);
+            klinePriceClient.init();
             log.info("已初始化OkxNewPriceWebSocketClient");
         } catch (Exception e) {
             log.error("初始化OkxNewPriceWebSocketClient失败", e);
@@ -56,7 +58,7 @@
         // 为每个账号创建一个WebSocket客户端实例
         for (ExchangeInfoEnum account : accounts) {
             try {
-                OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, redisUtils);
+                OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, caoZuoService, redisUtils);
                 quantClientMap.put(account.name(), client);
                 client.init();
                 log.info("已初始化账号 {} 的WebSocket客户端", account.name());
@@ -77,9 +79,9 @@
         log.info("开始销毁OkxWebSocketClientManager");
         
         // 关闭价格WebSocket客户端
-        if (newPriceClient != null) {
+        if (klinePriceClient != null) {
             try {
-                newPriceClient.destroy();
+                klinePriceClient.destroy();
                 log.info("已销毁OkxNewPriceWebSocketClient");
             } catch (Exception e) {
                 log.error("销毁OkxNewPriceWebSocketClient失败", e);
@@ -124,7 +126,7 @@
      * 获取OkxNewPriceWebSocketClient实例
      * @return 价格WebSocket客户端实例
      */
-    public OkxNewPriceWebSocketClient getNewPriceClient() {
-        return newPriceClient;
+    public OkxKlineWebSocketClient getKlineWebSocketClient() {
+        return klinePriceClient;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1