first commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package com.agricultural.stock.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* API统一响应结果封装
|
||||
*
|
||||
* @author Agricultural Stock Platform Team
|
||||
*/
|
||||
@Data
|
||||
public class ApiResponse<T> {
|
||||
|
||||
private static final int SUCCESS_CODE = 200;
|
||||
private static final int ERROR_CODE = 500;
|
||||
private static final String SUCCESS_MESSAGE = "success";
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
private T data;
|
||||
private long timestamp;
|
||||
|
||||
public ApiResponse() {
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public ApiResponse(int code, String message, T data) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功响应
|
||||
*/
|
||||
public static <T> ApiResponse<T> success() {
|
||||
return new ApiResponse<>(SUCCESS_CODE, SUCCESS_MESSAGE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功响应带数据
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(T data) {
|
||||
return new ApiResponse<>(SUCCESS_CODE, SUCCESS_MESSAGE, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功响应带消息和数据
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(String message, T data) {
|
||||
return new ApiResponse<>(SUCCESS_CODE, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误响应
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String message) {
|
||||
return new ApiResponse<>(ERROR_CODE, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误响应带错误码
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(int code, String message) {
|
||||
return new ApiResponse<>(code, message, null);
|
||||
}
|
||||
}
|
||||
76
backend/src/main/java/com/agricultural/stock/vo/Result.java
Normal file
76
backend/src/main/java/com/agricultural/stock/vo/Result.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.agricultural.stock.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一API响应结果类
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 响应消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private long timestamp;
|
||||
|
||||
public Result() {
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Result(int code, String message, T data) {
|
||||
this();
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功响应
|
||||
*/
|
||||
public static <T> Result<T> success(T data) {
|
||||
return new Result<>(200, "成功", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功响应(无数据)
|
||||
*/
|
||||
public static <T> Result<T> success() {
|
||||
return new Result<>(200, "成功", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败响应
|
||||
*/
|
||||
public static <T> Result<T> error(String message) {
|
||||
return new Result<>(500, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败响应(自定义状态码)
|
||||
*/
|
||||
public static <T> Result<T> error(int code, String message) {
|
||||
return new Result<>(code, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否成功
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
return this.code == 200;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.agricultural.stock.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 股票市场分析结果VO
|
||||
*
|
||||
* @author Agricultural Stock Platform Team
|
||||
*/
|
||||
@Data
|
||||
public class StockAnalysisVO {
|
||||
|
||||
/**
|
||||
* 市场总览
|
||||
*/
|
||||
private MarketOverview marketOverview;
|
||||
|
||||
/**
|
||||
* 涨幅榜前10
|
||||
*/
|
||||
private List<StockRankingItem> topGainers;
|
||||
|
||||
/**
|
||||
* 跌幅榜前10
|
||||
*/
|
||||
private List<StockRankingItem> topLosers;
|
||||
|
||||
/**
|
||||
* 成交量榜前10
|
||||
*/
|
||||
private List<StockRankingItem> topVolume;
|
||||
|
||||
/**
|
||||
* 行业分析
|
||||
*/
|
||||
private List<IndustryAnalysisItem> industryAnalysis;
|
||||
|
||||
/**
|
||||
* 行业分析
|
||||
*/
|
||||
private List<IndustryAnalysis> industryAnalysisList;
|
||||
|
||||
/**
|
||||
* 热门股票
|
||||
*/
|
||||
private List<HotStock> hotStocks;
|
||||
|
||||
/**
|
||||
* 市场情绪指标
|
||||
*/
|
||||
private MarketSentiment marketSentiment;
|
||||
|
||||
@Data
|
||||
public static class MarketOverview {
|
||||
/**
|
||||
* 总股票数
|
||||
*/
|
||||
private Integer totalStocks;
|
||||
|
||||
/**
|
||||
* 上涨股票数
|
||||
*/
|
||||
private Integer upCount;
|
||||
|
||||
/**
|
||||
* 下跌股票数
|
||||
*/
|
||||
private Integer downCount;
|
||||
|
||||
/**
|
||||
* 平盘股票数
|
||||
*/
|
||||
private Integer flatCount;
|
||||
|
||||
/**
|
||||
* 平均涨跌幅
|
||||
*/
|
||||
private BigDecimal avgChangePercent;
|
||||
|
||||
/**
|
||||
* 总成交量
|
||||
*/
|
||||
private Long totalVolume;
|
||||
|
||||
/**
|
||||
* 总成交额
|
||||
*/
|
||||
private BigDecimal totalTurnover;
|
||||
|
||||
/**
|
||||
* 总市值
|
||||
*/
|
||||
private BigDecimal totalMarketCap;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StockRankingItem {
|
||||
/**
|
||||
* 股票代码
|
||||
*/
|
||||
private String stockCode;
|
||||
|
||||
/**
|
||||
* 股票名称
|
||||
*/
|
||||
private String stockName;
|
||||
|
||||
/**
|
||||
* 当前价格
|
||||
*/
|
||||
private BigDecimal currentPrice;
|
||||
|
||||
/**
|
||||
* 涨跌幅
|
||||
*/
|
||||
private BigDecimal changePercent;
|
||||
|
||||
/**
|
||||
* 涨跌额
|
||||
*/
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
/**
|
||||
* 成交量
|
||||
*/
|
||||
private Long volume;
|
||||
|
||||
/**
|
||||
* 成交额
|
||||
*/
|
||||
private BigDecimal turnover;
|
||||
|
||||
/**
|
||||
* 市值
|
||||
*/
|
||||
private BigDecimal marketCap;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IndustryAnalysisItem {
|
||||
/**
|
||||
* 行业名称
|
||||
*/
|
||||
private String industry;
|
||||
|
||||
/**
|
||||
* 股票数量
|
||||
*/
|
||||
private Integer stockCount;
|
||||
|
||||
/**
|
||||
* 平均涨跌幅
|
||||
*/
|
||||
private BigDecimal avgChangePercent;
|
||||
|
||||
/**
|
||||
* 总市值
|
||||
*/
|
||||
private BigDecimal totalMarketCap;
|
||||
|
||||
/**
|
||||
* 总成交量
|
||||
*/
|
||||
private Long totalVolume;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IndustryAnalysis {
|
||||
/**
|
||||
* 行业名称
|
||||
*/
|
||||
private String industryName;
|
||||
|
||||
/**
|
||||
* 股票数量
|
||||
*/
|
||||
private Integer stockCount;
|
||||
|
||||
/**
|
||||
* 平均涨跌幅
|
||||
*/
|
||||
private BigDecimal avgChangePercent;
|
||||
|
||||
/**
|
||||
* 总市值
|
||||
*/
|
||||
private BigDecimal totalMarketCap;
|
||||
|
||||
/**
|
||||
* 领涨股票
|
||||
*/
|
||||
private String leadingStock;
|
||||
|
||||
/**
|
||||
* 行业排名
|
||||
*/
|
||||
private Integer ranking;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class HotStock {
|
||||
/**
|
||||
* 股票代码
|
||||
*/
|
||||
private String stockCode;
|
||||
|
||||
/**
|
||||
* 股票名称
|
||||
*/
|
||||
private String stockName;
|
||||
|
||||
/**
|
||||
* 涨跌幅
|
||||
*/
|
||||
private BigDecimal changePercent;
|
||||
|
||||
/**
|
||||
* 成交量
|
||||
*/
|
||||
private Long volume;
|
||||
|
||||
/**
|
||||
* 热度评分
|
||||
*/
|
||||
private Integer hotScore;
|
||||
|
||||
/**
|
||||
* 热度原因
|
||||
*/
|
||||
private String hotReason;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class MarketSentiment {
|
||||
/**
|
||||
* 市场情绪指数 (0-100)
|
||||
*/
|
||||
private Integer sentimentIndex;
|
||||
|
||||
/**
|
||||
* 恐慌贪婪指数 (0-100)
|
||||
*/
|
||||
private Integer fearGreedIndex;
|
||||
|
||||
/**
|
||||
* 波动率指数
|
||||
*/
|
||||
private BigDecimal volatilityIndex;
|
||||
|
||||
/**
|
||||
* 资金流向
|
||||
*/
|
||||
private String moneyFlow;
|
||||
|
||||
/**
|
||||
* 市场预期
|
||||
*/
|
||||
private String marketExpectation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.agricultural.stock.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 股票趋势分析VO
|
||||
*
|
||||
* @author Agricultural Stock Platform Team
|
||||
*/
|
||||
@Data
|
||||
public class StockTrendVO {
|
||||
|
||||
/**
|
||||
* 股票代码
|
||||
*/
|
||||
private String stockCode;
|
||||
|
||||
/**
|
||||
* 股票名称
|
||||
*/
|
||||
private String stockName;
|
||||
|
||||
/**
|
||||
* 分析天数
|
||||
*/
|
||||
private Integer days;
|
||||
|
||||
/**
|
||||
* 当前价格
|
||||
*/
|
||||
private BigDecimal currentPrice;
|
||||
|
||||
/**
|
||||
* 最高价格
|
||||
*/
|
||||
private BigDecimal highestPrice;
|
||||
|
||||
/**
|
||||
* 最低价格
|
||||
*/
|
||||
private BigDecimal lowestPrice;
|
||||
|
||||
/**
|
||||
* 平均价格
|
||||
*/
|
||||
private BigDecimal averagePrice;
|
||||
|
||||
/**
|
||||
* 总涨跌幅
|
||||
*/
|
||||
private BigDecimal totalChangePercent;
|
||||
|
||||
/**
|
||||
* 平均涨跌幅
|
||||
*/
|
||||
private BigDecimal avgChangePercent;
|
||||
|
||||
/**
|
||||
* 波动率
|
||||
*/
|
||||
private BigDecimal volatility;
|
||||
|
||||
/**
|
||||
* 总成交量
|
||||
*/
|
||||
private Long totalVolume;
|
||||
|
||||
/**
|
||||
* 平均成交量
|
||||
*/
|
||||
private Long avgVolume;
|
||||
|
||||
/**
|
||||
* 趋势方向 (UP/DOWN/FLAT)
|
||||
*/
|
||||
private String trendDirection;
|
||||
|
||||
/**
|
||||
* 趋势强度 (0-100)
|
||||
*/
|
||||
private BigDecimal trendStrength;
|
||||
|
||||
/**
|
||||
* 历史价格数据
|
||||
*/
|
||||
private List<PricePoint> priceHistory;
|
||||
|
||||
/**
|
||||
* 技术指标
|
||||
*/
|
||||
private TechnicalIndicators technicalIndicators;
|
||||
|
||||
@Data
|
||||
public static class PricePoint {
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private LocalDate tradeDate;
|
||||
|
||||
/**
|
||||
* 开盘价
|
||||
*/
|
||||
private BigDecimal openPrice;
|
||||
|
||||
/**
|
||||
* 收盘价
|
||||
*/
|
||||
private BigDecimal closePrice;
|
||||
|
||||
/**
|
||||
* 最高价
|
||||
*/
|
||||
private BigDecimal highPrice;
|
||||
|
||||
/**
|
||||
* 最低价
|
||||
*/
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
/**
|
||||
* 成交量
|
||||
*/
|
||||
private Long volume;
|
||||
|
||||
/**
|
||||
* 涨跌幅
|
||||
*/
|
||||
private BigDecimal changePercent;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TechnicalIndicators {
|
||||
/**
|
||||
* 5日移动平均线
|
||||
*/
|
||||
private BigDecimal ma5;
|
||||
|
||||
/**
|
||||
* 10日移动平均线
|
||||
*/
|
||||
private BigDecimal ma10;
|
||||
|
||||
/**
|
||||
* 20日移动平均线
|
||||
*/
|
||||
private BigDecimal ma20;
|
||||
|
||||
/**
|
||||
* 30日移动平均线
|
||||
*/
|
||||
private BigDecimal ma30;
|
||||
|
||||
/**
|
||||
* RSI相对强弱指标
|
||||
*/
|
||||
private BigDecimal rsi;
|
||||
|
||||
/**
|
||||
* MACD DIF值
|
||||
*/
|
||||
private BigDecimal macdDif;
|
||||
|
||||
/**
|
||||
* MACD DEA值
|
||||
*/
|
||||
private BigDecimal macdDea;
|
||||
|
||||
/**
|
||||
* 布林带上轨
|
||||
*/
|
||||
private BigDecimal bbUpper;
|
||||
|
||||
/**
|
||||
* 布林带中轨
|
||||
*/
|
||||
private BigDecimal bbMiddle;
|
||||
|
||||
/**
|
||||
* 布林带下轨
|
||||
*/
|
||||
private BigDecimal bbLower;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user