Schedule.java 996 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.qxgmat.schedule;
  2. import org.springframework.scheduling.annotation.Scheduled;
  3. import org.springframework.stereotype.Component;
  4. import java.text.SimpleDateFormat;
  5. import java.util.Date;
  6. /**
  7. * Created by gaojie on 2017/11/20.
  8. */
  9. @Component
  10. public class Schedule {
  11. /**
  12. * cron表达式:* * * * * *(共6位,使用空格隔开,具体如下)
  13. * cron表达式:*(秒0-59) *(分钟0-59) *(小时0-23) *(日期1-31) *(月份1-12或是JAN-DEC) *(星期1-7或是SUN-SAT)
  14. * 注意: 30 * * * * * 表示每分钟的第30秒执行,而(*斜杠30)表示每30秒执行
  15. *
  16. * */
  17. @Scheduled(cron="0 0 * * * *")
  18. public void refreshToken(){
  19. // 每小时刷新快过期用户的accessToken
  20. }
  21. @Scheduled(cron="0 0 * * * *")
  22. public void refreshPrepare(){
  23. // 每小时刷新备考统计信息
  24. }
  25. @Scheduled(cron="0 0 0 * * *")
  26. public void autoExercisePaper(){
  27. // 每天判断是否自动组卷
  28. }
  29. }