package cn.com.lzt.userstats.timetask; import java.util.Date; import org.jeecgframework.core.util.ApplicationContextUtil; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.stereotype.Service; import cn.com.lzt.userstats.service.UserStatsServiceI; /** * * @ClassName:SmsSendTask 人员统计定时任务类 * @Description: TODO * @author zhijia.wang * @date 2017-11-16 20:11:35 * */ @Service("userStatisticsTask") public class UserStatisticsTask implements Job{ /*@Scheduled(cron="0 0/1 * * * ?")*/ public void userStatistics() { long start = System.currentTimeMillis(); org.jeecgframework.core.util.LogUtil.info("===================人员统计定时任务开始==================="); try { System.out.println("===================人员统计定时任务开始"+new Date()); UserStatsServiceI userStatsServiceI = ApplicationContextUtil .getContext().getBean(UserStatsServiceI.class); userStatsServiceI.userStatsTaskData(); System.out.println("===================人员统计定时任务结束"+new Date()); } catch (Exception e) { e.printStackTrace(); } org.jeecgframework.core.util.LogUtil.info("===================人员统计定时任务结束==================="); long end = System.currentTimeMillis(); long times = end - start; org.jeecgframework.core.util.LogUtil.info("总耗时"+times+"毫秒"); } @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { userStatistics(); } }