|
@@ -132,12 +132,30 @@ public class RecallService implements ApplicationContextAware {
|
|
|
String cardJSON = ResourceUtil.readUtf8Str("file/AccountInfo.json");
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardJSON);
|
|
|
List<String> titleList = contentList.stream().map(Content::getTitle).collect(Collectors.toList());
|
|
|
+ List<String> crawlerTitleList = contentList.stream().map(Content::getCrawlerTitle).collect(Collectors.toList());
|
|
|
+ titleList.addAll(crawlerTitleList);
|
|
|
List<Article> hisArticleList = articleRepository.getByTitleIn(titleList);
|
|
|
Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
|
|
|
.collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
|
|
|
for (Content content : contentList) {
|
|
|
List<Article> hisArticles = new ArrayList<>();
|
|
|
Map<Integer, List<Article>> indexArticleMap = map.get(content.getTitle());
|
|
|
+ if (Objects.isNull(indexArticleMap)) {
|
|
|
+ indexArticleMap = map.get(content.getCrawlerTitle());
|
|
|
+ } else if (!content.getTitle().equals(content.getCrawlerTitle())) {
|
|
|
+ Map<Integer, List<Article>> crawlerTitleIndexArticleMap = map.get(content.getCrawlerTitle());
|
|
|
+ if (Objects.nonNull(crawlerTitleIndexArticleMap)) {
|
|
|
+ for (Map.Entry<Integer, List<Article>> entry : crawlerTitleIndexArticleMap.entrySet()) {
|
|
|
+ if (indexArticleMap.containsKey(entry.getKey())) {
|
|
|
+ List<Article> articleList = indexArticleMap.get(entry.getKey());
|
|
|
+ articleList.addAll(entry.getValue());
|
|
|
+ indexArticleMap.put(entry.getKey(), articleList);
|
|
|
+ } else {
|
|
|
+ indexArticleMap.put(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (Objects.nonNull(indexArticleMap) && !indexArticleMap.isEmpty()) {
|
|
|
for (Map.Entry<Integer, List<Article>> indexArticleEntry : indexArticleMap.entrySet()) {
|
|
|
List<Article> indexArticleList = indexArticleEntry.getValue();
|