|
|
@ -346,6 +346,8 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
|
|
|
|
List<String> cidList = commentMapper.selectAllCid();
|
|
|
|
List<String> cidList = commentMapper.selectAllCid();
|
|
|
|
// 2.3、循环评论进行匹配
|
|
|
|
// 2.3、循环评论进行匹配
|
|
|
|
if (CollUtil.isNotEmpty(jsonArrayAll)) {
|
|
|
|
if (CollUtil.isNotEmpty(jsonArrayAll)) {
|
|
|
|
|
|
|
|
List<TiktokHotCommentScriptEntity> scriptEntityList = scriptMapper.selectList(new QueryWrapper<>());
|
|
|
|
|
|
|
|
Map<Long, List<TiktokHotCommentScriptEntity>> map = scriptEntityList.stream().collect(Collectors.groupingBy(TiktokHotCommentScriptEntity::getHotCommentId));
|
|
|
|
List<CommentEntity> saveList = new ArrayList<>();
|
|
|
|
List<CommentEntity> saveList = new ArrayList<>();
|
|
|
|
for (Object obj : jsonArrayAll) {
|
|
|
|
for (Object obj : jsonArrayAll) {
|
|
|
|
JSONObject commentObj = JSONUtil.parseObj(obj);
|
|
|
|
JSONObject commentObj = JSONUtil.parseObj(obj);
|
|
|
@ -353,6 +355,7 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
|
|
|
|
if (cidList.contains(cid)) continue;
|
|
|
|
if (cidList.contains(cid)) continue;
|
|
|
|
String text = commentObj.get(DefaultKeyConstants.TEXT) + "";
|
|
|
|
String text = commentObj.get(DefaultKeyConstants.TEXT) + "";
|
|
|
|
String videoId = commentObj.get(DefaultKeyConstants.AWEME_ID) + "";
|
|
|
|
String videoId = commentObj.get(DefaultKeyConstants.AWEME_ID) + "";
|
|
|
|
|
|
|
|
String awemeId = commentObj.get(DefaultKeyConstants.AWEME_ID) + "";
|
|
|
|
JSONObject userObj = commentObj.getJSONObject(DefaultKeyConstants.USER);
|
|
|
|
JSONObject userObj = commentObj.getJSONObject(DefaultKeyConstants.USER);
|
|
|
|
// 3.1、匹配成功后添加信息
|
|
|
|
// 3.1、匹配成功后添加信息
|
|
|
|
WordTree tree = dfaMap.get(videoSopIdMap.get(videoId));
|
|
|
|
WordTree tree = dfaMap.get(videoSopIdMap.get(videoId));
|
|
|
@ -363,7 +366,7 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
|
|
|
|
long dateObj = Long.parseLong(commentObj.get(DefaultKeyConstants.CREATE_TIME) + "");
|
|
|
|
long dateObj = Long.parseLong(commentObj.get(DefaultKeyConstants.CREATE_TIME) + "");
|
|
|
|
commentEntity.setCreateTime(new Date(dateObj));
|
|
|
|
commentEntity.setCreateTime(new Date(dateObj));
|
|
|
|
commentEntity.setText(text);
|
|
|
|
commentEntity.setText(text);
|
|
|
|
commentEntity.setAwemeId(commentObj.get(DefaultKeyConstants.AWEME_ID) + "");
|
|
|
|
commentEntity.setAwemeId(awemeId);
|
|
|
|
HashSet<String> wordSet = new HashSet<>(matchAll);
|
|
|
|
HashSet<String> wordSet = new HashSet<>(matchAll);
|
|
|
|
commentEntity.setMatchingWord(org.apache.commons.lang3.StringUtils.join(wordSet, ","));
|
|
|
|
commentEntity.setMatchingWord(org.apache.commons.lang3.StringUtils.join(wordSet, ","));
|
|
|
|
commentEntity.setNickName(userObj.get(DefaultKeyConstants.NICK_NAME) + "");
|
|
|
|
commentEntity.setNickName(userObj.get(DefaultKeyConstants.NICK_NAME) + "");
|
|
|
@ -372,9 +375,13 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
|
|
|
|
List<String> keyWordList = wordEntityList.stream().map(KeyWordEntity::getWord).collect(Collectors.toList());
|
|
|
|
List<String> keyWordList = wordEntityList.stream().map(KeyWordEntity::getWord).collect(Collectors.toList());
|
|
|
|
commentEntity.setWord(org.apache.commons.lang3.StringUtils.join(keyWordList, ","));
|
|
|
|
commentEntity.setWord(org.apache.commons.lang3.StringUtils.join(keyWordList, ","));
|
|
|
|
commentEntity.setAddress(commentObj.get(DefaultKeyConstants.IP_LABEL) + "");
|
|
|
|
commentEntity.setAddress(commentObj.get(DefaultKeyConstants.IP_LABEL) + "");
|
|
|
|
commentEntity.setUniqueId(commentObj.get(DefaultKeyConstants.UNIQUE_ID) + "");
|
|
|
|
commentEntity.setUniqueId(userObj.get("unique_id") + "");
|
|
|
|
String avatarUrl = (String) userObj.getJSONObject(DefaultKeyConstants.AVATAR_MEDIUM).getJSONArray(DefaultKeyConstants.URL_LIST).get(0);
|
|
|
|
String avatarUrl = (String) userObj.getJSONObject(DefaultKeyConstants.AVATAR_MEDIUM).getJSONArray(DefaultKeyConstants.URL_LIST).get(0);
|
|
|
|
commentEntity.setAvatarUrl(avatarUrl);
|
|
|
|
commentEntity.setAvatarUrl(avatarUrl);
|
|
|
|
|
|
|
|
List<TiktokHotCommentScriptEntity> scriptEntities = map.get(videoSopIdMap.get(awemeId));
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(scriptEntities)){
|
|
|
|
|
|
|
|
commentEntity.setOrganizeId(scriptEntities.get(0).getFollowCommentOrganize());
|
|
|
|
|
|
|
|
}
|
|
|
|
saveList.add(commentEntity);
|
|
|
|
saveList.add(commentEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|