fix: 修复缓存调用错误
This commit is contained in:
@@ -41,7 +41,7 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
this.dailyRepository = dailyRepository;
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findFinanceIndicator", cacheManager = "long-cache", sync = true)
|
||||
public Optional<FinanceIndicator> findFinanceIndicator(Long stockId, Integer year) {
|
||||
return financeIndicatorRepository.findOne(
|
||||
QFinanceIndicator.financeIndicator.year.eq(year)
|
||||
@@ -49,7 +49,7 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
);
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findFinanceIndicatorRecent", cacheManager = "long-cache", sync = true)
|
||||
public List<FinanceIndicator> findFinanceIndicatorRecent(Long stockId, int years) {
|
||||
var current = LocalDate.now();
|
||||
return financeIndicatorRepository.findAll(
|
||||
@@ -59,7 +59,7 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
);
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findDailyRecent", cacheManager = "long-cache", sync = true)
|
||||
public List<Daily> findDailyRecent(Long stockId, int days) {
|
||||
var current = LocalDate.now();
|
||||
return dailyRepository.findAll(
|
||||
@@ -69,12 +69,12 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
);
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findDailyLatest", cacheManager = "long-cache", sync = true)
|
||||
public Optional<Daily> findDailyLatest(Long stockId) {
|
||||
return dailyRepository.findLatest(stockId);
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findYearlyRecent", cacheManager = "long-cache", sync = true)
|
||||
public List<Yearly> findYearlyRecent(Long stockId, int years) {
|
||||
var current = LocalDate.now().withMonth(1).withDayOfMonth(1);
|
||||
var start = current.minusYears(years).getYear();
|
||||
@@ -112,7 +112,7 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findMonthlyRecent", cacheManager = "long-cache", sync = true)
|
||||
public List<Monthly> findMonthlyRecent(Long stockId, int months) {
|
||||
var end = LocalDate.now().withDayOfMonth(1);
|
||||
var start = end.minusMonths(months);
|
||||
@@ -162,7 +162,7 @@ public class StockService extends SimpleServiceSupport<Stock> {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Cacheable(value = "long-cache", sync = true)
|
||||
@Cacheable(value = "findWeeklyRecent", cacheManager = "long-cache", sync = true)
|
||||
public List<Weekly> findWeeklyRecent(Long stockId, int weeks) {
|
||||
var end = LocalDate.now().with(ChronoField.DAY_OF_WEEK, 1);
|
||||
var start = end.minusWeeks(weeks);
|
||||
|
||||
Reference in New Issue
Block a user