|
@@ -29,6 +29,7 @@ import java.util.TreeSet;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -73,25 +74,6 @@ import com.ym.mec.biz.dal.dao.TeacherDefaultMusicGroupSalaryDao;
|
|
|
import com.ym.mec.biz.dal.dao.TeacherDefaultPracticeGroupSalaryDao;
|
|
|
import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
|
|
|
import com.ym.mec.biz.dal.dao.VipGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dto.BatchInsertCoursesDto;
|
|
|
-import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseAttendanceDetailHeadInfoDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CoursePostponeDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseScheduleDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseScheduleEndDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseScheduleRateDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseScheduleStudentDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseTimeDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CreateCourseScheduleDto;
|
|
|
-import com.ym.mec.biz.dal.dto.IntegerAndIntegerListDto;
|
|
|
-import com.ym.mec.biz.dal.dto.Mapper;
|
|
|
-import com.ym.mec.biz.dal.dto.StudentNameAndPhoneDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherRemarkCommitDto;
|
|
|
-import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
|
|
|
-import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
|
|
|
-import com.ym.mec.biz.dal.dto.VipGroupCourseAdjustInfoDto;
|
|
|
import com.ym.mec.biz.dal.entity.ClassGroup;
|
|
|
import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
|
|
|
import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
|
|
@@ -1826,9 +1808,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
//所有课程编号
|
|
|
- List<Long> allCourseScheduleIds = allCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
+ Set<Long> allCourseScheduleIds = allCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toSet());
|
|
|
//所有课程学员签到记录
|
|
|
- List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseIds(allCourseScheduleIds);
|
|
|
+ List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseIds(new ArrayList<>(allCourseScheduleIds));
|
|
|
//课程请假学员字典
|
|
|
Map<Long, Set<Integer>> courseLeaveStudentMap = studentAttendances.stream()
|
|
|
.filter(e -> StudentAttendanceStatusEnum.LEAVE.equals(e.getStatus()))
|
|
@@ -1897,24 +1879,27 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
// }
|
|
|
|
|
|
//助教冲突检测
|
|
|
- if (Objects.isNull(preCourseSchedule.getId())) {
|
|
|
- IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId());
|
|
|
- if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
- preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
- }
|
|
|
- } else if (existCourseScheduleIdsSet.contains(preCourseSchedule.getId())) {
|
|
|
- IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId());
|
|
|
+ if (allCourseScheduleIds.contains(preCourseSchedule.getId())) {
|
|
|
+ IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId());
|
|
|
+ if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
+ preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(preCourseSchedule.getTeachingTeacherIdList())) {
|
|
|
+ IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId().longValue());
|
|
|
if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
}
|
|
|
}
|
|
|
- if (Objects.isNull(backCourseSchedule.getId())) {
|
|
|
- IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId());
|
|
|
- if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
- backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
- }
|
|
|
- } else if (existCourseScheduleIdsSet.contains(backCourseSchedule.getId())) {
|
|
|
- IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
|
|
|
+
|
|
|
+ if (allCourseScheduleIds.contains(backCourseSchedule.getId())) {
|
|
|
+ IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
|
|
|
+ if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
+ backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(backCourseSchedule.getTeachingTeacherIdList())) {
|
|
|
+ IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId().longValue());
|
|
|
if (Objects.nonNull(integerAndIntegerListDto)) {
|
|
|
backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
|
|
|
}
|
|
@@ -5149,4 +5134,54 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
return courseScheduleRateDtos;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void courseRepeatCheck() {
|
|
|
+ List<CourseRepeatCheckDto> courseRepeatCheckInfos = courseScheduleDao.getCourseRepeatCheckInfos();
|
|
|
+ courseRepeatCheckInfos.sort(Comparator.comparing(CourseRepeatCheckDto::getStartClassTime));
|
|
|
+ Map<Date, List<CourseRepeatCheckDto>> dayCourseMap = courseRepeatCheckInfos.stream().collect(Collectors.groupingBy(CourseRepeatCheckDto::getClassDate));
|
|
|
+ Map<Long, List<Long>> courseRepeatIdMap = new HashMap<>();
|
|
|
+ for (CourseRepeatCheckDto cs1 : courseRepeatCheckInfos) {
|
|
|
+ if(!courseRepeatIdMap.containsKey(cs1.getCourseId())){
|
|
|
+ courseRepeatIdMap.put(cs1.getCourseId(), new ArrayList<>());
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<CourseRepeatCheckDto> dayCourses = dayCourseMap.get(cs1.getClassDate());
|
|
|
+ for (CourseRepeatCheckDto cs2 : dayCourses) {
|
|
|
+ if(cs1.getCourseId().equals(cs2.getCourseId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(cs2.getEndClassTime().compareTo(cs1.getStartClassTime())<=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(cs2.getStartClassTime().compareTo(cs1.getEndClassTime())>=0){
|
|
|
+ if(CollectionUtils.isEmpty(courseRepeatIdMap.get(cs1.getCourseId()))){
|
|
|
+ courseRepeatIdMap.remove(cs1.getCourseId());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(cs1.getStartClassTime().compareTo(cs2.getEndClassTime())>=0||cs1.getEndClassTime().compareTo(cs2.getStartClassTime())<=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ long repeatTeacherNums = cs1.getTeacherIds().stream().filter(teacherId -> cs2.getTeacherIds().contains(teacherId)).count();
|
|
|
+ if(repeatTeacherNums>0){
|
|
|
+ System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
|
|
|
+ courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+// long repeatStudentNums = cs1.getStudentIds().stream().filter(studentId -> cs2.getStudentIds().contains(studentId)).count();
|
|
|
+// if(repeatStudentNums>0){
|
|
|
+// System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
|
|
|
+// courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isEmpty(courseRepeatIdMap.get(cs1.getCourseId()))){
|
|
|
+ courseRepeatIdMap.remove(cs1.getCourseId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("重复课程:" + JSON.toJSONString(courseRepeatIdMap));
|
|
|
+ System.out.println("重复课程数量:" + courseRepeatIdMap.size());
|
|
|
+ }
|
|
|
}
|