package com.kmall.admin.task; import com.kmall.admin.service.GoodsService; import com.kmall.admin.service.kmall2eccs.KtoEccsService; import com.kmall.common.constant.Dict; 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; /** * @author zhangchuangbiao * @version 1.0 * 2021-01-28 14:59 */ @Component("sendToEccsTask") @EnableScheduling @EnableAsync public class SendToEccsTask { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private KtoEccsService ktoEccsService; /** * 发送数据给中控系统 * 每天1个小时执行1次 */ @Scheduled(cron = "0 0/1 * * * ?") // @Scheduled(cron = "0 0 0/1 * * ?") public void syncOmsHsCode() { logger.info("同步所有商品表海关备案编码数据开始-----------------"); try { ktoEccsService.sendToEccs(null, Dict.sendToEccsType.task.getItem()); } catch (Exception e) { e.printStackTrace(); logger.info("同步所有商品表海关备案编码数据异常-----------------原因:" + e.getMessage()); } logger.info("同步所有商品表海关备案编码数据结束-----------"); } }