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
2a2699ac
Commit
2a2699ac
authored
Jul 05, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'release'
竞品库保留默认关键词修复 See merge request
!354
parents
555a4b05
69acfe91
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 @
2a2699ac
...
@@ -18,7 +18,9 @@ import com.zhiwei.brandkbs2.service.CommonService;
...
@@ -18,7 +18,9 @@ import com.zhiwei.brandkbs2.service.CommonService;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
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.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
@@ -136,14 +138,21 @@ public class AppHotController extends BaseController {
...
@@ -136,14 +138,21 @@ public class AppHotController extends BaseController {
@ApiOperation
(
"热点库-品牌热点-关键词获取"
)
@ApiOperation
(
"热点库-品牌热点-关键词获取"
)
@GetMapping
(
"/keyword"
)
@GetMapping
(
"/keyword"
)
public
ResponseResult
getKeyword
(
@ApiParam
(
name
=
"竞品id"
)
@RequestParam
(
required
=
false
)
String
contendId
)
{
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
key
=
RedisKeyPrefix
.
hotKeywordKey
(
keyId
);
String
keywordStr
=
redisUtil
.
get
(
key
);
String
keywordStr
=
redisUtil
.
get
(
key
);
if
(
null
!=
keywordStr
)
{
if
(
null
!=
keywordStr
)
{
return
ResponseResult
.
success
(
JSONArray
.
parseArray
(
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
));
redisUtil
.
set
(
key
,
JSON
.
toJSONString
(
defaultKeyword
));
return
ResponseResult
.
success
(
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