admin
2024-10-30 010ef2a907e66efd4702443c06cdd18f8a7ffa5b
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
52
53
54
55
package com.yeshi.buwan.job;
 
import javax.annotation.Resource;
 
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import com.yeshi.buwan.log.LogHelper;
import com.yeshi.buwan.service.imp.SolrService;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.util.SolrUtil;
 
@Component
public class SearchIndexUpdateJob {
    @Resource
    private SolrService solrService;
 
    @Scheduled(cron = "0 0/5 * * * ? ")
    public void doJob() {
        if (!Constant.JobTasker)
            return;
        System.out.println("SearchIndexUpdateJob-doJob");
        LogHelper.iqiyi("增量更新Video...");
        SolrUtil.deltaimportVideo();
        LogHelper.iqiyi("增量更新Video完成");
        LogHelper.iqiyi("增量更新CategoryVideo...");
        SolrUtil.deltaimportCategoryVideo();
        LogHelper.iqiyi("增量更新CategoryVideo完成");
        new Thread(new Runnable() {
            public void run() {
                solrService.updateUnAvaileIndex();
            }
        }).start();
    }
    
    //每天凌晨1点更新
    @Scheduled(cron = "0 0 1 * * ? ")
    public void run(){
        if (!Constant.JobTasker)
            return;
        LogHelper.iqiyi("全量更新Video");
        SolrUtil.dataimportVideo();
        LogHelper.iqiyi("全量更新Video完成");
    }
    //每天凌晨3点更新
    @Scheduled(cron = "0 0 3 * * ? ")
    public void run2(){
        if (!Constant.JobTasker)
            return;
        LogHelper.iqiyi("全量更新CategoryVideo");
        SolrUtil.dataimportCategoryVideo();
        LogHelper.iqiyi("全量更新CategoryVideo完成");
    }
    
}