派生自 projectDept/qhighschool

yn147
2023-10-26 3970ced88b5b456f03fe277c254ca761f05492e0
src/main/java/com/qxueyou/scc/controller/ClsLectureController.java
@@ -6,10 +6,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.qxueyou.scc.admin.classes.model.ClsSubjectChapter;
import com.qxueyou.scc.admin.classes.model.ClsSubjectLecture;
@@ -29,8 +26,9 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags = "课件管理-教师端")
@Api(tags = "课件管理-教师端")
@RestController
@CrossOrigin(origins="*",maxAge=3600)
@RequestMapping(value = "teach/clsLecture")
public class ClsLectureController {
   @Autowired
@@ -42,22 +40,22 @@
   @Autowired
   IResService resService;
   
   /**-------------------------------------------------------------------app接口------------------------------------------------------------------------------------------**/
   /**-------------------------------------------------------------------app接口------------------------------------------------------------------------------------------**/
   @SuppressWarnings("unchecked")
   @ApiOperation(value = "获取课程下课件", notes = "")
   @ApiOperation(value = "获取课程下课件", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType="query", dataType = "String")
        @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType="query", dataType = "String")
    })
   @GetMapping(value = "/app/coursewareList")
   public Result coursewareList(String classId,String subjectId, String type) {
      
      if(StringUtils.isEmpty(subjectId)) {
         return new Result(false, "课程id不能为空");
         return new Result(false, "课程id不能为空");
      }
      
      //公开课和管理员课程
      //公开课和管理员课程
      if(StringUtils.isEmpty(classId)) {
         Object obj = this.classLectureService.coursewareChapterList(classId, subjectId, type).getData();
         if(obj == null) {
@@ -66,29 +64,29 @@
         return new Result(true, "success", ((Map<String, Object>)obj).get("listData"));
      }
      
      //查询课件
      //查询课件
      List<Map<String, Object>> lectures = classLectureService.listLectureBySubject(subjectId, type, classId);
      //查询章节
      //查询章节
      List<ClsSubjectChapter> chapterLst = classLectureService.getChapterLectures(classLectureService.getListChapter(classId, subjectId, null), lectures);
      return new Result(true, "success", QBeanUtils.listBean2ListMap(chapterLst,
            CollectionUtils.newStringMap("name", "name", "chapterId", "chapterId", "lectures", "lectures")));
   }
   
   /**-------------------------------------------------------------------后端接口------------------------------------------------------------------------------------------**/
   /**-------------------------------------------------------------------后端接口------------------------------------------------------------------------------------------**/
   /**
    * 加载课件tree
    * 加载课件tree
    *
    * @param parentId
    *            父节点id
    *            父节点id
    */
   @ApiOperation(value = "获取课程下章节", notes = "")
   @ApiOperation(value = "获取课程下章节", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "parentId", value = "父节点id", required = false, paramType="query", dataType = "String")
        @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "parentId", value = "父节点id", required = false, paramType="query", dataType = "String")
    })
   @GetMapping(value = "categoryTree")
   public Result categoryTree(String classId,String subjectId, String parentId) {
@@ -100,25 +98,25 @@
   }
   /**
    * 获取课件列表
    * 获取课件列表
    * 
    * @param chapterId
    *            章节id
    *            章节id
    * @param type
    *            课件类型
    *            课件类型
    * @param keyword
    *            搜索关键字
    *            搜索关键字
    * @param limit
    *            每页显示几条
    *            每页显示几条
    * @param pageNum
    *            页码
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    *            页码
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    */
   @ApiOperation(value = "获取课程下章节", notes = "")
   @ApiOperation(value = "获取课程下章节", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "chapterId", value = "章节id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType="query", dataType = "String")
        @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "chapterId", value = "章节id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType="query", dataType = "String")
    })
   @GetMapping(value = "coursewareList")
   public Result lectureList(String chapterId, String type, String keyword, Integer limit, Integer pageNum,
@@ -139,17 +137,17 @@
   }
   /**
    * 查看课件
    * 查看课件
    * 
    * @param id
    *            课件id
    *            课件id
    * @param attribute
    *            扩展属性 video:"mp4:HD","m3u8:SD" 可不用传 audio:可不用传 doc:可不用传
    *            扩展属性 video:"mp4:HD","m3u8:SD" 可不用传 audio:可不用传 doc:可不用传
    */
   @ApiOperation(value = "查看课件", notes = "")
   @ApiOperation(value = "查看课件", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "课件id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "attribute", value = "扩展属性 video:\"mp4:HD\",\"m3u8:SD\" 可不用传 audio:可不用传 doc:可不用传", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "id", value = "课件id", required = false, paramType="query", dataType = "String"),
        @ApiImplicitParam(name = "attribute", value = "扩展属性 video:\"mp4:HD\",\"m3u8:SD\" 可不用传 audio:可不用传 doc:可不用传", required = false, paramType="query", dataType = "String"),
    })
   @GetMapping(value = "showCourseware")
   public Result showLecture(String id, String attribute) {
@@ -164,10 +162,10 @@
   }
   /**
    * 删除课件
    * 删除课件
    * 
    * @param id
    *            课件ids
    *            课件ids
    */
   @GetMapping(value = "deleteCourseware")
   public Result deleteLecture(String id) {
@@ -177,18 +175,18 @@
   }
   /**
    * 课件管理 新增下级,同级
    * 课件管理 新增下级,同级
    * 
    * @param type
    *            (add:新增,edit :编辑)
    *            (add:新增,edit :编辑)
    * @param chapterId
    *            章节id
    *            章节id
    * @param classId
    *            班级id
    *            班级id
    * @param name
    *            名称
    *            名称
    * @param childFlag
    *            是否操作下级
    *            是否操作下级
    * 
    */
   @PostMapping(value = "addOrUpdateChapter")
@@ -204,10 +202,10 @@
   }
   /**
    * 课件管理 目录删除
    * 课件管理 目录删除
    * 
    * @param chapterId
    *            Ŀ¼id
    *            目录id
    */
   @GetMapping(value = "deleteChapter")
   public Result deleteChapter(String chapterId) {
@@ -215,24 +213,24 @@
   }
   /**
    * 添加/更新(视频,讲义,音频)
    * 添加/更新(视频,讲义,音频)
    * 
    * @param name
    *            名称
    *            名称
    * @param coverUrl
    *            封面Url
    *            封面Url
    * @param remark:
    *            <p>
    *            视频啊啊啊
    *            视频啊啊啊
    *            </p>
    *            介绍
    *            介绍
    *
    * @param id
    *            课件id
    *            课件id
    * @param sectionId
    *            小节Id
    *            小节Id
    * @param type
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    */
   @PostMapping(value = "addOrUpdate")
   public Result addOrUpdate(String id, String remark, String name, String coverUrl, String type, String fileId,
@@ -253,10 +251,10 @@
   }
   /**
    * 编辑 获取内容
    * 编辑 获取内容
    * 
    * @param id
    *            课件id
    *            课件id
    */
   @GetMapping(value = "getCoursewareDetail")
   public Result getLectureDetail(String id) {
@@ -272,19 +270,19 @@
   }
   /**
    * 课件获取资源列表
    * 课件获取资源列表
    * 
    * @param dirId
    *            Ŀ¼Id
    *            目录Id
    * @param limit
    *            每页显示几条
    *            每页显示几条
    * @param pageNum
    *            页码
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    *            页码
    * @return 状态说明(0,视频。1,音频。2,文档。3,练习。)
    */
   @ApiOperation(value = "课件获取资源列表", notes = "")
   @ApiOperation(value = "课件获取资源列表", notes = "")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "dirId", value = "Ŀ¼Id", required = false, paramType="query", dataType = "String")
        @ApiImplicitParam(name = "dirId", value = "目录Id", required = false, paramType="query", dataType = "String")
    })
   @GetMapping(value = "getResLst")
   public Result getResLst(String dirId, Integer limit, Integer pageNum, String keyword) {
@@ -299,12 +297,12 @@
   }
   /**
    * 课件从资源选择后保存
    * 课件从资源选择后保存
    * 
    * @param resId
    *            资源文件id
    *            资源文件id
    * @param sectionId
    *            小节id
    *            小节id
    * 
    */
   @GetMapping(value = "saveCourseware4Res")