Application.java 1.14 KB
package vion;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import vion.third.DingMod;

@SpringBootApplication
@MapperScan("vion.mapper")
@EnableScheduling
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Autowired
    private DingMod dingMod;

    private final static Logger logger = LoggerFactory.getLogger(Application.class);

    @Scheduled(cron = "${third.run.cron:0 0 2 * * ?}")
    public void startJob() {
        try {
            logger.info("启动");
            //定时获取钉钉用户列表
            dingMod.getDeptList();
            dingMod.getDingUserList();

            logger.info("启动完成");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}