package com.diagnose.controller; import com.diagnose.common.result.CommonResult; import com.diagnose.service.SearchService; import com.diagnose.service.StockService; import com.diagnose.vo.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.List; @Api(tags = "投顾") @RestController public class DiagnoseController { @Resource private SearchService searchService; @Resource private StockService stockService; @ApiOperation("综合搜索") @GetMapping("/diagnose/search") public CommonResult> search(@RequestParam("keyword") @Validated @NotBlank @ApiParam(required = true, value = "关键词") String keyword) { List list = searchService.search(keyword); return CommonResult.success(list); } @ApiOperation("聚合数据") @GetMapping("/diagnose/union") public CommonResult union(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { UnionVO vo = stockService.unionWithCache(stkUniCode); return CommonResult.success(vo); } @ApiOperation("综合评分") @GetMapping("/diagnose/comprehensiveEvaluation") public CommonResult comprehensiveEvaluation(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { ComprehensiveEvaluationVO vo = stockService.comprehensiveEvaluation(stkUniCode); return CommonResult.success(vo); } @ApiOperation("财务估值") @GetMapping("/diagnose/financialValuation") public CommonResult financialValuation(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { FinancialValuationVO vo = stockService.financialValuation(stkUniCode); return CommonResult.success(vo); } @ApiOperation("财务估值-更多") @GetMapping("/diagnose/financialValuationExtend") public CommonResult financialValuationExtend(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { FinancialValuationExtendVO vo = stockService.financialValuationExtend(stkUniCode); return CommonResult.success(vo); } @ApiOperation("财务估值-估值分析") @GetMapping("/diagnose/financialValuationAnalysis") public CommonResult> financialValuationAnalysis(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode, @RequestParam("timeSpan") @Validated @NotNull @Min(1) @Max(10) @ApiParam(required = true, value = "周期 1、3、5、10年") Integer timeSpan, @RequestParam("type") @Validated @NotNull @Min(2) @Max(3) @ApiParam(required = true, value = "类型 2:市盈率 3:市净率") Integer type) { List list = stockService.financialValuationAnalysis(stkUniCode, timeSpan, type); return CommonResult.success(list); } @ApiOperation("量化分析") @GetMapping("/diagnose/quantitativeAnalysis") public CommonResult quantitativeAnalysis(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { QuantitativeAnalysisVO vo = stockService.quantitativeAnalysis(stkUniCode); return CommonResult.success(vo); } @ApiOperation("市场热度") @GetMapping("/diagnose/marketSentiment") public CommonResult marketSentiment(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { MarketSentimentVO vo = stockService.marketSentiment(stkUniCode); return CommonResult.success(vo); } @ApiOperation("主力动向") @GetMapping("/diagnose/institutionalActivity") public CommonResult institutionalActivity(@RequestParam("stkUniCode") @Validated @NotNull @ApiParam(required = true, value = "证券统一编码") Long stkUniCode) { InstitutionalActivityVO vo = stockService.institutionalActivity(stkUniCode); return CommonResult.success(vo); } }