JinlunTask.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 1 0 * * ?")
  26. public void syncSaleOut(){
  27. jinlunTaskService.syncSaleOut();
  28. }
  29. //定时同步收款单
  30. @Scheduled(cron = "0 2 0 * * ?")
  31. public void syncReceipt(){
  32. jinlunTaskService.syncReceipt();
  33. }
  34. //定时同步应收单
  35. @Scheduled(cron = "0 3 0 * * ?")
  36. public void syncReceivable(){
  37. jinlunTaskService.syncReceivable();
  38. }
  39. //定时同步销售退货单
  40. @Scheduled(cron = "0 4 0 * * ?")
  41. public void syncSaleReturn(){
  42. jinlunTaskService.syncSaleReturn();
  43. }
  44. //定时同步性能
  45. @Scheduled(cron = "0 5 0 * * ?")
  46. public void syncXingneng(){
  47. jinlunTaskService.syncXingneng();
  48. }
  49. //定时同步销售订单
  50. @Scheduled(cron = "0 6 0 * * ?")
  51. public void syncSaleOrder(){
  52. jinlunTaskService.syncSaleOrder();
  53. }
  54. }