update 调整返回内容

develop
hhb@hotmail.com 1 week ago
parent e70f4b19e2
commit 98a48c1a37

@ -960,10 +960,10 @@ public class LaborEducationServiceImpl implements LaborEducationService {
}
// 7. 转换 classScoreRates 和 studentScoreRates 为新的数据结构
return getResult(className, compositeClassScoreRates, compositeStudentScores);
return getResult(className, compositeClassScoreRates, compositeStudentScores , rMembers);
}
private static @NotNull Map<String, Object> getResult(String className, Map<String, Double> compositeClassScoreRates, Map<String, Map<String, Double>> compositeStudentScores) {
private static @NotNull Map<String, Object> getResult(String className, Map<String, Double> compositeClassScoreRates, Map<String, Map<String, Double>> compositeStudentScores,List<RMember> rMembers) {
List<Map<String, Object>> adjustedClassScoreRates = new ArrayList<>();
Map<String, Object> classScore = new HashMap<>();
classScore.put("className", className); // 设置班级名称
@ -984,11 +984,25 @@ public class LaborEducationServiceImpl implements LaborEducationService {
List<Map<String, Object>> adjustedStudentScoreRates = new ArrayList<>();
for (Map.Entry<String, Map<String, Double>> entry : compositeStudentScores.entrySet()) {
String studentId = entry.getKey();
String studentName = entry.getKey();
Optional<RMember> memberOpt = rMembers.stream()
.filter(member -> member.getName().equals(studentName))
.findFirst();
String studentId;
if (memberOpt.isPresent()) {
studentId = memberOpt.get().getId();
} else {
// 可根据业务需求记录日志或设置默认值
studentId = "未知学生ID";
// 或者直接 continue 跳过该学生
// continue;
}
Map<String, Double> scores = entry.getValue();
Map<String, Object> studentScore = new HashMap<>();
studentScore.put("studentName", studentId); // 设置学生名称
studentScore.put("studentId", studentId);
studentScore.put("studentName", studentName); // 设置学生名称
List<Map<String, Object>> studentBlocks = new ArrayList<>();
for (Map.Entry<String, Double> scoreEntry : scores.entrySet()) {

@ -960,10 +960,10 @@ public class MoralEducationServiceImpl implements MoralEducationService {
}
// 7. 转换 classScoreRates 和 studentScoreRates 为新的数据结构
return getResult(className, compositeClassScoreRates, compositeStudentScores);
return getResult(className, compositeClassScoreRates, compositeStudentScores ,rMembers);
}
private static @NotNull Map<String, Object> getResult(String className, Map<String, Double> compositeClassScoreRates, Map<String, Map<String, Double>> compositeStudentScores) {
private static @NotNull Map<String, Object> getResult(String className, Map<String, Double> compositeClassScoreRates, Map<String, Map<String, Double>> compositeStudentScores, List<RMember> rMembers) {
List<Map<String, Object>> adjustedClassScoreRates = new ArrayList<>();
Map<String, Object> classScore = new HashMap<>();
classScore.put("className", className); // 设置班级名称
@ -984,11 +984,25 @@ public class MoralEducationServiceImpl implements MoralEducationService {
List<Map<String, Object>> adjustedStudentScoreRates = new ArrayList<>();
for (Map.Entry<String, Map<String, Double>> entry : compositeStudentScores.entrySet()) {
String studentId = entry.getKey();
String studentName = entry.getKey();
Optional<RMember> memberOpt = rMembers.stream()
.filter(member -> member.getName().equals(studentName))
.findFirst();
String studentId;
if (memberOpt.isPresent()) {
studentId = memberOpt.get().getId();
} else {
// 可根据业务需求记录日志或设置默认值
studentId = "未知学生ID";
// 或者直接 continue 跳过该学生
// continue;
}
Map<String, Double> scores = entry.getValue();
Map<String, Object> studentScore = new HashMap<>();
studentScore.put("studentName", studentId); // 设置学生名称
studentScore.put("studentId", studentId);
studentScore.put("studentName", studentName); // 设置学生名称
List<Map<String, Object>> studentBlocks = new ArrayList<>();
for (Map.Entry<String, Double> scoreEntry : scores.entrySet()) {

Loading…
Cancel
Save