SendToEccsTask.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.kmall.admin.task;
  2. import com.kmall.admin.service.GoodsService;
  3. import com.kmall.admin.service.kmall2eccs.KtoEccsService;
  4. import com.kmall.common.constant.Dict;
  5. import org.slf4j.Logger;
  6. import org.slf4j.LoggerFactory;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.scheduling.annotation.EnableAsync;
  9. import org.springframework.scheduling.annotation.EnableScheduling;
  10. import org.springframework.scheduling.annotation.Scheduled;
  11. import org.springframework.stereotype.Component;
  12. /**
  13. * @author zhangchuangbiao
  14. * @version 1.0
  15. * 2021-01-28 14:59
  16. */
  17. //@Component("sendToEccsTask")
  18. //@EnableScheduling
  19. //@EnableAsync
  20. public class SendToEccsTask {
  21. private Logger logger = LoggerFactory.getLogger(getClass());
  22. @Autowired
  23. private KtoEccsService ktoEccsService;
  24. /**
  25. * 发送数据给中控系统
  26. * 每天1个小时执行1次
  27. */
  28. @Scheduled(cron = "0 0/1 * * * ?")
  29. // @Scheduled(cron = "0 0 0/1 * * ?")
  30. public void syncOmsHsCode() {
  31. logger.info("同步所有商品表海关备案编码数据开始-----------------");
  32. try {
  33. ktoEccsService.sendToEccs(null, Dict.sendToEccsType.task.getItem());
  34. } catch (Exception e) {
  35. e.printStackTrace();
  36. logger.info("同步所有商品表海关备案编码数据异常-----------------原因:" + e.getMessage());
  37. }
  38. logger.info("同步所有商品表海关备案编码数据结束-----------");
  39. }
  40. }