admin
2024-10-17 b30fb8afd3cd6228bda9b182dc412bb3c8daf69c
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.yeshi.buwan.job;
 
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager;
import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager;
import com.yeshi.buwan.util.SolrUtil;
import com.yeshi.buwan.util.StringUtil;
import org.springframework.stereotype.Component;
import org.yeshi.utils.LinuxRemoteCommandUtil;
 
import javax.annotation.Resource;
 
 
/**
 * @author Administrator
 */
@Component
public class SolrJob {
 
    @Resource
    private SolrAlbumVideoDataManager solrAlbumDataManager;
 
    @Resource
    private SolrCommonVideoDataManager solrCommonVideoDataManager;
 
    @XxlJob("solr-watch")
    public ReturnT<String> reStartSolr(String param) throws Exception {
        String solrIP = "172.16.16.12";
        String serverAccount = "root";
        String serverPwd = "Yeshi2016@";
        LinuxRemoteCommandUtil.execute(solrIP, serverAccount, serverPwd, param);
        return ReturnT.SUCCESS;
    }
 
 
    /**
     * 同步专辑
     *
     * @param param
     * @return
     * @throws Exception
     */
    @XxlJob("solr-syncAlbum")
    public ReturnT<String> syncAlbum(String param) throws Exception {
        solrAlbumDataManager.syncAllAlbum();
        return ReturnT.SUCCESS;
    }
 
    /**
     * 同步常规搜索
     *
     * @param param
     * @return
     * @throws Exception
     */
    @XxlJob("solr-syncVideoCore")
    public ReturnT<String> syncCore(String param) throws Exception {
        //同步视频
        SolrUtil.dataimportVideo(param);
        return ReturnT.SUCCESS;
    }
 
    @XxlJob("solr-syncCommonVideo")
    public ReturnT<String> syncCommonVideo(String param) throws Exception {
        Long minId = null;
        if (!StringUtil.isNullOrEmpty(param)) {
            minId = Long.parseLong(param);
        }
        //同步视频
        solrCommonVideoDataManager.syncAllVideo(minId);
        return ReturnT.SUCCESS;
    }
 
}