|
@@ -343,63 +343,62 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
return;
|
|
|
}
|
|
|
Map<Integer, List<StudentServeCourseDto>> studentCourseMap = studentFutureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
|
|
|
+ Set<Integer> musicCourseStudentIds = studentFutureCourseInfo.stream().filter(s -> CourseSchedule.CourseScheduleType.SINGLE.equals(s.getType()) || CourseSchedule.CourseScheduleType.MIX.equals(s.getType())).map(StudentServeCourseDto::getStudentId).collect(Collectors.toSet());
|
|
|
|
|
|
Set<Integer> haveCourseBeServeStudentIds = studentCourseMap.keySet();
|
|
|
List<Integer> allServeStudentIds = studentDao.getServeStudentIds();
|
|
|
Set<Integer> noCourseServeStudentIds = allServeStudentIds.stream().filter(id -> !haveCourseBeServeStudentIds.contains(id)).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Set<Integer> musicStudentIds = new HashSet<>();
|
|
|
+ if(Objects.isNull(noCourseServeStudentIds)){
|
|
|
+ musicStudentIds.addAll(noCourseServeStudentIds);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(musicCourseStudentIds)){
|
|
|
+ musicStudentIds.addAll(musicCourseStudentIds);
|
|
|
+ }
|
|
|
List<StudentServeCourseDto> noCourseBeServeStudentInfo = new ArrayList<>();
|
|
|
- if(!CollectionUtils.isEmpty(noCourseServeStudentIds)){
|
|
|
- noCourseBeServeStudentInfo = studentDao.getNoCourseBeServeStudentInfo(new ArrayList<>(noCourseServeStudentIds));
|
|
|
+ if(!CollectionUtils.isEmpty(musicStudentIds)){
|
|
|
+ noCourseBeServeStudentInfo = studentDao.getNoCourseBeServeStudentInfo(new ArrayList<>(musicStudentIds));
|
|
|
}
|
|
|
|
|
|
+ Map<Integer, Set<String>> noCourseStudentMusicIdsMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId, Collectors.mapping(StudentServeCourseDto::getMusicGroupId, Collectors.toSet())));
|
|
|
+ Map<Integer, List<StudentServeCourseDto>> noCourseStudentCourseMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
|
|
|
+
|
|
|
List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
|
|
|
|
|
|
for (Map.Entry<Integer, List<StudentServeCourseDto>> studentCourseMapEntry : studentCourseMap.entrySet()) {
|
|
|
Map<CourseSchedule.CourseScheduleType, List<StudentServeCourseDto>> typeCourseMap = studentCourseMapEntry.getValue().stream().collect(Collectors.groupingBy(StudentServeCourseDto::getType));
|
|
|
|
|
|
if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.SINGLE)){
|
|
|
- List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
|
|
|
- List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
|
- if(CollectionUtils.isEmpty(weekCourseInfo)){
|
|
|
- Map<String, List<StudentServeCourseDto>> groupCourseInfo = futureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
-
|
|
|
- Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
- for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
|
|
|
- StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
|
|
|
-
|
|
|
- if(!teacherNumMap.containsKey(courseInfo.getActualTeacherId())){
|
|
|
- teacherNumMap.put(courseInfo.getActualTeacherId(), 1);
|
|
|
- }else{
|
|
|
- teacherNumMap.put(courseInfo.getActualTeacherId(), teacherNumMap.get(courseInfo.getActualTeacherId())+1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- teacherNumMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
- DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
- "EXERCISE", null);
|
|
|
- studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
|
|
|
- results.add(studentExtracurricularExercisesSituation);
|
|
|
+ Set<String> musicGroupIds = noCourseStudentMusicIdsMap.get(studentCourseMapEntry.getKey());
|
|
|
+ Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
+ for (String groupId : musicGroupIds) {
|
|
|
+ Integer teacherId = null;
|
|
|
+ List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(studentCourseMapEntry.getKey()), groupId);
|
|
|
+ if(!CollectionUtils.isEmpty(studentTeacherIdList)){
|
|
|
+ teacherId = studentTeacherIdList.get(0).getValue();
|
|
|
}
|
|
|
- }else{
|
|
|
- Map<String, List<StudentServeCourseDto>> groupCourseInfo = weekCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
- Map<Integer, Set<Long>> teacherServiceCourseIdMap = new HashMap<>();
|
|
|
- for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
|
|
|
- StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
|
|
|
- if(!teacherServiceCourseIdMap.containsKey(courseInfo.getActualTeacherId())){
|
|
|
- teacherServiceCourseIdMap.put(courseInfo.getActualTeacherId(), new HashSet<>());
|
|
|
- }
|
|
|
- teacherServiceCourseIdMap.get(courseInfo.getActualTeacherId()).add(courseInfo.getCourseScheduleId());
|
|
|
+ teacherId = Objects.isNull(teacherId)?noCourseStudentCourseMap.get(studentCourseMapEntry.getKey()).get(0).getLeadTeacherId():teacherId;
|
|
|
+ if(Objects.isNull(teacherId)){
|
|
|
+ continue;
|
|
|
}
|
|
|
- for (Map.Entry<Integer, Set<Long>> teacherServiceCourseIdMapEntry : teacherServiceCourseIdMap.entrySet()) {
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
- teacherServiceCourseIdMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
- DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
- "HOMEWORK", StringUtils.join(teacherServiceCourseIdMapEntry.getValue(), ","));
|
|
|
- studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherServiceCourseIdMapEntry.getValue().size());
|
|
|
- results.add(studentExtracurricularExercisesSituation);
|
|
|
+
|
|
|
+ if(!teacherNumMap.containsKey(teacherId)){
|
|
|
+ teacherNumMap.put(teacherId, 1);
|
|
|
+ }else{
|
|
|
+ teacherNumMap.put(teacherId, teacherNumMap.get(teacherId)+1);
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
|
|
|
+ StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
|
|
|
+ teacherNumMapEntry.getKey(),
|
|
|
+ nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
+ DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|
|
|
+ "EXERCISE", null);
|
|
|
+ studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
|
|
|
+ results.add(studentExtracurricularExercisesSituation);
|
|
|
}
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.VIP)){
|
|
|
List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
|
|
@@ -433,24 +432,15 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
}
|
|
|
}else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.MIX)){
|
|
|
- List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
|
|
|
- List<StudentServeCourseDto> weekCourseInfo = futureCourseInfo.stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
|
|
|
- List<StudentServeCourseDto> serveCourseInfo;
|
|
|
- if(CollectionUtils.isEmpty(weekCourseInfo)){
|
|
|
- serveCourseInfo = futureCourseInfo;
|
|
|
- }else{
|
|
|
- serveCourseInfo = weekCourseInfo;
|
|
|
- }
|
|
|
- Map<String, List<StudentServeCourseDto>> groupCourseInfo = serveCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
|
|
|
-
|
|
|
+ Set<String> musicGroupIds = noCourseStudentMusicIdsMap.get(studentCourseMapEntry.getKey());
|
|
|
Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
- for (String groupId : groupCourseInfo.keySet()) {
|
|
|
+ for (String groupId : musicGroupIds) {
|
|
|
Integer teacherId = null;
|
|
|
List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(studentCourseMapEntry.getKey()), groupId);
|
|
|
if(!CollectionUtils.isEmpty(studentTeacherIdList)){
|
|
|
teacherId = studentTeacherIdList.get(0).getValue();
|
|
|
}
|
|
|
- teacherId = Objects.isNull(teacherId)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():teacherId;
|
|
|
+ teacherId = Objects.isNull(teacherId)?noCourseStudentCourseMap.get(studentCourseMapEntry.getKey()).get(0).getLeadTeacherId():teacherId;
|
|
|
if(Objects.isNull(teacherId)){
|
|
|
continue;
|
|
|
}
|
|
@@ -506,17 +496,16 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<Integer, Set<String>> noCourseStudentMusicIdsMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId, Collectors.mapping(StudentServeCourseDto::getMusicGroupId, Collectors.toSet())));
|
|
|
- Map<Integer, List<StudentServeCourseDto>> noCourseStudentCourseMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
|
|
|
- for (Map.Entry<Integer, Set<String>> noCourseStudentMusicIdsMapEntry : noCourseStudentMusicIdsMap.entrySet()) {
|
|
|
+ for (Integer noCourseServeStudentId : noCourseServeStudentIds) {
|
|
|
+ Set<String> musicGroupIds = noCourseStudentMusicIdsMap.get(noCourseServeStudentId);
|
|
|
Map<Integer, Integer> teacherNumMap = new HashMap<>();
|
|
|
- for (String groupId : noCourseStudentMusicIdsMapEntry.getValue()) {
|
|
|
+ for (String groupId : musicGroupIds) {
|
|
|
Integer teacherId = null;
|
|
|
- List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(noCourseStudentMusicIdsMapEntry.getKey()), groupId);
|
|
|
+ List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(noCourseServeStudentId), groupId);
|
|
|
if(!CollectionUtils.isEmpty(studentTeacherIdList)){
|
|
|
teacherId = studentTeacherIdList.get(0).getValue();
|
|
|
}
|
|
|
- teacherId = Objects.isNull(teacherId)?noCourseStudentCourseMap.get(noCourseStudentMusicIdsMapEntry.getKey()).get(0).getLeadTeacherId():teacherId;
|
|
|
+ teacherId = Objects.isNull(teacherId)?noCourseStudentCourseMap.get(noCourseServeStudentId).get(0).getLeadTeacherId():teacherId;
|
|
|
if(Objects.isNull(teacherId)){
|
|
|
continue;
|
|
|
}
|
|
@@ -530,7 +519,7 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
}
|
|
|
|
|
|
for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
|
|
|
- StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(noCourseStudentMusicIdsMapEntry.getKey(),
|
|
|
+ StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(noCourseServeStudentId,
|
|
|
teacherNumMapEntry.getKey(),
|
|
|
nowDate.get(DateUtil.weekFields.weekOfYear()),
|
|
|
DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
|