Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
cd59bb5f
Commit
cd59bb5f
authored
Jul 27, 2023
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
热点库增加噪音词
parent
4bd86b08
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
5 deletions
+38
-5
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+30
-2
src/main/resources/application-dev.properties
+1
-1
src/main/resources/application-local.properties
+1
-1
src/main/resources/application-prod.properties
+1
-1
No files found.
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
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
);
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
cd59bb5f
...
...
@@ -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
,
accurate
Word
,
startTime
,
endTime
);
jsonObjectResponseEntity
=
restTemplate
.
getForEntity
(
hotSearchUrl
+
"&startTime={
8}&endTime={9}"
,
JSONObject
.
class
,
pageSize
,
page
,
type
,
keyword
,
sort
,
accurateWord
,
filter
Word
,
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
();
}
...
...
src/main/resources/application-dev.properties
View file @
cd59bb5f
...
...
@@ -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
...
...
src/main/resources/application-local.properties
View file @
cd59bb5f
...
...
@@ -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}
...
...
src/main/resources/application-prod.properties
View file @
cd59bb5f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment