package com.yihu.wlyy.statistics.job.business;



/**
 * Created by Administrator on 2016/8/16.
 * 现在用的数据库保存job不需要用这个类
 */
//@Component
public class InstantiationTracingBeanPostProcessor {
       // implements ApplicationListener<ContextRefreshedEvent> {
//
//    @Autowired
//    private SchedulerFactoryBean schedulerFactoryBean;
//    @Autowired
//    private QuotaDao quotaDao;
//    @Autowired
//    private JobConfigDao jobConfigDao;
//    private Scheduler scheduler = null;
//    @Autowired
//    private QuartzHelper quartzHelper;
//    @Override
//    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
//        try {
//            scheduler = schedulerFactoryBean.getScheduler();
//            //查询所有需要开始运行的任务的指标
//            List<QuartzJobConfig> jobConfigList=jobConfigDao.findByStatus("1");
//            for(QuartzJobConfig quartzJobConfig :jobConfigList){
//                WlyyQuota wlyyQuota=quotaDao.findOne(quartzJobConfig.getQuotaId());
//
//                WlyyQuotaVO wlyyQuotaVO= new WlyyQuotaVO();
//                WlyyJobConfigVO wlyyJobConfigVO=new WlyyJobConfigVO();
//                BeanUtils.copyProperties(wlyyQuota,wlyyQuotaVO);
//                BeanUtils.copyProperties(quartzJobConfig,wlyyJobConfigVO);
//
//                Map<String,Object> params=new HashMap<String,Object>();
//                params.put("quota",wlyyQuotaVO);
//                params.put("jobConfig",wlyyJobConfigVO);
//                quartzHelper.addJob(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getQuartzCron(), quartzJobConfig.getId(),params);
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
}
