|
|
@@ -20,7 +20,7 @@ import org.springframework.util.StopWatch;
|
|
|
import top.lvzhiqiang.config.InitRunner;
|
|
|
import top.lvzhiqiang.config.WorkWeixinProperties;
|
|
|
import top.lvzhiqiang.entity.CoinHistoryOrder;
|
|
|
-import top.lvzhiqiang.entity.CoinMixTrader;
|
|
|
+import top.lvzhiqiang.entity.CoinTrader;
|
|
|
import top.lvzhiqiang.mapper.CoinMapper;
|
|
|
import top.lvzhiqiang.service.CoinService;
|
|
|
import top.lvzhiqiang.util.*;
|
|
|
@@ -84,6 +84,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
private final ForkJoinPool forkJoinPool2 = new ForkJoinPool(16);
|
|
|
private final ForkJoinPool forkJoinPool3 = new ForkJoinPool(16);
|
|
|
private final ForkJoinPool forkJoinPool4 = new ForkJoinPool(16);
|
|
|
+ private final ForkJoinPool forkJoinPool5 = new ForkJoinPool(16);
|
|
|
private static final DecimalFormat df1 = new DecimalFormat("#,##0.00");
|
|
|
|
|
|
static {
|
|
|
@@ -167,8 +168,8 @@ public class CoinServiceImpl implements CoinService {
|
|
|
coinMapper.insertMixTradeList(parseMixTradeList(dataList));
|
|
|
}
|
|
|
|
|
|
- private List<CoinMixTrader> parseMixTradeList(JSONArray dataList) {
|
|
|
- List<CoinMixTrader> mixTraderList = JSONArray.parseArray(dataList.toJSONString(), CoinMixTrader.class);
|
|
|
+ private List<CoinTrader> parseMixTradeList(JSONArray dataList) {
|
|
|
+ List<CoinTrader> mixTraderList = JSONArray.parseArray(dataList.toJSONString(), CoinTrader.class);
|
|
|
mixTraderList.stream().forEach(e -> {
|
|
|
Map<String, String> columnMap = e.getColumnList().stream().filter(Objects::nonNull)
|
|
|
.collect(Collectors.toMap(
|
|
|
@@ -437,41 +438,47 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
// 跟单员监控报警
|
|
|
scheduler.scheduleWithFixedDelay(() -> {
|
|
|
- LocalDateTime endTime = LocalDateTime.now();
|
|
|
- // 交易员当前带单列表
|
|
|
- Map<String, String> paramMap = new LinkedHashMap<>();
|
|
|
- paramMap.put("traderId", "b1b5467f8bb73f53ac97");
|
|
|
- paramMap.put("pageNo", "1");
|
|
|
- paramMap.put("pageSize", "20");
|
|
|
+ List<String> monitorTraderList = coinMapper.findMonitorTraderList();
|
|
|
+ forkJoinPool5.submit(() -> monitorTraderList.parallelStream().forEach(e -> {
|
|
|
+ LocalDateTime endTime = LocalDateTime.now();
|
|
|
+ // 交易员当前带单列表
|
|
|
+ Map<String, String> paramMap = new LinkedHashMap<>();
|
|
|
|
|
|
- try {
|
|
|
- JSONObject response = requestApi4Common("/api/mix/v1/trace/report/order/currentList", null, JSONObject.toJSONString(paramMap), JsoupUtil.HTTP_POST, paramMap);
|
|
|
- JSONArray orderList = response.getJSONArray("data");
|
|
|
+ String[] split = e.split("\\|");
|
|
|
|
|
|
- for (int i = 0; i < orderList.size(); i++) {
|
|
|
- JSONObject order = orderList.getJSONObject(i);
|
|
|
- LocalDateTime openTime = DateUtils.longToLocalDateTime(order.getLong("openTime"));
|
|
|
- String trackingNo = order.getString("trackingNo");
|
|
|
- if (Duration.between(openTime, endTime).getSeconds() < 50 && !orderMap.containsKey(trackingNo)) {
|
|
|
- orderMap.put(trackingNo, "1");
|
|
|
+ paramMap.put("traderId", split[0]);
|
|
|
+ paramMap.put("pageNo", "1");
|
|
|
+ paramMap.put("pageSize", "20");
|
|
|
|
|
|
- String content = "<div class=\"highlight\">交易对:" + order.getString("symbol") + "</div>" +
|
|
|
- "<div>持仓方向:" + InitRunner.publicParamsMap.get("holdSide").getString(order.getString("holdSide")) + "</div>" +
|
|
|
- "<div>杠杆倍数:" + order.getString("leverage") + "</div>" +
|
|
|
- "<div>开仓均价:" + order.getString("openPrice") + "</div>" +
|
|
|
- "<div>止盈价:" + order.getString("takeProfitPrice") + "</div>" +
|
|
|
- "<div>止损价:" + order.getString("stopLossPrice") + "</div>" +
|
|
|
- "<div >交易员:" + "hale" + "</div>" +
|
|
|
- "<div class=\"gray\">开仓时间:" + DateUtils.longToString(order.getLong("openTime")) + "</div>";
|
|
|
- JSONObject params = new JSONObject();
|
|
|
- params.put("title", "交易员开单监控报警");
|
|
|
- params.put("logUrl", "https://jav.lvzhiqiang.top/coin/orderDetail/" + order.getString("trackingNo"));
|
|
|
- params.put("btnTxt", "跟单详情");
|
|
|
- SpringUtils.getBean(CoinServiceImpl.class).monitorAlarm4APP_TEXT_CARD(content, params);
|
|
|
+ try {
|
|
|
+ JSONObject response = requestApi4Common("/api/mix/v1/trace/report/order/currentList", null, JSONObject.toJSONString(paramMap), JsoupUtil.HTTP_POST, paramMap);
|
|
|
+ JSONArray orderList = response.getJSONArray("data");
|
|
|
+
|
|
|
+ for (int i = 0; i < orderList.size(); i++) {
|
|
|
+ JSONObject order = orderList.getJSONObject(i);
|
|
|
+ LocalDateTime openTime = DateUtils.longToLocalDateTime(order.getLong("openTime"));
|
|
|
+ String trackingNo = order.getString("trackingNo");
|
|
|
+ if (Duration.between(openTime, endTime).getSeconds() < 50 && !orderMap.containsKey(trackingNo)) {
|
|
|
+ orderMap.put(trackingNo, "1");
|
|
|
+
|
|
|
+ String content = "<div class=\"highlight\">交易对:" + order.getString("symbol") + "</div>" +
|
|
|
+ "<div>持仓方向:" + InitRunner.publicParamsMap.get("holdSide").getString(order.getString("holdSide")) + "</div>" +
|
|
|
+ "<div>杠杆倍数:" + order.getString("leverage") + "</div>" +
|
|
|
+ "<div>开仓均价:" + order.getString("openPrice") + "</div>" +
|
|
|
+ "<div>止盈价:" + order.getString("takeProfitPrice") + "</div>" +
|
|
|
+ "<div>止损价:" + order.getString("stopLossPrice") + "</div>" +
|
|
|
+ "<div >交易员:" + split[1] + "</div>" +
|
|
|
+ "<div class=\"gray\">开仓时间:" + DateUtils.longToString(order.getLong("openTime")) + "</div>";
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
+ params.put("title", "交易员开单监控报警");
|
|
|
+ params.put("logUrl", "https://jav.lvzhiqiang.top/coin/orderDetail/" + order.getString("trackingNo"));
|
|
|
+ params.put("btnTxt", "跟单详情");
|
|
|
+ SpringUtils.getBean(CoinServiceImpl.class).monitorAlarm4APP_TEXT_CARD(content, params);
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception ex) {
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
+ })).join();
|
|
|
}, 0, 3, TimeUnit.SECONDS);
|
|
|
|
|
|
return null;
|
|
|
@@ -654,7 +661,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
result = (JSONArray) JSON.toJSON(historyOrderList);
|
|
|
} else if (params.getString("nameEn").equals("traderList")) {
|
|
|
PageHelper.startPage(params.getInteger("pageNo"), params.getInteger("pageSize"), true);
|
|
|
- List<CoinMixTrader> mixTraderList = coinMapper.findMixTraderList(params.toJavaObject(Map.class));
|
|
|
+ List<CoinTrader> mixTraderList = coinMapper.findMixTraderList(params.toJavaObject(Map.class));
|
|
|
|
|
|
renderMainSearch4TraderList(mixTraderList);
|
|
|
result = (JSONArray) JSON.toJSON(mixTraderList);
|
|
|
@@ -684,8 +691,8 @@ public class CoinServiceImpl implements CoinService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private void renderMainSearch4TraderList(List<CoinMixTrader> mixTraderList) {
|
|
|
- for (CoinMixTrader mixTrader : mixTraderList) {
|
|
|
+ private void renderMainSearch4TraderList(List<CoinTrader> mixTraderList) {
|
|
|
+ for (CoinTrader mixTrader : mixTraderList) {
|
|
|
|
|
|
mixTrader.setLastTradeTime(DateUtils.longToString(Long.valueOf(mixTrader.getLastTradeTime())));
|
|
|
}
|