Commit 628bd882 by 陈健智

2022/8/22 15:22 修改竞品库相关接口错误

parent bb6734c5
......@@ -2,14 +2,17 @@ package com.zhiwei.brandkbs2.controller.app;
import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import com.zhiwei.brandkbs2.service.MarkDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -34,26 +37,33 @@ public class AppContendController extends BaseController {
@ApiOperation("竞品库-竞品舆情-搜索条件")
@GetMapping("/searchCriteria")
public ResponseResult getContendSearchCriteria(@RequestParam(required = false) String linkedGroupId) {
return ResponseResult.success(markDataService.getContendSearchCriteria(linkedGroupId));
public ResponseResult getContendSearchCriteria(@RequestParam(required = false) String contendId) {
return ResponseResult.success(markDataService.getContendSearchCriteria(contendId));
}
@ApiOperation("竞品库-竞品舆情-搜索结果列表")
@GetMapping("/list")
@PostMapping("/list")
public ResponseResult getContendSearchList(@RequestBody MarkSearchDTO markSearchDTO) throws IOException {
return ResponseResult.success(markDataService.getContendSearchList(markSearchDTO));
}
@ApiOperation("竞品库-竞品分析-舆情总结页面")
@GetMapping("/summary")
@PostMapping("/summary")
public ResponseResult getSummary(@RequestBody MarkSearchDTO markSearchDTO) throws IOException {
return ResponseResult.success(markDataService.getContendSummary(markSearchDTO, true));
return ResponseResult.success(markDataService.getContendSummary(markSearchDTO, true)); // 测试时关闭缓存,记得打开
}
@ApiOperation("竞品库-竞品对比-传播分析页面")
@GetMapping("/spread/analyze")
@PostMapping("/spread/analyze")
public ResponseResult getSpreadAnalyze(@RequestBody MarkSearchDTO markSearchDTO) throws IOException {
return ResponseResult.success(markDataService.getContendSpreadAnalyze(markSearchDTO, 5, true));
return ResponseResult.success(markDataService.getContendSpreadAnalyze(markSearchDTO, 5, true)); // 测试时关闭缓存,记得打开
}
@ApiOperation("竞品库-竞品舆情-舆情导出")
@PostMapping(value = "/list/export")
public ResponseResult exportContendMarkList(@RequestBody MarkSearchDTO markSearchDTO) {
Pair<String, List<ExportAppYuqingDTO>> stringListPair = markDataService.downloadContendMarkList(markSearchDTO);
EasyExcelUtil.download(stringListPair.getLeft() + "_舆情列表数据", "sheet1", ExportAppYuqingDTO.class, stringListPair.getRight(), response);
return ResponseResult.success();
}
}
......@@ -49,9 +49,9 @@ public class AppSearchController {
@RequestParam(value = "type",defaultValue = "weibo") String type,
@RequestParam(value = "word") String word){
ResponseEntity<JSONObject> jsonObjectResponseEntity = restTemplate.getForEntity(trendsSearchUrl, JSONObject.class, limit, page, type, word);
JSONObject body = jsonObjectResponseEntity.getBody();
if(Objects.nonNull(body)){
return ResponseResult.success(body);
JSONObject result = jsonObjectResponseEntity.getBody();
if(Objects.nonNull(result)){
return ResponseResult.success(result);
}else{
return ResponseResult.failure("响应超时");
}
......@@ -63,8 +63,8 @@ public class AppSearchController {
@RequestParam(value = "pageSize",defaultValue = "3") Integer pageSize,
@RequestParam("keyword") String keyword){
ResponseEntity<String> responseEntity = restTemplate.getForEntity(crisisSearchUrl, String.class, page, pageSize, keyword);
Object data = JSON.parseObject(responseEntity.getBody()).get("data");
return ResponseResult.success(data);
Object result = JSON.parseObject(responseEntity.getBody()).get("data");
return ResponseResult.success(result);
}
@ApiOperation("搜索-全网事件库-查事件")
......@@ -73,7 +73,7 @@ public class AppSearchController {
@RequestParam(value = "page",defaultValue = "1") Integer page){
String name = keyword.trim();
ResponseEntity<String> responseEntity = restTemplate.getForEntity(getEfSearchUrl, String.class, name, page);
JSONObject jsonObject = JSON.parseObject(responseEntity.getBody());
return ResponseResult.success(jsonObject);
JSONObject result = JSON.parseObject(responseEntity.getBody());
return ResponseResult.success(result);
}
}
......@@ -92,7 +92,7 @@ public class EsQueryTools {
public static BoolQueryBuilder assembleMediaTypeQuery(List<String> mediaTypes) {
BoolQueryBuilder tagQuery = QueryBuilders.boolQuery();
mediaTypes.forEach(e -> {
tagQuery.should(QueryBuilders.termQuery("brandkbs_mark_cache_maps.channel_type.keyword", e));
tagQuery.should(QueryBuilders.termQuery("brandkbs_cache_maps.channel_type.keyword", e));
});
return tagQuery;
}
......
......@@ -6,9 +6,11 @@ import com.zhiwei.brandkbs2.pojo.Event;
import com.zhiwei.brandkbs2.pojo.MarkFlowEntity;
import com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import org.apache.commons.lang3.tuple.Pair;
import javax.naming.directory.SearchControls;
import java.io.IOException;
import java.util.List;
import java.util.Map;
......@@ -166,10 +168,10 @@ public interface MarkDataService {
/**
* 竞品库-获取搜索条件
*
* @param linkedGroupId 关联组Id
* @param contendId 竞品Id
* @return 搜索条件
*/
JSONObject getContendSearchCriteria(String linkedGroupId);
JSONObject getContendSearchCriteria(String contendId);
/**
* 竞品库-获取搜索结果列表
......@@ -200,6 +202,20 @@ public interface MarkDataService {
JSONObject getContendSpreadAnalyze(MarkSearchDTO markSearchDTO, int hotArticleSize, boolean cache) throws IOException;
/**
* 竞品库-舆情导出
* @param markSearchDTO 标注数据搜索传输类
* @return
*/
Pair<String, List<ExportAppYuqingDTO>> downloadContendMarkList(MarkSearchDTO markSearchDTO);
/**
* 搜索-全网搜
* @param searchFilterDTO
* @return
*/
JSONObject searchWholeNetwork(SearchFilterDTO searchFilterDTO);
/**
* 时间段内稿件数
*
* @param startTime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment