Blame view

VodDictController.java 7.03 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
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));
    }


}