Commit 23f315ac by shenjunjie

Merge branch 'feature' into 'dev'

切换brandkbs_channel_record表

See merge request !97
parents 04208cf2 cba7eb07
......@@ -18,6 +18,7 @@ public class GenericAttribute {
// public static final String ES_INDEX_TEST = "brandkbs2_test";
public static final String ES_INDEX_TEST = "brandkbs2_2022";
public static final String ES_CHANNEL_INDEX_TEST = "brandkbs2_channel_record_test";
public static final String ES_CHANNEL_INDEX_PREFIX = "brandkbs2_channel_record_";
/**
* es ind_title
**/
......
......@@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
......@@ -109,13 +110,12 @@ public class ChannelEsDao extends EsClientDao {
public String getChannelRecordIndex() {
// if (test) {
return GenericAttribute.ES_CHANNEL_INDEX_TEST;
// return GenericAttribute.ES_CHANNEL_INDEX_TEST;
// }
// // 近1年数据库 TODO
// Calendar date = Calendar.getInstance();
// int year = date.get(Calendar.YEAR);
// res.add(GenericAttribute.ES_CHANNEL_INDEX_TEST);
// return res.toArray(new String[0]);
// 近1年数据库
Calendar date = Calendar.getInstance();
int year = date.get(Calendar.YEAR);
return GenericAttribute.ES_CHANNEL_INDEX_PREFIX + year;
}
private BoolQueryBuilder channelUniqueBool(String fid) {
......
......@@ -751,7 +751,7 @@ public class ChannelServiceImpl implements ChannelService {
boolean isPositive = false;
boolean isNegative = false;
long specNegativeCount = eventDao.getEventCount(new ChannelIndex(channel), Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()), EmotionEnum.NEGATIVE.getName());
long specPositiveCount = eventDao.getEventCount(new ChannelIndex(channel), Arrays.asList(EmotionEnum.NEGATIVE.getName(), EmotionEnum.POSITIVE.getName()), EmotionEnum.POSITIVE.getName());
long specPositiveCount = eventDao.getEventCount(new ChannelIndex(channel), Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName());
// 特殊情况:若皆有发布过反常稿件
if (specNegativeCount > 0 && specPositiveCount > 0) {
//正面稿件数>负面稿件数,为正面
......
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