package com.*.*.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.***.common.util.DateUtil;
import com.***.dao.StudentMessageDao;
@Component
public class TimerTask {
@Autowired
private StudentMessageDao messageDao;
/**
* 每天凌晨执行一次
*/
@Scheduled(cron = "0 0 0 * * ?")
public void scheduledTask(){
String stringNow = DateUtil.stringNow();
int num = messageDao.resetMessageDayCount();
if (num<=0) {
日志信息
}else{
日志信息
}
}
}
转载自:https://blog.csdn.net/a745533787/article/details/80066666