123
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.cai.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;
|
||||
@Scheduled(cron = "0 0/6 * * * ? *")
|
||||
public void persistentDb() {
|
||||
try {
|
||||
dayIncomeStatisticsService.refreshByDate(LocalDate.now());
|
||||
}catch (Exception e){
|
||||
log.error("保存昨日收益统计失败!",e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cai.job;
|
||||
|
||||
import com.ruoyi.cai.service.DayIncomeStatisticsService;
|
||||
import com.ruoyi.cai.service.RankService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -16,6 +17,8 @@ public class RankJob {
|
||||
|
||||
@Autowired
|
||||
private RankService rankService;
|
||||
@Autowired
|
||||
private DayIncomeStatisticsService dayIncomeStatisticsService;
|
||||
|
||||
@Scheduled(cron = "0 1 0 * * ? ")
|
||||
public void persistentDb() {
|
||||
@@ -57,6 +60,11 @@ public class RankJob {
|
||||
log.error("保存邀请 月榜失败", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
dayIncomeStatisticsService.refreshByDate(date);
|
||||
}catch (Exception e){
|
||||
log.error("保存昨日收益统计失败!",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user