|
@@ -4,6 +4,7 @@ import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.CourseHomeworkStudentDetailDto;
|
|
|
import com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto;
|
|
|
+import com.ym.mec.biz.dal.dto.Practice4ExercisesSituationDto;
|
|
|
import com.ym.mec.biz.dal.dto.SimpleUserDto;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
@@ -187,23 +188,26 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
|
|
|
LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
|
|
|
LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
|
|
LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
|
|
|
- List<Integer> noPracticeStudentIds = courseScheduleStudentPaymentDao.findNoPracticeStudentIdsOnWeek(monDayDate.toString(),sunDayDate.toString());
|
|
|
- if(CollectionUtils.isEmpty(noPracticeStudentIds)){
|
|
|
+ List<Practice4ExercisesSituationDto> noPracticeStudents = courseScheduleStudentPaymentDao.findNoPracticeStudentIdsOnWeek(monDayDate.toString(),sunDayDate.toString());
|
|
|
+ if(CollectionUtils.isEmpty(noPracticeStudents)){
|
|
|
return;
|
|
|
}
|
|
|
+ Map<Integer, List<Practice4ExercisesSituationDto>> studentCourseMap = noPracticeStudents.stream().filter(e->Objects.nonNull(e.getCourseStartTime())).collect(Collectors.groupingBy(Practice4ExercisesSituationDto::getUserId));
|
|
|
+
|
|
|
List<ExtracurricularExercisesReply> noPracticeStudentExercisesInWeek = extracurricularExercisesReplyDao.findNoPracticeStudentExercisesInWeek(monDayDate.toString(), sunDayDate.toString());
|
|
|
Map<Integer, List<ExtracurricularExercisesReply>> studentExercisesMap = noPracticeStudentExercisesInWeek.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getUserId));
|
|
|
|
|
|
List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
|
|
|
- for (Integer noPracticeStudentId : noPracticeStudentIds) {
|
|
|
+ for (Map.Entry<Integer, List<Practice4ExercisesSituationDto>> studentCourseEntry : studentCourseMap.entrySet()) {
|
|
|
StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation();
|
|
|
- studentExtracurricularExercisesSituation.setStudentId(noPracticeStudentId);
|
|
|
- studentExtracurricularExercisesSituation.setTeacherId(courseScheduleStudentPaymentDao.findNoPracticeStudentTeacherId(noPracticeStudentId));
|
|
|
+ studentExtracurricularExercisesSituation.setStudentId(studentCourseEntry.getKey());
|
|
|
+ studentCourseEntry.getValue().sort(Comparator.comparing(Practice4ExercisesSituationDto::getCourseStartTime).reversed());
|
|
|
+ studentExtracurricularExercisesSituation.setTeacherId(studentCourseEntry.getValue().get(0).getActualTeacherId());
|
|
|
studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
|
|
|
studentExtracurricularExercisesSituation.setWeekOfYear(nowDate.get(DateUtil.weekFields.weekOfYear()));
|
|
|
studentExtracurricularExercisesSituation.setMonday(DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"));
|
|
|
studentExtracurricularExercisesSituation.setSunday(DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"));
|
|
|
- List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(noPracticeStudentId);
|
|
|
+ List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(studentCourseEntry.getKey());
|
|
|
if(CollectionUtils.isEmpty(studentExercises)){
|
|
|
studentExtracurricularExercisesSituation.setActualExercisesNum(0);
|
|
|
studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
|