diff --git a/src/main/java/cn/stock/market/domain/basic/service/StockService.java b/src/main/java/cn/stock/market/domain/basic/service/StockService.java index 990ac73..35d5544 100644 --- a/src/main/java/cn/stock/market/domain/basic/service/StockService.java +++ b/src/main/java/cn/stock/market/domain/basic/service/StockService.java @@ -17,6 +17,9 @@ import javax.servlet.http.HttpServletRequest; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.text.StrFormatter; import cn.stock.market.dto.model.*; +import cn.stock.market.infrastructure.api.investing.IndiaIndexVo; +import cn.stock.market.infrastructure.api.investing.IndiaStockVO; +import cn.stock.market.infrastructure.api.investing.InvestingApis; import cn.stock.market.infrastructure.api.investing.InvestingInvokerApis; import cn.stock.market.infrastructure.api.sina.vo.HotSearchVO; import cn.stock.market.utils.*; @@ -864,4 +867,39 @@ public class StockService { } return result; } + + public ServerResponse getIndiaIndex() { + List indexVoList = new ArrayList<>(); + //获取BSESENSEX指数 + + try { + IndiaIndexVo vo1 = new IndiaIndexVo(); + String stockCode = "39929"; + IndiaStockVO market = InvestingApis.of().market(StockCode.of(stockCode)); + market.setName("BSESENSEX指数"); + vo1.setIndexVo(market); + + String type = "min"; + List list = InvestingApis.of().kline(StockCode.of(stockCode), type); + vo1.setKLine(list); + indexVoList.add(vo1); + } catch (IOException e) { + log.info("获取BSESENSEX指数数据异常,异常信息{}。。。。",e.getMessage()); + } + try { + IndiaIndexVo vo2 = new IndiaIndexVo(); + String stockCode = "17940"; + IndiaStockVO market = InvestingApis.of().market(StockCode.of(stockCode)); + market.setName("NIFTY50指数"); + vo2.setIndexVo(market); + + String type = "min"; + List list = InvestingApis.of().kline(StockCode.of(stockCode), type); + vo2.setKLine(list); + indexVoList.add(vo2); + } catch (IOException e) { + log.info("获取NIFTY50指数数据异常,异常信息{}。。。。",e.getMessage()); + } + return ServerResponse.createBySuccess(indexVoList); + } } \ No newline at end of file diff --git a/src/main/java/cn/stock/market/infrastructure/api/investing/IndiaIndexVo.java b/src/main/java/cn/stock/market/infrastructure/api/investing/IndiaIndexVo.java new file mode 100644 index 0000000..031d2fc --- /dev/null +++ b/src/main/java/cn/stock/market/infrastructure/api/investing/IndiaIndexVo.java @@ -0,0 +1,17 @@ +package cn.stock.market.infrastructure.api.investing; + +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "指数信息") +public class IndiaIndexVo { + @ApiModelProperty(value = "指数详情") + private IndiaStockVO indexVo; + @ApiModelProperty(value = "指数k线") + private List kLine; +} diff --git a/src/main/java/cn/stock/market/web/StockApiController.java b/src/main/java/cn/stock/market/web/StockApiController.java index f2990c4..79b1523 100644 --- a/src/main/java/cn/stock/market/web/StockApiController.java +++ b/src/main/java/cn/stock/market/web/StockApiController.java @@ -197,6 +197,12 @@ public class StockApiController { List list = InvestingApis.of().kline(StockCode.of(stockCode), type); return ServerResponse.createBySuccess(list); } + @RequestMapping({"getIndiaIndex.do"}) + @ApiOperation(value = "印度--获取指定指数信息", httpMethod = "GET") + @ResponseBody + public ServerResponse getIndiaIndex() { + return this.stockService.getIndiaIndex(); + } //根据股票id查询 股票指数、大盘指数信息 @RequestMapping({"getMarketByStockGid.do"})