From d23645e976981bc9b670eea1d469fe8a36be309c Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 17 Apr 2024 17:19:53 +0800
Subject: [PATCH] 55测试环境

---
 src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java b/src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
index 1f4adb0..d31f6f0 100644
--- a/src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
+++ b/src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
@@ -287,8 +287,8 @@
         }
     }
 
-    @Transactional(rollbackFor = Exception.class)
     public void wholeBomb() {
+        redisUtils.set("whole_bomb_execute", 1, 30);
         Map<String, WholePriceDataModel> dataModelMap = WholeDataQueue.MAP;
         if (CollUtil.isEmpty(dataModelMap)) {
             return;
@@ -339,12 +339,20 @@
                     continue;
                 }
 
-                dataModelMap.remove(entry.getKey());
-                redisUtils.set(AppContants.WHOLE_BOMB_MAP, JSONObject.toJSONString(dataModelMap));
-                log.info("全仓爆仓触发:{}", JSONObject.toJSONString(wholePriceData));
-                wholePriceData.setPrices(prices);
-                contractHoldOrderDao.updateMemberAllHoldOrderClosingStatus(wholePriceData.getMemberId());
-                orderProducer.sendWholeBomb(JSONObject.toJSONString(wholePriceData));
+                log.info("过来过来");
+                synchronized(this) {
+                    log.info("爆仓啥的:{}", entry.getKey());
+                    boolean b = redisUtils.setNotExist(AppContants.WHOLE_BOMB_PREFIX + entry.getKey(), 1, 5);
+                    if (b) {
+                        dataModelMap.remove(entry.getKey());
+                        wholePriceData.setEquity(wholePriceData.getBalance().add(totalProfitOrLoss));
+                        redisUtils.set(AppContants.WHOLE_BOMB_MAP, JSONObject.toJSONString(dataModelMap));
+                        log.info("全仓爆仓触发:{}", JSONObject.toJSONString(wholePriceData));
+                        wholePriceData.setPrices(prices);
+                        contractHoldOrderDao.updateMemberAllHoldOrderClosingStatus(wholePriceData.getMemberId());
+                        orderProducer.sendWholeBomb(JSONObject.toJSONString(wholePriceData));
+                    }
+                }
             }
         }
     }

--
Gitblit v1.9.1