Ver Fonte

Merge remote-tracking branch 'origin/saas' into saas

yanite há 3 anos atrás
pai
commit
13fa475231

+ 0 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java

@@ -36,22 +36,6 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
 	 */
 	Map<String,Object> checkCanApplyFreePracticeGroup(Integer userId);
 
-	/**
-	 * 给学生指派老师
-	 * @param practiceGroup: 申请参数
-	 * @return
-	 */
-	Integer searchTeacherId(PracticeGroup practiceGroup);
-
-	/**
-	 * @describe 给广州分部的学生指派老师
-	 * @author Joburgess
-	 * @date 2020/2/4
-	 * @param practiceGroup:
-	 * @return java.lang.Integer
-	 */
-	Integer searchTeacherIdForGuangZhou(PracticeGroup practiceGroup);
-
     /**
      * @describe 获取陪练课预约参数
      * @author Joburgess

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -2379,6 +2379,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if (Objects.nonNull(classGroup4MixDtos.get(0).getCourseAddType()) && classGroup4MixDtos.get(0).getCourseAddType().equals("onlyUpdateTeacher")) {
             List<ClassGroupTeacherMapper> byClassGroup = classGroupTeacherMapperDao.findByClassGroup(classGroupId);
             List<ClassGroupTeacherMapper> newTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
+            Set<Integer> collect = newTeacherMapperList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+            if(newTeacherMapperList.size() != collect.size()){
+                throw new BizException("主教与助教存在冲突");
+            }
             if(musicGroup.getStatus() == PROGRESS){
                 if (byClassGroup != null && byClassGroup.size() > 0) {
                     ClassGroupTeacherMapper groupTeacherMapper = byClassGroup.stream().filter(classGroupTeacherMapper -> classGroupTeacherMapper.getTeacherRole() == TeachTypeEnum.BISHOP).findFirst().get();

+ 3 - 535
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -268,516 +268,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Integer searchTeacherId(PracticeGroup practiceGroup) {
-        if (Objects.isNull(practiceGroup.getSubjectId())) {
-            return null;
-        }
-        SysUser sysUser = sysUserFeignService.queryUserById(practiceGroup.getStudentId());
-        if (Objects.isNull(sysUser)) {
-            return null;
-        }
-        if (Objects.isNull(sysUser.getOrganId())) {
-            return null;
-        }
-
-        //如果是广州分部的,并且声部满足条件的需要特殊处理
-        if (sysUser.getOrganId().equals(GUANGZHOU_ORGAN_ID) && GUANGZHOU_SUBJECTIDS.contains(practiceGroup.getSubjectId())) {
-            Integer teacherId = searchTeacherIdForGuangZhou(practiceGroup);
-            if (Objects.nonNull(teacherId)) {
-                return teacherId;
-            }
-        } else if (sysUser.getOrganId().equals(DALIAN_ORGAN_ID)) {
-            sysUser.setOrganId(SHENYANG_ORGAN_ID);
-        }
-
-        List<TeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject(sysUser.getOrganId(), practiceGroup.getSubjectId());
-        if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
-            return null;
-        }
-
-        boolean checkTeacherLeaveDate = true;
-        SysConfig allTeacherLeaveDataConfig = sysConfigDao.findByParamName(SysConfigService.TEACHER_LEAVE_DATA);
-        JSONObject allTeacherLeaveData = JSONObject.parseObject(allTeacherLeaveDataConfig.getParanValue());
-        JSONObject organTeacherLeaveData = null;
-        if (Objects.nonNull(allTeacherLeaveData)) {
-            organTeacherLeaveData = allTeacherLeaveData.getJSONObject(sysUser.getOrganId().toString());
-        }
-        if (Objects.isNull(organTeacherLeaveData)) {
-            checkTeacherLeaveDate = false;
-        }
-
-        SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
-        Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
-        List<Integer> teacherIds = organAndSubjectTeachers.stream().map(TeacherBasicDto::getId).collect(Collectors.toList());
-        teacherDao.lockTeachers(teacherIds);
-        Date now = new Date();
-        Calendar calendar = Calendar.getInstance();
-        if (now.before(applyStartDay)) {
-            now = applyStartDay;
-        }
-        calendar.setTime(now);
-        calendar.set(Calendar.HOUR_OF_DAY, 0);
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        List<Integer> firstTeacherIds = new ArrayList<>();
-        List<Integer> secondTeacherIds = new ArrayList<>();
-        while (calendar.getTime().before(activityEndDate)) {
-            calendar.add(Calendar.DATE, 1);
-            Date applyStartDay = calendar.getTime();
-            calendar.add(Calendar.DATE, 6);
-            Date applyEndDay = calendar.getTime();
-            if (applyEndDay.after(activityEndDate)) {
-                applyEndDay = activityEndDate;
-            }
-
-            boolean excludeFirstTime = practiceGroup.getFirstCourseTime().before(applyStartDay) || (practiceGroup.getFirstCourseTime().after(applyEndDay) && !DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), applyEndDay));
-            boolean excludeSecondTime = practiceGroup.getSecondCourseTime().before(applyStartDay) || (practiceGroup.getSecondCourseTime().after(applyEndDay) && !DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), applyEndDay));
-            if (excludeFirstTime && excludeSecondTime) {
-                continue;
-            }
-
-            Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDay, Calendar.MONDAY);
-            Date secondMonday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.MONDAY);
-            Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.SUNDAY);
-
-            List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeachersCoursesWithDateRange(teacherIds, firstMonday, secondSunday);
-
-            Date firstClassEndTime = DateUtil.addMinutes(practiceGroup.getFirstCourseTime(), practiceCourseMinutes);
-            Date secondClassEndTime = DateUtil.addMinutes(practiceGroup.getSecondCourseTime(), practiceCourseMinutes);
-
-            Map<Integer, List<CourseSchedule>> teacherCoursesMap = allTeacherCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getActualTeacherId));
-            for (Integer teacherId : teacherIds) {
-                if (Objects.nonNull(organTeacherLeaveData)) {
-                    checkTeacherLeaveDate = true;
-                }
-                JSONObject teacherLeaveData = null;
-                if (checkTeacherLeaveDate) {
-                    teacherLeaveData = organTeacherLeaveData.getJSONObject(teacherId.toString());
-                }
-                if (Objects.isNull(teacherLeaveData)) {
-                    checkTeacherLeaveDate = false;
-                }
-
-                if (teacherId == 100473) {
-                    checkTeacherLeaveDate = false;
-                    Calendar tempCalendar = Calendar.getInstance();
-                    tempCalendar.setFirstDayOfWeek(Calendar.MONDAY);
-                    tempCalendar.setTime(practiceGroup.getFirstCourseTime());
-                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY
-                            || tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
-                        String date_str = DateUtil.dateToString(practiceGroup.getFirstCourseTime(), "yyyy-MM-dd");
-                        Date date1 = DateUtil.stringToDate(date_str + " 11:30:00");
-                        Date date2 = DateUtil.stringToDate(date_str + " 14:30:00");
-                        Date date3 = DateUtil.stringToDate(date_str + " 20:30:00");
-                        if (practiceGroup.getFirstCourseTime().before(date2)
-                                && firstClassEndTime.after(date1)) {
-                            continue;
-                        }
-                        if (date3.before(firstClassEndTime)) {
-                            continue;
-                        }
-                    }
-                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
-                        continue;
-                    }
-
-                    tempCalendar.setTime(practiceGroup.getSecondCourseTime());
-                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY
-                            || tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
-                        String date_str = DateUtil.dateToString(practiceGroup.getSecondCourseTime(), "yyyy-MM-dd");
-                        Date date1 = DateUtil.stringToDate(date_str + " 11:30:00");
-                        Date date2 = DateUtil.stringToDate(date_str + " 14:30:00");
-                        Date date3 = DateUtil.stringToDate(date_str + " 20:30:00");
-                        if (practiceGroup.getSecondCourseTime().before(date2)
-                                && firstClassEndTime.after(date1)) {
-                            continue;
-                        }
-                        if (date3.before(secondClassEndTime)) {
-                            continue;
-                        }
-                    }
-                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
-                        continue;
-                    }
-                }
-
-                if (checkTeacherLeaveDate) {
-                    String dateStr = DateUtil.dateToString(practiceGroup.getFirstCourseTime(), "yyyy-MM-dd");
-                    JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
-                    if (Objects.nonNull(leaveDateData)) {
-                        Date leaveStartTime = leaveDateData.getDate("leave_start_time");
-                        Date leaveEndTime = leaveDateData.getDate("leave_end_time");
-                        if (practiceGroup.getFirstCourseTime().before(leaveEndTime)
-                                && firstClassEndTime.after(leaveStartTime)) {
-                            continue;
-                        }
-                    }
-                    String dateStr2 = DateUtil.dateToString(practiceGroup.getSecondCourseTime(), "yyyy-MM-dd");
-                    JSONObject leaveDateData2 = teacherLeaveData.getJSONObject(dateStr2);
-                    if (Objects.nonNull(leaveDateData2)) {
-                        Date leaveStartTime = leaveDateData2.getDate("leave_start_time");
-                        Date leaveEndTime = leaveDateData2.getDate("leave_end_time");
-                        if (practiceGroup.getSecondCourseTime().before(leaveEndTime)
-                                && secondClassEndTime.after(leaveStartTime)) {
-                            continue;
-                        }
-                    }
-                }
-
-                List<CourseSchedule> teacherCourses = teacherCoursesMap.get(teacherId);
-                if (CollectionUtils.isEmpty(teacherCourses)) {
-                    if (!excludeFirstTime) {
-                        firstTeacherIds.add(teacherId);
-                    }
-                    if (!excludeSecondTime) {
-                        secondTeacherIds.add(teacherId);
-                    }
-                    continue;
-                }
-
-                List<CourseSchedule> firstWeekCourses = new ArrayList<>();
-                List<CourseSchedule> secondWeekCourses = new ArrayList<>();
-                List<CourseSchedule> applyDateRangeCourses = new ArrayList<>();
-                for (CourseSchedule teacherCours : teacherCourses) {
-                    if (teacherCours.getClassDate().before(secondMonday)) {
-                        firstWeekCourses.add(teacherCours);
-                    } else {
-                        secondWeekCourses.add(teacherCours);
-                    }
-                    if (!teacherCours.getClassDate().before(applyStartDay)
-                            && (teacherCours.getClassDate().before(applyEndDay) || DateUtil.isSameDay(teacherCours.getClassDate(), applyEndDay))) {
-                        applyDateRangeCourses.add(teacherCours);
-                    }
-                }
-
-                boolean firstWeekEnableApply = true;
-                boolean secondWeekEnableApply = true;
-
-                if (!CollectionUtils.isEmpty(firstWeekCourses)) {
-                    Map<GroupType, Long> groupTypeCountFirstMap = firstWeekCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getGroupType, Collectors.counting()));
-                    if (Objects.nonNull(groupTypeCountFirstMap.get(GroupType.PRACTICE)) && groupTypeCountFirstMap.get(GroupType.PRACTICE) >= 80) {
-                        firstWeekEnableApply = false;
-                    }
-                }
-
-                if (!CollectionUtils.isEmpty(firstWeekCourses)) {
-                    Map<GroupType, Long> groupTypeCountSecondMap = secondWeekCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getGroupType, Collectors.counting()));
-                    if (Objects.nonNull(groupTypeCountSecondMap.get(GroupType.PRACTICE)) && groupTypeCountSecondMap.get(GroupType.PRACTICE) >= 80) {
-                        secondWeekEnableApply = false;
-                    }
-                }
-
-                Date enableApplyStartDate = applyStartDay;
-                Date enableApplyEndDate = secondSunday;
-                if (!firstWeekEnableApply) {
-                    enableApplyStartDate = secondMonday;
-                }
-                if (!secondWeekEnableApply) {
-                    enableApplyEndDate = secondMonday;
-                }
-
-                if (DateUtil.isSameDay(enableApplyStartDate, enableApplyEndDate)) {
-                    continue;
-                }
-
-                teacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-                boolean enableCreateFirstCourse = true;
-                if (practiceGroup.getFirstCourseTime().before(enableApplyStartDate)
-                        || practiceGroup.getFirstCourseTime().after(enableApplyEndDate)) {
-                    enableCreateFirstCourse = false;
-                }
-                boolean enableCreateSecondCourse = true;
-                if (practiceGroup.getSecondCourseTime().before(enableApplyStartDate)
-                        || practiceGroup.getSecondCourseTime().after(enableApplyEndDate)) {
-                    enableCreateSecondCourse = false;
-                }
-                for (int i = 0; i < applyDateRangeCourses.size(); i++) {
-                    CourseSchedule preCourseSchedule = applyDateRangeCourses.get(i);
-
-                    if (practiceGroup.getFirstCourseTime().before(preCourseSchedule.getEndClassTime())
-                            && firstClassEndTime.after(preCourseSchedule.getStartClassTime())) {
-                        enableCreateFirstCourse = false;
-                    }
-
-                    if (practiceGroup.getSecondCourseTime().before(preCourseSchedule.getEndClassTime())
-                            && secondClassEndTime.after(preCourseSchedule.getStartClassTime())) {
-                        enableCreateSecondCourse = false;
-                    }
-                }
-                if (enableCreateFirstCourse) {
-                    firstTeacherIds.add(teacherId);
-                }
-                if (enableCreateSecondCourse) {
-                    secondTeacherIds.add(teacherId);
-                }
-            }
-            if (!CollectionUtils.isEmpty(firstTeacherIds) && !CollectionUtils.isEmpty(secondTeacherIds)) {
-                break;
-            }
-        }
-        if (CollectionUtils.isEmpty(firstTeacherIds) || CollectionUtils.isEmpty(secondTeacherIds)) {
-            return null;
-        }
-
-        List<Integer> includeTeacherIds = firstTeacherIds.stream().filter(firstTeacherId -> secondTeacherIds.contains(firstTeacherId)).collect(Collectors.toList());
-
-        if (CollectionUtils.isEmpty(includeTeacherIds)) {
-            return null;
-        }
-
-        List<CourseScheduleTeacherSalary> studentRelateTeachers = courseScheduleTeacherSalaryDao.findStudentRelateTeachers(practiceGroup.getStudentId(), includeTeacherIds);
-        Random random = new Random();
-        if (!CollectionUtils.isEmpty(studentRelateTeachers)) {
-            Map<GroupType, List<CourseScheduleTeacherSalary>> groupTypeTeachersMap = studentRelateTeachers.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getGroupType));
-            List<CourseScheduleTeacherSalary> vipGroupTeachers = groupTypeTeachersMap.get(GroupType.VIP);
-            if (!CollectionUtils.isEmpty(vipGroupTeachers)) {
-                int randomIndex = random.nextInt(vipGroupTeachers.size());
-                return vipGroupTeachers.get(randomIndex).getUserId();
-            }
-            List<CourseScheduleTeacherSalary> musicGroupTeachers = groupTypeTeachersMap.get(GroupType.MUSIC);
-            if (!CollectionUtils.isEmpty(musicGroupTeachers)) {
-                int randomIndex = random.nextInt(musicGroupTeachers.size());
-                return musicGroupTeachers.get(randomIndex).getUserId();
-            }
-        }
-
-        List<Map<Integer, Integer>> teacherCourseNumMaps = courseScheduleTeacherSalaryDao.countTeacherCourses(includeTeacherIds, GroupType.PRACTICE);
-        HashMap<Integer, Integer> teacherCourseNumMap = (HashMap<Integer, Integer>) MapUtil.convertIntegerMap(teacherCourseNumMaps);
-        for (Integer includeTeacherId : includeTeacherIds) {
-            if (!teacherCourseNumMap.containsKey(includeTeacherId)) {
-                teacherCourseNumMap.put(includeTeacherId, 0);
-            }
-        }
-        List<Integer> temp = new ArrayList<>();
-        teacherCourseNumMap.entrySet().stream()
-                .sorted((r1, r2) -> r1.getValue().compareTo(r2.getValue()))
-                .forEach(result -> temp.add(result.getKey()));
-        return temp.get(0);
-    }
-
-    @Override
-    public Integer searchTeacherIdForGuangZhou(PracticeGroup practiceGroup) {
-        List<MusicGroup> userMusicGroups = musicGroupDao.findUserMusicGroups(practiceGroup.getStudentId());
-        if (CollectionUtils.isEmpty(userMusicGroups)) {
-            return null;
-        }
-
-        List<Integer> userSchoolIds = userMusicGroups.stream()
-                .filter(musicGroup -> Objects.nonNull(musicGroup.getSchoolId()) && schoolSubjectTeachersMap.containsKey(musicGroup.getSchoolId()))
-                .map(MusicGroup::getSchoolId).collect(Collectors.toList());
-
-        if (CollectionUtils.isEmpty(userSchoolIds)) {
-            return null;
-        }
-
-        Collections.shuffle(userSchoolIds);
-        Integer schoolId = userMusicGroups.get(0).getSchoolId();
-
-        List<Integer> teacherIds = schoolSubjectTeachersMap.get(schoolId).get(practiceGroup.getSubjectId());
-        teacherDao.lockTeachers(teacherIds);
-
-        boolean checkTeacherLeaveDate = true;
-        SysConfig allTeacherLeaveDataConfig = sysConfigDao.findByParamName(SysConfigService.TEACHER_LEAVE_DATA);
-        JSONObject allTeacherLeaveData = JSONObject.parseObject(allTeacherLeaveDataConfig.getParanValue());
-        JSONObject organTeacherLeaveData = null;
-        if (Objects.nonNull(allTeacherLeaveData)) {
-            organTeacherLeaveData = allTeacherLeaveData.getJSONObject(GUANGZHOU_ORGAN_ID.toString());
-        }
-        if (Objects.isNull(organTeacherLeaveData)) {
-            checkTeacherLeaveDate = false;
-        }
-
-        SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
-        Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
-        Date now = new Date();
-        if (now.before(applyStartDay)) {
-            now = applyStartDay;
-        }
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(now);
-        calendar.set(Calendar.HOUR_OF_DAY, 0);
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        List<Integer> firstTeacherIds = new ArrayList<>();
-        List<Integer> secondTeacherIds = new ArrayList<>();
-        while (calendar.getTime().before(activityEndDate)) {
-            calendar.add(Calendar.DATE, 1);
-            Date applyStartDay = calendar.getTime();
-            calendar.add(Calendar.DATE, 6);
-            Date applyEndDay = calendar.getTime();
-            if (applyEndDay.after(activityEndDate)) {
-                applyEndDay = activityEndDate;
-            }
-            boolean excludeFirstTime = practiceGroup.getFirstCourseTime().before(applyStartDay) || (practiceGroup.getFirstCourseTime().after(applyEndDay) && !DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), applyEndDay));
-            boolean excludeSecondTime = practiceGroup.getSecondCourseTime().before(applyStartDay) || (practiceGroup.getSecondCourseTime().after(applyEndDay) && !DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), applyEndDay));
-            if (excludeFirstTime && excludeSecondTime) {
-                continue;
-            }
-
-            Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDay, Calendar.MONDAY);
-            Date secondMonday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.MONDAY);
-            Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.SUNDAY);
-
-            List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeachersCoursesWithDateRange(teacherIds, firstMonday, secondSunday);
-
-            Date firstClassEndTime = DateUtil.addMinutes(practiceGroup.getFirstCourseTime(), practiceCourseMinutes);
-            Date secondClassEndTime = DateUtil.addMinutes(practiceGroup.getSecondCourseTime(), practiceCourseMinutes);
-
-            Map<Integer, List<CourseSchedule>> teacherCoursesMap = allTeacherCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getActualTeacherId));
-            for (Integer teacherId : teacherIds) {
-                if (Objects.nonNull(organTeacherLeaveData)) {
-                    checkTeacherLeaveDate = true;
-                }
-                JSONObject teacherLeaveData = null;
-                if (checkTeacherLeaveDate) {
-                    teacherLeaveData = organTeacherLeaveData.getJSONObject(teacherId.toString());
-                }
-                if (Objects.isNull(teacherLeaveData)) {
-                    checkTeacherLeaveDate = false;
-                }
-
-                if (checkTeacherLeaveDate) {
-                    String dateStr = DateUtil.dateToString(practiceGroup.getFirstCourseTime(), "yyyy-MM-dd");
-                    JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
-                    if (Objects.nonNull(leaveDateData)) {
-                        Date leaveStartTime = leaveDateData.getDate("leave_start_time");
-                        Date leaveEndTime = leaveDateData.getDate("leave_end_time");
-                        if (practiceGroup.getFirstCourseTime().before(leaveEndTime)
-                                && firstClassEndTime.after(leaveStartTime)) {
-                            continue;
-                        }
-                    }
-                    String dateStr2 = DateUtil.dateToString(practiceGroup.getSecondCourseTime(), "yyyy-MM-dd");
-                    JSONObject leaveDateData2 = teacherLeaveData.getJSONObject(dateStr2);
-                    if (Objects.nonNull(leaveDateData2)) {
-                        Date leaveStartTime = leaveDateData2.getDate("leave_start_time");
-                        Date leaveEndTime = leaveDateData2.getDate("leave_end_time");
-                        if (practiceGroup.getSecondCourseTime().before(leaveEndTime)
-                                && secondClassEndTime.after(leaveStartTime)) {
-                            continue;
-                        }
-                    }
-                }
-
-                List<CourseSchedule> teacherCourses = teacherCoursesMap.get(teacherId);
-                if (CollectionUtils.isEmpty(teacherCourses)) {
-                    if (!excludeFirstTime) {
-                        firstTeacherIds.add(teacherId);
-                    }
-                    if (!excludeSecondTime) {
-                        secondTeacherIds.add(teacherId);
-                    }
-                    continue;
-                }
-
-                List<CourseSchedule> firstWeekCourses = new ArrayList<>();
-                List<CourseSchedule> secondWeekCourses = new ArrayList<>();
-                List<CourseSchedule> applyDateRangeCourses = new ArrayList<>();
-                for (CourseSchedule teacherCours : teacherCourses) {
-                    if (teacherCours.getClassDate().before(secondMonday)) {
-                        firstWeekCourses.add(teacherCours);
-                    } else {
-                        secondWeekCourses.add(teacherCours);
-                    }
-                    if (!teacherCours.getClassDate().before(applyStartDay)
-                            && (teacherCours.getClassDate().before(applyEndDay) || DateUtil.isSameDay(teacherCours.getClassDate(), applyEndDay))) {
-                        applyDateRangeCourses.add(teacherCours);
-                    }
-                }
-
-                boolean firstWeekEnableApply = true;
-                boolean secondWeekEnableApply = true;
-
-                if (!CollectionUtils.isEmpty(firstWeekCourses)) {
-                    Map<GroupType, Long> groupTypeCountFirstMap = firstWeekCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getGroupType, Collectors.counting()));
-                    if (Objects.nonNull(groupTypeCountFirstMap.get(GroupType.PRACTICE)) && groupTypeCountFirstMap.get(GroupType.PRACTICE) >= 80) {
-                        firstWeekEnableApply = false;
-                    }
-                }
-
-                if (!CollectionUtils.isEmpty(firstWeekCourses)) {
-                    Map<GroupType, Long> groupTypeCountSecondMap = secondWeekCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getGroupType, Collectors.counting()));
-                    if (Objects.nonNull(groupTypeCountSecondMap.get(GroupType.PRACTICE)) && groupTypeCountSecondMap.get(GroupType.PRACTICE) >= 80) {
-                        secondWeekEnableApply = false;
-                    }
-                }
-
-                Date enableApplyStartDate = applyStartDay;
-                Date enableApplyEndDate = secondSunday;
-                if (!firstWeekEnableApply) {
-                    enableApplyStartDate = secondMonday;
-                }
-                if (!secondWeekEnableApply) {
-                    enableApplyEndDate = secondMonday;
-                }
-
-                if (DateUtil.isSameDay(enableApplyStartDate, enableApplyEndDate)) {
-                    continue;
-                }
-
-                teacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-                boolean enableCreateFirstCourse = true;
-                if (practiceGroup.getFirstCourseTime().before(enableApplyStartDate)
-                        || practiceGroup.getFirstCourseTime().after(enableApplyEndDate)) {
-                    enableCreateFirstCourse = false;
-                }
-                boolean enableCreateSecondCourse = true;
-                if (practiceGroup.getSecondCourseTime().before(enableApplyStartDate)
-                        || practiceGroup.getSecondCourseTime().after(enableApplyEndDate)) {
-                    enableCreateSecondCourse = false;
-                }
-
-                for (int i = 0; i < applyDateRangeCourses.size(); i++) {
-                    CourseSchedule preCourseSchedule = applyDateRangeCourses.get(i);
-
-                    if (practiceGroup.getFirstCourseTime().before(preCourseSchedule.getEndClassTime())
-                            && firstClassEndTime.after(preCourseSchedule.getStartClassTime())) {
-                        enableCreateFirstCourse = false;
-                    }
-
-                    if (practiceGroup.getSecondCourseTime().before(preCourseSchedule.getEndClassTime())
-                            && secondClassEndTime.after(preCourseSchedule.getStartClassTime())) {
-                        enableCreateSecondCourse = false;
-                    }
-                }
-                if (enableCreateFirstCourse) {
-                    firstTeacherIds.add(teacherId);
-                }
-                if (enableCreateSecondCourse) {
-                    secondTeacherIds.add(teacherId);
-                }
-            }
-            if (!CollectionUtils.isEmpty(firstTeacherIds) && !CollectionUtils.isEmpty(secondTeacherIds)) {
-                break;
-            }
-        }
-        if (CollectionUtils.isEmpty(firstTeacherIds) || CollectionUtils.isEmpty(secondTeacherIds)) {
-            return null;
-        }
-
-        List<Integer> includeTeacherIds = firstTeacherIds.stream().filter(firstTeacherId -> secondTeacherIds.contains(firstTeacherId)).collect(Collectors.toList());
-
-        if (CollectionUtils.isEmpty(includeTeacherIds)) {
-            return null;
-        }
-
-        List<Map<Integer, Integer>> teacherCourseNumMaps = courseScheduleTeacherSalaryDao.countTeacherCourses(includeTeacherIds, GroupType.PRACTICE);
-        HashMap<Integer, Integer> teacherCourseNumMap = (HashMap<Integer, Integer>) MapUtil.convertIntegerMap(teacherCourseNumMaps);
-        for (Integer includeTeacherId : includeTeacherIds) {
-            if (!teacherCourseNumMap.containsKey(includeTeacherId)) {
-                teacherCourseNumMap.put(includeTeacherId, 0);
-            }
-        }
-        List<Integer> temp = new ArrayList<>();
-        teacherCourseNumMap.entrySet().stream()
-                .sorted((r1, r2) -> r1.getValue().compareTo(r2.getValue()))
-                .forEach(result -> temp.add(result.getKey()));
-        return temp.get(0);
-    }
-
-    @Override
     public Map getPracticeApplyParams(Integer userId, Integer tenantId) {
         Map result = new HashMap(7);
         String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST, tenantId);
@@ -2926,10 +2416,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
         }
         allTeacherCourses = new ArrayList<>();
-//
-//        practiceGroupBuyParams.setName(subject.getName() + "•" + sysUser.getUsername());
-//
-//        List<CourseSchedule> practiceCourses = createPracticeCourses(practiceGroupBuyParams, practiceCourseMinutes);
 
         JSONObject drillTimesObject = new JSONObject();
         for (PracticeDrillTimeDto drillTime : practiceGroupBuyParams.getDrillTimes()) {
@@ -2941,17 +2427,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             throw new BizException("所在城市暂不参与此活动");
         }
         BigDecimal oneMonthPrice = practiceGroupSellPrice.getSingleClassMinutesPrice();
-        /*if (practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&& studentExitChargePractices <= 0) {
-//            oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceActivityPrice() : practiceGroupSellPrice.getTwiceActivityPrice();
-            oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
-            if (!now.before(practicePromotionActivityStartDate) && practiceGroupBuyParams.getBuyMonths() >= 3 && studentExitChargePractices > 0) {
-                oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceQuartActivityPrice() : practiceGroupSellPrice.getTwiceQuartActivityPrice();
-            } else if (!now.before(practicePromotionActivityStartDate) && studentExitChargePractices <= 0) {
-                oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
-            }
-        } else {
-            oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
-        }*/
         BigDecimal amount = oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getAllCourseNum()));
 
         practiceGroupBuyParams.setDrillTimesJson(drillTimesObject.toJSONString());
@@ -3059,11 +2534,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (teacherDefaultSalary == null) {
             throw new BizException("请设置教师课酬");
         }
-//        BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
-
-//        BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
-//        BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
-//        BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
 
         //实际支付金额,去除优惠券
         BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
@@ -3097,8 +2567,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 courseScheduleStudentPayment.setExpectPrice(divide);
                 courseScheduleStudentPayment.setActualPrice(divide);
             }
-//            courseScheduleStudentPayment.setExpectPrice(oneMonthPrice);
-//            courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
             courseScheduleStudentPayment.setOriginalPrice(oneMonthPrice);
             courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
             courseScheduleStudentPayment.setCreateTime(now);
@@ -3714,7 +3182,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                     practiceGroup.getId(), practiceGroup.getUserId());
             practiceGroup.setActivityUserMapperId(activityUserMapperId);
             if (classGroup.getDelFlag() == 1) {
-                updatePracticeGroupStudentNumAndStatus(practiceGroup, classGroup, order);
+                this.updatePracticeGroupStudentNumAndStatus(practiceGroup, classGroup, order);
             } else {
                 courseScheduleDao.updateGroupCourseLock(order.getMusicGroupId(), GroupType.PRACTICE, 0);
             }
@@ -3854,7 +3322,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         imUserFriendService.refreshGroupImUserFriend(practiceGroup.getId().toString(), GroupType.PRACTICE);
     }
 
-    private void updatePracticeGroupStudentNumAndStatus(PracticeGroup practiceGroup, ClassGroup classGroup, StudentPaymentOrder order) {
+    public void updatePracticeGroupStudentNumAndStatus(PracticeGroup practiceGroup, ClassGroup classGroup, StudentPaymentOrder order) {
         classGroup.setStudentNum(1);
         classGroup.setDelFlag(0);
         classGroupDao.update(classGroup);
@@ -3937,7 +3405,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             //教师签到记录
             TeacherAttendance teacherAttendance = new TeacherAttendance();
             teacherAttendance.setMusicGroupId(practiceGroup.getId().toString());
-            teacherAttendance.setTeacherId(practiceGroup.getStudentId());
+            teacherAttendance.setTeacherId(practiceGroup.getUserId());
             teacherAttendance.setClassGroupId(classGroup.getId());
             teacherAttendance.setGroupType(GroupType.PRACTICE);
             teacherAttendance.setCourseScheduleId(courseSchedule.getId());