PushJob.java 1.38 KB
package com.subsidy.jobs;

import com.subsidy.service.PushDataService;
import com.subsidy.service.impl.PushDataServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 核对数据定时任务
 */
@Component
public class PushJob {

    @Value("${spring.profiles.active}")
    private String env;

    @Autowired
    private PushDataService pushDataService;

    /**
     * POST-4:学时
     */
    @Scheduled(cron = "0 0 4 * * ?")
    public void post4() throws IOException {
        if ("prod".equals(env)) {
            pushDataService.post4();
        }
    }

    /**
     * POST-5: 考试
     */
    @Scheduled(cron = "0 10 4 * * ?")
    public void post5() throws IOException {
        if ("prod".equals(env)) {
            pushDataService.post5();
        }
    }

    /**
     * POST-6: 答疑
     */
    @Scheduled(cron = "0 20 4 * * ?")
    public void post6() throws IOException {
        if ("prod".equals(env)) {
            pushDataService.post6();
        }
    }

    /**
     * POST-7:人脸
     */
    @Scheduled(cron = "0 30 4 * * ?")
    public void post7() throws IOException {
        if ("prod".equals(env)) {
            pushDataService.post7();
        }
    }

}