|
@@ -2,12 +2,18 @@ package com.qmth.distributed.print.start;
|
|
|
|
|
|
import com.qmth.distributed.print.business.service.OrgCenterDataDisposeService;
|
|
import com.qmth.distributed.print.business.service.OrgCenterDataDisposeService;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
|
|
+import com.qmth.distributed.print.task.enums.JobEnum;
|
|
|
|
+import com.qmth.distributed.print.task.job.TestJob;
|
|
|
|
+import com.qmth.distributed.print.task.job.TimedSyncSchoolJob;
|
|
|
|
+import com.qmth.distributed.print.task.service.QuartzService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.boot.CommandLineRunner;
|
|
import org.springframework.boot.CommandLineRunner;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 服务启动时初始化运行,哪个微服务模块需要则拿此模版去用
|
|
* @Description: 服务启动时初始化运行,哪个微服务模块需要则拿此模版去用
|
|
@@ -20,8 +26,8 @@ import javax.annotation.Resource;
|
|
public class StartRunning implements CommandLineRunner {
|
|
public class StartRunning implements CommandLineRunner {
|
|
private final static Logger log = LoggerFactory.getLogger(StartRunning.class);
|
|
private final static Logger log = LoggerFactory.getLogger(StartRunning.class);
|
|
|
|
|
|
-// @Resource
|
|
|
|
-// QuartzService quartzService;
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ QuartzService quartzService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private OrgCenterDataDisposeService orgCenterDataDisposeService;
|
|
private OrgCenterDataDisposeService orgCenterDataDisposeService;
|
|
@@ -39,6 +45,16 @@ public class StartRunning implements CommandLineRunner {
|
|
// quartzService.addJob(TestJob.class, JobEnum.TEST_JOB.name(), JobEnum.TEST_JOB_GROUP.name(), "0/10 * * * * ?", testJobMap);
|
|
// quartzService.addJob(TestJob.class, JobEnum.TEST_JOB.name(), JobEnum.TEST_JOB_GROUP.name(), "0/10 * * * * ?", testJobMap);
|
|
// log.info("增加test job end");
|
|
// log.info("增加test job end");
|
|
|
|
|
|
|
|
+ log.info("增加学校信息同步定时任务 start");
|
|
|
|
+ Map schoolJobMap = new HashMap();
|
|
|
|
+ schoolJobMap.computeIfAbsent("name", v -> TimedSyncSchoolJob.class.getName());
|
|
|
|
+ quartzService.deleteJob(JobEnum.Timed_SYNC_SCHOOL_JOB.name(), JobEnum.Timed_TASK_JOB_GROUP.name());
|
|
|
|
+ // 每天0点定时任务
|
|
|
|
+ String jobTime = "0 0 0 * * ?";
|
|
|
|
+ quartzService.addJob(TimedSyncSchoolJob.class, JobEnum.Timed_SYNC_SCHOOL_JOB.name(), JobEnum.Timed_TASK_JOB_GROUP.name(), jobTime, schoolJobMap);
|
|
|
|
+ log.info("增加学校信息同步定时任务 end");
|
|
|
|
+
|
|
|
|
+
|
|
log.info("服务器启动时执行 end");
|
|
log.info("服务器启动时执行 end");
|
|
}
|
|
}
|
|
}
|
|
}
|