Commit 9ba54fd5 by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !94
parents 76b3edf5 d4b2772d
......@@ -83,4 +83,10 @@ public class BaseMap {
return Tools.getTitleWithContent(title, incompleteContent, content);
}
public void subStringContentTop() {
if (null != content) {
this.content = content.substring(0, Math.min(200, content.length()));
}
}
}
......@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -17,7 +18,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class BrandkbsHotEventWarn {
private List<HotEvent> hotEventList;
private Map<String, List<HotEvent>> hotEventMap;
@Data
public static class HotEvent {
......
......@@ -1788,7 +1788,7 @@ public class MarkDataServiceImpl implements MarkDataService {
emotionMap.put(ChannelEmotion.NEUTRAL.getState(), new AtomicInteger());
for (SearchResponse searchResponse : searchResponses) {
for (SearchHit hit : searchResponse.getHits().getHits()) {
Object emotionObj = Tools.getBrandkbsHitMap(hit.getSourceAsMap(), Tools.concat(projectId, linkedGroupId, "0")).get("channel_emotion");
Object emotionObj = Tools.getBrandkbsHitMap(hit.getSourceAsMap(), Tools.concat(projectId, "0")).get("channel_emotion");
if (null != emotionObj) {
int channelEmotion = Integer.parseInt(String.valueOf(emotionObj));
Optional.ofNullable(emotionMap.get(channelEmotion)).ifPresent(AtomicInteger::getAndIncrement);
......
......@@ -136,7 +136,7 @@ public class MarkFlowServiceImpl implements MarkFlowService {
// sourceDetails.put("channelEmotion", ChannelEmotion.getNameFromState(hitMap.get("channel_emotion")));
// }
// }
JSONObject brandkbsHitJson = Tools.getBrandkbsHitMap(tJson, Tools.concat(projectId, linkedGroupId, contendId));
JSONObject brandkbsHitJson = Tools.getBrandkbsHitMap(tJson, Tools.concat(projectId, contendId));
if (null != brandkbsHitJson.get("channel_emotion")) {
sourceDetails.put("channelEmotion", ChannelEmotion.getNameFromState(brandkbsHitJson.getIntValue("channel_emotion")));
}
......
......@@ -332,7 +332,10 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
} else {
key4 = keyBuilder4.toString();
}
List<BrandkbsHotEventWarn.HotEvent> collect = eventMap.entrySet().stream().map(entry -> entry.getValue().stream().map(event -> BrandkbsHotEventWarn.HotEvent.createFromEvent(entry.getKey(), event)).collect(Collectors.toList())).collect(Collectors.toList()).stream().flatMap(List::stream).collect(Collectors.toList());
Map<String, List<BrandkbsHotEventWarn.HotEvent>> collect = eventMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().stream().map(event -> BrandkbsHotEventWarn.HotEvent.createFromEvent(entry.getKey(), event)).collect(Collectors.toList())));
// List<BrandkbsHotEventWarn.HotEvent> collect = eventMap.entrySet().stream().map(entry -> entry.getValue().stream().
// map(event -> BrandkbsHotEventWarn.HotEvent.createFromEvent(entry.getKey(), event)).collect(Collectors.toList())).
// collect(Collectors.toList()).stream().flatMap(List::stream).collect(Collectors.toList());
return new BrandkbsWarnTemplate(firstCount, key1, key2, key3, key4, new BrandkbsHotEventWarn(collect));
}
......@@ -612,6 +615,8 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
if (!hitMap.isEmpty() && (null != config.getContends() && config.getContends().contains(contendId))) {
baseMap.setBrandName(projectService.getProjectByContendId(projectId, contendId).getBrandName());
}
baseMap.setTitle(baseMap.getTitleNullOptionalContent());
baseMap.subStringContentTop();
return baseMap;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 开启去重
......@@ -657,7 +662,12 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
// 搜索结果
SearchHits searchHits = esClientDao.searchHits(helper);
log.info("获取渠道参与预警-es搜索到数据:{}条,剩余渠道指数筛选未进行,project:{}", searchHits.getHits().length, project.getProjectName());
List<BaseMap> datas = Arrays.stream(searchHits.getHits()).map(hit -> Tools.getBaseFromEsMap(hit.getSourceAsMap())).collect(Collectors.toList());
List<BaseMap> datas = Arrays.stream(searchHits.getHits()).map(hit -> {
BaseMap baseMap = Tools.getBaseFromEsMap(hit.getSourceAsMap());
baseMap.setTitle(baseMap.getTitleNullOptionalContent());
baseMap.subStringContentTop();
return baseMap;
}).collect(Collectors.toList());
// 开启去重
if (Boolean.TRUE.equals(config.getDuplicate())) {
datas = duplicateBaseMapList(datas);
......
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