From 71b1b3615d6ba865f23e4175e0a697e40a23f8c1 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 28 Jan 2021 16:52:37 +0800
Subject: [PATCH] 20210128

---
 src/test/java/com/xcong/excoin/WholeTest.java |   78 ++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/src/test/java/com/xcong/excoin/WholeTest.java b/src/test/java/com/xcong/excoin/WholeTest.java
index e8eb9e4..9d52d39 100644
--- a/src/test/java/com/xcong/excoin/WholeTest.java
+++ b/src/test/java/com/xcong/excoin/WholeTest.java
@@ -13,10 +13,12 @@
 import com.xcong.excoin.modules.member.entity.MemberEntity;
 import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
 import com.xcong.excoin.rabbit.pricequeue.OrderModel;
+import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
 import com.xcong.excoin.rabbit.producer.OrderProducer;
 import com.xcong.excoin.utils.CalculateUtil;
 import com.xcong.excoin.utils.RedisUtils;
 import com.xcong.excoin.utils.ThreadPoolUtils;
+import lombok.SneakyThrows;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -27,6 +29,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author wzy
@@ -96,14 +99,6 @@
     @Autowired
     private OrderProducer orderProducer;
 
-    @Test
-    public void sendMsg() {
-        List<OrderModel> list = new ArrayList<>();
-        OrderModel orderModel = new OrderModel(1L, RabbitPriceTypeEnum.ENTRUST_OPEN_MORE.getValue(), "111", "BTC");
-        list.add(orderModel);
-        orderProducer.sendLimitClose(JSONObject.toJSONString(list));
-    }
-
 
     // 面值*(多单张数*多单开仓价-空单张数*空单开仓价)-余额-已实现盈亏 / 面值*(多单张数-空单张数)-(维持保证金率+TAKER手续费)*面值*(开多张数+开空张数)
 
@@ -119,24 +114,8 @@
      */
     @Test
     public void forceSetPriceTest() {
-        MemberEntity memberEntity = memberDao.selectById(5L);
+        MemberEntity memberEntity = memberDao.selectById(21L);
         CalculateUtil.getForceSetPriceForWhole("BTC/USDT", memberEntity);
-    }
-
-    @Test
-    public void initOrderTest() {
-        List<HashMap<String, Object>> wholeHoldOrders = contractHoldOrderDao.selectAllWholeOrderMemberIdAndSymbol();
-        if (CollUtil.isNotEmpty(wholeHoldOrders)) {
-            MemberEntity memberEntity = null;
-            for (HashMap<String, Object> wholeHoldOrder : wholeHoldOrders) {
-                Long memberId = (Long) wholeHoldOrder.get("member_id");
-                String symbol = (String) wholeHoldOrder.get("symbol");
-                if (memberEntity == null || !memberId.equals(memberEntity.getId())) {
-                    memberEntity = memberDao.selectById(memberId);
-                }
-                System.out.println(memberId + "-----" + symbol);
-            }
-        }
     }
 
     @Resource
@@ -144,6 +123,55 @@
 
     @Test
     public void redisTest() {
+        for (int i = 827; i < 999; i++) {
+            redisUtils.del(AppContants.CLOSING_ORDER_PREFIX + i);
+        }
+    }
+
+    @Resource
+    private WebsocketPriceService websocketPriceService;
+
+    @Test
+    public void wholeBombTest() {
+        websocketPriceService.wholeBomb("BTC/USDT", "9000");
+    }
+
+    @Test
+    public void forceTest() {
+        MemberEntity memberEntity = memberDao.selectById(5L);
+        CalculateUtil.getForceSetPriceForWhole(null, memberEntity);
+    }
+
+    public static void main(String[] args) {
+        Map<String, String> map = new ConcurrentHashMap<>();
+        map.put("1", "1");
+        map.put("2", "2");
+        map.put("3", "3");
+        map.put("4", "4");
+        map.put("5", "5");
+
+        new Thread(new Runnable() {
+            @SneakyThrows
+            @Override
+            public void run() {
+                for (Map.Entry<String, String> entry : map.entrySet()) {
+                    System.out.println(entry.getKey() + " - " + entry.getValue());
+                    if (entry.getKey().equals("3")) {
+                        System.out.println(11);
+                        map.remove("3");
+                    }
+                    Thread.sleep(1000);
+                }
+
+                System.out.println(map.get("3"));
+            }
+        }).start();
+
+    }
+
+    @Test
+    public void mapTest() {
+        websocketPriceService.wholeBomb();
     }
 
 }

--
Gitblit v1.9.1