|
@@ -1,5 +1,6 @@
|
|
|
package com.fs.course.business;
|
|
package com.fs.course.business;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.fs.course.domain.FsUserCourseVideo;
|
|
import com.fs.course.domain.FsUserCourseVideo;
|
|
|
import com.fs.course.domain.FsVideoResource;
|
|
import com.fs.course.domain.FsVideoResource;
|
|
@@ -8,6 +9,8 @@ import com.fs.course.service.IFsVideoResourceService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
@Service
|
|
@Service
|
|
|
public class FsVideoResourceBusinessService {
|
|
public class FsVideoResourceBusinessService {
|
|
|
|
|
|
|
@@ -24,6 +27,9 @@ public class FsVideoResourceBusinessService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void edit(FsVideoResource fsVideoResource) {
|
|
public void edit(FsVideoResource fsVideoResource) {
|
|
|
FsVideoResource oldResource = fsVideoResourceService.getById(fsVideoResource.getId());
|
|
FsVideoResource oldResource = fsVideoResourceService.getById(fsVideoResource.getId());
|
|
|
|
|
+ List<FsUserCourseVideo> courseVideos = fsUserCourseVideoService.list(new LambdaQueryWrapper<FsUserCourseVideo>()
|
|
|
|
|
+ .eq(FsUserCourseVideo::getVideoUrl, oldResource.getVideoUrl())
|
|
|
|
|
+ .eq(FsUserCourseVideo::getIsDel, 0));
|
|
|
fsVideoResourceService.updateById(fsVideoResource);
|
|
fsVideoResourceService.updateById(fsVideoResource);
|
|
|
fsUserCourseVideoService.update(new UpdateWrapper<FsUserCourseVideo>()
|
|
fsUserCourseVideoService.update(new UpdateWrapper<FsUserCourseVideo>()
|
|
|
.eq("video_url", oldResource.getVideoUrl())
|
|
.eq("video_url", oldResource.getVideoUrl())
|
|
@@ -37,5 +43,11 @@ public class FsVideoResourceBusinessService {
|
|
|
.set("file_name", fsVideoResource.getFileName())
|
|
.set("file_name", fsVideoResource.getFileName())
|
|
|
.set("thumbnail", fsVideoResource.getThumbnail())
|
|
.set("thumbnail", fsVideoResource.getThumbnail())
|
|
|
);
|
|
);
|
|
|
|
|
+ if (fsVideoResource.getDuration() != null) {
|
|
|
|
|
+ Long duration = fsVideoResource.getDuration().longValue();
|
|
|
|
|
+ for (FsUserCourseVideo courseVideo : courseVideos) {
|
|
|
|
|
+ fsUserCourseVideoService.syncVideoDurationCache(courseVideo.getVideoId(), duration);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|