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.weixin.service.WXServiceI; @Service("pushWXMsgInMorningTask") public class PushWXMsgInMorning implements Job { private static final Logger logger = Logger.getLogger(PushWXMsgInMorning.class); @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { long start = System.currentTimeMillis(); logger.info("===================每日早晨发送微信工作摘要定时任务开始==================="); try { logger.info("===================每日早晨发送微信工作摘要定时任务开始"+new Date()); WXServiceI service = ApplicationContextUtil.getContext().getBean(WXServiceI.class); service.sendMsgToWXInMorning(); logger.info("===================每日早晨发送微信工作摘要定时任务结束"+new Date()); } catch (Exception e) { e.printStackTrace(); } logger.info("===================每日早晨发送微信工作摘要定时任务结束==================="); long end = System.currentTimeMillis(); long times = end - start; logger.info("总耗时"+times+"毫秒"); } }