package com.xcgl.weixin.timetask; import java.util.Date; import org.apache.log4j.Logger; import org.jeecgframework.core.util.ApplicationContextUtil; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.stereotype.Service; import com.xcgl.taskplatform.service.TaskServiceI; @Service("createWorkFromPlanTask") public class CreateWorkFromPlan implements Job { private static final Logger logger = Logger.getLogger(CreateWorkFromPlan.class); @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { long start = System.currentTimeMillis(); logger.info("===================每日凌晨创建下一天计划的工作-定时任务开始==================="); try { logger.info("===================每日凌晨创建下一天计划的工作-定时任务开始"+new Date()); TaskServiceI service = ApplicationContextUtil.getContext().getBean(TaskServiceI.class); service.CreateFromProjectPlan(); logger.info("===================每日凌晨创建下一天计划的工作-定时任务结束"+new Date()); } catch (Exception e) { e.printStackTrace(); } logger.info("===================每日凌晨创建下一天计划的工作-定时任务结束==================="); long end = System.currentTimeMillis(); long times = end - start; logger.info("总耗时"+times+"毫秒"); } }