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
aabd3ff5
Commit
aabd3ff5
authored
Apr 08, 2024
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!477
parents
f310b08d
f97541bd
Hide 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 @
aabd3ff5
...
@@ -994,69 +994,70 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -994,69 +994,70 @@ public class ChannelServiceImpl implements ChannelService {
@Override
@Override
public
Channel
calculateChannelEmotionIndex
(
Channel
channel
)
{
public
Channel
calculateChannelEmotionIndex
(
Channel
channel
)
{
try
{
// 渠道倾向及渠道影响力指数计算关闭
Project
project
=
projectService
.
getProjectById
(
channel
.
getProjectId
());
// try {
// 数据格式变化未含有contendId部分
// Project project = projectService.getProjectById(channel.getProjectId());
if
(
null
==
channel
.
getContendId
())
{
// // 数据格式变化未含有contendId部分
channel
.
setContendId
(
"0"
);
// if (null == channel.getContendId()) {
}
// channel.setContendId("0");
// 不做统计
// }
if
(!
hasEmotion
(
channel
))
{
// // 不做统计
return
channel
;
// if (!hasEmotion(channel)) {
}
// return channel;
// 该渠道发布正面稿件
// }
Long
positiveCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
());
// // 该渠道发布正面稿件
// 该渠道发布中性稿件
// Long positiveCount = markCountByEmotion(channel, EmotionEnum.POSITIVE.getName());
Long
neutralCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
NEUTRAL
.
getName
());
// // 该渠道发布中性稿件
// 该渠道发布负面稿件
// Long neutralCount = markCountByEmotion(channel, EmotionEnum.NEUTRAL.getName());
Long
negativeCount
=
markCountByEmotion
(
channel
,
EmotionEnum
.
NEGATIVE
.
getName
());
// // 该渠道发布负面稿件
// 是否友好渠道
// Long negativeCount = markCountByEmotion(channel, EmotionEnum.NEGATIVE.getName());
boolean
isPositive
=
false
;
// // 是否友好渠道
boolean
isNegative
=
false
;
// boolean isPositive = false;
long
specNegativeCount
=
eventMiddlewareDao
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(),
// boolean isNegative = false;
Arrays
.
asList
(
EmotionEnum
.
POSITIVE
.
getName
(),
EmotionEnum
.
NEUTRAL
.
getName
()),
// long specNegativeCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
EmotionEnum
.
NEGATIVE
.
getName
());
// Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()),
long
specPositiveCount
=
eventMiddlewareDao
.
getEventCount
(
new
ChannelIndex
(
channel
).
getFid
(),
// EmotionEnum.NEGATIVE.getName());
Collections
.
singletonList
(
EmotionEnum
.
NEGATIVE
.
getName
()),
EmotionEnum
.
POSITIVE
.
getName
());
// long specPositiveCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
// 特殊情况:若皆有发布过反常稿件
// Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName());
if
(
specNegativeCount
>
0
&&
specPositiveCount
>
0
)
{
// // 特殊情况:若皆有发布过反常稿件
// 正面稿件数>负面稿件数,为正面
// if (specNegativeCount > 0 && specPositiveCount > 0) {
if
(
positiveCount
>
negativeCount
)
{
// // 正面稿件数>负面稿件数,为正面
isPositive
=
true
;
// if (positiveCount > negativeCount) {
// 正面稿件数<负面稿件数,为负面
// isPositive = true;
}
else
if
(
positiveCount
<
negativeCount
)
{
// // 正面稿件数<负面稿件数,为负面
isNegative
=
true
;
// } else if (positiveCount < negativeCount) {
}
// isNegative = true;
}
else
{
// }
// 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件)
// } else {
if
(
negativeCount
>
positiveCount
)
{
// // 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件)
isNegative
=
true
;
// if (negativeCount > positiveCount) {
// 如果有在正面事件中发布负面稿件
// isNegative = true;
}
else
if
(
specNegativeCount
>
0
)
{
// // 如果有在正面事件中发布负面稿件
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
// } else if (specNegativeCount > 0) {
if
(
positiveCount
>
negativeCount
&&
positiveCount
>=
neutralCount
// // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
&&
(
this
.
inEventCountMonthAverage
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
())
>=
4.64
))
{
// if (positiveCount > negativeCount && positiveCount >= neutralCount
isPositive
=
true
;
// && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
}
else
{
// isPositive = true;
isNegative
=
true
;
// } else {
}
// isNegative = true;
}
else
{
// }
// 在负面事件中发布过正面稿件即满足
// } else {
if
(
specPositiveCount
>
0
)
{
// // 在负面事件中发布过正面稿件即满足
isPositive
=
true
;
// if (specPositiveCount > 0) {
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
// isPositive = true;
}
else
if
(
positiveCount
>
negativeCount
&&
positiveCount
>=
neutralCount
// // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
&&
(
this
.
inEventCountMonthAverage
(
channel
,
EmotionEnum
.
POSITIVE
.
getName
())
>=
4.64
))
{
// } else if (positiveCount > negativeCount && positiveCount >= neutralCount
isPositive
=
true
;
// && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
}
// isPositive = true;
}
// }
}
// }
// 更新渠道指数,渠道等级,情感倾向并记录变化
// }
this
.
updateChannel
(
channel
,
project
,
positiveCount
,
neutralCount
,
negativeCount
,
isPositive
,
isNegative
,
// // 更新渠道指数,渠道等级,情感倾向并记录变化
specPositiveCount
,
specNegativeCount
);
// this.updateChannel(channel, project, positiveCount, neutralCount, negativeCount, isPositive, isNegative,
}
catch
(
Exception
e
)
{
// specPositiveCount, specNegativeCount);
log
.
error
(
"calculateChannelEmotionIndex-"
,
e
);
// } catch (Exception e) {
}
// log.error("calculateChannelEmotionIndex-", e);
// }
return
channel
;
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