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.search.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");
|
}
|
|
|
}
|