Commit aabd3ff5 by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !477
parents f310b08d f97541bd
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment