传送门
SpringMVC的源码解析(精品)
Spring6的源码解析(精品)
SpringBoot3框架(精品)
MyBatis框架(精品)
MyBatis-Plus
SpringDataJPA
SpringCloudNetflix
SpringCloudAlibaba(精品)
Shiro
SpringSecurity
java的LOG日志框架
Activiti(敬请期待)
JDK8新特性
JDK9新特性
JDK10新特性
JDK11新特性
JDK12新特性
JDK13新特性
JDK14新特性
JDK15新特性
JDK16新特性
JDK17新特性
JDK18新特性
JDK19新特性
JDK20新特性
JDK21新特性
其他技术文章传送门入口
前言
记录一个定时任务注解,很简单的,就可以在SpringBoot框架中执行
package com.hotent.assembly.conf.task;
import com.hotent.assembly.manager.LcCrkglWlxxManager;
import com.hotent.assembly.manager.LcWxjfWlxxManager;
import org.activiti.bpmn.converter.XMLStreamReaderUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@Configuration
@EnableScheduling
public class TaskHandler {
protected static final Logger LOGGER = LoggerFactory.getLogger(TaskHandler.class);
@Autowired
LcCrkglWlxxManager lcCrkglWlxxManager;
@Scheduled(cron = "0 0 0 * * ?")// 每天凌晨00:00
// @Scheduled(cron = "0 * * * * ?")// 每分钟的0秒 本地调试测试用
public void updateLcCrkglWlxxZlztJob() {
// 质量有效状态+所检日期取数规则:“物料+批次”查询最近所检申请单【已完结状态】中所检日期,如果大于阈值(180天)为“超期”
//定时任务,每天凌晨00:00 , LC_CRKGL_WLXX.SJRQ +180 <LC_CRKGL_MAIN.SJDAT 如果符合条件,更新LC_CRKGL_WLXX.ZLZT = 0
LOGGER.error("执行任务:质量有效状态+所检日期取数规则:“物料+批次”查询最近所检申请单【已完结状态】中所检日期,如果大于阈值(180天)为“超期”");
lcCrkglWlxxManager.updateLcCrkglWlxxZlzt();
}
}
@Configuration
@EnableScheduling
public class TaskHandler {
@Scheduled(cron = "0 0 3 1/1 * ?")
public void userVipJob() {
}
}