Browse Source

feat:合课

Joburgess 4 năm trước cách đây
mục cha
commit
05683e6b3f

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -37,6 +37,7 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.event.source.CourseEventSource;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.tomcat.jni.Local;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -5247,9 +5248,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		System.out.println("重复课程数量:" + courseRepeatIdMap.size());
 	}
 
+	public static void main(String[] args) {
+		System.out.println(Date.from(LocalDate.now().plusDays(3).atStartOfDay(DateUtil.zoneId).toInstant()));
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void courseMerge(CourseMergeDto courseMergeInfo) {
+		Date now = new Date();
+		Date thirdDay = Date.from(LocalDate.now().plusDays(3).atStartOfDay(DateUtil.zoneId).toInstant());
+
 		if(CollectionUtils.isEmpty(courseMergeInfo.getMergeCourseIds())){
 			throw new BizException("请选择需要合并的课程");
 		}
@@ -5265,7 +5273,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(courseTypeNum>1){
 			throw new BizException("课程合并仅支持同课程类型");
 		}
-		Date now = new Date();
 		for (CourseSchedule courseSchedule : allCourses) {
 			if(Objects.nonNull(courseSchedule.getNewCourseId())){
 				throw new BizException("存在已合并课程");
@@ -5273,6 +5280,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if(courseSchedule.getStartClassTime().compareTo(now)<=0){
 				throw new BizException("课程合并仅支持未开始的课程");
 			}
+			if(courseSchedule.getEndClassTime().compareTo(thirdDay)>0){
+				throw new BizException("仅支持合并三天以内的课程");
+			}
 			if(VIP.equals(courseSchedule.getGroupType())||PRACTICE.equals(courseSchedule.getGroupType())){
 				throw new BizException("VIP课、网管课暂不支持课程合并");
 			}