|
|
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@@ -163,12 +164,32 @@ public class ContentProfileServiceImpl implements ContentProfileService {
|
|
|
result.put(keyword, Collections.emptyList());
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ Map<String, List<Record>> contentIdAndRecordMap = records.stream()
|
|
|
+ .collect(Collectors.groupingBy(i -> i.getString("content_id")));
|
|
|
+
|
|
|
List<ContentDescontructionResultVo> contentDescontructionResultVos = new ArrayList<>(result.size());
|
|
|
- for (Record record : records) {
|
|
|
+ for (String contentId : contentIdAndRecordMap.keySet()) {
|
|
|
+
|
|
|
+ List<Record> contentRecord = contentIdAndRecordMap.get(contentId);
|
|
|
+ if (CollectionUtils.isEmpty(contentRecord)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ContentDescontructionResultVo.DescriptionInfo> description = contentRecord.stream()
|
|
|
+ .map(i -> {
|
|
|
+ ContentDescontructionResultVo.DescriptionInfo descriptionInfo = new ContentDescontructionResultVo.DescriptionInfo();
|
|
|
+ descriptionInfo.setType(i.getString("type"));
|
|
|
+ descriptionInfo.setTypeDesc(i.getString("type_desc"));
|
|
|
+ return descriptionInfo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
ContentDescontructionResultVo contentDescontructionResultVo = new ContentDescontructionResultVo();
|
|
|
- contentDescontructionResultVo.setContentId(record.getString("content_id"));
|
|
|
+ contentDescontructionResultVo.setContentId(contentId);
|
|
|
+ contentDescontructionResultVo.setDescription(description);
|
|
|
contentDescontructionResultVos.add(contentDescontructionResultVo);
|
|
|
}
|
|
|
+
|
|
|
result.put(keyword, contentDescontructionResultVos);
|
|
|
}
|
|
|
return result;
|