ExpressTask.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.fs.task;
  2. import com.fs.express.IExpressService;
  3. import com.fs.store.service.IFsStoreOrderService;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Component;
  7. /**
  8. * 物流信息定时任务
  9. */
  10. @Slf4j
  11. @Component("expressTask")
  12. public class ExpressTask {
  13. @Autowired
  14. private IExpressService expressService;
  15. /**
  16. * 推送物流信息到快递鸟定时任务
  17. */
  18. public void subscribeExpress(){
  19. long startTime = System.currentTimeMillis();
  20. log.info("定时任务【推送物流信息到快递鸟】开始执行, 开始时间: {}", startTime);
  21. try {
  22. expressService.subscribeExpress();
  23. log.info("定时任务【推送物流信息到快递鸟】执行成功");
  24. } catch (Exception e) {
  25. log.error("定时任务【推送物流信息到快递鸟】执行失败, 异常信息: {}", e.getMessage(), e);
  26. throw e;
  27. } finally {
  28. long endTime = System.currentTimeMillis();
  29. long costTime = endTime - startTime;
  30. log.info("定时任务【推送物流信息到快递鸟】执行结束, 结束时间: {}, 耗时: {}ms", endTime, costTime);
  31. }
  32. }
  33. }