|
@@ -16,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import java.util.function.Function;
|
|
|
+
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -48,7 +50,18 @@ public class PublishTimesStrategy implements ScoreStrategy {
|
|
|
// 获取今日已发布内容
|
|
|
String dateStr = DateUtils.getCurrentDateStr("yyyy-MM-dd");
|
|
|
List<PublishSortLog> hisPublishContentList = publishSortLogRepository.findByDateStr(dateStr);
|
|
|
- Map<String, List<PublishSortLog>> hisPublishedContentMap = hisPublishContentList.stream().collect(Collectors.groupingBy(PublishSortLog::getTitle));
|
|
|
+ Map<String, Set<PublishSortLog>> hisPublishedContentMap = hisPublishContentList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ PublishSortLog::getTitle,
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.toMap(
|
|
|
+ PublishSortLog::getGhId, // 用于去重的字段,例如 id
|
|
|
+ Function.identity(),
|
|
|
+ (existing, replacement) -> existing // 如果有重复的 id,保留已有的记录
|
|
|
+ ),
|
|
|
+ map -> new HashSet<>(map.values()) // 将结果转换为 Set<PublishSortLog>
|
|
|
+ )
|
|
|
+ ));
|
|
|
Map<Integer, AccountPublishTimesConfig> indexPublishTimesMap = Arrays.stream(indexPublishTimesArr).collect(Collectors.toMap(AccountPublishTimesConfig::getIndex, o -> o));
|
|
|
String[] contentPools = accountContentPoolConfigService.getContentPools(param.getAccountName());
|
|
|
for (Content content : param.getContents()) {
|