|
@@ -1,9 +1,7 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
|
|
|
-import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.StudentEduTeacherDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentExercisesSituationDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentServiceDetailDto;
|
|
|
import com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation;
|
|
@@ -18,6 +16,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.time.DayOfWeek;
|
|
|
import java.time.LocalDate;
|
|
@@ -37,6 +36,8 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
@Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
+ @Autowired
|
|
|
+ private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentExtracurricularExercisesSituation> getDAO() {
|
|
@@ -63,12 +64,21 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
|
|
|
|
|
|
List<Map<Integer, Long>> studentPracticeCoursesMaps = courseScheduleDao.countStudentPayPracticeCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday());
|
|
|
Map<Integer, Long> studentPracticeCourseMap = MapUtil.convertIntegerMap(studentPracticeCoursesMaps);
|
|
|
+
|
|
|
+ List<StudentEduTeacherDto> studentEducationalTeachers = classGroupStudentMapperDao.getStudentEducationalTeachers(studentIds);
|
|
|
+ Map<Integer, List<StudentEduTeacherDto>> studentEduTeachersMap = studentEducationalTeachers.stream().collect(Collectors.groupingBy(StudentEduTeacherDto::getStudentId));
|
|
|
+
|
|
|
for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
|
|
|
Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
|
|
|
exercisesSituationDto.setExistVipCourse(Objects.isNull(vipCourses)?0:vipCourses.intValue());
|
|
|
Long practiceCourses=studentPracticeCourseMap.get(exercisesSituationDto.getStudentId());
|
|
|
exercisesSituationDto.setExistPracticeCourse(Objects.isNull(practiceCourses)?0:practiceCourses.intValue());
|
|
|
exercisesSituationDto.setExpectExercisesNum((int) until+1);
|
|
|
+ List<StudentEduTeacherDto> studentEduTeachers = studentEduTeachersMap.get(exercisesSituationDto.getStudentId());
|
|
|
+ if(!CollectionUtils.isEmpty(studentEduTeachers)){
|
|
|
+ exercisesSituationDto.setEducationalTeacherId(studentEduTeachers.get(0).getEducationalTeacherId());
|
|
|
+ exercisesSituationDto.setEducationalTeacherName(studentEduTeachers.get(0).getEducationalTeacherName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (count == 0) {
|
|
@@ -90,11 +100,14 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
|
|
|
pageInfo.setTotal(count);
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = studentExtracurricularExercisesSituationDao.findExercisesSituations(params);
|
|
|
+ Map<Integer, Long> studentVipCourseMap=new HashMap<>();
|
|
|
if(Objects.isNull(queryInfo.getExistVipCourse())){
|
|
|
List<Integer> studentIds = dataList.stream().map(StudentExtracurricularExercisesSituation::getStudentId).collect(Collectors.toList());
|
|
|
List<Map<Integer, Long>> studentVipCoursesMaps = courseScheduleDao.countStudentVipCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday(),GroupType.VIP);
|
|
|
- Map<Integer, Long> studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
|
|
|
- for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
|
|
|
+ studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
|
|
|
+ }
|
|
|
+ for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
|
|
|
+ if(Objects.isNull(queryInfo.getExistVipCourse())){
|
|
|
Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
|
|
|
if(Objects.isNull(vipCourses)||vipCourses<=0){
|
|
|
exercisesSituationDto.setExistVipCourse(0);
|