mirror of
https://gitee.com/gz-yami/mall4j.git
synced 2025-12-25 23:56:20 +08:00
定时任务sql
This commit is contained in:
parent
ce829538f6
commit
0f4d58ed4d
@ -4,7 +4,7 @@ MySQL - 5.7.23 : Database - yami_shops
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
create database IF NOT EXISTS `yami_shops` default character set utf8 collate utf8_general_ci;
|
||||
create database IF NOT EXISTS `yami_shops` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
|
||||
USE yami_shops;
|
||||
|
||||
@ -34,10 +34,6 @@ CREATE TABLE `qrtz_blob_triggers` (
|
||||
|
||||
/*Data for the table `qrtz_blob_triggers` */
|
||||
|
||||
insert into `qrtz_cron_triggers`(`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`CRON_EXPRESSION`,`TIME_ZONE_ID`) values
|
||||
('clusteredScheduler','TASK_14','DEFAULT','0 * * * * ?','Asia/Shanghai'),
|
||||
('clusteredScheduler','TASK_16','DEFAULT','0 0/5 * * * ?','Asia/Shanghai');
|
||||
|
||||
/*Table structure for table `qrtz_calendars` */
|
||||
|
||||
DROP TABLE IF EXISTS `qrtz_calendars`;
|
||||
@ -67,6 +63,10 @@ CREATE TABLE `qrtz_cron_triggers` (
|
||||
|
||||
/*Data for the table `qrtz_cron_triggers` */
|
||||
|
||||
insert into `qrtz_cron_triggers`(`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`CRON_EXPRESSION`,`TIME_ZONE_ID`) values
|
||||
('clusteredScheduler','TASK_14','DEFAULT','0 * * * * ?','Asia/Shanghai'),
|
||||
('clusteredScheduler','TASK_16','DEFAULT','0 0/5 * * * ?','Asia/Shanghai');
|
||||
|
||||
/*Table structure for table `qrtz_fired_triggers` */
|
||||
|
||||
DROP TABLE IF EXISTS `qrtz_fired_triggers`;
|
||||
|
||||
@ -26,6 +26,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
@ -43,6 +44,9 @@ public class SysJobListener {
|
||||
@EventListener(ScheduleJobEvent.class)
|
||||
public void scheduleJobEventListener(ScheduleJobEvent event) {
|
||||
ScheduleJob scheduleJob = event.getScheduleJob();
|
||||
if (Objects.isNull(scheduleJob)) {
|
||||
return;
|
||||
}
|
||||
//数据库保存执行记录
|
||||
ScheduleJobLog jobLog = new ScheduleJobLog();
|
||||
jobLog.setJobId(scheduleJob.getJobId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user