1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package com.kmall.admin.task;
- import com.kmall.admin.service.GoodsService;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.scheduling.annotation.EnableAsync;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- /**
- * 同步oms数据定时器
- *
- * @author 小问号
- * @email 1076650290@qq.com
- * @date 2020年11月30日15:33:57
- */
- @Component("syncOmsTask")
- @EnableScheduling
- @EnableAsync
- public class SyncOmsTask {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private GoodsService goodsService;
- /**
- * 同步oms海关备案编码
- * 每天凌晨四点执行一次
- */
- @Scheduled(cron = "0 0 4 * * ?")
- public void syncOmsHsCode() {
- logger.info("同步所有商品表海关备案编码数据开始-----------------");
- try {
- goodsService.syncOmsHsCode();
- } catch (Exception e) {
- e.printStackTrace();
- logger.info("同步所有商品表海关备案编码数据异常-----------------原因:" + e.getMessage());
- }
- logger.info("同步所有商品表海关备案编码数据结束-----------");
- }
- }
|