12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.yihu.jw.event;
- import com.yihu.jw.job.InternetUpdateJob;
- import com.yihu.jw.job.PrescriptionStatusUpdateJob;
- import com.yihu.jw.job.QuartzHelper;
- import com.yihu.jw.util.SystemConf;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- 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 zdm on 2017/3/10.
- */
- @Service
- public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent> {
- private Logger logger = LoggerFactory.getLogger(ApplicationEvent.class);
- @Autowired
- QuartzHelper quartzHelper;
- @Override
- public void onApplicationEvent(ContextRefreshedEvent ContextRefreshedEvent) {
- try {
- //互联网医院处方状态更新job
- if (!quartzHelper.isExistJob("prescriptionStatus_update_job")) {
- String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescriptionStatus_update_job");
- quartzHelper.addJob(PrescriptionStatusUpdateJob.class, trigger, "prescriptionStatus_update_job", new HashMap<String, Object>());
- logger.info("prescriptionStatus_update_job job success");
- } else {
- logger.info("prescriptionStatus_update_job job exist");
- }
- //互联网医院 监管平台上报 job
- if (!quartzHelper.isExistJob("internet_update_job")) {
- String trigger = SystemConf.getInstance().getSystemProperties().getProperty("internet_update_job");
- quartzHelper.addJob(InternetUpdateJob.class, trigger, "internet_update_job", new HashMap<String, Object>());
- logger.info("internet_update_job job success");
- } else {
- logger.info("internet_update_job job exist");
- }
- } catch (Exception e) {
- logger.info("followup_plan_remind job start failed");
- }
- }
- }
|