|
@@ -25,6 +25,7 @@ import com.fs.course.domain.*;
|
|
|
import com.fs.course.mapper.*;
|
|
|
import com.fs.course.param.*;
|
|
|
import com.fs.course.param.newfs.FsUserCourseListParam;
|
|
|
+import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.vo.*;
|
|
|
import com.fs.course.vo.newfs.FsUserCourseListVO;
|
|
|
import com.fs.his.config.IntegralConfig;
|
|
@@ -102,6 +103,12 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
@Autowired
|
|
|
private QwApiService qwApiService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFsUserCourseService fsUserCourseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsUserCourseVideoService fsUserCourseVideoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
private static final String realLink = "/courseH5/pages/course/learning?course=";
|
|
@@ -609,6 +616,33 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
return convertToBase64(combined, outputFormat);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class) // 显式声明事务
|
|
|
+ public int copyFsUserCourse(Long courseId) {
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(courseId);
|
|
|
+ if(fsUserCourse != null){
|
|
|
+ fsUserCourse.setCourseId(null);
|
|
|
+ fsUserCourseService.insertFsUserCourse(fsUserCourse);
|
|
|
+ Long newCourseId = fsUserCourse.getCourseId();
|
|
|
+
|
|
|
+ if (newCourseId == null) {
|
|
|
+ throw new RuntimeException("课程插入失败,无法获取新课程ID");
|
|
|
+ }
|
|
|
+
|
|
|
+ FsUserCourseVideo fsUserCourseVideo = new FsUserCourseVideo();
|
|
|
+ fsUserCourseVideo.setCourseId(courseId);
|
|
|
+ List<FsUserCourseVideo> list = fsUserCourseVideoService.selectFsUserCourseVideoListByCourseId(fsUserCourseVideo);
|
|
|
+ for (FsUserCourseVideo courseVideo : list) {
|
|
|
+ courseVideo.setVideoId(null);
|
|
|
+ courseVideo.setCourseId(newCourseId);
|
|
|
+ fsUserCourseVideoService.insertFsUserCourseVideo(courseVideo);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private Graphics2D initializeGraphics(BufferedImage combined) {
|
|
|
Graphics2D graphics = combined.createGraphics();
|