|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package cn.teammodel.controller.admin.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
@ -302,12 +301,20 @@ public class AdminAppraiseServiceImpl implements AdminAppraiseService {
|
|
|
|
|
if (ObjectUtils.isEmpty(res)) return null;
|
|
|
|
|
Set<String> studentIdSet = res.stream().map(StudentRankVo::getId).collect(Collectors.toSet());
|
|
|
|
|
if (ObjectUtils.isEmpty(studentIdSet)) return res;
|
|
|
|
|
|
|
|
|
|
List<Student> students = studentRepository.findAllByCodeAndIdIn(String.format(PK.STUDENT, schoolId), studentIdSet);
|
|
|
|
|
// 提取 Student 中的 name 和 classId
|
|
|
|
|
Map<String, Pair<String, String>> idNameMap = students.stream().collect(Collectors.toMap(Student::getId, item -> new Pair<>(item.getName(), item.getClassId())));
|
|
|
|
|
// 利用数组作为三元组,提取 Student 中的 name 和 classId, picture
|
|
|
|
|
Map<String, String[]> idNameMap = students.stream().collect(Collectors.toMap(Student::getId, item -> {
|
|
|
|
|
String[] studentInfo = new String[3];
|
|
|
|
|
studentInfo[0] = item.getName();
|
|
|
|
|
studentInfo[1]= item.getClassId();
|
|
|
|
|
studentInfo[2] = item.getPicture();
|
|
|
|
|
return studentInfo;
|
|
|
|
|
}));
|
|
|
|
|
res.forEach(rankVo -> {
|
|
|
|
|
rankVo.setName(idNameMap.get(rankVo.getId()).getKey());
|
|
|
|
|
rankVo.setClassName(idNameMap.get(rankVo.getId()).getValue());
|
|
|
|
|
rankVo.setName(idNameMap.get(rankVo.getId())[0]);
|
|
|
|
|
rankVo.setClassName(idNameMap.get(rankVo.getId())[1]);
|
|
|
|
|
rankVo.setPicture(idNameMap.get(rankVo.getId())[2]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 设置 class name
|
|
|
|
|