package com.ruoyi.oa.task;

import com.ruoyi.oa.service.impl.OaExpressServiceImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@Component
public class OaExpressRefreshTask {

    @Resource
    private OaExpressServiceImpl oaExpressService;

    // 每20分钟执行一次
    @Scheduled(cron = "0 0/20 * * * ?")
    public void refreshExpress() throws IOException {
        List<Long> expressIds = oaExpressService.getAllSfExpressIdsToRefresh();
        if (expressIds != null && !expressIds.isEmpty()) {
            oaExpressService.getRefreshExpress(expressIds);
        }
    }
} 