ScheduleJob.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.fdkankan.contro.schedule;
  2. import com.fdkankan.contro.service.IRelocationBatchService;
  3. import com.fdkankan.contro.service.IRelocationBindService;
  4. import com.fdkankan.contro.service.IRelocationInitService;
  5. import com.fdkankan.contro.service.IScene3dNumService;
  6. import lombok.extern.log4j.Log4j2;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.scheduling.annotation.Scheduled;
  9. import org.springframework.stereotype.Component;
  10. @Log4j2
  11. @Component
  12. public class ScheduleJob {
  13. @Autowired
  14. private IScene3dNumService scene3dNumService;
  15. @Autowired
  16. private IRelocationBatchService relocationBatchService;
  17. @Autowired
  18. private IRelocationInitService relocationInitService;
  19. @Autowired
  20. private IRelocationBindService relocationBindService;
  21. /**
  22. * 定时生成场景码,间隔1小时执行一次,项目启动一秒后执行一次
  23. */
  24. @Scheduled(fixedDelay = 60*60*1000, initialDelay = 1000)
  25. public void generateSceneNum() {
  26. scene3dNumService.generateSceneNumHandler();
  27. }
  28. /**
  29. * 重定位调度
  30. */
  31. @Scheduled(fixedDelay = 5*60*1000, initialDelay = 1000)
  32. public void relocationControl() {
  33. log.info("重定位调度开始");
  34. relocationBatchService.relocationControl();
  35. log.info("重定位调度结束");
  36. }
  37. /**
  38. * 重定位调度
  39. */
  40. @Scheduled(fixedDelay = 5*60*1000, initialDelay = 1000)
  41. public void relocationInit() {
  42. log.info("重定位初始化调度开始");
  43. relocationInitService.relocationInit();
  44. log.info("重定位初始化调度结束");
  45. }
  46. /**
  47. * 重定位绑定关系初始化
  48. */
  49. @Scheduled(fixedDelay = 5*60*1000, initialDelay = 1000)
  50. public void relocationBind() {
  51. log.info("重定位绑定关系开始");
  52. relocationBindService.relocationBind();
  53. log.info("重定位绑定关系结束");
  54. }
  55. }