fix:增加指数相关接口
This commit is contained in:
@@ -17,6 +17,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.text.StrFormatter;
|
import cn.hutool.core.text.StrFormatter;
|
||||||
import cn.stock.market.dto.model.*;
|
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.investing.InvestingInvokerApis;
|
||||||
import cn.stock.market.infrastructure.api.sina.vo.HotSearchVO;
|
import cn.stock.market.infrastructure.api.sina.vo.HotSearchVO;
|
||||||
import cn.stock.market.utils.*;
|
import cn.stock.market.utils.*;
|
||||||
@@ -864,4 +867,39 @@ public class StockService {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerResponse getIndiaIndex() {
|
||||||
|
List<IndiaIndexVo> 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<JSONObject> 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<JSONObject> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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<JSONObject> kLine;
|
||||||
|
}
|
||||||
@@ -197,6 +197,12 @@ public class StockApiController {
|
|||||||
List<JSONObject> list = InvestingApis.of().kline(StockCode.of(stockCode), type);
|
List<JSONObject> list = InvestingApis.of().kline(StockCode.of(stockCode), type);
|
||||||
return ServerResponse.createBySuccess(list);
|
return ServerResponse.createBySuccess(list);
|
||||||
}
|
}
|
||||||
|
@RequestMapping({"getIndiaIndex.do"})
|
||||||
|
@ApiOperation(value = "印度--获取指定指数信息", httpMethod = "GET")
|
||||||
|
@ResponseBody
|
||||||
|
public ServerResponse getIndiaIndex() {
|
||||||
|
return this.stockService.getIndiaIndex();
|
||||||
|
}
|
||||||
|
|
||||||
//根据股票id查询 股票指数、大盘指数信息
|
//根据股票id查询 股票指数、大盘指数信息
|
||||||
@RequestMapping({"getMarketByStockGid.do"})
|
@RequestMapping({"getMarketByStockGid.do"})
|
||||||
|
|||||||
Reference in New Issue
Block a user