|
@@ -817,11 +817,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
TeacherFreeTime teacherFreeTime=teacherFreeTimeDao.findTeacherFreeTime(teacherId);
|
|
|
int maxTeacherCourses=80;
|
|
|
+ int holiday=0;
|
|
|
if(Objects.nonNull(teacherFreeTime)){
|
|
|
if(Objects.nonNull(teacherFreeTime.getTotalTimes())){
|
|
|
maxTeacherCourses=teacherFreeTime.getTotalTimes();
|
|
|
}
|
|
|
-// if(Objects.nonNull(teacherFreeTime.get))
|
|
|
+ if(Objects.nonNull(teacherFreeTime.getHoliday())){
|
|
|
+ holiday=DateUtil.normalWeekNumCalendarWeekNumMap.get(teacherFreeTime.getHoliday());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Date now = new Date();
|
|
@@ -865,7 +868,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
applyDateRangeCourses.add(teacherCourse);
|
|
|
}
|
|
|
courseCalendar.setTime(teacherCourse.getClassDate());
|
|
|
- if(practiceCourseNum>80){
|
|
|
+ if (i==0&&teacherCourse.getGroupType().equals(GroupType.PRACTICE)) {
|
|
|
+ practiceCourseNum+=1;
|
|
|
+ courseWeekNum = courseCalendar.get(Calendar.WEEK_OF_YEAR);
|
|
|
+ }
|
|
|
+ if(practiceCourseNum>=maxTeacherCourses){
|
|
|
disableApplyWeekNum.add(courseWeekNum);
|
|
|
}
|
|
|
if (courseCalendar.get(Calendar.WEEK_OF_YEAR) != courseWeekNum) {
|
|
@@ -935,7 +942,10 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- allTeacherFreeDates.add(enableApplyDate);
|
|
|
+ calendar.setTime(enableApplyDate);
|
|
|
+ if (calendar.get(Calendar.DAY_OF_WEEK)!=holiday) {
|
|
|
+ allTeacherFreeDates.add(enableApplyDate);
|
|
|
+ }
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(allTeacherFreeDates)) {
|
|
|
List<Date> tempDates=new ArrayList<>();
|
|
@@ -1028,6 +1038,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
}
|
|
|
calendar.setTime(enableApplyDate);
|
|
|
+
|
|
|
+ if (calendar.get(Calendar.DAY_OF_WEEK)==holiday) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
if (!disableApplyWeekNum.contains(calendar.get(Calendar.WEEK_OF_YEAR))) {
|
|
|
tempEnableApplyDates.add(enableApplyDate);
|
|
|
}
|
|
@@ -1552,10 +1567,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ TeacherFreeTime teacherFreeTime=teacherFreeTimeDao.findTeacherFreeTime(practiceGroup.getUserId());
|
|
|
+ int maxTeacherCourses=80;
|
|
|
+ if(Objects.nonNull(teacherFreeTime)){
|
|
|
+ if(Objects.nonNull(teacherFreeTime.getTotalTimes())){
|
|
|
+ maxTeacherCourses=teacherFreeTime.getTotalTimes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Date monday1 = DateUtil.getWeekDayWithDate(allCourseDates.get(0), Calendar.MONDAY);
|
|
|
Date sunday1 = DateUtil.getWeekDayWithDate(allCourseDates.get(0), Calendar.SUNDAY);
|
|
|
int tp1 = courseScheduleDao.countTeacherPracticeCourse(practiceGroup.getUserId(), monday1, sunday1);
|
|
|
- if(tp1>=80){
|
|
|
+ if(tp1>=maxTeacherCourses){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
result.put("status", "TEACHER_PRACTICE_REPEAT");
|
|
|
result.put("info", "抱歉啦,当前所选时段组合,「" + teacher.getRealName() +"」老师已被预约,请重新选择时段或更换老师后重试。");
|
|
@@ -1565,7 +1590,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Date monday2 = DateUtil.getWeekDayWithDate(allCourseDates.get(1), Calendar.MONDAY);
|
|
|
Date sunday2 = DateUtil.getWeekDayWithDate(allCourseDates.get(1), Calendar.SUNDAY);
|
|
|
int tp2 = courseScheduleDao.countTeacherPracticeCourse(practiceGroup.getUserId(), monday2, sunday2);
|
|
|
- if(tp2>=80){
|
|
|
+ if(tp2>=maxTeacherCourses){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
result.put("status", "TEACHER_PRACTICE_REPEAT");
|
|
|
result.put("info", "抱歉啦,当前所选时段组合,「" + teacher.getRealName() +"」老师已被预约,请重新选择时段或更换老师后重试。");
|
|
@@ -1575,7 +1600,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Date monday3 = DateUtil.getWeekDayWithDate(allCourseDates.get(2), Calendar.MONDAY);
|
|
|
Date sunday3 = DateUtil.getWeekDayWithDate(allCourseDates.get(2), Calendar.SUNDAY);
|
|
|
int tp3 = courseScheduleDao.countTeacherPracticeCourse(practiceGroup.getUserId(), monday3, sunday3);
|
|
|
- if(tp3>=80){
|
|
|
+ if(tp3>=maxTeacherCourses){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
result.put("status", "TEACHER_PRACTICE_REPEAT");
|
|
|
result.put("info", "抱歉啦,当前所选时段组合,「" + teacher.getRealName() +"」老师已被预约,请重新选择时段或更换老师后重试。");
|
|
@@ -1585,7 +1610,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
Date monday4 = DateUtil.getWeekDayWithDate(allCourseDates.get(3), Calendar.MONDAY);
|
|
|
Date sunday4 = DateUtil.getWeekDayWithDate(allCourseDates.get(3), Calendar.SUNDAY);
|
|
|
int tp4 = courseScheduleDao.countTeacherPracticeCourse(practiceGroup.getUserId(), monday4, sunday4);
|
|
|
- if(tp4>=80){
|
|
|
+ if(tp4>=maxTeacherCourses){
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
result.put("status", "TEACHER_PRACTICE_REPEAT");
|
|
|
result.put("info", "抱歉啦,当前所选时段组合,「" + teacher.getRealName() +"」老师已被预约,请重新选择时段或更换老师后重试。");
|