|
|
@@ -285,6 +285,44 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
CourseTable courseTable = courseTableMapper.selectById(courseAdjust.getCourseId());
|
|
|
CourseTable swapCourseTable = courseTableMapper.selectById(courseAdjust.getExchangeCourseId());
|
|
|
+ LocalDateTime adjustDate = courseAdjust.getAdjustDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ //获取当前学期的时间段
|
|
|
+ Integer current_week = null, adjust_week = null;
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ BaseSemester baseSemester = baseSemesterMapper.selectById(courseTable.getBaseSemesterId());
|
|
|
+ LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ Duration between = Duration.between(startDateTime, endDateTime);
|
|
|
+ long days = between.toDays();
|
|
|
+ int weeks = (int) Math.ceil((double) days / 7);
|
|
|
+ for (int i = 0; i < weeks; i ++){
|
|
|
+ LocalDateTime startDate = startDateTime.plusDays(i * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ LocalDateTime endDate = startDateTime.plusDays((i + 1) * 7).withHour(23).withMinute(59).withSecond(59).withNano(9999);
|
|
|
+ if(now.isAfter(startDate) && now.isBefore(endDate)){
|
|
|
+ current_week = i + 1;
|
|
|
+ }
|
|
|
+ if(adjustDate.isAfter(startDate) && adjustDate.isBefore(endDate)){
|
|
|
+ adjust_week = i + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //先备份数据
|
|
|
+ CourseTableBak courseTableBak = BeanUtil.toBean(courseTable, CourseTableBak.class);
|
|
|
+ courseTableBak.setWfCourseAdjustId(courseAdjust.getId());
|
|
|
+ courseTableBak.setCourseTableId(courseTable.getCourseId());
|
|
|
+ courseTableBak.setId(null);
|
|
|
+ courseTableBakMapper.insert(courseTableBak);
|
|
|
+
|
|
|
+ CourseTableBak swapCourseTableBak = BeanUtil.toBean(swapCourseTable, CourseTableBak.class);
|
|
|
+ swapCourseTableBak.setWfCourseAdjustId(courseAdjust.getId());
|
|
|
+ swapCourseTableBak.setCourseTableId(swapCourseTable.getCourseId());
|
|
|
+ swapCourseTableBak.setId(null);
|
|
|
+ courseTableBakMapper.insert(swapCourseTableBak);
|
|
|
+ //先判断是否本周
|
|
|
+ if(current_week == adjust_week){//是本周,修改后提交代码
|
|
|
+ courseTable.setTeacherId(courseAdjust.getExchangeTeacherId());
|
|
|
+ courseTableMapper.updateById(courseTable);
|
|
|
+ }
|
|
|
|
|
|
}else if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
CourseTable courseTable = courseTableMapper.selectById(courseAdjust.getCourseId());
|
|
|
@@ -321,15 +359,9 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
courseTableMapper.updateById(courseTable);
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
- void sendSubsitute(){
|
|
|
- String url = ScheduleUtil.apiUrl + "RescheduleApply/Extend/Substitute/Submit";
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 顶课预检查
|