Merge remote-tracking branch 'origin/retifive' into retifive
This commit is contained in:
@@ -30,12 +30,12 @@ public class RetifiveStockInfo {
|
|||||||
private String stockType;
|
private String stockType;
|
||||||
|
|
||||||
@ApiModelProperty("当前价格")
|
@ApiModelProperty("当前价格")
|
||||||
private String currentPrice;
|
private String lastPrice;
|
||||||
|
|
||||||
@ApiModelProperty("变动百分比")
|
@ApiModelProperty("变动百分比")
|
||||||
private String changePercent;
|
private String perchg;
|
||||||
@ApiModelProperty("变动值")
|
@ApiModelProperty("变动值")
|
||||||
private String changeValue;
|
private String change;
|
||||||
|
|
||||||
@ApiModelProperty("开盘价格")
|
@ApiModelProperty("开盘价格")
|
||||||
private String openPrice;
|
private String openPrice;
|
||||||
|
|||||||
@@ -127,10 +127,10 @@ public class RefinitivUtil {
|
|||||||
}
|
}
|
||||||
return RetifiveStockInfo.builder()
|
return RetifiveStockInfo.builder()
|
||||||
.stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
.stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
||||||
.openPrice(openPrice).currentPrice(price).highPrice(high).lowPrice(low)
|
.openPrice(openPrice).lastPrice(price).highPrice(high).lowPrice(low)
|
||||||
.previousPrice(previousPrice).changePercent(percentChange).volume(volume)
|
.previousPrice(previousPrice).perchg(percentChange).volume(volume)
|
||||||
.week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType)
|
.week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType)
|
||||||
.changeValue(changeValue)
|
.change(changeValue)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,8 +257,8 @@ public class RefinitivUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RetifiveStockInfo retifiveStockInfo = RetifiveStockInfo.builder().stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
RetifiveStockInfo retifiveStockInfo = RetifiveStockInfo.builder().stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
||||||
.openPrice(openPrice).currentPrice(price).highPrice(high).lowPrice(low).previousPrice(previousPrice).changePercent(percentChange)
|
.openPrice(openPrice).lastPrice(price).highPrice(high).lowPrice(low).previousPrice(previousPrice).perchg(percentChange)
|
||||||
.volume(volume).week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType).changeValue(changeValue)
|
.volume(volume).week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType).change(changeValue)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return retifiveStockInfo;
|
return retifiveStockInfo;
|
||||||
|
|||||||
@@ -3,19 +3,15 @@ package cn.stock.market.web;
|
|||||||
import cn.stock.market.domain.basic.entity.RetifiveStock;
|
import cn.stock.market.domain.basic.entity.RetifiveStock;
|
||||||
import cn.stock.market.domain.basic.service.RetifiveStockService;
|
import cn.stock.market.domain.basic.service.RetifiveStockService;
|
||||||
import cn.stock.market.dto.RetifiveStockInfo;
|
import cn.stock.market.dto.RetifiveStockInfo;
|
||||||
import cn.stock.market.infrastructure.db.po.RetifiveStockPO;
|
|
||||||
import cn.stock.market.listener.AppClient;
|
import cn.stock.market.listener.AppClient;
|
||||||
import cn.stock.market.listener.ConcurrentAppClient;
|
import cn.stock.market.listener.ConcurrentAppClient;
|
||||||
import cn.stock.market.listener.StockInfoRefinitiv;
|
import cn.stock.market.listener.StockInfoRefinitiv;
|
||||||
import cn.stock.market.listener.SymbolRefinitiv;
|
import cn.stock.market.listener.SymbolRefinitiv;
|
||||||
import cn.stock.market.utils.ServerResponse;
|
import cn.stock.market.utils.ServerResponse;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.thomsonreuters.ema.access.Data;
|
|
||||||
import com.thomsonreuters.ema.access.DataType;
|
import com.thomsonreuters.ema.access.DataType;
|
||||||
import com.thomsonreuters.ema.access.FieldEntry;
|
import com.thomsonreuters.ema.access.FieldEntry;
|
||||||
import com.thomsonreuters.ema.access.FieldList;
|
import com.thomsonreuters.ema.access.FieldList;
|
||||||
import com.thomsonreuters.ema.access.Map;
|
|
||||||
import com.thomsonreuters.ema.access.MapEntry;
|
|
||||||
import com.thomsonreuters.ema.access.RefreshMsg;
|
import com.thomsonreuters.ema.access.RefreshMsg;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -27,14 +23,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -661,8 +652,8 @@ public class MessageRetifiveController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RetifiveStockInfo retifiveStockInfo = RetifiveStockInfo.builder().stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
RetifiveStockInfo retifiveStockInfo = RetifiveStockInfo.builder().stockCode(stockCode).stockName(stockName).symbol(name).status(status)
|
||||||
.openPrice(openPrice).currentPrice(price).highPrice(high).lowPrice(low).previousPrice(previousPrice).changePercent(percentChange)
|
.openPrice(openPrice).lastPrice(price).highPrice(high).lowPrice(low).previousPrice(previousPrice).perchg(percentChange)
|
||||||
.volume(volume).week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType).changeValue(changeValue)
|
.volume(volume).week52HighPrice(week52High).week52LowPrice(week52Low).stockType(stockType).change(changeValue)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return retifiveStockInfo;
|
return retifiveStockInfo;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package cn.stock.market.web;
|
package cn.stock.market.web;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.stock.market.domain.basic.entity.RetifiveStock;
|
||||||
|
import cn.stock.market.domain.basic.service.RetifiveStockService;
|
||||||
import cn.stock.market.dto.RetifiveStockInfo;
|
import cn.stock.market.dto.RetifiveStockInfo;
|
||||||
import cn.stock.market.listener.AppClient;
|
import cn.stock.market.listener.AppClient;
|
||||||
import cn.stock.market.utils.RefinitivUtil;
|
import cn.stock.market.utils.RefinitivUtil;
|
||||||
@@ -13,12 +16,14 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -34,19 +39,25 @@ public class RefinitivApiController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AppClient appClient;
|
private AppClient appClient;
|
||||||
|
@Autowired
|
||||||
|
private RetifiveStockService retifiveStockService;
|
||||||
|
|
||||||
@ApiOperation(value = "股票详情信息", httpMethod = "GET", response = RetifiveStockInfo.class)
|
@ApiOperation(value = "股票详情信息", httpMethod = "GET", response = RetifiveStockInfo.class)
|
||||||
@ApiImplicitParams({@ApiImplicitParam(name = "symbol", value = "symbol值")})
|
@ApiImplicitParams({@ApiImplicitParam(name = "symbol", value = "symbol值")})
|
||||||
@GetMapping("/getStockDetail")
|
@GetMapping("/getStockDetail")
|
||||||
@EncryptFilter(decryptRequest = false)
|
@EncryptFilter(decryptRequest = false)
|
||||||
public ServerResponse<?> getStockDetail(String symbol) {
|
public ServerResponse<?> getStockDetail(String symbol) {
|
||||||
// 计算每个线程应处理的元素数量
|
|
||||||
try {
|
try {
|
||||||
appClient.subscribe(symbol);
|
appClient.subscribe(symbol);
|
||||||
// 等待消息, 设置超时时间,例如10秒
|
// 等待消息, 设置超时时间,例如10秒
|
||||||
RefreshMsg refreshMsg = appClient.getMessageFuture().get(10, TimeUnit.SECONDS);
|
RefreshMsg refreshMsg = appClient.getMessageFuture().get(10, TimeUnit.SECONDS);
|
||||||
if (DataType.DataTypes.FIELD_LIST == refreshMsg.payload().dataType()) {
|
if (DataType.DataTypes.FIELD_LIST == refreshMsg.payload().dataType()) {
|
||||||
RetifiveStockInfo retifiveStockInfo = RefinitivUtil.decodeData(refreshMsg.payload().fieldList(), refreshMsg.name());
|
RetifiveStockInfo retifiveStockInfo = RefinitivUtil.decodeData(refreshMsg.payload().fieldList(), refreshMsg.name());
|
||||||
|
//获取股票id
|
||||||
|
RetifiveStock stock = retifiveStockService.repository().findBtStockByCoCode(symbol);
|
||||||
|
if(stock != null){
|
||||||
|
retifiveStockInfo.setId(stock.getId());
|
||||||
|
}
|
||||||
return ServerResponse.createBySuccess("操作成功", retifiveStockInfo);
|
return ServerResponse.createBySuccess("操作成功", retifiveStockInfo);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -85,6 +96,10 @@ public class RefinitivApiController {
|
|||||||
@GetMapping("/getTopActives")
|
@GetMapping("/getTopActives")
|
||||||
@EncryptFilter(decryptRequest = false)
|
@EncryptFilter(decryptRequest = false)
|
||||||
public ServerResponse<?> getTopActives(@RequestParam String stockType) {
|
public ServerResponse<?> getTopActives(@RequestParam String stockType) {
|
||||||
|
if (StrUtil.equalsIgnoreCase(stockType, "nse")) {
|
||||||
|
return ServerResponse.createBySuccess("操作成功", new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
String name = ".AV.BO";
|
String name = ".AV.BO";
|
||||||
List<RetifiveStockInfo> list = Lists.newArrayList();
|
List<RetifiveStockInfo> list = Lists.newArrayList();
|
||||||
try {
|
try {
|
||||||
@@ -111,6 +126,9 @@ public class RefinitivApiController {
|
|||||||
@GetMapping("/getTopGainers")
|
@GetMapping("/getTopGainers")
|
||||||
@EncryptFilter(decryptRequest = false)
|
@EncryptFilter(decryptRequest = false)
|
||||||
public ServerResponse<?> getTopGainers(@RequestParam String stockType) {
|
public ServerResponse<?> getTopGainers(@RequestParam String stockType) {
|
||||||
|
if (StrUtil.equalsIgnoreCase(stockType, "nse")) {
|
||||||
|
return ServerResponse.createBySuccess("操作成功", new ArrayList<>());
|
||||||
|
}
|
||||||
String name = ".PG.BO";
|
String name = ".PG.BO";
|
||||||
List<RetifiveStockInfo> list = Lists.newArrayList();
|
List<RetifiveStockInfo> list = Lists.newArrayList();
|
||||||
try {
|
try {
|
||||||
@@ -137,6 +155,10 @@ public class RefinitivApiController {
|
|||||||
@GetMapping("/getTopLosers")
|
@GetMapping("/getTopLosers")
|
||||||
@EncryptFilter(decryptRequest = false)
|
@EncryptFilter(decryptRequest = false)
|
||||||
public ServerResponse<?> getTopLosers(@RequestParam String stockType) {
|
public ServerResponse<?> getTopLosers(@RequestParam String stockType) {
|
||||||
|
if (StrUtil.equalsIgnoreCase(stockType, "nse")) {
|
||||||
|
return ServerResponse.createBySuccess("操作成功", new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
String name = ".PL.BO";
|
String name = ".PL.BO";
|
||||||
List<RetifiveStockInfo> list = Lists.newArrayList();
|
List<RetifiveStockInfo> list = Lists.newArrayList();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user