|
@@ -488,6 +488,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
//每日日期数据
|
|
|
List<CourseCalendarEntity> list = new ArrayList<>();
|
|
|
|
|
|
+ //查询系统配置开课/结束时间
|
|
|
+ String star = sysConfigService.findConfigValue(SysConfigConstant.COURSE_START_SETTING);//系统开课时间
|
|
|
+ String end = sysConfigService.findConfigValue(SysConfigConstant.COURSE_END_SETTING);//系统关课时间
|
|
|
+
|
|
|
//获取每日日期数据
|
|
|
while (firstDay.isBefore(lastDay) || firstDay.isEqual(lastDay)) {
|
|
|
CourseCalendarEntity entity = new CourseCalendarEntity();
|
|
@@ -499,6 +503,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
if (Objects.nonNull(jsonArray)) {
|
|
|
List<CourseTimeEntity> timeEntities = jsonArray.stream()
|
|
|
.map(t -> getCourseTimeEntity(entity, (JSONObject) t))
|
|
|
+ .filter(f -> checkTime(f, star, end))
|
|
|
.collect(Collectors.toList());
|
|
|
entity.setCourseTime(timeEntities);
|
|
|
}
|
|
@@ -517,6 +522,18 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
return timeEntity;
|
|
|
}
|
|
|
|
|
|
+ private boolean checkTime(CourseTimeEntity entity, String star, String end) {
|
|
|
+ Date startTime = entity.getStartTime();
|
|
|
+ Date endTime = entity.getEndTime();
|
|
|
+ String classDate = DateUtil.dateToString(entity.getStartTime());
|
|
|
+ Date s = DateUtil.strToDate(classDate + " " + star + ":00");
|
|
|
+ Date e = DateUtil.strToDate(classDate + " " + end + ":00");
|
|
|
+ if (startTime.before(s) || endTime.after(e)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将每日上课时间时间添加到日历中
|
|
|
*
|
|
@@ -1116,7 +1133,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Date endTime = adjustVo.getEndTime();
|
|
|
Date now = new Date();
|
|
|
|
|
|
- if(endTime==null){
|
|
|
+ if (endTime == null) {
|
|
|
CourseSchedule courseSchedule = baseMapper.selectById(courseId);
|
|
|
Integer minutes = Math.toIntExact(ChronoUnit.MINUTES.between(Instant.ofEpochMilli(courseSchedule.getStartTime().getTime()), Instant.ofEpochMilli(courseSchedule.getEndTime().getTime())));
|
|
|
endTime = DateUtil.offsetMinute(startTime, minutes);
|
|
@@ -1978,7 +1995,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Date s = DateUtil.strToDate(classDate + " " + star + ":00");
|
|
|
Date e = DateUtil.strToDate(classDate + " " + end + ":00");
|
|
|
if (startTime.before(s) || endTime.after(e)) {
|
|
|
- throw new BizException("排课时间区间为{}~{}",star,end);
|
|
|
+ throw new BizException("排课时间区间为{}~{}", star, end);
|
|
|
}
|
|
|
|
|
|
if (startTime.before(new Date())) {
|