|
@@ -26,6 +26,7 @@ import com.fs.course.domain.*;
|
|
|
import com.fs.course.mapper.*;
|
|
import com.fs.course.mapper.*;
|
|
|
import com.fs.course.param.*;
|
|
import com.fs.course.param.*;
|
|
|
import com.fs.course.param.newfs.FsUserCourseListParam;
|
|
import com.fs.course.param.newfs.FsUserCourseListParam;
|
|
|
|
|
+import com.fs.course.service.IFsUserCoursePeriodDaysService;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.vo.*;
|
|
import com.fs.course.vo.*;
|
|
|
import com.fs.course.vo.newfs.FsUserCourseListVO;
|
|
import com.fs.course.vo.newfs.FsUserCourseListVO;
|
|
@@ -128,6 +129,9 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsUserIntegralLogsService userIntegralLogsService;
|
|
private IFsUserIntegralLogsService userIntegralLogsService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsUserCoursePeriodDaysService fsUserCoursePeriodDaysService;
|
|
|
|
|
+
|
|
|
private static final String realLink = "/courseH5/pages/course/learning?course=";
|
|
private static final String realLink = "/courseH5/pages/course/learning?course=";
|
|
|
public static final String shortLink = "/courseH5/pages/course/learning?s=";
|
|
public static final String shortLink = "/courseH5/pages/course/learning?s=";
|
|
|
|
|
|
|
@@ -690,24 +694,41 @@ public class FsUserCourseServiceImpl implements IFsUserCourseService
|
|
|
@Transactional(rollbackFor = Exception.class) // 显式声明事务
|
|
@Transactional(rollbackFor = Exception.class) // 显式声明事务
|
|
|
public int copyFsUserCourse(Long courseId) {
|
|
public int copyFsUserCourse(Long courseId) {
|
|
|
FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(courseId);
|
|
FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(courseId);
|
|
|
- if(fsUserCourse != null){
|
|
|
|
|
- fsUserCourse.setCourseId(null);
|
|
|
|
|
- fsUserCourseService.insertFsUserCourse(fsUserCourse);
|
|
|
|
|
- Long newCourseId = fsUserCourse.getCourseId();
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ if(fsUserCourse != null){
|
|
|
|
|
+ fsUserCourse.setCourseId(null);
|
|
|
|
|
+ fsUserCourseService.insertFsUserCourse(fsUserCourse);
|
|
|
|
|
+ Long newCourseId = fsUserCourse.getCourseId();
|
|
|
|
|
|
|
|
- if (newCourseId == null) {
|
|
|
|
|
- throw new RuntimeException("课程插入失败,无法获取新课程ID");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (newCourseId == null) {
|
|
|
|
|
+ throw new RuntimeException("课程插入失败,无法获取新课程ID");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCourseVideo fsUserCourseVideo = new FsUserCourseVideo();
|
|
|
|
|
+ fsUserCourseVideo.setCourseId(courseId);
|
|
|
|
|
+ List<FsUserCourseVideo> list = fsUserCourseVideoService.selectFsUserCourseVideoListByCourseId(fsUserCourseVideo);
|
|
|
|
|
+ if(list != null && !list.isEmpty()){
|
|
|
|
|
+ for (FsUserCourseVideo courseVideo : list) {
|
|
|
|
|
+ courseVideo.setVideoId(null);
|
|
|
|
|
+ courseVideo.setCourseId(newCourseId);
|
|
|
|
|
+ fsUserCourseVideoService.insertFsUserCourseVideo(courseVideo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //增加手动发课部分的复制
|
|
|
|
|
+ List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysService.selectFsUserCoursePeriodDaysByCourseId(courseId);
|
|
|
|
|
+ if(fsUserCoursePeriodDays != null && !fsUserCoursePeriodDays.isEmpty()){
|
|
|
|
|
+ for (FsUserCoursePeriodDays periodDays : fsUserCoursePeriodDays) {
|
|
|
|
|
+ periodDays.setId(null);
|
|
|
|
|
+ periodDays.setCourseId(newCourseId);
|
|
|
|
|
+ fsUserCoursePeriodDaysService.insertFsUserCoursePeriodDays(periodDays);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- 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 1;
|
|
|
|
|
|
|
+ } catch (RuntimeException e) {
|
|
|
|
|
+ throw new RuntimeException("复制失败,请联系开发人员");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|