TransferSubscribeScheduleTask.java
1.28 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
47
48
package com.topdraw.schedule;
import com.topdraw.business.process.calculate.task.SubscribeCalculateTask;
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 TransferSubscribeScheduleTask {
@Autowired
private SubscribeCalculateTask subscribeCalculateTask;
@Value("${cronSubscribe:50 0/5 * * * ?}")
// @Value("0/5 * * * * ?")
private String cron;
public String cron(){
return cron;
}
/**
* 统计订购转换数据
*/
@Scheduled(cron = "#{transferSubscribeScheduleTask.cron()}")
// @Scheduled(cron = "0/5 * * * * ?")
public void calculateSubscribe2Mysql(){
log.info("订购数据统计 ===>>> 开始 !!!" + LocalDateTime.now());
this.subscribeCalculateTask.calculateSubscribe2Mysql();
}
}