admin
2021-04-14 759f8df85ddb840682f91bad31e874fa0b58c075
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
package com.yeshi.buwan.controller;
 
import com.yeshi.buwan.dto.search.SolrResultDTO;
import com.yeshi.buwan.dto.search.SolrVideoSearchFilter;
import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
 
@Controller
@RequestMapping("monitor")
public class MonitorController {
 
    @Resource
    private SolrAlbumVideoDataManager solrDataManager;
 
 
    /**
     * solr专辑搜索内容监控
     *
     * @param count
     * @param response
     */
    @RequestMapping("solrAlbum")
    public void solrAlbum(int count, HttpServletResponse response) throws IOException {
        SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
        filter.setKey("");
        filter.setVideoType(null);
        filter.setContentType(1);
 
        SolrResultDTO dto = solrDataManager.find(filter, 1, 10);
        if (dto == null) {
            response.sendError(201, "无法获取到搜索内容");
            return;
        }
 
        if (count > dto.getTotalCount()) {
            response.sendError(202, "专辑内容数量不足");
            return;
        }
        response.getWriter().print("ok");
    }
 
 
}