|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.common.annotation.Log;
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
|
|
+import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
import com.fs.common.utils.ServletUtils;
|
|
@@ -67,30 +68,29 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@RequestParam(required = false) Integer typeSubId,
|
|
@RequestParam(required = false) Integer typeSubId,
|
|
|
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
-// Map<String, Object> params = new HashMap<>();
|
|
|
|
|
-// params.put("resourceName", resourceName);
|
|
|
|
|
-// params.put("fileName", fileName);
|
|
|
|
|
-// params.put("typeId", typeId);
|
|
|
|
|
-// params.put("typeSubId", typeSubId);
|
|
|
|
|
-// LoginUser loginUser = (LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
-// CourseConfig config = null;
|
|
|
|
|
-// if (json != null && !json.isEmpty()) {
|
|
|
|
|
-// try {
|
|
|
|
|
-// config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
|
-// log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// if (config != null && ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
|
|
-// if (loginUser.getCompanyUser() != null) {
|
|
|
|
|
-// params.put("userId", loginUser.getCompanyUser().getUserId());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
-// List<FsVideoResourceVO> list = fsVideoResourceService.selectVideoResourceListByMap(params);
|
|
|
|
|
-// return getDataTable(list);
|
|
|
|
|
- throw new RuntimeException("未实现");
|
|
|
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
|
+ params.put("resourceName", resourceName);
|
|
|
|
|
+ params.put("fileName", fileName);
|
|
|
|
|
+ params.put("typeId", typeId);
|
|
|
|
|
+ params.put("typeSubId", typeSubId);
|
|
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = null;
|
|
|
|
|
+ if (json != null && !json.isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (config != null && ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
|
|
+ if (loginUser.getUser() != null) {
|
|
|
|
|
+ params.put("userId", loginUser.getUser().getUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
+ List<FsVideoResourceVO> list = fsVideoResourceService.selectVideoResourceListByMap(params);
|
|
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -110,34 +110,33 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@Log(title = "视频素材库", businessType = BusinessType.INSERT)
|
|
@Log(title = "视频素材库", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody FsVideoResource fsVideoResource) {
|
|
public AjaxResult add(@RequestBody FsVideoResource fsVideoResource) {
|
|
|
-// LoginUser loginUser = (LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
-// CourseConfig config = null;
|
|
|
|
|
-// if (json != null && !json.isEmpty()) {
|
|
|
|
|
-// try {
|
|
|
|
|
-// config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
|
-// log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// if (config != null && ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
|
|
-// if (loginUser.getCompanyUser() != null) {
|
|
|
|
|
-// fsVideoResource.setUserId(loginUser.getCompanyUser().getUserId());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// fsVideoResource.setCreateTime(LocalDateTime.now());
|
|
|
|
|
-// 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();
|
|
|
|
|
- throw new RuntimeException("未实现");
|
|
|
|
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = null;
|
|
|
|
|
+ if (json != null && !json.isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (config != null && ObjectUtil.isNotEmpty(config.getIsBound()) && config.getIsBound()) {
|
|
|
|
|
+ if (loginUser.getUser() != null) {
|
|
|
|
|
+ fsVideoResource.setUserId(loginUser.getUser().getUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ fsVideoResource.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ 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();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -212,43 +211,42 @@ public class FsVideoResourceController extends BaseController {
|
|
|
@Log(title = "视频素材库", businessType = BusinessType.INSERT)
|
|
@Log(title = "视频素材库", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/batchAddVideoResource")
|
|
@PostMapping("/batchAddVideoResource")
|
|
|
public AjaxResult batchAddVideoResource(@RequestBody List<FsVideoResource> list) {
|
|
public AjaxResult batchAddVideoResource(@RequestBody List<FsVideoResource> list) {
|
|
|
-// if (Objects.isNull(list) || list.isEmpty()) {
|
|
|
|
|
-// return AjaxResult.error("数据不能为空");
|
|
|
|
|
-// }
|
|
|
|
|
-// LoginUser loginUser = (LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
-// String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
-// CourseConfig config = null;
|
|
|
|
|
-// if (json != null && !json.isEmpty()) {
|
|
|
|
|
-// try {
|
|
|
|
|
-// config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
|
-// log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// final CourseConfig finalConfig = config;
|
|
|
|
|
-// list.forEach(v -> {
|
|
|
|
|
-// v.setCreateTime(LocalDateTime.now());
|
|
|
|
|
-// if (finalConfig != null && ObjectUtil.isNotEmpty(finalConfig.getIsBound()) && finalConfig.getIsBound()) {
|
|
|
|
|
-// if (loginUser.getCompanyUser() != null) {
|
|
|
|
|
-// v.setUserId(loginUser.getCompanyUser().getUserId());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-// 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();
|
|
|
|
|
- throw new RuntimeException("未实现");
|
|
|
|
|
|
|
+ if (Objects.isNull(list) || list.isEmpty()) {
|
|
|
|
|
+ return AjaxResult.error("数据不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = null;
|
|
|
|
|
+ if (json != null && !json.isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析course.config失败: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ final CourseConfig finalConfig = config;
|
|
|
|
|
+ list.forEach(v -> {
|
|
|
|
|
+ v.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ if (finalConfig != null && ObjectUtil.isNotEmpty(finalConfig.getIsBound()) && finalConfig.getIsBound()) {
|
|
|
|
|
+ if (loginUser.getUser() != null) {
|
|
|
|
|
+ v.setUserId(loginUser.getUser().getUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ 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();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|