|
@@ -4194,11 +4194,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
throw new BizException("课程有效时间不能早于开始时间");
|
|
|
}
|
|
|
|
|
|
- LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
- LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
|
|
|
- Date courseExpiredDateTemp=Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
|
|
|
- if(coursesExpireDate.before(courseExpiredDateTemp)){
|
|
|
- throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
|
|
|
+ if(Objects.nonNull(practiceGroup.getBuyMonths())){
|
|
|
+ LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
+ LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
|
|
|
+ Date courseExpiredDateTemp=Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
|
|
|
+ if(coursesExpireDate.before(courseExpiredDateTemp)){
|
|
|
+ throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
practiceGroup.setCoursesExpireDate(DateUtil.addSeconds(DateUtil.addDays(coursesExpireDate, 1),-1));
|