for (Content content : chunkContents) {
String tagIds = content2Tags.get(content.contentId).stream().sorted().map(String::valueOf).collect(Collectors.joining(","));
if (CommonUtils.isEmpty(tagIds)) {
tagIds = null;
}
LOG.info(CommonUtils.buildTabLog(content.contentId, genText(content.contentType, content.title, content.description, content.jsonBody),
content2Tags.get(content.contentId).stream().map(tagId -> String.join("-", String.valueOf(tagId), tagMap.get(tagId).name)).collect(Collectors.toSet())));
LOG.info("__________________________________________");
ContentTag existedContentTag = existedContentTagMap.get(content.contentId);
if (existedContentTag != null) {
if (!Objects.equals(existedContentTag.tagIds, tagIds)) {
existedContentTag.tagIds = tagIds;
contentTagsForUpdate.add(existedContentTag);
LOG.info(CommonUtils.buildTabLog("Update content tags", content.contentId, existedContentTag));
}
} else {
if (CommonUtils.isEmpty(tagIds)) {
continue;
}
ContentTag contentTag = new ContentTag();
contentTag.contentId = content.contentId;
// contentTag.modifiedDate = new Timestamp(System.currentTimeMillis());
contentTag.tagIds = tagIds;
contentTagsForInsert.add(contentTag);
LOG.info(CommonUtils.buildTabLog("Insert content tags", content.contentId, contentTag));
}
}