12345678910111213141516171819202122232425262728293031323334353637 |
- package com.yihu.wlyy.event;
- import com.yihu.wlyy.job.QuartzHelper;
- import com.yihu.wlyy.job.SignEndJob;
- import com.yihu.wlyy.util.SystemConf;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.ApplicationListener;
- import org.springframework.context.event.ContextRefreshedEvent;
- import org.springframework.stereotype.Service;
- import java.util.HashMap;
- /**
- * Created by lyr-pc on 2017/3/10.
- */
- @Service
- public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent>{
- @Autowired
- QuartzHelper quartzHelper;
- @Override
- public void onApplicationEvent(ContextRefreshedEvent ContextRefreshedEvent) {
- try {
- // 启动签约到期处理JOB
- if (!quartzHelper.isExistJob("sign_end_job")) {
- String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sign_end_job_trigger");
- quartzHelper.addJob(SignEndJob.class, trigger, "sign_end_job", new HashMap<String, Object>());
- System.out.println("sign end job start success");
- } else {
- System.out.println("sign end job exist");
- }
- } catch (Exception e) {
- System.out.println("sign end job start failed");
- }
- }
- }
|