TransferScheduleTask.java
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.topdraw.schedule;
import com.topdraw.business.process.calculate.task.PvUvCalculateTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/2/26 19:44
* @version: :
* @modified By:
* @since : modified in 2022/2/26 19:44
*/
@Component
@Slf4j
@EnableScheduling
public class TransferScheduleTask {
@Autowired
private PvUvCalculateTask pvUvCalculateTask;
@Value("${cron:50 0/5 * * * ?}")
private String cron;
public String cron(){
return cron;
}
/**
* 统计pv、uv
*/
@Scheduled(cron = "#{transferScheduleTask.cron()}")
public void calculatePvUv2Mysql(){
log.info("专题pv、uv统计 ===>>> 开始 !!!" + LocalDateTime.now());
this.pvUvCalculateTask.calculateRedisData2Mysql();
}
}