cy 3 vuotta sitten
vanhempi
commit
070d9ea56c

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -45,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.temporal.TemporalAdjusters;
 import java.time.temporal.TemporalAdjusters;
@@ -1621,6 +1622,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
 
         //校验上下课时间
         //校验上下课时间
         for (int i = 0; i < timeList.size(); i++) {
         for (int i = 0; i < timeList.size(); i++) {
+            if (timeList.get(i).getStartTime().before(new Date())){
+                throw new BizException("上课时间必须大于当前时间");
+            }
             if (!DateUtil.offsetMinute(timeList.get(i).getStartTime(), singleClssTime).equals(timeList.get(i).getEndTime())) {
             if (!DateUtil.offsetMinute(timeList.get(i).getStartTime(), singleClssTime).equals(timeList.get(i).getEndTime())) {
                 throw new BizException("第{}节课结束时间计算错误", i + 1);
                 throw new BizException("第{}节课结束时间计算错误", i + 1);
             }
             }
@@ -1843,6 +1847,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         courseTime.setEndTime(endTime);
         courseTime.setEndTime(endTime);
         List<CourseTimeEntity> timeList = Arrays.asList(courseTime);
         List<CourseTimeEntity> timeList = Arrays.asList(courseTime);
 
 
+        if (startTime.before(new Date())){
+            throw new BizException("上课时间必须大于当前时间");
+        }
+
         CourseSchedule courseSchedule = baseMapper.selectOne(Wrappers.<CourseSchedule>lambdaQuery()
         CourseSchedule courseSchedule = baseMapper.selectOne(Wrappers.<CourseSchedule>lambdaQuery()
                 .eq(CourseSchedule::getId, courseId)
                 .eq(CourseSchedule::getId, courseId)
                 .eq(CourseSchedule::getTeacherId, teacherId)
                 .eq(CourseSchedule::getTeacherId, teacherId)