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
2729ec69
Commit
2729ec69
authored
Apr 08, 2024
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道倾向及渠道影响力指数计算关闭
parent
204f125f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
63 deletions
+64
-63
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+64
-63
No files found.
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
2729ec69
...
...
@@ -994,69 +994,70 @@ public class ChannelServiceImpl implements ChannelService {
@Override
public
Channel
calculateChannelEmotionIndex
(
Channel
channel
)
{
try
{
Project
project
=
projectService
.
getProjectById
(
channel
.
getProjectId
());
// 数据格式变化未含有contendId部分
if
(
null
==
channel
.
getContendId
())
{
channel
.
setContendId
(
"0"
);
}
// 不做统计
if
(!
hasEmotion
(
channel
))
{
return
channel
;
}
// 该渠道发布正面稿件
Long
positiveCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
());
// 该渠道发布中性稿件
Long
neutralCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
NEUTRAL
.
getName
());
// 该渠道发布负面稿件
Long
negativeCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
NEGATIVE
.
getName
());
// 是否友好渠道
boolean
isPositive
=
false
;
boolean
isNegative
=
false
;
long
specNegativeCount
=
eventMiddlewareDao
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(),
Arrays
.
asList
(
EmotionEnum
.
POSITIVE
.
getName
(),
EmotionEnum
.
NEUTRAL
.
getName
()),
EmotionEnum
.
NEGATIVE
.
getName
());
long
specPositiveCount
=
eventMiddlewareDao
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(),
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
EmotionEnum
.
POSITIVE
.
getName
());
// 特殊情况:若皆有发布过反常稿件
if
(
specNegativeCount
>
0
&&
specPositiveCount
>
0
)
{
// 正面稿件数>负面稿件数,为正面
if
(
positiveCount
>
negativeCount
)
{
isPositive
=
true
;
// 正面稿件数<负面稿件数,为负面
}
else
if
(
positiveCount
<
negativeCount
)
{
isNegative
=
true
;
}
}
else
{
// 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件)
if
(
negativeCount
>
positiveCount
)
{
isNegative
=
true
;
// 如果有在正面事件中发布负面稿件
}
else
if
(
specNegativeCount
>
0
)
{
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
if
(
positiveCount
>
negativeCount
&&
positiveCount
>=
neutralCount
&&
(
this
.
inEventCountMonthAverage
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
())
>=
4.64
))
{
isPositive
=
true
;
}
else
{
isNegative
=
true
;
}
}
else
{
// 在负面事件中发布过正面稿件即满足
if
(
specPositiveCount
>
0
)
{
isPositive
=
true
;
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
}
else
if
(
positiveCount
>
negativeCount
&&
positiveCount
>=
neutralCount
&&
(
this
.
inEventCountMonthAverage
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
())
>=
4.64
))
{
isPositive
=
true
;
}
}
}
// 更新渠道指数,渠道等级,情感倾向并记录变化
this
.
updateChannel
(
channel
,
project
,
positiveCount
,
neutralCount
,
negativeCount
,
isPositive
,
isNegative
,
specPositiveCount
,
specNegativeCount
);
}
catch
(
Exception
e
)
{
log
.
error
(
"calculateChannelEmotionIndex-"
,
e
);
}
// 渠道倾向及渠道影响力指数计算关闭
// try {
// Project project = projectService.getProjectById(channel.getProjectId());
// // 数据格式变化未含有contendId部分
// if (null == channel.getContendId()) {
// channel.setContendId("0");
// }
// // 不做统计
// if (!hasEmotion(channel)) {
// return channel;
// }
// // 该渠道发布正面稿件
// Long positiveCount = markCountByEmotion(channel, EmotionEnum.POSITIVE.getName());
// // 该渠道发布中性稿件
// Long neutralCount = markCountByEmotion(channel, EmotionEnum.NEUTRAL.getName());
// // 该渠道发布负面稿件
// Long negativeCount = markCountByEmotion(channel, EmotionEnum.NEGATIVE.getName());
// // 是否友好渠道
// boolean isPositive = false;
// boolean isNegative = false;
// long specNegativeCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
// Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()),
// EmotionEnum.NEGATIVE.getName());
// long specPositiveCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
// Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName());
// // 特殊情况:若皆有发布过反常稿件
// if (specNegativeCount > 0 && specPositiveCount > 0) {
// // 正面稿件数>负面稿件数,为正面
// if (positiveCount > negativeCount) {
// isPositive = true;
// // 正面稿件数<负面稿件数,为负面
// } else if (positiveCount < negativeCount) {
// isNegative = true;
// }
// } else {
// // 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件)
// if (negativeCount > positiveCount) {
// isNegative = true;
// // 如果有在正面事件中发布负面稿件
// } else if (specNegativeCount > 0) {
// // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
// if (positiveCount > negativeCount && positiveCount >= neutralCount
// && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
// isPositive = true;
// } else {
// isNegative = true;
// }
// } else {
// // 在负面事件中发布过正面稿件即满足
// if (specPositiveCount > 0) {
// isPositive = true;
// // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
// } else if (positiveCount > negativeCount && positiveCount >= neutralCount
// && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
// isPositive = true;
// }
// }
// }
// // 更新渠道指数,渠道等级,情感倾向并记录变化
// this.updateChannel(channel, project, positiveCount, neutralCount, negativeCount, isPositive, isNegative,
// specPositiveCount, specNegativeCount);
// } catch (Exception e) {
// log.error("calculateChannelEmotionIndex-", e);
// }
return
channel
;
}
...
...
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