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
ccc01d5e
Commit
ccc01d5e
authored
Jan 11, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!167
parents
b66927b3
3903c936
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelRecord.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+17
-6
No files found.
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelRecord.java
View file @
ccc01d5e
...
...
@@ -162,7 +162,7 @@ public class ChannelRecord {
JSONObject
json
=
new
JSONObject
(
esMap
);
this
.
rangeStartTime
=
json
.
getLongValue
(
RANGE_START_TIME
);
this
.
rangeEndTime
=
json
.
getLongValue
(
RANGE_END_TIME
);
this
.
platform
=
json
.
getString
(
"platform"
);
this
.
platform
=
GlobalPojo
.
getPlatformNameById
(
json
.
getString
(
"platform_id"
)
);
this
.
realSource
=
json
.
getString
(
"real_source"
);
this
.
source
=
json
.
getString
(
"source"
);
this
.
projectId
=
json
.
getString
(
"project_id"
);
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
ccc01d5e
...
...
@@ -434,12 +434,28 @@ public class ChannelServiceImpl implements ChannelService {
List
<
ChannelListVO
>
resList
=
new
ArrayList
<>();
try
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
redisKey
=
RedisUtil
.
getChannelRecordList
(
projectId
,
startTime
,
endTime
,
emotion
);
// 部分条件不缓存
if
(
null
!=
keyword
)
{
return
getEmotionList
(
projectId
,
contendId
,
platform
,
keyword
,
sorter
,
startTime
,
endTime
,
size
,
emotion
,
cache
);
}
String
redisKey
=
RedisUtil
.
getChannelRecordList
(
projectId
,
startTime
,
endTime
,
platform
,
emotion
);
String
resultStr
;
// 返回缓存
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
ChannelListVO
.
class
);
}
resList
=
getEmotionList
(
projectId
,
contendId
,
platform
,
keyword
,
sorter
,
startTime
,
endTime
,
size
,
emotion
,
cache
);
// 配合天级缓存开启
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resList
));
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"es查询异常"
);
}
return
resList
;
}
private
List
<
ChannelListVO
>
getEmotionList
(
String
projectId
,
String
contendId
,
String
platform
,
String
keyword
,
String
sorter
,
Long
startTime
,
Long
endTime
,
int
size
,
int
emotion
,
boolean
cache
)
throws
IOException
{
List
<
ChannelListVO
>
resList
=
new
ArrayList
<>();
Map
<
String
,
Pair
<
Long
,
ChannelRecord
>>
keyMap
=
new
HashMap
<>();
EsClientDao
.
SearchHelper
searchHelper
=
createSearchHelperByChannelCriteria
(
projectId
,
null
,
Collections
.
singleton
(
contendId
),
platform
,
keyword
,
startTime
,
endTime
);
...
...
@@ -513,11 +529,6 @@ public class ChannelServiceImpl implements ChannelService {
resList
.
add
(
ChannelListVO
.
createFromChannel
(
record
,
record
.
getRecord
().
getArticles
().
size
()));
}
});
// 配合天级缓存开启
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resList
));
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"es查询异常"
);
}
return
resList
;
}
...
...
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