feat: 增加股票现价显示,日线改为后复权数据
This commit is contained in:
@@ -42,6 +42,20 @@ public class NumberHelper {
|
||||
return NumberUtil.decimalFormat("0.00%", value);
|
||||
}
|
||||
|
||||
public static String formatPriceDouble(Double value) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return null;
|
||||
}
|
||||
return NumberUtil.decimalFormat("0.00", value);
|
||||
}
|
||||
|
||||
public static String formatPriceDouble(Integer value) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return null;
|
||||
}
|
||||
return NumberUtil.decimalFormat("0.00", value);
|
||||
}
|
||||
|
||||
public static Double parseDouble(String value) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
return null;
|
||||
|
||||
@@ -23,6 +23,9 @@ public interface DailyRepository extends SimpleRepository<Daily> {
|
||||
@Query("select min(daily.tradeDate) from Daily daily")
|
||||
LocalDate findMinTradeDate();
|
||||
|
||||
@Query("from Daily daily where daily.stock.id = ?1 order by daily.tradeDate desc limit 1")
|
||||
Optional<Daily> findLatest(Long stockId);
|
||||
|
||||
@EntityGraph(attributePaths = {"stock"})
|
||||
@Override
|
||||
Optional<Daily> findOne(Predicate predicate);
|
||||
|
||||
@@ -58,4 +58,8 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
Sort.by(Sort.Direction.ASC, Daily_.TRADE_DATE)
|
||||
);
|
||||
}
|
||||
|
||||
public Optional<Daily> findDailyLatest(Long stockId) {
|
||||
return dailyRepository.findLatest(stockId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user