|
@@ -22,11 +22,13 @@ import com.ym.mec.jiari.JiaRiFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
@@ -358,20 +360,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if(CollectionUtils.isEmpty(courseSchedules)){
|
|
|
return;
|
|
|
}
|
|
|
- //第一节课
|
|
|
- CourseSchedule firstCourseSchedule;
|
|
|
- //最后一节课
|
|
|
- CourseSchedule latestCourseSchedule;
|
|
|
- if(courseSchedules.size()==1){
|
|
|
- firstCourseSchedule = courseSchedules.get(0);
|
|
|
- latestCourseSchedule = courseSchedules.get(0);
|
|
|
- }else{
|
|
|
- firstCourseSchedule = courseSchedules.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
|
|
|
- latestCourseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
|
|
|
- }
|
|
|
- //获取第一节课和最后一节课所包含的时间段内已存在的课程
|
|
|
- List<CourseSchedule> existCourseSchedules = courseScheduleDao
|
|
|
- .findAllCourseByDateZone(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
+ List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates);
|
|
|
|
|
|
//只需要调整课程信息的课程编号列表
|
|
|
List<Long> updateCourseScheduleIds = courseSchedules
|
|
@@ -842,6 +834,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void vipCourseAdjust(VipGroupCourseAdjustInfoDto vipGroupCourseAdjustInfo) {
|
|
|
if(Objects.isNull(vipGroupCourseAdjustInfo.getVipGroupId())){
|
|
|
throw new BizException("请指定小课");
|