Browse Source

难点赌点生成项目话题Map时遇到同样的key覆盖上一个

master
wangchao 5 years ago
parent
commit
5182ba8f63
  1. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

@ -147,7 +147,7 @@ public class TopicServiceImpl implements TopicService {
List<ScreenDifficultyImgDataEntity> imgs = topicDao.selectTopicImgs(list);
if(CollectionUtils.isEmpty(imgs)) return Collections.EMPTY_MAP;
//key -> topicId | value -> projectId
Map<String,String> projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId));
Map<String,String> projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId,(o,n)->n));
//key -> topicId
Map<String,List<ScreenDifficultyImgDataEntity>> result
= imgs.stream().collect(Collectors.groupingBy(ScreenDifficultyImgDataEntity :: getEventId));
@ -178,7 +178,7 @@ public class TopicServiceImpl implements TopicService {
if(CollectionUtils.isEmpty(contents)) return Collections.EMPTY_MAP;
Map<String,String> topicContentMap = contents.stream().collect(Collectors.toMap(TopicContentResultDTO :: getTopicId,TopicContentResultDTO::getContent));
//key -> topicId | value -> projectId
Map<String,String> projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId));
Map<String,String> projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId,(o,n)->n));
Map<String,String> result = new HashMap<>();
projectTopicMap.forEach((topic,project) -> {
result.put(project,topicContentMap.get(topic));

Loading…
Cancel
Save