|
@@ -2,6 +2,9 @@ package com.xjrsoft.module.schedule.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
+import com.xjrsoft.common.enums.CourseAdjustTypeEnum;
|
|
|
+import com.xjrsoft.common.enums.EnabledMark;
|
|
|
+import com.xjrsoft.module.courseTable.entity.CourseTable;
|
|
|
import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
import com.xjrsoft.module.schedule.dto.WfCourseAdjustDto;
|
|
|
import com.xjrsoft.module.schedule.entity.CourseTableBak;
|
|
@@ -13,7 +16,11 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Author dzx
|
|
@@ -36,6 +43,42 @@ public class WfCourseAdjustServiceImpl extends MPJBaseServiceImpl<WfCourseAdjust
|
|
|
new QueryWrapper<CourseTableBak>().lambda()
|
|
|
.eq(CourseTableBak::getWfCourseAdjustId, dto.getId())
|
|
|
);
|
|
|
- return null;
|
|
|
+ Map<Long, CourseTableBak> bakMap = new HashMap<>();
|
|
|
+ for (CourseTableBak courseTableBak : bakList) {
|
|
|
+ bakMap.put(courseTableBak.getId(), courseTableBak);
|
|
|
+ }
|
|
|
+ List<Long> courseIds = bakList.stream().map(CourseTableBak::getId).collect(Collectors.toList());
|
|
|
+ List<CourseTable> list = courseTableService.listByIds(courseIds);
|
|
|
+ if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseAdjust.getAdjustType())){//顶课
|
|
|
+ for (CourseTable courseTable : list) {
|
|
|
+ CourseTableBak tableBak = bakMap.get(courseTable.getId());
|
|
|
+ if(tableBak == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ courseTable.setTeacherId(tableBak.getTeacherId());
|
|
|
+ courseTable.setTeacherName(tableBak.getTeacherName());
|
|
|
+ courseTableService.updateById(courseTable);
|
|
|
+ }
|
|
|
+ }else if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
+ for (CourseTable courseTable : list) {
|
|
|
+ CourseTableBak tableBak = bakMap.get(courseTable.getId());
|
|
|
+ if(tableBak == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ courseTable.setTeacherId(tableBak.getTeacherId());
|
|
|
+ courseTable.setTeacherName(tableBak.getTeacherName());
|
|
|
+ courseTable.setScheduleDate(tableBak.getScheduleDate());
|
|
|
+ courseTable.setTimePeriod(tableBak.getTimePeriod());
|
|
|
+ courseTable.setTimeNumber(tableBak.getTimeNumber());
|
|
|
+ courseTable.setWeek(tableBak.getWeek());
|
|
|
+ courseTable.setWeeks(tableBak.getWeeks());
|
|
|
+ courseTable.setWeeksCn(tableBak.getWeeksCn());
|
|
|
+ courseTableService.updateById(courseTable);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ courseAdjust.setEnabledMark(EnabledMark.DISABLED.getCode());
|
|
|
+ courseAdjust.setModifyDate(new Date());
|
|
|
+ this.updateById(courseAdjust);
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|