|
@@ -14,6 +14,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.google.gson.JsonArray;
|
|
import com.google.gson.JsonArray;
|
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonObject;
|
|
|
import com.google.gson.JsonParser;
|
|
import com.google.gson.JsonParser;
|
|
|
|
|
+import com.xjrsoft.common.enums.CourseAdjustTypeEnum;
|
|
|
import com.xjrsoft.common.enums.TimeNumberEnum;
|
|
import com.xjrsoft.common.enums.TimeNumberEnum;
|
|
|
import com.xjrsoft.common.enums.TimePeriodEnum;
|
|
import com.xjrsoft.common.enums.TimePeriodEnum;
|
|
|
import com.xjrsoft.common.enums.WeekEnum;
|
|
import com.xjrsoft.common.enums.WeekEnum;
|
|
@@ -34,6 +35,9 @@ import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
import com.xjrsoft.module.courseTable.vo.ClassListVo;
|
|
import com.xjrsoft.module.courseTable.vo.ClassListVo;
|
|
|
import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
|
|
import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
|
|
|
import com.xjrsoft.module.schedule.dto.CourseTableDto;
|
|
import com.xjrsoft.module.schedule.dto.CourseTableDto;
|
|
|
|
|
+import com.xjrsoft.module.schedule.entity.CourseTableBak;
|
|
|
|
|
+import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
|
|
|
|
|
+import com.xjrsoft.module.schedule.mapper.CourseTableBakMapper;
|
|
|
import com.xjrsoft.module.schedule.util.ScheduleUtil;
|
|
import com.xjrsoft.module.schedule.util.ScheduleUtil;
|
|
|
import com.xjrsoft.module.schedule.vo.CourseDetailVo;
|
|
import com.xjrsoft.module.schedule.vo.CourseDetailVo;
|
|
|
import com.xjrsoft.module.schedule.vo.CourseListVo;
|
|
import com.xjrsoft.module.schedule.vo.CourseListVo;
|
|
@@ -89,6 +93,8 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
private final ClassTimeMapper classTimeMapper;
|
|
private final ClassTimeMapper classTimeMapper;
|
|
|
private final BaseSemesterMapper baseSemesterMapper;
|
|
private final BaseSemesterMapper baseSemesterMapper;
|
|
|
|
|
|
|
|
|
|
+ private final CourseTableBakMapper courseTableBakMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean wordImport(InputStream inputStream) throws IOException {
|
|
public Boolean wordImport(InputStream inputStream) throws IOException {
|
|
@@ -245,9 +251,9 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String getPreCheck(Integer preCheckType, Long courseId, Long swapCourseId, Date swapDate, Long subTeacherId) {
|
|
|
|
|
- if(preCheckType != null){
|
|
|
|
|
- if(preCheckType == 1){
|
|
|
|
|
|
|
+ public String getPreCheck(String preCheckType, Long courseId, Long swapCourseId, Date swapDate, Long subTeacherId) {
|
|
|
|
|
+ if(preCheckType != null && !"".equals(preCheckType)){
|
|
|
|
|
+ if(CourseAdjustTypeEnum.courseExchange.getCode().equals(preCheckType)){
|
|
|
CourseTable courseTable = courseTableMapper.selectById(courseId);
|
|
CourseTable courseTable = courseTableMapper.selectById(courseId);
|
|
|
CourseTable swapCourseTable = courseTableMapper.selectById(swapCourseId);
|
|
CourseTable swapCourseTable = courseTableMapper.selectById(swapCourseId);
|
|
|
try {
|
|
try {
|
|
@@ -259,7 +265,7 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- }else if(preCheckType == 2){
|
|
|
|
|
|
|
+ }else if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(preCheckType)){
|
|
|
CourseTable courseTable = courseTableMapper.selectById(courseId);
|
|
CourseTable courseTable = courseTableMapper.selectById(courseId);
|
|
|
try {
|
|
try {
|
|
|
JsonObject jsonObject = substitutePreTestin(subTeacherId, courseTable);
|
|
JsonObject jsonObject = substitutePreTestin(subTeacherId, courseTable);
|
|
@@ -274,6 +280,57 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean adjustCourse(WfCourseAdjust courseAdjust) {
|
|
|
|
|
+ if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
|
|
+ CourseTable courseTable = courseTableMapper.selectById(courseAdjust.getCourseId());
|
|
|
|
|
+ CourseTable swapCourseTable = courseTableMapper.selectById(courseAdjust.getExchangeCourseId());
|
|
|
|
|
+
|
|
|
|
|
+ }else if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
|
|
+ CourseTable courseTable = courseTableMapper.selectById(courseAdjust.getCourseId());
|
|
|
|
|
+ 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.setCourseTableId(courseTable.getId());
|
|
|
|
|
+ courseTableBak.setId(null);
|
|
|
|
|
+ courseTableBak.setWfCourseAdjustId(courseAdjust.getId());
|
|
|
|
|
+ courseTableBak.setWeek(adjust_week);
|
|
|
|
|
+ courseTableBakMapper.insert(courseTableBak);
|
|
|
|
|
+ //先判断是否本周
|
|
|
|
|
+ if(current_week == adjust_week){//是本周,修改后提交代码
|
|
|
|
|
+ courseTable.setTeacherId(courseAdjust.getExchangeTeacherId());
|
|
|
|
|
+ courseTableMapper.updateById(courseTable);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+ void sendSubsitute(){
|
|
|
|
|
+ String url = ScheduleUtil.apiUrl + "RescheduleApply/Extend/Substitute/Submit";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 顶课预检查
|
|
* 顶课预检查
|
|
|
* @param courseTable
|
|
* @param courseTable
|