src/main/java/com/nathan/crm/task/JobTask.java

(完整代码) 741B

package com.nathan.crm.task;

import com.nathan.crm.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *  定时任务的执行
 */
@Component
public class JobTask {

    @Resource
    private CustomerService customerService;

    // 每月执行一次
    @Scheduled(cron = "0 15 10 15 * ?")
    public void job(){
        System.out.println("定时任务执行----->" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

        customerService.updateCustomerState();
    }

}


24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。