Commit 30b37f4f by 陈健智

舆情列表新增关联标注标签展示

parent da9a657b
...@@ -2748,9 +2748,6 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -2748,9 +2748,6 @@ public class MarkDataServiceImpl implements MarkDataService {
CompletableFuture.allOf(markTopTitleList.stream().map(json -> CompletableFuture.supplyAsync(() -> { CompletableFuture.allOf(markTopTitleList.stream().map(json -> CompletableFuture.supplyAsync(() -> {
try { try {
BaseMap firstArticle = getFirstArticle(startTime, endTime, json.getString("title"), projectId, Constant.PRIMARY_CONTEND_ID, planId, include); BaseMap firstArticle = getFirstArticle(startTime, endTime, json.getString("title"), projectId, Constant.PRIMARY_CONTEND_ID, planId, include);
if (Objects.isNull(firstArticle)){
return null;
}
json.put("content", firstArticle.getContent()); json.put("content", firstArticle.getContent());
json.put("url", firstArticle.getUrl()); json.put("url", firstArticle.getUrl());
json.put("realSource", firstArticle.getRealSource()); json.put("realSource", firstArticle.getRealSource());
......
...@@ -15,7 +15,9 @@ import com.zhiwei.brandkbs2.enmus.ChannelEmotion; ...@@ -15,7 +15,9 @@ import com.zhiwei.brandkbs2.enmus.ChannelEmotion;
import com.zhiwei.brandkbs2.exception.ExceptionCast; import com.zhiwei.brandkbs2.exception.ExceptionCast;
import com.zhiwei.brandkbs2.model.CommonCodeEnum; import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import com.zhiwei.brandkbs2.pojo.MarkFlowEntity; import com.zhiwei.brandkbs2.pojo.MarkFlowEntity;
import com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO;
import com.zhiwei.brandkbs2.service.MarkFlowService; import com.zhiwei.brandkbs2.service.MarkFlowService;
import com.zhiwei.brandkbs2.service.TagFilterService;
import com.zhiwei.brandkbs2.util.RedisUtil; import com.zhiwei.brandkbs2.util.RedisUtil;
import com.zhiwei.brandkbs2.util.Tools; import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.automaticmark.vo.Keyword; import com.zhiwei.middleware.automaticmark.vo.Keyword;
...@@ -24,6 +26,7 @@ import com.zhiwei.middleware.mark.service.MarkerClient; ...@@ -24,6 +26,7 @@ import com.zhiwei.middleware.mark.service.MarkerClient;
import com.zhiwei.middleware.mark.vo.QueryResult; import com.zhiwei.middleware.mark.vo.QueryResult;
import com.zhiwei.qbjc.bean.pojo.common.Tag; import com.zhiwei.qbjc.bean.pojo.common.Tag;
import com.zhiwei.qbjc.bean.tools.BeanTools; import com.zhiwei.qbjc.bean.tools.BeanTools;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -62,10 +65,14 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -62,10 +65,14 @@ public class MarkFlowServiceImpl implements MarkFlowService {
@Resource(name = "highlightWordDao") @Resource(name = "highlightWordDao")
HighlightWordDao highlightWordDao; HighlightWordDao highlightWordDao;
@Resource(name = "tagFilterServiceImpl")
TagFilterService tagFilterService;
@Override @Override
public JSONObject createMarkFlowInfo(MarkInfoSource markInfoSource) { public JSONObject createMarkFlowInfo(MarkInfoSource markInfoSource) {
JSONObject resultInfo = createInfoWithEmotion(markInfoSource.getJson()); JSONObject resultInfo = createInfoWithEmotion(markInfoSource.getJson());
resultInfo.put("sourceDetails", getSourceDetails(markInfoSource)); resultInfo.put("sourceDetails", getSourceDetails(markInfoSource));
resultInfo.put("customTags", getCustomTagsInfo(markInfoSource));
return resultInfo; return resultInfo;
} }
...@@ -85,6 +92,7 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -85,6 +92,7 @@ public class MarkFlowServiceImpl implements MarkFlowService {
JSONObject json = markInfoSource.getJson(); JSONObject json = markInfoSource.getJson();
JSONObject resultInfo = createInfoWithEmotion(json); JSONObject resultInfo = createInfoWithEmotion(json);
resultInfo.put("sourceDetails", getSourceDetails(markInfoSource)); resultInfo.put("sourceDetails", getSourceDetails(markInfoSource));
resultInfo.put("customTags", getCustomTagsInfo(markInfoSource));
String zip = Tools.gzip(JSON.toJSONString(json)); String zip = Tools.gzip(JSON.toJSONString(json));
resultInfo.put("zip", zip); resultInfo.put("zip", zip);
// 每条数据高亮词 // 每条数据高亮词
...@@ -196,6 +204,34 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -196,6 +204,34 @@ public class MarkFlowServiceImpl implements MarkFlowService {
return JSON.parseObject(data, MarkFlowEntity.class); return JSON.parseObject(data, MarkFlowEntity.class);
} }
/**
* 获取自定义标签
* @param markInfoSource
* @return
*/
private List<JSONObject> getCustomTagsInfo(MarkInfoSource markInfoSource){
List<JSONObject> res = new ArrayList<>();
JSONObject json = markInfoSource.getJson();
List<JSONObject> markCacheMaps = json.getJSONArray(GenericAttribute.ES_MARK_CACHE_MAPS).toJavaList(JSONObject.class);
if (CollectionUtils.isEmpty(markCacheMaps)){
return null;
}
// 已配置的标签筛选
List<TagFilterDTO> tagFilter = tagFilterService.getTagFilter();
List<String> groupNames = tagFilter.stream().map(TagFilterDTO::getGroupName).collect(Collectors.toList());
for (JSONObject markCacheMap : markCacheMaps) {
String groupName = markCacheMap.getString("group_name");
if (!groupNames.contains(groupName) || Objects.equals(Constant.EMOTION_LABEL_KEY, groupName)){
continue;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("uniqueId", markCacheMap.getString("unique_id"));
jsonObject.put("name", markCacheMap.getString("name"));
res.add(jsonObject);
}
return res;
}
private JSONObject createInfoWithEmotion(JSONObject json) { private JSONObject createInfoWithEmotion(JSONObject json) {
JSONObject info = new JSONObject(); JSONObject info = new JSONObject();
String emotion = Tools.getEmotion(json); String emotion = Tools.getEmotion(json);
......
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