财务接口完成
This commit is contained in:
parent
73feff4dbb
commit
c6ee4fd46a
5
pom.xml
5
pom.xml
@ -95,11 +95,6 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ahocorasick</groupId>
|
||||
<artifactId>ahocorasick</artifactId>
|
||||
<version>0.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hazelcast.config.InMemoryFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.diagnose.common.config.cache.CacheKey.*;
|
||||
import static com.diagnose.common.config.cache.CacheKey.DISTRIBUTED_LOCK;
|
||||
|
||||
public class CacheConfig {
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.diagnose.common.handler;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.diagnose.common.result.CommonResult;
|
||||
import com.diagnose.common.result.ResponseStatus;
|
||||
import com.diagnose.common.util.logger.LoggerUtil;
|
||||
@ -16,7 +15,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import java.util.Set;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
package com.diagnose.common.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.diagnose.common.config.cache.CacheKey;
|
||||
import com.diagnose.common.entity.ScheduleLog;
|
||||
import com.diagnose.common.handler.BizException;
|
||||
import com.diagnose.common.util.logger.LoggerUtil;
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.crdt.pncounter.PNCounter;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceProxy;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.diagnose.common.config.cache.CacheKey;
|
||||
import com.diagnose.common.handler.BizException;
|
||||
import com.diagnose.common.util.logger.LoggerUtil;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
19
src/main/java/com/diagnose/constant/PriceTableName.java
Normal file
19
src/main/java/com/diagnose/constant/PriceTableName.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.diagnose.constant;
|
||||
|
||||
// 股票市场 1:深圳 2:上海 8:北京
|
||||
public enum PriceTableName {
|
||||
|
||||
SZ("stk_basic_price_mid", "深圳"),
|
||||
SH("stk_basic_price_mid", "上海"),
|
||||
BJ("bse_stk_basic_price", "北京"),
|
||||
;
|
||||
|
||||
public final String tableName;
|
||||
public final String name;
|
||||
|
||||
PriceTableName(String tableName, String name) {
|
||||
this.tableName = tableName;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,9 +3,7 @@ package com.diagnose.controller;
|
||||
import com.diagnose.common.result.CommonResult;
|
||||
import com.diagnose.service.SearchService;
|
||||
import com.diagnose.service.StockService;
|
||||
import com.diagnose.vo.ComprehensiveEvaluationVO;
|
||||
import com.diagnose.vo.FinancialValuationVO;
|
||||
import com.diagnose.vo.StockVO;
|
||||
import com.diagnose.vo.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
@ -15,6 +13,8 @@ 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;
|
||||
@ -50,5 +50,27 @@ public class DiagnoseController {
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("财务估值-更多")
|
||||
@GetMapping("/diagnose/financialValuationExtend")
|
||||
public CommonResult<FinancialValuationExtendVO> financialValuationExtend(@RequestParam("证券统一编码") @Validated @NotNull @ApiParam(required = true) Long stkUniCode) {
|
||||
FinancialValuationExtendVO vo = stockService.financialValuationExtend(stkUniCode);
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("财务估值-估值分析")
|
||||
@GetMapping("/diagnose/financialValuationAnalysis")
|
||||
public CommonResult<List<ValuationAnalysisVO>> financialValuationAnalysis(@RequestParam("证券统一编码") @Validated @NotNull @ApiParam(required = true) Long stkUniCode,
|
||||
@RequestParam("周期 1、3、5、10年") @Validated @NotNull @Min(1) @Max(10) @ApiParam(required = true) Integer timeSpan,
|
||||
@RequestParam("类型 2:市盈率 3:市净率") @Validated @NotNull @Min(2) @Max(3) @ApiParam(required = true) Integer type) {
|
||||
List<ValuationAnalysisVO> list = stockService.financialValuationAnalysis(stkUniCode, timeSpan, type);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("量化分析")
|
||||
@GetMapping("/diagnose/quantitativeAnalysis")
|
||||
public CommonResult<QuantitativeAnalysisVO> quantitativeAnalysis(@RequestParam("证券统一编码") @Validated @NotNull @ApiParam(required = true) Long stkUniCode) {
|
||||
QuantitativeAnalysisVO vo = stockService.quantitativeAnalysis(stkUniCode);
|
||||
return CommonResult.success(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.diagnose.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.diagnose.vo.DiagnoseBackTestVO;
|
||||
import com.diagnose.vo.DiagnoseRankVO;
|
||||
import com.diagnose.vo.DiagnoseValuationVO;
|
||||
import com.diagnose.vo.QuantitativeAnalysisVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@ -31,4 +33,18 @@ public interface DiagnoseMapper extends BaseMapper<DiagnoseRankVO> {
|
||||
") t WHERE t.rk = 1")
|
||||
List<DiagnoseBackTestVO> selectBackTest(@Param("star") BigDecimal star);
|
||||
|
||||
@Select("SELECT * FROM (" +
|
||||
" SELECT TIME_SPAN, Q_30_PE, Q_70_PE, CURRENT_Q_PE, Q_30_PB, Q_70_PB, CURRENT_Q_PB, RANK() OVER (PARTITION BY stk_uni_code ORDER BY trade_date DESC) AS rk\n" +
|
||||
" FROM _fe_stk_diag_valuation\n" +
|
||||
" WHERE stk_uni_code = #{stkUniCode} AND isvalid = 1\n" +
|
||||
") t WHERE t.rk = 1")
|
||||
List<DiagnoseValuationVO> selectDiagnoseValuation(@Param("stkUniCode") Long stkUniCode);
|
||||
|
||||
@Select("SELECT * FROM (" +
|
||||
" SELECT tech_sum_mac, stk_spt_lvl, stk_prs_lvl, ROW_NUMBER() OVER (PARTITION BY stk_code, mkt_num ORDER BY trd_date DESC) AS rn\n" +
|
||||
" FROM vol_pri_fac\n" +
|
||||
" WHERE stk_code = #{stkCode} AND mkt_num = #{mktNum}\n" +
|
||||
") t WHERE t.rn = 1")
|
||||
QuantitativeAnalysisVO selectQuantitativeAnalysis(@Param("stkCode") String stkCode, @Param("mktNum") Integer mktNum);
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.diagnose.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.diagnose.vo.FinanceCashShortVO;
|
||||
import com.diagnose.vo.FinanceIndexAnalysisVO;
|
||||
import com.diagnose.vo.FinanceRankVO;
|
||||
import com.diagnose.vo.FinancialValuationVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@ -32,4 +33,11 @@ public interface FinanceMapper extends BaseMapper<FinancialValuationVO> {
|
||||
") t WHERE t.rn <= 5")
|
||||
List<FinanceCashShortVO> selectFinanceCashShort(@Param("stkCode") String stkCode, @Param("secMarPar") Integer secMarPar);
|
||||
|
||||
@Select("SELECT * FROM (" +
|
||||
" SELECT profit_indu_rank, growth_indu_rank, operate_indu_rank, debt_indu_rank, cash_indu_rank, ROW_NUMBER() OVER (PARTITION BY stk_uni_code ORDER BY end_date DESC) AS rn\n" +
|
||||
" FROM _fe_stk_diag_fin_rank\n" +
|
||||
" WHERE stk_uni_code = #{stkUniCode}\n" +
|
||||
") t WHERE t.rn = 1")
|
||||
FinanceRankVO selectFinanceRank(@Param("stkUniCode") Long stkUniCode);
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.diagnose.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.diagnose.vo.KLineVO;
|
||||
import com.diagnose.vo.StockPriceVO;
|
||||
import com.diagnose.vo.StockVO;
|
||||
import com.diagnose.vo.ValuationAnalysisVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
@ -16,4 +20,37 @@ public interface StockMapper extends BaseMapper<StockVO> {
|
||||
"ON sp.plate_uni_code = pi.plate_uni_code")
|
||||
List<StockVO> selectAllStock();
|
||||
|
||||
@Select("SELECT * FROM (\n" +
|
||||
" SELECT end_date, close_price, stk_per_ttm, price_bookv_ratio, row_number() OVER (PARTITION BY stk_uni_code ORDER BY end_date DESC) AS rn\n" +
|
||||
" FROM ${tableName}\n" +
|
||||
" WHERE stk_uni_code = #{stkUniCode} AND isvalid = 1\n" +
|
||||
") t WHERE t.rn = 1")
|
||||
StockPriceVO selectLatestPrice(@Param("tableName") String tableName, @Param("stkUniCode") Long stkUniCode);
|
||||
|
||||
@Select("SELECT s.end_date, s.${stockValueColumn} AS stock_value, p.avg_1 AS plate_value\n" +
|
||||
"FROM ${tableName} s\n" +
|
||||
"JOIN plate_val_info p\n" +
|
||||
"ON s.end_date = p.end_date\n" +
|
||||
"WHERE s.stk_uni_code = #{stkUniCode}\n" +
|
||||
" AND s.end_date >= DATE_SUB(CURDATE(), INTERVAL #{year} YEAR)\n" +
|
||||
" AND s.isvalid = 1\n" +
|
||||
" AND p.plate_uni_code = #{plateUniCode}\n" +
|
||||
" AND p.end_date >= DATE_SUB(CURDATE(), INTERVAL #{year} YEAR)\n" +
|
||||
" AND p.val_index_par = #{type}" +
|
||||
" AND p.isvalid = 1\n" +
|
||||
"ORDER BY s.end_date")
|
||||
List<ValuationAnalysisVO> selectFinancialValuationAnalysis(@Param("tableName") String tableName,
|
||||
@Param("stockValueColumn") String stockValueColumn,
|
||||
@Param("stkUniCode") Long stkUniCode,
|
||||
@Param("plateUniCode") Long plateUniCode,
|
||||
@Param("year") Integer year,
|
||||
@Param("type") Integer type);
|
||||
|
||||
@Select("SELECT s.trade_date, s.open_price, s.close_price, s.high_price, s.low_price\n" +
|
||||
"FROM ${tableName} s\n" +
|
||||
"WHERE s.stk_uni_code = #{stkUniCode}\n" +
|
||||
" AND s.trade_date >= DATE_SUB(CURDATE(), INTERVAL #{month} MONTH)\n" +
|
||||
" AND s.isvalid = 1\n" +
|
||||
"ORDER BY s.trade_date")
|
||||
List<KLineVO> selectKLine(@Param("tableName") String tableName, @Param("stkUniCode") Long stkUniCode, @Param("month") int month);
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import com.diagnose.vo.StockVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.diagnose.service;
|
||||
|
||||
import com.diagnose.common.handler.BizException;
|
||||
import com.diagnose.common.result.ResponseStatus;
|
||||
import com.diagnose.mapper.DiagnoseMapper;
|
||||
import com.diagnose.mapper.FinanceMapper;
|
||||
import com.diagnose.mapper.StockMapper;
|
||||
@ -20,6 +22,8 @@ public class StockService {
|
||||
|
||||
private static long cacheTime = 0;
|
||||
|
||||
private static final int kLineMonth = 3;
|
||||
|
||||
private List<StockVO> stockListCache = null;
|
||||
|
||||
private Map<Long, StockVO> stockMapCache = null; // <stkUniCode, StockVO>
|
||||
@ -55,6 +59,9 @@ public class StockService {
|
||||
|
||||
public DiagnoseRankVO rank(StockVO stock) {
|
||||
DiagnoseRankVO diagnoseRankVO = diagnoseMapper.selectRank(stock.getSecUniCode());
|
||||
if (diagnoseRankVO == null) {
|
||||
return null;
|
||||
}
|
||||
Integer totalInduCount = diagnoseMapper.selectTotalInduCount(stock.getPlateUniCode());
|
||||
Integer totalMktCount = diagnoseMapper.selectTotalMktCount();
|
||||
diagnoseRankVO.setTotalInduCount(totalInduCount);
|
||||
@ -67,15 +74,15 @@ public class StockService {
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
DiagnoseRankVO diagnoseRankVO = rank(stock);
|
||||
BigDecimal star = diagnoseRankVO.getTotalStar();
|
||||
if (star == null) {
|
||||
return null;
|
||||
}
|
||||
List<DiagnoseBackTestVO> backTestList = diagnoseMapper.selectBackTest(star);
|
||||
ComprehensiveEvaluationVO vo = new ComprehensiveEvaluationVO();
|
||||
vo.setStock(stock);
|
||||
DiagnoseRankVO diagnoseRankVO = rank(stock);
|
||||
vo.setRank(diagnoseRankVO);
|
||||
BigDecimal star = diagnoseRankVO.getTotalStar();
|
||||
if (star == null) {
|
||||
return vo;
|
||||
}
|
||||
List<DiagnoseBackTestVO> backTestList = diagnoseMapper.selectBackTest(star);
|
||||
vo.setBackTestList(backTestList);
|
||||
return vo;
|
||||
}
|
||||
@ -85,10 +92,44 @@ public class StockService {
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
Long secUniCode = stock.getSecUniCode();
|
||||
String secCode = stock.getSecCode();
|
||||
Integer mktNum = stock.getMktNum();
|
||||
// 总结性机器语 & 财务估值得分
|
||||
FinancialValuationVO vo = financeMapper.selectFinancialValuation(secCode, mktNum);
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
// 财务分析行业排名
|
||||
FinanceRankVO financeRank = financeMapper.selectFinanceRank(secUniCode);
|
||||
vo.setFinanceRank(financeRank);
|
||||
// 估值分析
|
||||
List<DiagnoseValuationVO> diagnoseValuationList = diagnoseMapper.selectDiagnoseValuation(secUniCode);
|
||||
vo.setDiagnoseValuationList(diagnoseValuationList);
|
||||
// 行情估值
|
||||
String tableName = stock.getPriceTableName();
|
||||
StockPriceVO stockPrice = stockMapper.selectLatestPrice(tableName, secUniCode);
|
||||
vo.setStockPrice(stockPrice);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public FinancialValuationExtendVO financialValuationExtend(Long stkUniCode) {
|
||||
StockVO stock = getStock(stkUniCode);
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
String secCode = stock.getSecCode();
|
||||
Integer mktNum = stock.getMktNum();
|
||||
Integer secMarPar = stock.getSecMarPar();
|
||||
// 总结性机器语 & 财务估值得分
|
||||
FinancialValuationVO baseVO = financeMapper.selectFinancialValuation(secCode, mktNum);
|
||||
if (baseVO != null) {
|
||||
return null;
|
||||
}
|
||||
FinancialValuationExtendVO vo = new FinancialValuationExtendVO();
|
||||
vo.setFinSumMac(baseVO.getFinSumMac());
|
||||
vo.setScore(baseVO.getScore());
|
||||
// 财务指标分析列表
|
||||
List<FinanceIndexAnalysisVO> financeIndexAnalysisList = financeMapper.selectFinanceIndexAnalysis(secCode, secMarPar);
|
||||
financeIndexAnalysisList.forEach(fiaVO -> {
|
||||
if (fiaVO.getEndDate() != null && fiaVO.getEndDate().length() > 10) {
|
||||
@ -96,6 +137,7 @@ public class StockService {
|
||||
}
|
||||
});
|
||||
vo.setFinanceIndexAnalysisList(financeIndexAnalysisList);
|
||||
// 现金流量列表
|
||||
List<FinanceCashShortVO> financeCashShortList = financeMapper.selectFinanceCashShort(secCode, secMarPar);
|
||||
financeCashShortList.forEach(fcsVO -> {
|
||||
if (fcsVO.getEndDate() != null && fcsVO.getEndDate().length() > 10) {
|
||||
@ -106,4 +148,42 @@ public class StockService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
public List<ValuationAnalysisVO> financialValuationAnalysis(Long stkUniCode, Integer timeSpan, Integer type) {
|
||||
StockVO stock = getStock(stkUniCode);
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
String tableName = stock.getPriceTableName();
|
||||
String stockValueColumn = getStockValueColumn(type);
|
||||
Long plateUniCode = stock.getPlateUniCode();
|
||||
List<ValuationAnalysisVO> list = stockMapper.selectFinancialValuationAnalysis(tableName, stockValueColumn, stkUniCode, plateUniCode, timeSpan, type);
|
||||
return list;
|
||||
}
|
||||
|
||||
public QuantitativeAnalysisVO quantitativeAnalysis(Long stkUniCode) {
|
||||
StockVO stock = getStock(stkUniCode);
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
String secCode = stock.getSecCode();
|
||||
Integer mktNum = stock.getMktNum();
|
||||
QuantitativeAnalysisVO vo = diagnoseMapper.selectQuantitativeAnalysis(secCode, mktNum);
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
String tableName = stock.getPriceTableName();
|
||||
List<KLineVO> kLineList = stockMapper.selectKLine(tableName, stkUniCode, kLineMonth);
|
||||
vo.setkLineList(kLineList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private String getStockValueColumn(Integer type) {
|
||||
if (type == 2) {
|
||||
return "stk_per_ttm";
|
||||
} else if (type == 3) {
|
||||
return "price_bookv_ratio";
|
||||
}
|
||||
throw new BizException(ResponseStatus.PARM_ERROR, "类型错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
package com.diagnose.util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class StringMatcher {
|
||||
|
||||
private final int GRAM_SIZE = 1;
|
||||
|
||||
private Map<String, Set<Integer>> indexMap = new HashMap<>();
|
||||
private List<String> dataList;
|
||||
|
||||
public StringMatcher(List<String> dataList) {
|
||||
this.dataList = dataList;
|
||||
buildIndex();
|
||||
}
|
||||
|
||||
private void buildIndex() {
|
||||
// 为了平衡性能和内存,可以考虑只索引n-gram
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
String s = dataList.get(i);
|
||||
// 生成所有可能的子串或n-gram
|
||||
for (int j = 0; j < s.length() - GRAM_SIZE + 1; j++) {
|
||||
String gram = s.substring(j, j + GRAM_SIZE); // n-gram
|
||||
indexMap.computeIfAbsent(gram, k -> new HashSet<>()).add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> search(String query, int limit) {
|
||||
// 如果查询字符串长度小于GRAM_SIZE,使用简单遍历
|
||||
if (query.length() < GRAM_SIZE) {
|
||||
return simpleSearch(query, limit);
|
||||
}
|
||||
|
||||
Set<Integer> candidates = null;
|
||||
|
||||
// 使用查询的n-gram找候选集
|
||||
for (int i = 0; i <= query.length() - GRAM_SIZE; i++) {
|
||||
String gram = query.substring(i, i + GRAM_SIZE);
|
||||
Set<Integer> indices = indexMap.getOrDefault(gram, Collections.emptySet());
|
||||
|
||||
if (candidates == null) {
|
||||
candidates = new HashSet<>(indices);
|
||||
} else {
|
||||
candidates.retainAll(indices);
|
||||
}
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
// 验证候选集
|
||||
List<String> result = new ArrayList<>();
|
||||
for (Integer idx : candidates) {
|
||||
if (dataList.get(idx).contains(query)) {
|
||||
result.add(dataList.get(idx));
|
||||
if (result.size() >= limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> simpleSearch(String query, int limit) {
|
||||
// 简单遍历法
|
||||
List<String> result = new ArrayList<>();
|
||||
for (String s : dataList) {
|
||||
if (s.contains(query)) {
|
||||
result.add(s);
|
||||
if (result.size() >= limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package com.diagnose.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestSearch {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 示例数据
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("hello world");
|
||||
list.add("java programming");
|
||||
list.add("ahocorasick algorithm");
|
||||
list.add("substring matching");
|
||||
list.add("performance optimization");
|
||||
list.add("data structures");
|
||||
list.add("algorithm design");
|
||||
list.add("string search");
|
||||
list.add("efficient matching");
|
||||
list.add("aho-corasick implementation");
|
||||
list.add("another example");
|
||||
list.add("yet another example");
|
||||
list.add("example");
|
||||
list.add("abcexample");
|
||||
list.add("abcexampledef");
|
||||
|
||||
StringMatcher matcher = new StringMatcher(list);
|
||||
List<String> results = matcher.search("example", 10);
|
||||
|
||||
for (String result : results) {
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,11 @@ package com.diagnose.vo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("综合评分")
|
||||
public class ComprehensiveEvaluationVO {
|
||||
public class ComprehensiveEvaluationVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("股票基本信息")
|
||||
private StockVO stock;
|
||||
|
||||
86
src/main/java/com/diagnose/vo/DiagnoseValuationVO.java
Normal file
86
src/main/java/com/diagnose/vo/DiagnoseValuationVO.java
Normal file
@ -0,0 +1,86 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DiagnoseValuationVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("分析周期")
|
||||
private String timeSpan;
|
||||
|
||||
@ApiModelProperty("市盈率(TTM)_30分位数")
|
||||
private BigDecimal q30pe;
|
||||
|
||||
@ApiModelProperty("市盈率(TTM)_70分位数")
|
||||
private BigDecimal q70pe;
|
||||
|
||||
@ApiModelProperty("市盈率(TTM)当前分位数")
|
||||
private BigDecimal currentQPe;
|
||||
|
||||
@ApiModelProperty("市净率_30分位数")
|
||||
private BigDecimal q30pb;
|
||||
|
||||
@ApiModelProperty("市净率_70分位数")
|
||||
private BigDecimal q70pb;
|
||||
|
||||
@ApiModelProperty("市净率_当前分位数")
|
||||
private BigDecimal currentQPb;
|
||||
|
||||
public String getTimeSpan() {
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
public void setTimeSpan(String timeSpan) {
|
||||
this.timeSpan = timeSpan;
|
||||
}
|
||||
|
||||
public BigDecimal getQ30pe() {
|
||||
return q30pe;
|
||||
}
|
||||
|
||||
public void setQ30pe(BigDecimal q30pe) {
|
||||
this.q30pe = q30pe;
|
||||
}
|
||||
|
||||
public BigDecimal getQ70pe() {
|
||||
return q70pe;
|
||||
}
|
||||
|
||||
public void setQ70pe(BigDecimal q70pe) {
|
||||
this.q70pe = q70pe;
|
||||
}
|
||||
|
||||
public BigDecimal getCurrentQPe() {
|
||||
return currentQPe;
|
||||
}
|
||||
|
||||
public void setCurrentQPe(BigDecimal currentQPe) {
|
||||
this.currentQPe = currentQPe;
|
||||
}
|
||||
|
||||
public BigDecimal getQ30pb() {
|
||||
return q30pb;
|
||||
}
|
||||
|
||||
public void setQ30pb(BigDecimal q30pb) {
|
||||
this.q30pb = q30pb;
|
||||
}
|
||||
|
||||
public BigDecimal getQ70pb() {
|
||||
return q70pb;
|
||||
}
|
||||
|
||||
public void setQ70pb(BigDecimal q70pb) {
|
||||
this.q70pb = q70pb;
|
||||
}
|
||||
|
||||
public BigDecimal getCurrentQPb() {
|
||||
return currentQPb;
|
||||
}
|
||||
|
||||
public void setCurrentQPb(BigDecimal currentQPb) {
|
||||
this.currentQPb = currentQPb;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("现金流量")
|
||||
public class FinanceCashShortVO {
|
||||
|
||||
@ApiModelProperty("截止日期")
|
||||
|
||||
@ -3,10 +3,11 @@ package com.diagnose.vo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ApiModel("财务指标分析")
|
||||
public class FinanceIndexAnalysisVO {
|
||||
public class FinanceIndexAnalysisVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("截止日期")
|
||||
private String endDate;
|
||||
|
||||
65
src/main/java/com/diagnose/vo/FinanceRankVO.java
Normal file
65
src/main/java/com/diagnose/vo/FinanceRankVO.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("财务分析行业排名")
|
||||
public class FinanceRankVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("盈利能力行业排名")
|
||||
private Integer profitInduRank;
|
||||
|
||||
@ApiModelProperty("成长能力行业排名")
|
||||
private Integer growthInduRank;
|
||||
|
||||
@ApiModelProperty("运营能力排名")
|
||||
private Integer operateInduRank;
|
||||
|
||||
@ApiModelProperty("偿债能力行业排名")
|
||||
private Integer debtInduRank;
|
||||
|
||||
@ApiModelProperty("现金流量行业排名")
|
||||
private Integer cashInduRank;
|
||||
|
||||
public Integer getProfitInduRank() {
|
||||
return profitInduRank;
|
||||
}
|
||||
|
||||
public void setProfitInduRank(Integer profitInduRank) {
|
||||
this.profitInduRank = profitInduRank;
|
||||
}
|
||||
|
||||
public Integer getGrowthInduRank() {
|
||||
return growthInduRank;
|
||||
}
|
||||
|
||||
public void setGrowthInduRank(Integer growthInduRank) {
|
||||
this.growthInduRank = growthInduRank;
|
||||
}
|
||||
|
||||
public Integer getOperateInduRank() {
|
||||
return operateInduRank;
|
||||
}
|
||||
|
||||
public void setOperateInduRank(Integer operateInduRank) {
|
||||
this.operateInduRank = operateInduRank;
|
||||
}
|
||||
|
||||
public Integer getDebtInduRank() {
|
||||
return debtInduRank;
|
||||
}
|
||||
|
||||
public void setDebtInduRank(Integer debtInduRank) {
|
||||
this.debtInduRank = debtInduRank;
|
||||
}
|
||||
|
||||
public Integer getCashInduRank() {
|
||||
return cashInduRank;
|
||||
}
|
||||
|
||||
public void setCashInduRank(Integer cashInduRank) {
|
||||
this.cashInduRank = cashInduRank;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("财务估值")
|
||||
public class FinancialValuationExtendVO {
|
||||
|
||||
@ApiModelProperty("总结性机器语")
|
||||
private String finSumMac;
|
||||
|
||||
@ApiModelProperty("财务估值得分")
|
||||
private Integer score;
|
||||
|
||||
@ApiModelProperty("财务指标分析列表")
|
||||
private List<FinanceIndexAnalysisVO> financeIndexAnalysisList;
|
||||
|
||||
@ApiModelProperty("现金流量列表")
|
||||
private List<FinanceCashShortVO> financeCashShortList;
|
||||
|
||||
public String getFinSumMac() {
|
||||
return finSumMac;
|
||||
}
|
||||
|
||||
public void setFinSumMac(String finSumMac) {
|
||||
this.finSumMac = finSumMac;
|
||||
}
|
||||
|
||||
public Integer getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Integer score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public List<FinanceIndexAnalysisVO> getFinanceIndexAnalysisList() {
|
||||
return financeIndexAnalysisList;
|
||||
}
|
||||
|
||||
public void setFinanceIndexAnalysisList(List<FinanceIndexAnalysisVO> financeIndexAnalysisList) {
|
||||
this.financeIndexAnalysisList = financeIndexAnalysisList;
|
||||
}
|
||||
|
||||
public List<FinanceCashShortVO> getFinanceCashShortList() {
|
||||
return financeCashShortList;
|
||||
}
|
||||
|
||||
public void setFinanceCashShortList(List<FinanceCashShortVO> financeCashShortList) {
|
||||
this.financeCashShortList = financeCashShortList;
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,11 @@ package com.diagnose.vo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("财务估值")
|
||||
public class FinancialValuationVO {
|
||||
public class FinancialValuationVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("总结性机器语")
|
||||
private String finSumMac;
|
||||
@ -14,11 +15,14 @@ public class FinancialValuationVO {
|
||||
@ApiModelProperty("财务估值得分")
|
||||
private Integer score;
|
||||
|
||||
@ApiModelProperty("财务指标分析列表")
|
||||
private List<FinanceIndexAnalysisVO> financeIndexAnalysisList;
|
||||
@ApiModelProperty("财务分析行业排名")
|
||||
private FinanceRankVO financeRank;
|
||||
|
||||
@ApiModelProperty("现金流量列表")
|
||||
private List<FinanceCashShortVO> financeCashShortList;
|
||||
@ApiModelProperty("行情估值")
|
||||
private StockPriceVO stockPrice;
|
||||
|
||||
@ApiModelProperty("估值分析")
|
||||
private List<DiagnoseValuationVO> diagnoseValuationList;
|
||||
|
||||
public String getFinSumMac() {
|
||||
return finSumMac;
|
||||
@ -36,19 +40,28 @@ public class FinancialValuationVO {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public List<FinanceIndexAnalysisVO> getFinanceIndexAnalysisList() {
|
||||
return financeIndexAnalysisList;
|
||||
public FinanceRankVO getFinanceRank() {
|
||||
return financeRank;
|
||||
}
|
||||
|
||||
public void setFinanceIndexAnalysisList(List<FinanceIndexAnalysisVO> financeIndexAnalysisList) {
|
||||
this.financeIndexAnalysisList = financeIndexAnalysisList;
|
||||
public StockPriceVO getStockPrice() {
|
||||
return stockPrice;
|
||||
}
|
||||
|
||||
public List<FinanceCashShortVO> getFinanceCashShortList() {
|
||||
return financeCashShortList;
|
||||
public void setStockPrice(StockPriceVO stockPrice) {
|
||||
this.stockPrice = stockPrice;
|
||||
}
|
||||
|
||||
public void setFinanceCashShortList(List<FinanceCashShortVO> financeCashShortList) {
|
||||
this.financeCashShortList = financeCashShortList;
|
||||
public void setFinanceRank(FinanceRankVO financeRank) {
|
||||
this.financeRank = financeRank;
|
||||
}
|
||||
|
||||
public List<DiagnoseValuationVO> getDiagnoseValuationList() {
|
||||
return diagnoseValuationList;
|
||||
}
|
||||
|
||||
public void setDiagnoseValuationList(List<DiagnoseValuationVO> diagnoseValuationList) {
|
||||
this.diagnoseValuationList = diagnoseValuationList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
66
src/main/java/com/diagnose/vo/KLineVO.java
Normal file
66
src/main/java/com/diagnose/vo/KLineVO.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@ApiModel("K线")
|
||||
public class KLineVO {
|
||||
|
||||
@ApiModelProperty("交易日")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("开盘价")
|
||||
private BigDecimal open;
|
||||
|
||||
@ApiModelProperty("收盘价")
|
||||
private BigDecimal close;
|
||||
|
||||
@ApiModelProperty("最高价")
|
||||
private BigDecimal high;
|
||||
|
||||
@ApiModelProperty("最低价")
|
||||
private BigDecimal low;
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public BigDecimal getOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(BigDecimal open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public BigDecimal getClose() {
|
||||
return close;
|
||||
}
|
||||
|
||||
public void setClose(BigDecimal close) {
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
public BigDecimal getHigh() {
|
||||
return high;
|
||||
}
|
||||
|
||||
public void setHigh(BigDecimal high) {
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
public BigDecimal getLow() {
|
||||
return low;
|
||||
}
|
||||
|
||||
public void setLow(BigDecimal low) {
|
||||
this.low = low;
|
||||
}
|
||||
}
|
||||
56
src/main/java/com/diagnose/vo/QuantitativeAnalysisVO.java
Normal file
56
src/main/java/com/diagnose/vo/QuantitativeAnalysisVO.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("量化分析")
|
||||
public class QuantitativeAnalysisVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("总结性机器语")
|
||||
private String techSumMac;
|
||||
|
||||
@ApiModelProperty("支撑位")
|
||||
private BigDecimal stkSptLvl;
|
||||
|
||||
@ApiModelProperty("压力位")
|
||||
private BigDecimal stkPrsLvl;
|
||||
|
||||
@ApiModelProperty("K线列表")
|
||||
private List<KLineVO> kLineList;
|
||||
|
||||
public String getTechSumMac() {
|
||||
return techSumMac;
|
||||
}
|
||||
|
||||
public void setTechSumMac(String techSumMac) {
|
||||
this.techSumMac = techSumMac;
|
||||
}
|
||||
|
||||
public BigDecimal getStkSptLvl() {
|
||||
return stkSptLvl;
|
||||
}
|
||||
|
||||
public void setStkSptLvl(BigDecimal stkSptLvl) {
|
||||
this.stkSptLvl = stkSptLvl;
|
||||
}
|
||||
|
||||
public BigDecimal getStkPrsLvl() {
|
||||
return stkPrsLvl;
|
||||
}
|
||||
|
||||
public void setStkPrsLvl(BigDecimal stkPrsLvl) {
|
||||
this.stkPrsLvl = stkPrsLvl;
|
||||
}
|
||||
|
||||
public List<KLineVO> getkLineList() {
|
||||
return kLineList;
|
||||
}
|
||||
|
||||
public void setkLineList(List<KLineVO> kLineList) {
|
||||
this.kLineList = kLineList;
|
||||
}
|
||||
}
|
||||
55
src/main/java/com/diagnose/vo/StockPriceVO.java
Normal file
55
src/main/java/com/diagnose/vo/StockPriceVO.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@ApiModel("行情估值")
|
||||
public class StockPriceVO {
|
||||
|
||||
@ApiModelProperty("结算日")
|
||||
private LocalDate endDate;
|
||||
|
||||
@ApiModelProperty("收盘价")
|
||||
private BigDecimal closePrice;
|
||||
|
||||
@ApiModelProperty("市盈率(TTM)")
|
||||
private BigDecimal stkPerTtm;
|
||||
|
||||
@ApiModelProperty("市净率(MRQ)")
|
||||
private BigDecimal priceBookvRatio;
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public BigDecimal getClosePrice() {
|
||||
return closePrice;
|
||||
}
|
||||
|
||||
public void setClosePrice(BigDecimal closePrice) {
|
||||
this.closePrice = closePrice;
|
||||
}
|
||||
|
||||
public BigDecimal getStkPerTtm() {
|
||||
return stkPerTtm;
|
||||
}
|
||||
|
||||
public void setStkPerTtm(BigDecimal stkPerTtm) {
|
||||
this.stkPerTtm = stkPerTtm;
|
||||
}
|
||||
|
||||
public BigDecimal getPriceBookvRatio() {
|
||||
return priceBookvRatio;
|
||||
}
|
||||
|
||||
public void setPriceBookvRatio(BigDecimal priceBookvRatio) {
|
||||
this.priceBookvRatio = priceBookvRatio;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.diagnose.vo;
|
||||
|
||||
import com.diagnose.constant.MktNum;
|
||||
import com.diagnose.constant.MktTypePar;
|
||||
import com.diagnose.constant.PriceTableName;
|
||||
import com.diagnose.constant.SecMarPar;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -65,6 +66,20 @@ public class StockVO implements Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPriceTableName() {
|
||||
if (mktTypePar == null) {
|
||||
return null;
|
||||
}
|
||||
if (MktTypePar.SZ.value.equals(mktTypePar)) {
|
||||
return PriceTableName.SZ.tableName;
|
||||
} else if (MktTypePar.SH.value.equals(mktTypePar)) {
|
||||
return PriceTableName.SH.tableName;
|
||||
} else if (MktTypePar.BJ.value.equals(mktTypePar)) {
|
||||
return PriceTableName.BJ.tableName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Long getSecUniCode() {
|
||||
return secUniCode;
|
||||
}
|
||||
|
||||
42
src/main/java/com/diagnose/vo/ValuationAnalysisVO.java
Normal file
42
src/main/java/com/diagnose/vo/ValuationAnalysisVO.java
Normal file
@ -0,0 +1,42 @@
|
||||
package com.diagnose.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ValuationAnalysisVO {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("股票值")
|
||||
private BigDecimal stockValue;
|
||||
|
||||
@ApiModelProperty("行业值")
|
||||
private BigDecimal plateValue;
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public BigDecimal getStockValue() {
|
||||
return stockValue;
|
||||
}
|
||||
|
||||
public void setStockValue(BigDecimal stockValue) {
|
||||
this.stockValue = stockValue;
|
||||
}
|
||||
|
||||
public BigDecimal getPlateValue() {
|
||||
return plateValue;
|
||||
}
|
||||
|
||||
public void setPlateValue(BigDecimal plateValue) {
|
||||
this.plateValue = plateValue;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user