admin
2020-10-13 fc7a6634496066fe45dca8ea9832bdd2f7341db4
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
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.SolrAlbumDataManager;
import com.yeshi.buwan.util.SolrUtil;
import org.springframework.stereotype.Component;
import org.yeshi.utils.LinuxRemoteCommandUtil;
 
import javax.annotation.Resource;
 
 
/**
 * @author Administrator
 */
@Component
public class SolrJob {
 
    @Resource
    private SolrAlbumDataManager solrAlbumDataManager;
 
    @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;
    }
 
}