From c8becdd9554e47ab975cebee20439082b9c34df1 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 29 Jan 2021 16:04:26 +0800
Subject: [PATCH] 20210129
---
src/test/java/com/xcong/excoin/WholeTest.java | 59 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/src/test/java/com/xcong/excoin/WholeTest.java b/src/test/java/com/xcong/excoin/WholeTest.java
index 8c4b73a..8e7dbf8 100644
--- a/src/test/java/com/xcong/excoin/WholeTest.java
+++ b/src/test/java/com/xcong/excoin/WholeTest.java
@@ -18,6 +18,7 @@
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;
@@ -28,6 +29,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* @author wzy
@@ -116,22 +118,6 @@
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
private RedisUtils redisUtils;
@@ -156,4 +142,45 @@
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();
+ }
+
+
+ @Test
+ public void wholeForceTest() {
+ // 3153.33181635
+// System.out.println(new BigDecimal("9921.69458495").subtract(new BigDecimal("6768.36276860")));
+
+ // 33684.14725218
+ }
+
}
--
Gitblit v1.9.1