wlzboy
6 天以前 09e6dc3fb7266620fafb5e341808a8eb36e080a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.ruoyi.quartz.task;
 
import com.ruoyi.system.service.ILegacyTransferSyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
/**
 * 旧系统转运单同步定时任务
 * 
 * @author ruoyi
 * @date 2025-11-19
 */
@Component("legacyTransferSyncTask")
public class LegacyTransferSyncTask {
    
    private static final Logger log = LoggerFactory.getLogger(LegacyTransferSyncTask.class);
    
    @Autowired
    private ILegacyTransferSyncService legacyTransferSyncService;
    
    /**
     * 同步7天前的旧系统转运单数据
     */
    public void syncTransferOrders7Days() {
//        log.info("开始执行7天前旧系统转运单同步任务");
        try {
            int count = legacyTransferSyncService.syncLegacyTransferOrders(7);
//            log.info("7天前旧系统转运单同步任务执行完成,同步数量: {}", count);
        } catch (Exception e) {
            log.error("7天前旧系统转运单同步任务执行异常", e);
        }
    }
    
    /**
     * 同步指定天数前的旧系统转运单数据
     * 
     * @param daysAgo 天数
     */
    public void syncTransferOrders(String daysAgo) {
//        log.info("开始执行{}天前旧系统转运单同步任务", daysAgo);
        try {
            int days = Integer.parseInt(daysAgo);
            int count = legacyTransferSyncService.syncLegacyTransferOrders(days);
//            log.info("{}天前旧系统转运单同步任务执行完成,同步数量: {}", daysAgo, count);
        } catch (Exception e) {
            log.error("{}天前旧系统转运单同步任务执行异常", daysAgo, e);
        }
    }
}