admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
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
package com.yeshi.fanli.job;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Component;
import org.yeshi.utils.StringUtil;
 
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.fanli.service.inter.order.ESOrderService;
 
/**
 * 搜索引擎任务
 * @author Administrator
 *
 */
@Component
public class ElasticSearchJob {
 
    @Resource
    private ESOrderService esOrderService;
 
    /**
     * 每两个小时进行更新品牌商品信息
     */
    @XxlJob("orderSearchIndexAddHandler")
    public ReturnT<String> orderSearchIndexAddHandler(String param) throws Exception {
        Integer count = null;
        if (!StringUtil.isNullOrEmpty(param))
            count = Integer.parseInt(param);
        addIndex(count);
        return ReturnT.SUCCESS;
    }
 
    public void addIndex(Integer count) {
        if (count == null)
            count = 200;
        esOrderService.syncAddOrder(count);
    }
 
}