JinlunTask.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package com.malk.jinlun.schedule;
  2. import com.malk.jinlun.service.JinlunTaskService;
  3. import lombok.extern.slf4j.Slf4j;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
  6. import org.springframework.context.annotation.Configuration;
  7. import org.springframework.scheduling.annotation.EnableScheduling;
  8. import org.springframework.scheduling.annotation.Scheduled;
  9. /**
  10. * @EnableScheduling 开启定时任务 [配置参考McScheduleTask]
  11. */
  12. @Slf4j
  13. @Configuration
  14. @EnableScheduling
  15. @ConditionalOnProperty(name = {"enable.scheduling"})
  16. public class JinlunTask {
  17. @Autowired
  18. private JinlunTaskService jinlunTaskService;
  19. //定时同步物料
  20. @Scheduled(cron = "0 0 0 * * ?")
  21. public void syncMaterial(){
  22. jinlunTaskService.syncMaterial();
  23. }
  24. //定时同步销售出库单
  25. @Scheduled(cron = "0 0 1 * * ?")
  26. public void syncSaleOut(){
  27. jinlunTaskService.syncSaleOut();
  28. }
  29. //定时同步收款单
  30. @Scheduled(cron = "0 0 2 * * ?")
  31. public void syncReceipt(){
  32. jinlunTaskService.syncReceipt();
  33. }
  34. //定时同步应收单
  35. @Scheduled(cron = "0 0 3 * * ?")
  36. public void syncReceivable(){
  37. jinlunTaskService.syncReceivable();
  38. }
  39. }