Commit c9603190 by shentao

Merge branch 'feature' into 'release'

Feature

See merge request !558
parents 60bc2ed8 aefac40b
......@@ -228,4 +228,9 @@ public class MarkSearchDTO {
*/
@ApiModelProperty(value = "聚合标题")
private String aggTitle;
/**
* 定制舆情分析数据类型 视频/图文
*/
@ApiModelProperty(value = "数据类型:视频/图文")
private Boolean isVideo;
}
......@@ -3081,7 +3081,7 @@ public class MarkDataServiceImpl implements MarkDataService {
long total = getYuqingAnalyzeCount(dto, null);
jsonObject.put("total", total);
// 视频舆情总量
dto.setDataType(Collections.singletonList(5));
dto.setIsVideo(true);
long videoTotal = getYuqingAnalyzeCount(dto, null);
jsonObject.put("videoTotal", videoTotal);
// 图文舆情总量
......@@ -3154,12 +3154,12 @@ public class MarkDataServiceImpl implements MarkDataService {
// 负面趋势图
Pair<String, List<LineVO>> negativeSpreadTendency = getEmotionSpreadTendency(dto, EmotionEnum.NEGATIVE.getName());
// 视频趋势图
dto.setDataType(Collections.singletonList(5));
dto.setIsVideo(true);
Pair<String, List<LineVO>> videoSpreadTendency = getEmotionSpreadTendency(dto, null);
// 图文趋势图
dto.setDataType(Arrays.asList(1, 2, 3));
dto.setIsVideo(false);
Pair<String, List<LineVO>> textSpreadTendency = getEmotionSpreadTendency(dto, null);
dto.setDataType(null);
dto.setIsVideo(null);
Map<String, BaseMap> baseMaps = new HashMap<>(2);
if (Objects.nonNull(negativeSpreadTendency.getLeft()) || Objects.nonNull(spreadTendency.getLeft())) {
CompletableFuture.allOf(Stream.of(spreadTendency.getLeft(), negativeSpreadTendency.getLeft())
......@@ -4207,6 +4207,14 @@ public class MarkDataServiceImpl implements MarkDataService {
String planKeyword = xiaohongshuWordDao.findOneById(dto.getCustomPlanId()).getKeyword();
postFilter.must(EsQueryTools.assembleNormalKeywordQuery(planKeyword, new String[]{GenericAttribute.ES_IND_FULL_TEXT}));
}
// 视频/图文
if (Objects.nonNull(dto.getIsVideo())){
if (dto.getIsVideo()){
postFilter.must(QueryBuilders.existsQuery(GenericAttribute.ES_VIDEO_URLS));
}else {
postFilter.mustNot(QueryBuilders.existsQuery(GenericAttribute.ES_VIDEO_URLS));
}
}
return postFilter;
}
......
......@@ -498,7 +498,8 @@ public class TaskServiceImpl implements TaskService {
if (CollectionUtils.isNotEmpty(platforms)) {
postFilter.must(EsQueryTools.assemblePlatformQuery(Tools.getPlatformByIds(platforms)));
}
List<JSONObject> list = esClientDao.searchScroll(postFilter, 10000, new String[]{"id", "like_num", "favourites_num", "comment_num", "share_num","time", "url"});
List<JSONObject> list = esClientDao.searchScroll(postFilter, 10000,
new String[]{"id", "like_num", "favourites_num", "comment_num", "share_num","time", "url", "pic_urls", "video_urls"});
List<String> urls = list.stream().map(json -> json.getString("url")).distinct().collect(Collectors.toList());
log.info("项目:{}-定制化舆情分析-互动量更新-时间范围:{}-{},即将更新共{}条", projectId, startTime, endTime, list.size());
// 链接互动量更新
......@@ -511,7 +512,7 @@ public class TaskServiceImpl implements TaskService {
++ failedCount;
continue;
}
// 点赞、收藏、评论、分享
// 点赞、收藏、评论、分享、图片地址、视频地址
int likeNum = Objects.nonNull(updatedJson.getInteger("likeCount")) ? updatedJson.getIntValue("likeCount")
: Objects.nonNull(esJsonData.getInteger("like_num")) ? esJsonData.getInteger("like_num") : 0;
int favouritesNum = Objects.nonNull(updatedJson.getInteger("collectCount")) ? updatedJson.getIntValue("collectCount")
......@@ -520,11 +521,21 @@ public class TaskServiceImpl implements TaskService {
: Objects.nonNull(esJsonData.getInteger("comment_num")) ? esJsonData.getInteger("comment_num") : 0;
int shareNum = Objects.nonNull(updatedJson.getInteger("shareCount")) ? updatedJson.getIntValue("shareCount")
: Objects.nonNull(esJsonData.getInteger("share_num")) ? esJsonData.getInteger("share_num") : 0;
List<String> picUrl = Objects.nonNull(updatedJson.getString("picUrl")) ? Arrays.asList(updatedJson.getString("picUrl").split(","))
: CollectionUtils.isNotEmpty(esJsonData.getJSONArray("pic_urls")) ? esJsonData.getJSONArray("pic_urls").toJavaList(String.class) : null;
List<String> videosUrl = Objects.nonNull(updatedJson.getString("videoUrl")) ? Collections.singletonList(updatedJson.getString("videoUrl"))
: CollectionUtils.isNotEmpty(esJsonData.getJSONArray("video_urls")) ? esJsonData.getJSONArray("video_urls").toJavaList(String.class) : null;
resJson.put("id", esJsonData.getString("id"));
resJson.put("like_num", likeNum);
resJson.put("favourites_num", favouritesNum);
resJson.put("comment_num", commentNum);
resJson.put("share_num", shareNum);
if (Objects.nonNull(picUrl)) {
resJson.put("pic_urls", picUrl);
}
if (Objects.nonNull(videosUrl)) {
resJson.put("video_urls", videosUrl);
}
// 数据对应index
Calendar date = Calendar.getInstance();
date.setTime(new Date(esJsonData.getLongValue("time")));
......
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