VodDictController.java 7.03 KB
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.voddict.*;
import com.meishu.model.VodDictDO;
import com.meishu.model.VodPlayHistoryDO;
import com.meishu.model.VodSubjectTreeMappingDO;
import com.meishu.service.VodDictService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 * 视频字典表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-04-27
 */
@RestController
@Api(tags = "视频字典表")
@RequestMapping("/vodDict")
public class VodDictController {

    @Autowired
    private VodDictService vodDictService;

    @PostMapping("/signature")
    @ApiOperation("获取签名")
    public ResponseVO signature()throws Exception{
        return ResponseData.generateCreatedResponse(0,vodDictService.signature());
    }

    @PostMapping("getTreeVods")
    @ApiOperation("(个人库/公共库)获取某个知识树下的视频  subjectId 科目id vodType:课型  vodName:视频名称  shareStatus 0:个人库 1:公共库 treeId:知识树id userId 用户id pageSize pageNum")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getTreeVods (@RequestBody GetTreeVodsDTO getTreeVodsDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.getTreeVods(getTreeVodsDTO));
    }

    @PostMapping("getCheckTreeVods")
    @ApiOperation("(审核)获取某个知识树下的视频  subjectId 科目id vodType:课型  vodName:视频名称  checkStatus 1:已审核 2:待审核 treeId:知识树id userId 用户id pageSize pageNum")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getCheckTreeVods (@RequestBody GetTreeVodsDTO getTreeVodsDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.getCheckTreeVods(getTreeVodsDTO));
    }

    @PostMapping("deleteVod")
    @ApiOperation("删除某个视频(从腾讯云中也删除)  id   ")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.deleteVod(vodDictDO));
    }

    @PostMapping("uploadVods")
    @ApiOperation("上传某个视频  {subjectId 科目id  vodName视频名称  vodUrl 视频地址 vodType课型" +
            "vodIntro 视频介绍  vodLength视频长度  vodCode:腾讯云上视频code  administerId 视频提供者" +
            "treeIds 多个知识点(数组)}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO uploadVods(@RequestBody UploadVodsDTO uploadVodsDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.uploadVods(uploadVodsDTO));
    }

    @PostMapping("updateVod")
    @ApiOperation("修改某个视频 {id 视频名称 subjectId 科目id   vodName视频名称  vodUrl 视频地址 vodType课型" +
            " vodIntro 视频介绍  vodLength视频长度  vodCode:腾讯云上视频code  administerId 视频提供者" +
            "treeIds 多个知识点(数组)}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateVod(@RequestBody UploadVodsDTO uploadVodsDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.updateVod(uploadVodsDTO));
    }

    @PostMapping("getVodInfo")
    @ApiOperation("小程序---获取视频详情 id:视频id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getVodInfo(@RequestBody VodDictDO vodDictDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.getVodInfo(vodDictDO));
    }

    @PostMapping("insertPlayHistory")
    @ApiOperation("小程序--记录播放记录  {vodId 视频id treeId知识点 studentId 学生id  playLength 观看时长  playRecord 播放位点}")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO insertPlayHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.insertPlayHistory(vodPlayHistoryDO));
    }

    @PostMapping("getToCheckVodCounts")
    @ApiOperation("获取所有未审核/已审核的视频个数   {subjectId 科目  checkStatus 审核状态 1:已审核  2:待审核}")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getToCheckVodCounts(@RequestBody GetToCheckVodCountsDTO getToCheckVodCountsDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.getToCheckVodCounts(getToCheckVodCountsDTO));
    }

    @PostMapping("compressVodByCode")
    @ApiOperation("通过code压缩视频并删除原视频  {id 视频id }")
    public ResponseVO compressVodByCode(@RequestBody VodDictDO vodDictDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.compressVodByCode(vodDictDO));
    }

    @PostMapping("deleteOriginVod")
    @ApiOperation("删除原视频")
    public ResponseVO deleteOriginVod(@RequestBody DeleteOriginVodDTO deleteOriginVodDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.deleteOriginVod(deleteOriginVodDTO));
    }

    @PostMapping("checkVod")
    @ApiOperation("审核视频  {checkId 审核人id  id 视频id  vodType:课型 vodName:视频名称  treeIds:多个知识点id  checkStatus 1:审核通过  3:未通过  reason:原因}")
    public ResponseVO checkVod(@RequestBody CheckVodDTO checkVodDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.checkVod(checkVodDTO));
    }

    @PostMapping("publicUpload")
    @ApiOperation("公共资源上载  {userId   checkStatus 1:审核通过 2:审核中 3:未通过}")
    public ResponseVO publicUpload(@RequestBody PublicCheckingDTO publicCheckingDTO){
        return ResponseData.generateCreatedResponse(0,vodDictService.publicUpload(publicCheckingDTO));
    }

    @PostMapping("withdraw")
    @ApiOperation("撤回视频  id 视频id")
    public ResponseVO withdraw(@RequestBody VodDictDO vodDictDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.withdraw(vodDictDO));
    }

    @PostMapping("getVodDetail")
    @ApiOperation("获取一个视频详情{id}")
    public ResponseVO getVodDetail(@RequestBody VodDictDO vodDictDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.getVodDetail(vodDictDO));
    }

    @PostMapping("setRelatedVod")
    @ApiOperation("设置关联题目  {vodId 视频id status 1:关联  0:取消关联}")
    public ResponseVO setRelatedVod(@RequestBody VodSubjectTreeMappingDO vodSubjectTreeMappingDO){
        return ResponseData.generateCreatedResponse(0,vodDictService.setRelatedVod(vodSubjectTreeMappingDO));
    }


}