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
34a865de
Commit
34a865de
authored
Jul 05, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!355
parents
79db4c45
2a2699ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+12
-3
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
34a865de
...
...
@@ -18,7 +18,9 @@ import com.zhiwei.brandkbs2.service.CommonService;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
...
@@ -136,14 +138,21 @@ public class AppHotController extends BaseController {
@ApiOperation
(
"热点库-品牌热点-关键词获取"
)
@GetMapping
(
"/keyword"
)
public
ResponseResult
getKeyword
(
@ApiParam
(
name
=
"竞品id"
)
@RequestParam
(
required
=
false
)
String
contendId
)
{
String
keyId
=
null
==
contendId
?
UserThreadLocal
.
getProjectId
()
:
contendId
;
boolean
primary
=
null
==
contendId
;
String
keyId
=
primary
?
UserThreadLocal
.
getProjectId
()
:
contendId
;
String
key
=
RedisKeyPrefix
.
hotKeywordKey
(
keyId
);
String
keywordStr
=
redisUtil
.
get
(
key
);
if
(
null
!=
keywordStr
)
{
return
ResponseResult
.
success
(
JSONArray
.
parseArray
(
keywordStr
));
}
// 默认返回并设置品牌名
List
<
String
>
defaultKeyword
=
Collections
.
singletonList
(
projectService
.
getProjectById
(
keyId
).
getBrandName
());
List
<
String
>
defaultKeyword
;
if
(
primary
){
defaultKeyword
=
Collections
.
singletonList
(
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getBrandName
());
}
else
{
String
brandName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getContendList
().
stream
().
filter
(
contend
->
contend
.
getId
().
equals
(
keyId
)).
findFirst
().
get
().
getBrandName
();
defaultKeyword
=
Collections
.
singletonList
(
brandName
);
}
redisUtil
.
set
(
key
,
JSON
.
toJSONString
(
defaultKeyword
));
return
ResponseResult
.
success
(
defaultKeyword
);
}
...
...
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