|
@@ -1,5 +1,6 @@
|
|
|
package com.xjrsoft.module.schedule.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.xjrsoft.common.enums.CourseAdjustTypeEnum;
|
|
@@ -16,6 +17,8 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -81,4 +84,37 @@ public class WfCourseAdjustServiceImpl extends MPJBaseServiceImpl<WfCourseAdjust
|
|
|
this.updateById(courseAdjust);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void backupsData(Long id) {
|
|
|
+ WfCourseAdjust courseAdjust = this.getById(id);
|
|
|
+ List<CourseTableBak> insertList = new ArrayList<>();
|
|
|
+ if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseAdjust.getAdjustType())){//顶课
|
|
|
+ String[] courseIds = courseAdjust.getCourseId().split(",");
|
|
|
+ List<CourseTable> list = courseTableService.listByIds(Arrays.asList(courseIds));
|
|
|
+ for (CourseTable courseTable : list) {
|
|
|
+ CourseTableBak tableBak = BeanUtil.toBean(courseTable, CourseTableBak.class);
|
|
|
+ tableBak.setWfCourseAdjustId(id);
|
|
|
+ insertList.add(tableBak);
|
|
|
+ }
|
|
|
+ }else if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseAdjust.getAdjustType())){
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ String[] courseIds = courseAdjust.getCourseId().split(",");
|
|
|
+ ids.addAll(Arrays.asList(courseIds));
|
|
|
+
|
|
|
+ String[] exchangeCourseIds = courseAdjust.getExchangeCourseId().split(",");
|
|
|
+ ids.addAll(Arrays.asList(exchangeCourseIds));
|
|
|
+
|
|
|
+ List<CourseTable> list = courseTableService.listByIds(ids);
|
|
|
+ for (CourseTable courseTable : list) {
|
|
|
+ CourseTableBak tableBak = BeanUtil.toBean(courseTable, CourseTableBak.class);
|
|
|
+ tableBak.setWfCourseAdjustId(id);
|
|
|
+ insertList.add(tableBak);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!insertList.isEmpty()){
|
|
|
+ courseTableBakService.saveBatch(insertList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|