|
|
@@ -16,6 +16,7 @@ import com.fs.config.cloud.CloudHostProper;
|
|
|
import com.fs.course.business.FsVideoResourceBusinessService;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsVideoResource;
|
|
|
+import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.course.service.IFsUserVideoService;
|
|
|
import com.fs.course.service.IFsVideoResourceService;
|
|
|
import com.fs.course.vo.FsVideoResourceVO;
|
|
|
@@ -23,6 +24,7 @@ import com.fs.framework.web.service.TokenService;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -34,6 +36,7 @@ import java.util.stream.Collectors;
|
|
|
/**
|
|
|
* 资源库管理
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/course/videoResource")
|
|
|
@AllArgsConstructor
|
|
|
@@ -50,6 +53,8 @@ public class FsVideoResourceController extends BaseController {
|
|
|
private final FsVideoResourceBusinessService videoResourceBusinessService;
|
|
|
@Autowired
|
|
|
private IFsUserVideoService fsUserVideoService;
|
|
|
+ @Autowired
|
|
|
+ private IFsUserCourseVideoService fsUserCourseVideoService;
|
|
|
|
|
|
/**
|
|
|
* 查询视频素材库列表
|
|
|
@@ -102,8 +107,17 @@ public class FsVideoResourceController extends BaseController {
|
|
|
if (ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
fsVideoResource.setUserId(userId);
|
|
|
}
|
|
|
+
|
|
|
fsVideoResource.setCreateTime(LocalDateTime.now());
|
|
|
- fsVideoResourceService.save(fsVideoResource);
|
|
|
+ boolean save = fsVideoResourceService.save(fsVideoResource);
|
|
|
+ if (save&&StringUtils.isNotEmpty(fsVideoResource.getHsyVid())){
|
|
|
+ try {
|
|
|
+ fsUserCourseVideoService.updateMediaPublishStatus(fsVideoResource.getHsyVid());
|
|
|
+ log.info("更新视频发布状态成功,hsyVid: {}", fsVideoResource.getHsyVid());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新视频发布状态失败,hsyVid: {}, 错误: {}", fsVideoResource.getHsyVid(), e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@@ -193,7 +207,20 @@ public class FsVideoResourceController extends BaseController {
|
|
|
v.setUserId(userId);
|
|
|
}
|
|
|
});
|
|
|
- fsVideoResourceService.saveBatch(list);
|
|
|
+ boolean saveStatus = fsVideoResourceService.saveBatch(list);
|
|
|
+ if (saveStatus) {
|
|
|
+ list.forEach(fsVideoResource -> {
|
|
|
+ // 检查hsyVid是否存在且不为空
|
|
|
+ if (ObjectUtil.isNotEmpty(fsVideoResource.getHsyVid())) {
|
|
|
+ try {
|
|
|
+ fsUserCourseVideoService.updateMediaPublishStatus(fsVideoResource.getHsyVid());
|
|
|
+ log.info("更新视频发布状态成功,hsyVid: {}", fsVideoResource.getHsyVid());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新视频发布状态失败,hsyVid: {}, 错误: {}", fsVideoResource.getHsyVid(), e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
}
|