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
d5631dcb
Commit
d5631dcb
authored
May 16, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
添加品牌热点-默认关键词 See merge request
!324
parents
874161bb
25c1b130
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
+12
-6
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppHotController.java
View file @
d5631dcb
...
...
@@ -13,6 +13,7 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -27,10 +28,7 @@ import org.springframework.web.client.RestTemplate;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -63,6 +61,9 @@ public class AppHotController extends BaseController {
@Autowired
private
MarkDataService
markDataService
;
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
@Resource
(
name
=
"esSearchExecutor"
)
ThreadPoolTaskExecutor
executor
;
...
...
@@ -101,9 +102,14 @@ public class AppHotController extends BaseController {
@ApiOperation
(
"热点库-品牌热点-关键词获取"
)
@GetMapping
(
"/keyword"
)
public
ResponseResult
getKeyword
()
{
String
keywordStr
=
redisUtil
.
get
(
RedisKeyPrefix
.
hotKeywordKey
(
UserThreadLocal
.
getProjectId
()));
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
key
=
RedisKeyPrefix
.
hotKeywordKey
(
projectId
);
String
keywordStr
=
redisUtil
.
get
(
key
);
if
(
null
==
keywordStr
)
{
return
ResponseResult
.
success
();
// 默认返回并设置品牌名
List
<
String
>
defaultKeyword
=
Collections
.
singletonList
(
projectService
.
getProjectById
(
projectId
).
getBrandName
());
redisUtil
.
set
(
key
,
JSON
.
toJSONString
(
defaultKeyword
));
return
ResponseResult
.
success
(
defaultKeyword
);
}
return
ResponseResult
.
success
(
JSONArray
.
parseArray
(
keywordStr
));
}
...
...
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