KSJC_timer.java 971 B

123456789101112131415161718192021222324252627282930313233
  1. package com.malk.luyi.controller;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.scheduling.annotation.EnableScheduling;
  7. import org.springframework.scheduling.annotation.Scheduled;
  8. @Slf4j
  9. @Configuration
  10. @EnableScheduling
  11. public class KSJC_timer {
  12. @Autowired
  13. private KSJCController legalEntityService;
  14. /*集晨判断是否能打卡*/
  15. //每天早晨7点05分同步数据
  16. @Scheduled(cron = "0 5 7 * * ?")
  17. // @Scheduled(fixedRate = 5000)
  18. public void LegalEntityList(){
  19. log.info("k");
  20. try{
  21. legalEntityService.insetTHXM_TMER();
  22. System.out.println("集晨判断,同步完成");
  23. }catch (Exception e){
  24. //记录错误信息
  25. e.printStackTrace();
  26. }
  27. }
  28. }