Browse Source

fix: VIP课课程结束逻辑调整-进行中的课程组中没有未完成的课即结束

Joburgess 4 years ago
parent
commit
81bc4e3de8

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -370,6 +370,51 @@ public class StudentServeServiceImpl implements StudentServeService {
             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);
+//                    }
+//                }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());
+//                    }
+//                    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);
+//                    }
+//                }
+
                 Set<String> musicGroupIds = noCourseStudentMusicIdsMap.get(studentCourseMapEntry.getKey());
                 if(CollectionUtils.isEmpty(musicGroupIds)){
                     continue;

+ 10 - 6
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -923,12 +923,16 @@
     </update>
 
     <select id="queryRequiredOverList" resultMap="VipGroup">
-        select vg.*
-        from vip_group vg
-            left join class_group cg on vg.id_ = cg.music_group_id_ AND cg.group_type_ = 'VIP'
-        where vg.group_status_ = 2
-          and cg.total_class_times_ = cg.current_class_times_
-          and cg.total_class_times_ &gt; 0
+        SELECT
+            vg.*
+        FROM
+            vip_group vg
+            LEFT JOIN course_schedule cs ON cs.group_type_ = 'VIP' AND CONCAT(vg.id_, '') = cs.music_group_id_
+        WHERE
+            vg.group_status_ = 2
+            GROUP BY
+            vg.id_
+        HAVING COUNT( CASE WHEN cs.status_ != 'OVER' THEN 1 ELSE NULL END )&lt;=0
     </select>
     <select id="queryNormalStatusList" resultMap="VipGroup">
         SELECT *