|
@@ -5823,8 +5823,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
//2、获取班级学生
|
|
|
- List<Integer> studentIds = Arrays.stream(groupDto.getUserIds().split(",")).map(id -> Integer.valueOf(id)).distinct().collect(Collectors.toList());
|
|
|
- List<Long> oldCourseIdList = Arrays.stream(groupDto.getCourseIds().split(",")).map(id -> Long.parseLong(id)).collect(Collectors.toList());
|
|
|
+ List<Integer> studentIds = Arrays.stream(groupDto.getUserIds().split(",")).map(Integer::valueOf).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> oldCourseIdList = Arrays.stream(groupDto.getCourseIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
|
|
//获取可转换课程时长,学员数量,课程数量
|
|
|
CourseConvertSumDto courseConvertSumDto = courseScheduleConvertDao.sumCourseConvert(oldCourseIdList);
|
|
@@ -5834,7 +5834,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
//校验老师是否冲突
|
|
|
courseTimeDtoList.forEach(e->classGroupTeacherMapperService.checkTeachingBishop(e.getClassGroupTeacherMapperList()));
|
|
|
- LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+// LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
//获取排课总时长
|
|
|
int totalCourseTimes = 0;
|
|
|
long totalCourseDuration = 0;
|
|
@@ -5869,7 +5869,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
while (true) {
|
|
|
// int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
for (CourseTimeDto courseTimeDto : courseTimeDtoList) {
|
|
|
+ if(courseTimeDto.getCalendar() == null){
|
|
|
+ //排课开始时间
|
|
|
+ courseTimeDto.setCalendar(courseTimeDto.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
|
|
+ }
|
|
|
List<ClassGroupTeacherMapper> newClassGroupTeacherMapperList = courseTimeDto.getClassGroupTeacherMapperList();
|
|
|
+
|
|
|
+ Set<Integer> noRepeatTeacherIds = newClassGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
|
|
|
+ if (noRepeatTeacherIds.size() != newClassGroupTeacherMapperList.size()) {
|
|
|
+ throw new BizException("主教与助教存在冲突");
|
|
|
+ }
|
|
|
+
|
|
|
Integer teacherId = newClassGroupTeacherMapperList.stream().filter(ct -> TeachTypeEnum.BISHOP.equals(ct.getTeacherRole())).findAny().get().getUserId();
|
|
|
if (Objects.isNull(teacherId)) {
|
|
|
throw new BizException("请设置主教");
|
|
@@ -5882,13 +5892,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
//跳过节假日
|
|
|
- if (courseTimeDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
|
|
|
+ if (courseTimeDto.getHoliday() && holidayDays.contains(courseTimeDto.getCalendar().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
|
|
|
+ courseTimeDto.setCalendar(courseTimeDto.getCalendar().plusDays(courseTimeDto.getIntervalDays()));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// if (!courseTimeDto.getDayOfWeek().equals(dayOfWeek)) continue;
|
|
|
|
|
|
- Date classDate = DateConvertor.toDate(now);
|
|
|
+ Date classDate = DateConvertor.toDate(courseTimeDto.getCalendar());
|
|
|
|
|
|
if (courseTimeDto.getStartDate().compareTo(classDate) > 0
|
|
|
|| courseTimeDto.getEndDate().compareTo(classDate) < 0
|
|
@@ -5899,6 +5910,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (totalCourseTimes <= generateCourseTimes) {
|
|
|
break WhileNode;
|
|
|
}
|
|
|
+ courseTimeDto.setCalendar(courseTimeDto.getCalendar().plusDays(courseTimeDto.getIntervalDays()));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -5944,8 +5956,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
courseScheduleList.add(courseSchedule);
|
|
|
courseScheduleTeacherSalaryService.initMusicGroupCourseTeacherSalary(newClassGroupTeacherMapperList,courseSchedule,
|
|
|
musicGroup,courseScheduleTeacherSalaryList);
|
|
|
+
|
|
|
+ courseTimeDto.setCalendar(courseTimeDto.getCalendar().plusDays(courseTimeDto.getIntervalDays()));
|
|
|
}
|
|
|
- now = now.plusDays(1);
|
|
|
}
|
|
|
this.checkNewCourseSchedules(courseScheduleList, false, false);
|
|
|
if(!groupDto.getConfirmGenerate()){
|