|
@@ -10,6 +10,8 @@ import com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto;
|
|
|
import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
|
|
|
import com.ym.mec.biz.dal.entity.Student;
|
|
|
import com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation;
|
|
|
+import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
import com.ym.mec.biz.service.StudentServeService;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
@@ -63,21 +65,33 @@ public class StudentServeServiceImpl implements StudentServeService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ Map<Integer, List<StudentServeDto>> studentCoursesMap = serviceStudents.stream().collect(Collectors.groupingBy(StudentServeDto::getUserId));
|
|
|
+
|
|
|
//本周不服务学员列表
|
|
|
Set<Integer> dontServeInCurrentWeekStudentIds=new HashSet<>();
|
|
|
//本周有课学员编号集合
|
|
|
Set<Integer> haveClassStudentIds=new HashSet<>();
|
|
|
//本周无课学员编号集合
|
|
|
Set<Integer> noClassStudentIds=new HashSet<>();
|
|
|
- for (StudentServeDto serviceStudent : serviceStudents) {
|
|
|
- if(Objects.nonNull(serviceStudent.getCourseStartTime())&&serviceStudent.getCourseStartTime().after(nextMonday)){
|
|
|
- dontServeInCurrentWeekStudentIds.add(serviceStudent.getUserId());
|
|
|
+ for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
|
|
|
+ if(CollectionUtils.isEmpty(studentCoursesEntry.getValue())){
|
|
|
+ noClassStudentIds.add(studentCoursesEntry.getKey());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ StudentServeDto studentServeDto = studentCoursesEntry.getValue().stream().min(Comparator.comparing(StudentServeDto::getCourseStartTime)).get();
|
|
|
+ if(Objects.isNull(studentServeDto.getCourseStartTime())){
|
|
|
+ noClassStudentIds.add(studentCoursesEntry.getKey());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(studentServeDto.getCourseStartTime().after(nextMonday)){
|
|
|
+ dontServeInCurrentWeekStudentIds.add(studentCoursesEntry.getKey());
|
|
|
continue;
|
|
|
}
|
|
|
- if(Objects.nonNull(serviceStudent.getCourseStartTime())){
|
|
|
- haveClassStudentIds.add(serviceStudent.getUserId());
|
|
|
+ if(GroupType.PRACTICE.equals(studentServeDto.getGroupType())||
|
|
|
+ (GroupType.MUSIC.equals(studentServeDto.getGroupType())&&TeachModeEnum.OFFLINE.equals(studentServeDto.getTeachMode()))){
|
|
|
+ haveClassStudentIds.add(studentCoursesEntry.getKey());
|
|
|
}else{
|
|
|
- noClassStudentIds.add(serviceStudent.getUserId());
|
|
|
+ noClassStudentIds.add(studentCoursesEntry.getKey());
|
|
|
}
|
|
|
}
|
|
|
|