Commit ba323c08 by shenjunjie

Merge branch 'feature' into 'release'

热点库增加噪音词

See merge request !368
parents d9fe2f6c cd59bb5f
......@@ -63,6 +63,7 @@ public class RedisKeyPrefix {
public static final String HOT_RANK_LIST = "BRANDKBS:HOT:RANK_LIST:";
public static final String HOT_LIST = "BRANDKBS:HOT:LIST:";
public static final String HOT_KEYWORD = "BRANDKBS:HOT:KEYWORD:";
public static final String HOT_FILTER_WORD = "BRANDKBS:HOT:FILTER_WORD:";
public static final String HOT_SUPPLEMENT_WORD = "BRANDKBS:HOT:SUPPLEMENT_WORD:";
/**
......@@ -126,6 +127,10 @@ public class RedisKeyPrefix {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.HOT_KEYWORD, projectId);
}
public static String hotFilterWordKey(String projectId) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.HOT_FILTER_WORD, projectId);
}
public static String supplementWordKey(String projectId) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.HOT_SUPPLEMENT_WORD, projectId);
}
......
......@@ -157,6 +157,19 @@ public class AppHotController extends BaseController {
return ResponseResult.success(defaultKeyword);
}
@ApiOperation("热点库-品牌热点-噪音词获取")
@GetMapping("/filter-word")
public ResponseResult getFilterWord(@ApiParam(name = "竞品id")@RequestParam(required = false) String contendId) {
boolean primary = null == contendId;
String keyId = primary ? UserThreadLocal.getProjectId() : contendId;
String key = RedisKeyPrefix.hotFilterWordKey(keyId);
String filterWord = redisUtil.get(key);
if (null != filterWord) {
return ResponseResult.success(JSONArray.parseArray(filterWord));
}
return ResponseResult.success();
}
@ApiOperation("热点库-品牌热点-关键词调整")
@PutMapping("/keyword/update")
public ResponseResult updateKeyword(@ApiParam(name = "json:{list:关键词数组,contendId:竞品id}") @RequestBody JSONObject json) {
......@@ -166,6 +179,15 @@ public class AppHotController extends BaseController {
return ResponseResult.success();
}
@ApiOperation("热点库-品牌热点-噪音词调整")
@PutMapping("/filter-word/update")
public ResponseResult updateFilterWord(@ApiParam(name = "json:{list:噪音词数组,contendId:竞品id}") @RequestBody JSONObject json) {
JSONArray list = json.getJSONArray("list");
String contendId = json.getString("contendId");
redisUtil.set(RedisKeyPrefix.hotFilterWordKey(null == contendId ? UserThreadLocal.getProjectId() : contendId), list.toJSONString());
return ResponseResult.success();
}
/**
* weibo 热搜
* weibo-topic 话题
......@@ -387,10 +409,16 @@ public class AppHotController extends BaseController {
*/
private JSONObject searchHotHandler(int pageSize, int page, String type, String sort, Long startTime, Long endTime,String contendId) {
String keyId = null == contendId ? UserThreadLocal.getProjectId() : contendId;
// 关键词
String keywordStr = redisUtil.get(RedisKeyPrefix.hotKeywordKey(keyId));
if (null == keywordStr) {
return null;
}
// 噪音词
String filterWord = redisUtil.get(RedisKeyPrefix.hotFilterWordKey(keyId));
if (StringUtils.isNotBlank(filterWord)){
filterWord = StringUtils.join(JSONArray.parseArray(filterWord, String.class), "|");
}
String accurateWord = null;
List<Object> valueList = redisUtil.getMapValueAll(RedisKeyPrefix.supplementWordKey(keyId));
if (CollectionUtils.isNotEmpty(valueList)) {
......@@ -400,9 +428,9 @@ public class AppHotController extends BaseController {
String keyword = StringUtils.join(JSONArray.parseArray(keywordStr, String.class), "|");
ResponseEntity<JSONObject> jsonObjectResponseEntity;
if (null != startTime && null != endTime) {
jsonObjectResponseEntity = restTemplate.getForEntity(hotSearchUrl + "&startTime={7}&endTime={8}", JSONObject.class, pageSize, page, type, keyword, sort, accurateWord, startTime, endTime);
jsonObjectResponseEntity = restTemplate.getForEntity(hotSearchUrl + "&startTime={8}&endTime={9}", JSONObject.class, pageSize, page, type, keyword, sort, accurateWord, filterWord, startTime, endTime);
} else {
jsonObjectResponseEntity = restTemplate.getForEntity(hotSearchUrl, JSONObject.class, pageSize, page, type, keyword, sort, accurateWord);
jsonObjectResponseEntity = restTemplate.getForEntity(hotSearchUrl, JSONObject.class, pageSize, page, type, keyword, sort, accurateWord, filterWord);
}
return jsonObjectResponseEntity.getBody();
}
......
......@@ -84,7 +84,7 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5\}&accurateWord={6}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}&maskWord={7}
trends.queryHotSearchTrendInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
......
......@@ -87,7 +87,7 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5\}&accurateWord={6}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}&maskWord={7}
trends.queryHotSearchTrendInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
......
......@@ -84,7 +84,7 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}&maskWord={7}
trends.queryHotSearchTrendInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
......
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