Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
02a38c4b66

+ 20 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -56,17 +56,28 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			params.put("offset", pageInfo.getOffset());
 			dataList = studentExtracurricularExercisesSituationDao.findExercisesSituations(params);
 			long until = LocalDateTime.ofInstant(queryInfo.getMonday().toInstant(), DateUtil.zoneId).until(LocalDateTime.ofInstant(queryInfo.getSunday().toInstant(), DateUtil.zoneId), ChronoUnit.WEEKS);
-			if(Objects.isNull(queryInfo.getExistVipCourse())){
+			if(Objects.isNull(queryInfo.getExistVipCourse())||Objects.isNull(queryInfo.getExistPracticeCourse())){
 				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);
-				List<Map<Integer, Long>> studentPracticeCoursesMaps = courseScheduleDao.countStudentPayPracticeCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday());
-				Map<Integer, Long> studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
-				Map<Integer, Long> studentPracticeCourseMap = MapUtil.convertIntegerMap(studentPracticeCoursesMaps);
+				Map<Integer, Long> studentVipCourseMap=new HashMap<>();
+				if(Objects.isNull(queryInfo.getExistVipCourse())){
+					List<Map<Integer, Long>> studentVipCoursesMaps = courseScheduleDao.countStudentVipCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday(), GroupType.VIP);
+					studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
+				}
+
+				Map<Integer, Long> studentPracticeCourseMap=new HashMap<>();
+				if(Objects.isNull(queryInfo.getExistPracticeCourse())){
+					List<Map<Integer, Long>> studentPracticeCoursesMaps = courseScheduleDao.countStudentPayPracticeCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday());
+					studentPracticeCourseMap = MapUtil.convertIntegerMap(studentPracticeCoursesMaps);
+				}
 				for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
-					Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
-					Long practiceCourses=studentPracticeCourseMap.get(exercisesSituationDto.getStudentId());
-					exercisesSituationDto.setExistVipCourse(Objects.isNull(vipCourses)?0:vipCourses.intValue());
-					exercisesSituationDto.setExistPracticeCourse(Objects.isNull(practiceCourses)?0:practiceCourses.intValue());
+					if(Objects.isNull(queryInfo.getExistVipCourse())){
+						Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
+						exercisesSituationDto.setExistVipCourse(Objects.isNull(vipCourses)?0:vipCourses.intValue());
+					}
+					if(Objects.isNull(queryInfo.getExistPracticeCourse())){
+						Long practiceCourses=studentPracticeCourseMap.get(exercisesSituationDto.getStudentId());
+						exercisesSituationDto.setExistPracticeCourse(Objects.isNull(practiceCourses)?0:practiceCourses.intValue());
+					}
 					exercisesSituationDto.setExpectExercisesNum((int) until+1);
 				}
 			}else{