package com.ruoyi.web.controller.system;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.service.impl.project.BmProjectServiceImpl;
import com.ruoyi.system.service.project.IBmProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author tjf
 * @Date: 2021/07/23/10:10
 */
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class SysSpringTaskController {

    @Autowired
    private IBmProjectService bmProjectService;
    /**
     * 每周四下午14点30分给未添加线索信息的用户发送短信
     */
    @Scheduled(cron = "0 30 14 ? * THU")
    private void configureTasks() {
        System.out.println(DateUtils.getNowDate() +"开始执行定时任务 发送短信");
        bmProjectService.selectBmProjectInProjectStatus();
        System.out.println(DateUtils.getNowDate() +"执行定时任务 发送短信成功");
    }
}
