从零开始做网站seo,网站扁平化布局,上海行业网站建设,兰州事件最新进展今日指数-day07
1.股票Code联想推荐
1.1 股票Code联想推荐功能介绍
1) 原型效果 输入框输入股票编码后#xff0c;显示关联的股票信息;
2#xff09;接口定义说明
接口说明#xff1a;
功能描述#xff1a;根据输入的个股代码#xff0c;进行模糊查询#xff0c;返…今日指数-day07
1.股票Code联想推荐
1.1 股票Code联想推荐功能介绍
1) 原型效果 输入框输入股票编码后显示关联的股票信息;
2接口定义说明
接口说明
功能描述根据输入的个股代码进行模糊查询返回证券代码和证券名称
服务路径/quot/stock/search
服务方法GET
请求参数searchStr 只接受代码模糊查询不支持文字查询 响应数据格式
{code: 1,data: [{code: 600000,//股票编码name: 浦发银行 //股票名称},{code: 600004,name: 白云机场}]
}1.2股票Code联想推荐功能实现
1定义Web访问接口 GetMapping(/stock/search)public RListMapString,Object fuzzyQuery(RequestParam(searchStr) String searchStr){return stockService.fuzzyQuery(searchStr);}2定义服务接口和实现
定义服务接口 /*** 根据输入的个股代码进行模糊查询返回证券代码和证券名称* param searchStr* return*/RListMapString, Object fuzzyQuery(String searchStr);实现 Overridepublic RListMapString, Object fuzzyQuery(String searchStr) {//检查参数校验if(StringUtils.isBlank(searchStr)){R.error(ResponseCode.DATA_ERROR.getMessage());}// 对参数进行模糊处理String searchStrFuzzy % searchStr %;//根据股票代码模糊查询ListMapString,ObjectstockRtInfoListstockRtInfoMapper.getByCodeFuzzy(searchStrFuzzy);return R.ok(stockRtInfoList);}
3定义mapper接口方法与xml
mapper /*** 根据股票编码模糊查询* param searchStrFuzzy* return*/ListMapString, Object getByCodeFuzzy(String searchStrFuzzy);xml
select idgetByCodeFuzzy resultTypejava.util.Mapselect distinctsri.stock_code as code,sri.stock_name as namefrom stock_rt_info as sriwhere sri.stock_code like #{searchStrFuzzy}
/select2.个股描述功能实现
2.1 个股描述功能实现说明
1原型示意 2接口说明
功能描述个股主营业务查询接口
服务路径/api/quot/stock/describe
服务方法GET
请求参数code #股票编码响应参数
{code: 1,data: {code: 000002, //股票编码trade: 房地产 , //行业也就是行业板块名称business: 房地产开发和物业服务,//公司主营业务name: 万科 //公司名称}
}2.2股描述功能实现
1定义Web访问接口
/*** 个股主营业务查询接口* param code* return*/
GetMapping(/stock/describe)
public RMapString,Object getStockDescribe(RequestParam(code) String code){return stockService.getStockDescribe(code);
}2定义服务接口和实现
定义服务接口
/*** 个股主营业务查询接口* param code* return*/
RMapString, Object getStockDescribe(String code);实现
Override
public RMapString, Object getStockDescribe(String code) {//检查参数校验if(StringUtils.isBlank(code)){R.error(ResponseCode.DATA_ERROR.getMessage());}//根据参数查询个股主营业务MapString,Object mapResultstockBusinessMapper.getBySecCodeInfo(code);return R.ok(mapResult);}
3定义mapper接口方法与xml
mapper /*** 根据参数查询个股主营业务* param code* return*/MapString, Object getBySecCodeInfo(String code);xml
select idgetBySecCodeInfo resultTypejava.util.Mapselectsb.stock_code as code,sb.stock_name as name,sb.block_name as trade,sb.business as businessfrom stock_business as sbwhere stock_code#{code}
/select3.个股周K线功能实现
3.1 个股周K线功能实现功能分析
1个股周K线功能原型分析 2个股周K线功能接口分析
个股周K线数据主要包含股票ID、 一周内最高价、 一周内最低价 、周1开盘价、周5的收盘价、整周均价、以及一周内最大交易日期一般是周五所对应日期接口要求
功能描述统计每周内的股票数据信息信息包含股票ID、 一周内最高价、 一周内最低价 、周1开盘价、周5的收盘价、整周均价、以及一周内最大交易日期一般是周五所对应日期;
服务路径/api/quot/stock/screen/weekkline
服务方法GET
请求参数code //股票编码响应数据格式
{code: 1,data: [{avgPrice: 8.574954,//一周内平均价minPrice: 8.56,//一周内最低价openPrice: 8.6,//周一开盘价maxPrice: 8.6,//一周内最高价closePrice: 8.57,//周五收盘价如果当前日期不到周五则显示最新价格mxTime: 2021-12-19 15:00,//一周内最大时间stockCode: 600000//股票编码}]
}3.2个股周K线功能实现
1定义Web访问接口 /*** 功能描述统计每周内的股票数据信息信息包含* 股票ID、 一周内最高价、 一周内最低价 、周1开盘价、周5的收盘价、* 整周均价、以及一周内最大交易日期一般是周五所对应日期** param code* return*/GetMapping(/stock/screen/weekkline)public RListMapString, Object getStockInfo(RequestParam(code) String code) {return stockService.getStockInfo(code);}2定义服务接口和实现
定义服务接口
/*** 功能描述统计每周内的股票数据信息信息包含* 股票ID、 一周内最高价、 一周内最低价 、周1开盘价、周5的收盘价、* 整周均价、以及一周内最大交易日期一般是周五所对应日期** param code* return*/
RListMapString, Object getStockInfo(String code);实现
Override
public RListMapString, Object getStockInfo(String code) {// 获取日期范围DateTime lastDate4Stock DateTimeUtil.getLastDate4Stock(DateTime.now());Date endTime lastDate4Stock.toDate();Date startTime lastDate4Stock.minusDays(4).toDate();// TODO moke 测试数据startTime DateTime.parse(2021-12-25 09:30:00, DateTimeFormat.forPattern(yyyy-MM-dd HH:mm:ss)).toDate();endTime DateTime.parse(2021-12-30 15:00:00, DateTimeFormat.forPattern(yyyy-MM-dd HH:mm:ss)).toDate();// 根据日期范围统计每周的股票数据信息ListMapString, Object mapResult stockRtInfoMapper.getStockInfo4Week(code, startTime, endTime);return R.ok(mapResult);
}3定义mapper接口方法与xml
定义mapper ListMapString, Object getStockInfo4Week(Param(code) String code,Param(startTime) Date startTime,Param(endTime) Date endTime);xml select idgetStockInfo4Week resultTypejava.util.Mapselect distinctavg(sri.cur_price) as avgPrice,min(sri.cur_price) as minPrice,sri.open_price as openPrice,max(sri.cur_price) as maxPrice,sri.cur_price as closePrice,date_format(max(sri.cur_time), %Y%m%d) as mxTime,sri.stock_code as stock_codefrom stock_rt_info as sriwhere sri.stock_code #{code}and sri.cur_time between #{startTime} and #{endTime}/selectmax(sri.cur_price) as maxPrice,sri.cur_price as closePrice,date_format(max(sri.cur_time), %Y%m%d) as mxTime,sri.stock_code as stock_codefrom stock_rt_info as sriwhere sri.stock_code #{code}and sri.cur_time between #{startTime} and #{endTime}
/select