|
@@ -358,17 +358,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
if(CollectionUtils.isEmpty(courseSchedules)){
|
|
if(CollectionUtils.isEmpty(courseSchedules)){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
- List<String> classDates = courseSchedules.stream()
|
|
|
|
- .map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
|
|
|
|
|
|
+ List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
-
|
|
|
|
- //获取第一节课和最后一节课所包含的时间段内已存在的课程
|
|
|
|
List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates);
|
|
List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates);
|
|
|
|
|
|
- System.out.println(System.currentTimeMillis());
|
|
|
|
-
|
|
|
|
//只需要调整课程信息的课程编号列表
|
|
//只需要调整课程信息的课程编号列表
|
|
List<Long> updateCourseScheduleIds = courseSchedules
|
|
List<Long> updateCourseScheduleIds = courseSchedules
|
|
.stream()
|
|
.stream()
|
|
@@ -423,31 +417,25 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
Map<Integer, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
Map<Integer, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
- System.out.println(System.currentTimeMillis());
|
|
|
|
-
|
|
|
|
//将课程计划按照开课时间排序
|
|
//将课程计划按照开课时间排序
|
|
allCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
allCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
if(allCourseSchedules.size()>1){
|
|
if(allCourseSchedules.size()>1){
|
|
//记录连续冲突的次数
|
|
//记录连续冲突的次数
|
|
- Integer repeatTimes=1;
|
|
|
|
- for (int i=0;i<allCourseSchedules.size();i++){
|
|
|
|
- if(i==0){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- for(int j=repeatTimes;j>0;j--){
|
|
|
|
|
|
+ Integer repeatTimes=0;
|
|
|
|
+ for (int i=1;i<allCourseSchedules.size();i++){
|
|
|
|
+ for(int j=1;j<=repeatTimes+1&&j<=i;j++){
|
|
//当前课程
|
|
//当前课程
|
|
CourseSchedule preCourseSchedule = allCourseSchedules.get(i-j);
|
|
CourseSchedule preCourseSchedule = allCourseSchedules.get(i-j);
|
|
//后面一节课程
|
|
//后面一节课程
|
|
CourseSchedule backCourseSchedule = allCourseSchedules.get(i);
|
|
CourseSchedule backCourseSchedule = allCourseSchedules.get(i);
|
|
//判断前后两节课是否存在冲突
|
|
//判断前后两节课是否存在冲突
|
|
if(backCourseSchedule.getStartClassTime().before(preCourseSchedule.getEndClassTime())){
|
|
if(backCourseSchedule.getStartClassTime().before(preCourseSchedule.getEndClassTime())){
|
|
- if(repeatTimes==j){
|
|
|
|
- repeatTimes+=1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if(!checkExistCourseSchedule
|
|
if(!checkExistCourseSchedule
|
|
&&existCourseScheduleIds.contains(preCourseSchedule.getId())
|
|
&&existCourseScheduleIds.contains(preCourseSchedule.getId())
|
|
&&existCourseScheduleIds.contains(backCourseSchedule.getId())){
|
|
&&existCourseScheduleIds.contains(backCourseSchedule.getId())){
|
|
|
|
+ if(j==repeatTimes){
|
|
|
|
+ repeatTimes+=1;
|
|
|
|
+ }
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -516,6 +504,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
if(!CollectionUtils.isEmpty(repeatStudentIds)){
|
|
if(!CollectionUtils.isEmpty(repeatStudentIds)){
|
|
throw new BizException(courseCheckInfo(preCourseSchedule,backCourseSchedule,existCourseScheduleIds,3));
|
|
throw new BizException(courseCheckInfo(preCourseSchedule,backCourseSchedule,existCourseScheduleIds,3));
|
|
}
|
|
}
|
|
|
|
+ if(j==repeatTimes){
|
|
|
|
+ repeatTimes+=1;
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
repeatTimes=j;
|
|
repeatTimes=j;
|
|
break;
|
|
break;
|
|
@@ -841,7 +832,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
public void vipCourseAdjust(VipGroupCourseAdjustInfoDto vipGroupCourseAdjustInfo) {
|
|
public void vipCourseAdjust(VipGroupCourseAdjustInfoDto vipGroupCourseAdjustInfo) {
|
|
if(Objects.isNull(vipGroupCourseAdjustInfo.getVipGroupId())){
|
|
if(Objects.isNull(vipGroupCourseAdjustInfo.getVipGroupId())){
|
|
throw new BizException("请指定小课");
|
|
throw new BizException("请指定小课");
|