| | |
| | | import com.dy.common.schedulerTask.SchedulerTaskSupport; |
| | | import com.dy.pipIrrGlobal.util.Org; |
| | | import com.dy.pipIrrGlobal.util.OrgListenerSupport; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.event.ApplicationReadyEvent; |
| | |
| | | * Spring容器并没有创建完,而本类中用了Spring容器中的Bean,即*Dao 。 |
| | | * 所以采用了Spring事件监听器来实现 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class StatisticsListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> { |
| | | |
| | | private static Logger log = LogManager.getLogger(StatisticsListener.class.getName()) ; |
| | | |
| | | protected static final String orgKey = "tag" ; |
| | | private static final String JobName = "statisticsJob" ; |
| | |
| | | HashMap<String , Object> jobDataMap = new HashMap<String , Object>() ; |
| | | jobDataMap.put(orgKey, vo.tag) ; |
| | | SchedulerTaskSupport.addDailyJob(JobName + vo.tag, JobGroupName, StatisticsJob.class, jobDataMap, startHour, startMinute ) ; |
| | | //SchedulerTaskSupport.addSecondlyJob(JobName + vo.tag, JobGroupName, TestJob.class, jobDataMap, 10, 10000, 0 ) ; |
| | | } |
| | | } |
| | | } |