|
@@ -233,17 +233,22 @@ public class ActivityEvaluationRecordServiceImpl extends ServiceImpl<ActivityEva
|
|
List<Long> userIds = activityRankings.stream()
|
|
List<Long> userIds = activityRankings.stream()
|
|
.map(ActivityRankingVo::getUserId).distinct().collect(Collectors.toList());
|
|
.map(ActivityRankingVo::getUserId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- Map<Long, Long> userSubjectMap = studentMapper.selectList(Wrappers.<Student>lambdaQuery().in(Student::getUserId, userIds)).stream()
|
|
|
|
- .collect(Collectors.toMap(Student::getUserId, x -> Long.parseLong(Optional.ofNullable(x.getSubjectId()).orElse("").split(",")[0]), (o, n) -> n));
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
|
|
|
|
|
+ Map<Long, Long> userSubjectMap = studentMapper.selectList(Wrappers.<Student>lambdaQuery().in(Student::getUserId, userIds)).stream()
|
|
|
|
+ .filter(x -> Objects.nonNull(x.getSubjectId()))
|
|
|
|
+ .collect(Collectors.toMap(Student::getUserId, x -> Long.parseLong(Optional.ofNullable(x.getSubjectId()).orElse("0").split(",")[0]), (o, n) -> n));
|
|
|
|
|
|
- Map<Long, String> subjectNameMap = subjectService.findBySubjectByIdList(Lists.newArrayList(userSubjectMap.values())).stream()
|
|
|
|
- .collect(Collectors.toMap(Subject::getId, Subject::getName, (o, n) -> n));
|
|
|
|
|
|
|
|
- for (ActivityRankingVo item : activityRankings) {
|
|
|
|
|
|
+ Map<Long, String> subjectNameMap = subjectService.findBySubjectByIdList(Lists.newArrayList(userSubjectMap.values())).stream()
|
|
|
|
+ .collect(Collectors.toMap(Subject::getId, Subject::getName, (o, n) -> n));
|
|
|
|
|
|
- item.setUserSubject(subjectNameMap.getOrDefault(userSubjectMap.get(item.getUserId()), ""));
|
|
|
|
|
|
+ for (ActivityRankingVo item : activityRankings) {
|
|
|
|
+
|
|
|
|
+ item.setUserSubject(subjectNameMap.getOrDefault(userSubjectMap.get(item.getUserId()), ""));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
|
|
|
|
// 单曲排名
|
|
// 单曲排名
|