28 lines
749 B
Java
28 lines
749 B
Java
package com.ruoyi.job;
|
|
|
|
import com.ruoyi.cai.service.DayIncomeStatisticsService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
@Component
|
|
@Slf4j
|
|
public class IncomeStatisticsJob {
|
|
@Autowired
|
|
private DayIncomeStatisticsService dayIncomeStatisticsService;
|
|
|
|
// 每6分钟执行一次
|
|
@Scheduled(cron = "0 0/6 * * * ?")
|
|
public void persistentDb() {
|
|
try {
|
|
dayIncomeStatisticsService.refreshByDate(LocalDate.now());
|
|
}catch (Exception e){
|
|
log.error("更新每日收益统计失败!",e);
|
|
}
|
|
|
|
}
|
|
}
|