|
@@ -34,6 +34,8 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
@Resource
|
|
|
private LessonExaminationDao lessonExaminationDao;
|
|
|
|
|
|
+ private static final Map<String, String> gradeMap = createGradeMap();
|
|
|
+
|
|
|
@Override
|
|
|
public SchoolIndexStatDto stat(SchoolIndexStatWrapper.QueryDto queryDto) {
|
|
|
List<String> musicGroupIds = new ArrayList<>();
|
|
@@ -46,7 +48,7 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
if(CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
return result;
|
|
|
}
|
|
|
- List<StudentRegistration> studentRegistrations = studentRegistrationDao.findByMusicGroupIds(musicGroupIds, StudentMusicGroupStatusEnum.NORMAL);
|
|
|
+ List<StudentRegistration> studentRegistrations = studentRegistrationDao.findByMusicGroupIds1(musicGroupIds, StudentMusicGroupStatusEnum.NORMAL);
|
|
|
if(CollectionUtils.isEmpty(studentRegistrations)){
|
|
|
return result;
|
|
|
}
|
|
@@ -57,9 +59,8 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
//年级分布
|
|
|
List<SchoolIndexStatWrapper.GradeDistribution> gradeDistributions = studentRegistrations.stream()
|
|
|
.map(e -> {
|
|
|
- if (e.getCurrentGrade() == null) {
|
|
|
- e.setCurrentGrade("一年级");
|
|
|
- }
|
|
|
+ String gradeName = createGradeMap().getOrDefault(e.getCurrentGrade(), "一年级");
|
|
|
+ e.setCurrentGrade(gradeName);
|
|
|
return e;
|
|
|
})
|
|
|
.collect(Collectors.groupingBy(
|
|
@@ -229,6 +230,23 @@ public class SchoolIndexStatServiceImpl implements SchoolIndexStatService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 辅助方法:创建年级映射
|
|
|
+ private static Map<String, String> createGradeMap() {
|
|
|
+ Map<String, String> gradeMap = new HashMap<>();
|
|
|
+ gradeMap.put("1", "一年级");
|
|
|
+ gradeMap.put("2", "二年级");
|
|
|
+ gradeMap.put("3", "三年级");
|
|
|
+ gradeMap.put("4", "四年级");
|
|
|
+ gradeMap.put("5", "五年级");
|
|
|
+ gradeMap.put("6", "六年级");
|
|
|
+ gradeMap.put("7", "七年级");
|
|
|
+ gradeMap.put("8", "八年级");
|
|
|
+ gradeMap.put("9", "九年级");
|
|
|
+ gradeMap.put("10", "高一");
|
|
|
+ gradeMap.put("11", "高二");
|
|
|
+ gradeMap.put("12", "高三");
|
|
|
+ return gradeMap;
|
|
|
+ }
|
|
|
|
|
|
// 定义自定义顺序的列表
|
|
|
List<String> gradeOrder = Arrays.asList(
|