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
0ba5c8e1
Commit
0ba5c8e1
authored
Jan 10, 2024
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道榜单调整上线
parent
50c8b073
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
8 deletions
+26
-8
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
+10
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+5
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
+7
-3
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+2
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
View file @
0ba5c8e1
...
...
@@ -277,7 +277,7 @@ public class AppChannelController extends BaseController {
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
)
String
sorter
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
return
ResponseResult
.
success
(
channelService
.
getPositiveChannelList
(
contendId
,
startTime
,
endTime
,
size
,
sorter
,
true
));
return
ResponseResult
.
success
(
channelService
.
getPositiveChannelList
(
contendId
,
startTime
,
endTime
,
size
,
null
,
true
));
}
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"品牌id"
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"string"
),
...
...
@@ -294,7 +294,7 @@ public class AppChannelController extends BaseController {
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
)
String
sorter
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
return
ResponseResult
.
success
(
channelService
.
getNegativeChannelList
(
contendId
,
startTime
,
endTime
,
size
,
sorter
,
true
));
return
ResponseResult
.
success
(
channelService
.
getNegativeChannelList
(
contendId
,
startTime
,
endTime
,
size
,
null
,
true
));
}
@ApiOperation
(
"渠道库-渠道申请"
)
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
View file @
0ba5c8e1
...
...
@@ -200,11 +200,21 @@ public class ChannelIndex extends AbstractBaseMongo {
}
public
static
List
<
Article
>
filterArticles
(
Long
startTime
,
Long
endTime
,
List
<
Article
>
articles
)
{
return
filterArticles
(
startTime
,
endTime
,
articles
,
null
);
}
public
static
List
<
Article
>
filterArticles
(
Long
startTime
,
Long
endTime
,
List
<
Article
>
articles
,
Integer
emotion
)
{
// 去除不符合时间段数据
articles
=
articles
.
stream
().
filter
(
article
->
Tools
.
hitTimeRange
(
startTime
,
endTime
,
article
.
getTime
())).
collect
(
Collectors
.
toList
());
// 去重并保留最近标注时间
Map
<
String
,
ChannelIndex
.
Article
>
setMap
=
new
HashMap
<>();
for
(
ChannelIndex
.
Article
article
:
articles
)
{
if
(
null
!=
emotion
)
{
// 文章类型与其不一致
if
(
emotion
!=
EmotionEnum
.
ALL
.
getState
()
&&
emotion
!=
article
.
getEmotion
())
{
continue
;
}
}
setMap
.
compute
(
article
.
getId
(),
(
k
,
v
)
->
{
// 旧值为null或标注时间更新
if
(
null
==
v
||
article
.
getMtime
()
>
v
.
getMtime
())
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
0ba5c8e1
...
...
@@ -519,7 +519,10 @@ public class ChannelServiceImpl implements ChannelService {
// 情感过滤
if
(
emotion
==
EmotionEnum
.
ALL
.
getState
()
||
emotion
==
channelRecord
.
getEmotion
())
{
List
<
ChannelIndex
.
Article
>
articles
=
ChannelIndex
.
Record
.
filterArticles
(
startTime
,
endTime
,
channelRecord
.
getRecord
().
getArticles
());
channelRecord
.
getRecord
().
getArticles
(),
emotion
);
if
(
0
==
articles
.
size
())
{
return
null
;
}
articles
.
sort
(
Comparator
.
comparingLong
(
ChannelIndex
.
Article
::
getTime
).
reversed
());
channelRecord
.
getRecord
().
setArticles
(
articles
);
return
channelRecord
;
...
...
@@ -575,6 +578,7 @@ public class ChannelServiceImpl implements ChannelService {
return
resList
;
}
@Deprecated
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
<>();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
View file @
0ba5c8e1
...
...
@@ -378,8 +378,10 @@ public class IndexServiceImpl implements IndexService {
long
normalCount
=
markDataService
.
getYuqingMarkCount
(
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendId
);
//获取时间范围内总正面稿件数
long
positiveCount
=
markDataService
.
getYuqingMarkCount
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
contendId
);
//获取时间范围内总中性稿件数
long
neutralCount
=
markDataService
.
getYuqingMarkCount
(
startTime
,
endTime
,
EmotionEnum
.
NEUTRAL
.
getName
(),
projectId
,
contendId
);
double
reputation
=
normalCount
==
0
?
0
d
:
100
*
positiveCount
/
(
double
)
normalCount
;
double
neutralPercent
=
normalCount
==
0
?
0
d
:
100
*
neutralCount
/
(
double
)
normalCount
;
SimpleDateFormat
sdf
;
if
(
"year"
.
equals
(
type
))
{
type
=
"年"
;
...
...
@@ -393,9 +395,11 @@ public class IndexServiceImpl implements IndexService {
}
String
date
=
spreadResult
.
stream
().
max
(
Comparator
.
comparing
(
json
->
json
.
getIntValue
(
"normalCount"
))).
map
(
json
->
sdf
.
format
(
json
.
getDate
(
"time"
))).
get
();
if
(!
flag
)
{
return
"近一月,传播高峰为"
+
date
+
",全网品牌相关新闻传播总量达"
+
normalCount
+
"篇,正面内容占比为"
+
String
.
format
(
"%.1f"
,
reputation
)
+
"%。"
;
return
"近一月,传播高峰为"
+
date
+
",全网品牌相关新闻传播总量达"
+
normalCount
+
"篇,正面内容占比为"
+
String
.
format
(
"%.1f"
,
reputation
)
+
"%,中性内容占比为"
+
String
.
format
(
"%.1f"
,
neutralPercent
)
+
"%。"
;
}
else
{
return
"近"
+
spreadResult
.
size
()
+
type
+
"内,传播高峰为"
+
date
+
",全网品牌相关新闻传播总量达"
+
normalCount
+
"篇,正面内容占比为"
+
String
.
format
(
"%.1f"
,
reputation
)
+
"%。"
;
return
"近"
+
spreadResult
.
size
()
+
type
+
"内,传播高峰为"
+
date
+
",全网品牌相关新闻传播总量达"
+
normalCount
+
"篇,正面内容占比为"
+
String
.
format
(
"%.1f"
,
reputation
)
+
"%,中性内容占比为"
+
String
.
format
(
"%.1f"
,
neutralPercent
)
+
"%。"
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
0ba5c8e1
...
...
@@ -155,10 +155,10 @@ public class TaskServiceImpl implements TaskService {
channelService
.
getActiveChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
false
);
// 友好渠道榜
channelService
.
getPositiveList
(
Constant
.
PRIMARY_CONTEND_ID
,
null
,
null
,
sorter
,
times
[
0
],
times
[
1
],
50
,
false
);
channelService
.
getPositiveChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
sorter
,
false
);
channelService
.
getPositiveChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
null
,
false
);
// 敏感渠道榜
channelService
.
getNegativeList
(
Constant
.
PRIMARY_CONTEND_ID
,
null
,
null
,
sorter
,
times
[
0
],
times
[
1
],
50
,
false
);
channelService
.
getNegativeChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
sorter
,
false
);
channelService
.
getNegativeChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
null
,
false
);
});
log
.
info
(
"项目:{}-渠道榜单缓存已完成:{}个"
,
project
.
getProjectName
(),
total
.
incrementAndGet
());
return
null
;
...
...
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