Commit 881e33a0 by 陈健智

全网搜

parent 40629424
...@@ -4,19 +4,25 @@ package com.zhiwei.brandkbs2.controller.app; ...@@ -4,19 +4,25 @@ package com.zhiwei.brandkbs2.controller.app;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.auth.Auth; import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.enmus.RoleEnum; import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.ResponseResult; import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO;
import com.zhiwei.brandkbs2.service.MarkDataService;
import com.zhiwei.brandkbs2.util.Tools;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.Period;
import org.joda.time.PeriodType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -42,6 +48,9 @@ public class AppSearchController { ...@@ -42,6 +48,9 @@ public class AppSearchController {
@Value("${ef.search.url}") @Value("${ef.search.url}")
private String getEfSearchUrl; private String getEfSearchUrl;
@Resource(name = "markDataServiceImpl")
MarkDataService markDataService;
@ApiOperation("搜索-查热点") @ApiOperation("搜索-查热点")
@GetMapping("/hot/list") @GetMapping("/hot/list")
public ResponseResult searchHotList(@RequestParam(value = "pageSize",defaultValue ="10") Integer limit, public ResponseResult searchHotList(@RequestParam(value = "pageSize",defaultValue ="10") Integer limit,
...@@ -76,4 +85,18 @@ public class AppSearchController { ...@@ -76,4 +85,18 @@ public class AppSearchController {
JSONObject result = JSON.parseObject(responseEntity.getBody()); JSONObject result = JSON.parseObject(responseEntity.getBody());
return ResponseResult.success(result); return ResponseResult.success(result);
} }
@ApiOperation("搜索-全网搜")
@GetMapping("/searchWhole")
public ResponseResult searchWholeNetwork(@RequestBody SearchFilterDTO dto){
long time = DateUtils.addDays(Tools.truncDate(new Date(), Constant.DAY_PATTERN), -89).getTime();
if (time > dto.getStartTime()){
return ResponseResult.failure("仅能搜索近3个月内信息");
}
Period periodDay = new Period(dto.getStartTime(), dto.getEndTime(), PeriodType.days());
if (periodDay.getDays() > 30) {
return ResponseResult.failure("时间跨度不能超过30天");
}
return ResponseResult.success(markDataService.searchWholeNetwork(dto));
}
} }
package com.zhiwei.brandkbs2.pojo.dto; package com.zhiwei.brandkbs2.pojo.dto;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.*;
@Data @Data
@ApiModel("全网搜搜索传输类") @ApiModel("全网搜搜索传输类")
...@@ -44,7 +45,7 @@ public class SearchFilterDTO { ...@@ -44,7 +45,7 @@ public class SearchFilterDTO {
* 关键字 * 关键字
*/ */
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyword; private String search;
/** /**
* 平台 * 平台
...@@ -53,13 +54,15 @@ public class SearchFilterDTO { ...@@ -53,13 +54,15 @@ public class SearchFilterDTO {
private List<String> platforms; private List<String> platforms;
/** /**
* 平台(真正用于搜索的) * 平台(查商业数据库用)
*/ */
@ApiModelProperty(value = "平台(查商业数据库用)")
private String platformsStr; private String platformsStr;
/** /**
* 数据类型 1:原创, 2:转发, 7:评论 * 数据类型 1:原创, 2:转发, 7:评论 (查商业数据库用)
*/ */
@ApiModelProperty(value = "数据类型(查商业数据库用)")
private String filterForward = "1,2"; private String filterForward = "1,2";
/** /**
...@@ -69,13 +72,27 @@ public class SearchFilterDTO { ...@@ -69,13 +72,27 @@ public class SearchFilterDTO {
private String sorter; private String sorter;
/** /**
* 排序字段(真正用于搜索的) * 排序字段(查商业数据库用)
*/ */
@ApiModelProperty(value = "排序字段(查商业数据库用)")
private String sortOf; private String sortOf;
/** /**
* 匹配域名 默认标题+内容 * 来源
*/ */
@ApiModelProperty(value = "来源")
private String source;
/**
* 过滤关键字
*/
@ApiModelProperty(value = "过滤关键字")
private String filterWords;
/**
* 匹配域名 默认标题+内容(查商业数据库用)
*/
@ApiModelProperty(value = "匹配域名(查商业数据库用)")
private String matchFields = null; private String matchFields = null;
/** /**
...@@ -84,4 +101,48 @@ public class SearchFilterDTO { ...@@ -84,4 +101,48 @@ public class SearchFilterDTO {
@ApiModelProperty(value = "查询类型") @ApiModelProperty(value = "查询类型")
private String matchType; private String matchType;
/**
* 重要渠道,{father:"区域",son:"北京"},{father:"全部"}
*/
@ApiModelProperty(value = "重要渠道")
private Map<String, String> sensitiveChannels;
/**
* 粉丝数
*/
@ApiModelProperty(value = "粉丝数")
private String fans;
/**
* 过滤类型 标题/全文
*/
@ApiModelProperty(value = "过滤类型 标题/全文")
private String filterType;
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("timeType","time");
map.put("pt", getPt());
map.put("matchType", matchType);
map.put("search", search);
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("source", source);
map.put("sort", Objects.nonNull(sorter) ? sorter : "DESC");
map.put("page", page);
map.put("pageSize", pageSize);
map.put("notWords", filterWords);
map.put("sensitiveChannels", sensitiveChannels);
map.put("fans", fans);
map.put("filterType", filterType);
return map;
}
public List<String> getPt() {
return Objects.nonNull(platforms) ? this.platforms : Collections.emptyList();
}
public String getMatchType() {
return Objects.nonNull(this.matchType) ? this.matchType : "标题";
}
} }
...@@ -76,3 +76,7 @@ ef.searchCriteria.url=https://ef.zhiweidata.com/index/getSearchKey.do ...@@ -76,3 +76,7 @@ ef.searchCriteria.url=https://ef.zhiweidata.com/index/getSearchKey.do
ef.filterNew.url=https://ef.zhiweidata.com/filterNew.do?firstType={1}&start={2}&end={3}&page={4} ef.filterNew.url=https://ef.zhiweidata.com/filterNew.do?firstType={1}&start={2}&end={3}&page={4}
ef.captcha.url=https://ef.zhiweidata.com/captchaApi/getNewCaptcha.do.do?type=test ef.captcha.url=https://ef.zhiweidata.com/captchaApi/getNewCaptcha.do.do?type=test
ef.checkCaptcha.url=https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id={1}&captcha={2}&type=test ef.checkCaptcha.url=https://ef.zhiweidata.com/captchaApi/checkeCaptcha.do.do?id={1}&captcha={2}&type=test
#\u5168\u7F51\u641C\u5916\u90E8\u63A5\u53E3
istarshine.addIStarShineKSData.url=https://istarshine-service.zhiweidata.com/istarshine/ks/addIStarShineKSData
istarshine.getIStarShineKSInfoData.url=https://istarshine-service.zhiweidata.com/istarshine/ks/getIStarShineKSInfoData?taskId={1}&appId=6183571e0d710000f6003a12
whole.search.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
\ No newline at end of file
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