cy
2023-02-10 0316bb78f8805116a6ddcfe5aff1968eb56673e0
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.integrated.zyyt;
 
import com.integrated.zyyt.service.ZyytService;
import com.integrated.zyyt.util.ZyytUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
 
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
 
/**
 * @ClassName ZyytQuartz
 * @Author cy
 * @Date 2022/11/15
 * @Description
 * @Version 1.0
 **/
@Configuration
@Slf4j
public class ZyytQuartz {
    @Resource
    private ZyytService zyytService;
    @Resource
    private JdbcTemplate jdbcTemplate;
 
 
    @Scheduled(cron = "0 3 0/6 * * ?")
    private void stationInfoTask() {
        LocalDate yestDay = LocalDate.now().minus(1, ChronoUnit.DAYS);
        if (ZyytUtil.canGetAgain("STATIONINFO", yestDay)) {
            log.info("执行stationInfoTask--{}", yestDay);
            zyytService.stationInfoTasks();
        } else {
            log.info("放弃执行stationInfoTask--{}", yestDay);
        }
    }
 
 
    @Scheduled(cron = "0 23 0/3 * * ?")
    private void shkdrbTasks() {
        LocalDate yestDay = LocalDate.now().minus(1, ChronoUnit.DAYS);
        if (ZyytUtil.canGetAgain("YYZT_T_SHKDRB", yestDay)) {
            log.info("执行shkdrbTasks--{}", yestDay);
            zyytService.shkdrbTasks(yestDay);
        } else {
            log.info("放弃执行shkdrbTasks--{}", yestDay);
        }
    }
 
    @Scheduled(cron = "0 7 0/3 * * ?")
    private void djtjbTasks() {
        LocalDate yestDay = LocalDate.now().minus(1, ChronoUnit.DAYS);
        if (!ZyytUtil.canGetAgain("YYZT_T_DJTJB", yestDay)) {
            log.info("放弃执行djtjbTasks--{}", yestDay);
        }
        log.info("执行djtjbTasks--{}", yestDay);
        zyytService.djtjbTasks(yestDay);
    }
 
}