feat:行情

This commit is contained in:
rplees
2023-12-04 14:17:13 +08:00
parent 79efb022b3
commit 93fc03bfa9
11 changed files with 616 additions and 202 deletions

View File

@@ -1,5 +1,6 @@
package cn.stock.market.web;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ag.utils.DateUtils;
import com.ag.utils.Jsons;
import com.ag.utils.param.ParamUtils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.google.common.cache.Cache;
@@ -40,6 +42,9 @@ import cn.stock.market.domain.basic.service.StockService;
import cn.stock.market.dto.model.StockCode;
import cn.stock.market.dto.model.StockVO;
import cn.stock.market.infrastructure.api.EastmoneyApi;
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.qq.QqStockApi;
import cn.stock.market.infrastructure.api.sina.SinaStockApi;
import cn.stock.market.utils.RequestCacheUtils;
@@ -119,22 +124,18 @@ public class StockApiController {
@ApiOperation(value = "印度股票个股详情", httpMethod = "GET")
@ResponseBody
public ServerResponse getINDStockInfo(@RequestParam("stockCode") String stockCode) {
return this.stockService.getYCStockInfo(stockCode);
}
//测试
@RequestMapping({"test.do"})
@ResponseBody
public ServerResponse test(@RequestParam("stockCode") String stockCode) {
return ServerResponse.createBySuccess(stockCode);
ParamUtils.verify("股票代码", stockCode, ParamUtils.STRING_NOT_EMPTY_VERIFY_AND_CONVERT_VALUE);
IndiaStockVO market = InvestingApis.of().market(StockCode.of(stockCode));
return ServerResponse.createBySuccess(market.toStockVo());
}
//印度股票列表 英情
@RequestMapping({"getINDStockList.do"})
@ApiOperation(value = "印度股票列表", httpMethod = "GET")
@ResponseBody
public ServerResponse getINDStockList(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) {
return this.stockService.getINDStockList(pageSize, pageNum);
public ServerResponse getINDStockList(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) throws IOException {
return ServerResponse.createBySuccess(InvestingInvokerApis.of().__page(pageNum, pageSize));
}
//印度股票时线-K线
@@ -142,11 +143,15 @@ public class StockApiController {
@ApiOperation(value = "印度股票K线", httpMethod = "GET")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "stockCode",value = "股票对应代码",dataType ="String",required = true),
@ApiImplicitParam(name = "type",value = "type 0-时分线 1-日线 2-周线 3-月线",dataType ="Integer",required = true),
@ApiImplicitParam(name = "stockCode",value = "股票对应代码",dataType ="String", paramType = "query", required = true),
@ApiImplicitParam(name = "type",value = "type min-时分线 day-日线 week-周线 month-月线",dataType ="String", paramType = "query", required = true),
})
public ServerResponse getINDTimeK(@RequestParam("stockCode") String stockCode, @RequestParam("type") Integer type) {
return this.stockService.getIndiaK(stockCode, type);
public ServerResponse getINDTimeK(@RequestParam("stockCode") String stockCode, @RequestParam("type") String type) throws IOException {
ParamUtils.verify("股票代码", stockCode, ParamUtils.STRING_NOT_EMPTY_VERIFY_AND_CONVERT_VALUE);
ParamUtils.verify("K线类型", stockCode, ParamUtils.STRING_NOT_EMPTY_VERIFY_AND_CONVERT_VALUE);
List<JSONObject> list = InvestingApis.of().kline(StockCode.of(stockCode), type);
return ServerResponse.createBySuccess(list);
}
//根据股票id查询 股票指数、大盘指数信息

View File

@@ -6,7 +6,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@Configuration
@EnableScheduling
@ConditionalOnProperty(prefix = "enable", name = "scheduled", havingValue = "true")
@ConditionalOnProperty(prefix = "enable", name = "scheduled", havingValue = "true", matchIfMissing = true)
public class ControlSchedulingConfiguration {
}