package com.fs.task; import com.fs.express.IExpressService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * 物流信息定时任务 */ @Slf4j @Component("expressTask") public class ExpressTask { @Autowired private IExpressService expressService; /** * 推送物流信息到快递鸟定时任务 */ public void subscribeExpress(){ long startTime = System.currentTimeMillis(); log.info("定时任务【推送物流信息到快递鸟】开始执行, 开始时间: {}", startTime); try { expressService.subscribeExpress(); log.info("定时任务【推送物流信息到快递鸟】执行成功"); } catch (Exception e) { log.error("定时任务【推送物流信息到快递鸟】执行失败, 异常信息: {}", e.getMessage(), e); throw e; } finally { long endTime = System.currentTimeMillis(); long costTime = endTime - startTime; log.info("定时任务【推送物流信息到快递鸟】执行结束, 结束时间: {}, 耗时: {}ms", endTime, costTime); } } }