|
|
@ -3,15 +3,13 @@ package com.sztzjy.forex.trading_trading.service;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.websocket.WebSocket;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.*;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.*;
|
|
|
|
import com.sztzjy.forex.trading_trading.mappers.*;
|
|
|
|
import com.sztzjy.forex.trading_trading.mappers.*;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ForexMarketDateUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ForexMarketDateUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.RedisUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.RedisUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.file.IFileUtil;
|
|
|
|
|
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
|
|
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -29,8 +27,6 @@ public class WainingService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MarketWarningMapper marketWarningMapper;
|
|
|
|
private MarketWarningMapper marketWarningMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SimpMessagingTemplate simpMessagingTemplate;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MarketWarningRecordMapper marketWarningRecordMapper;
|
|
|
|
private MarketWarningRecordMapper marketWarningRecordMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ForexMarketDateUtil forexMarketDateUtil;
|
|
|
|
private ForexMarketDateUtil forexMarketDateUtil;
|
|
|
@ -46,6 +42,8 @@ public class WainingService {
|
|
|
|
private TransactionNumberWarningMapper transactionNumberWarningMapper;
|
|
|
|
private TransactionNumberWarningMapper transactionNumberWarningMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private TransactionNumberWarningRecordMapper transactionNumberWarningRecordMapper;
|
|
|
|
private TransactionNumberWarningRecordMapper transactionNumberWarningRecordMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private WebSocket webSocket;
|
|
|
|
|
|
|
|
|
|
|
|
//保证金比较接口
|
|
|
|
//保证金比较接口
|
|
|
|
public String compareMarginLevels(String memberId, String trainingId) {
|
|
|
|
public String compareMarginLevels(String memberId, String trainingId) {
|
|
|
@ -70,7 +68,7 @@ public class WainingService {
|
|
|
|
marginWarningRecord.setWarningTime(current);
|
|
|
|
marginWarningRecord.setWarningTime(current);
|
|
|
|
marginWarningRecord.setEarlyWarningLevel(memberLevel);
|
|
|
|
marginWarningRecord.setEarlyWarningLevel(memberLevel);
|
|
|
|
marginWarningRecordMapper.updateByPrimaryKeySelective(marginWarningRecord);
|
|
|
|
marginWarningRecordMapper.updateByPrimaryKeySelective(marginWarningRecord);
|
|
|
|
simpMessagingTemplate.convertAndSend("/topic/margin-change", message);
|
|
|
|
WebSocket.sendMessage(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -101,6 +99,8 @@ public class WainingService {
|
|
|
|
BeanUtils.copyProperties(member, marginWarning);
|
|
|
|
BeanUtils.copyProperties(member, marginWarning);
|
|
|
|
marginWarning.setStatus(0);
|
|
|
|
marginWarning.setStatus(0);
|
|
|
|
marginWarning.setId(IdUtil.simpleUUID());
|
|
|
|
marginWarning.setId(IdUtil.simpleUUID());
|
|
|
|
|
|
|
|
marginWarning.setMarginLevel(50.12);
|
|
|
|
|
|
|
|
marginWarning.setNetValue(50.2131);
|
|
|
|
marginWarningMapper.insert(marginWarning);
|
|
|
|
marginWarningMapper.insert(marginWarning);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return marginWarning;
|
|
|
|
return marginWarning;
|
|
|
@ -195,7 +195,7 @@ public class WainingService {
|
|
|
|
if (direction.equals("买")) {
|
|
|
|
if (direction.equals("买")) {
|
|
|
|
// 3.拿redis的价位和新增的高价低价做比较,==的时候就弹出提示,并且存入行情预警记录表
|
|
|
|
// 3.拿redis的价位和新增的高价低价做比较,==的时候就弹出提示,并且存入行情预警记录表
|
|
|
|
if (buyPic.equals(upperBreakPrice) || buyPic.equals(lowerBreakPrice)) {
|
|
|
|
if (buyPic.equals(upperBreakPrice) || buyPic.equals(lowerBreakPrice)) {
|
|
|
|
simpMessagingTemplate.convertAndSend("/topic/alerts", message);
|
|
|
|
WebSocket.sendMessage(message);
|
|
|
|
marketWarningRecord.setWarningPrice(buyPic);
|
|
|
|
marketWarningRecord.setWarningPrice(buyPic);
|
|
|
|
marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime())));
|
|
|
|
marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime())));
|
|
|
|
marketWarningRecordMapper.updateByPrimaryKeySelective(marketWarningRecord);
|
|
|
|
marketWarningRecordMapper.updateByPrimaryKeySelective(marketWarningRecord);
|
|
|
@ -203,7 +203,7 @@ public class WainingService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (sellPicValue.equals(upperBreakPrice) || sellPicValue.equals(lowerBreakPrice)) {
|
|
|
|
if (sellPicValue.equals(upperBreakPrice) || sellPicValue.equals(lowerBreakPrice)) {
|
|
|
|
simpMessagingTemplate.convertAndSend("/topic/alerts", message);
|
|
|
|
WebSocket.sendMessage(message);
|
|
|
|
marketWarningRecord.setWarningPrice(sellPicValue);
|
|
|
|
marketWarningRecord.setWarningPrice(sellPicValue);
|
|
|
|
marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime())));
|
|
|
|
marketWarningRecord.setWarningTime((new Timestamp(new Date().getTime())));
|
|
|
|
marketWarningRecordMapper.updateByPrimaryKeySelective(marketWarningRecord);
|
|
|
|
marketWarningRecordMapper.updateByPrimaryKeySelective(marketWarningRecord);
|
|
|
@ -319,6 +319,7 @@ public class WainingService {
|
|
|
|
// 如果当前交易次数在到达用户设置的预警时间时还是小于,那么就返回消息给前端提示
|
|
|
|
// 如果当前交易次数在到达用户设置的预警时间时还是小于,那么就返回消息给前端提示
|
|
|
|
tnwr.setWarningingCount(openingTrades);
|
|
|
|
tnwr.setWarningingCount(openingTrades);
|
|
|
|
tnwr.setWarningTime(new Timestamp(new Date().getTime()));
|
|
|
|
tnwr.setWarningTime(new Timestamp(new Date().getTime()));
|
|
|
|
|
|
|
|
WebSocket.sendMessage(message);
|
|
|
|
transactionNumberWarningRecordMapper.updateByPrimaryKeySelective(tnwr);
|
|
|
|
transactionNumberWarningRecordMapper.updateByPrimaryKeySelective(tnwr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|