派生自 projectDept/qhighschool

EricsHu
2022-12-05 f1bd8ee1a861eee55ee07eb313cdda51c3f31d98
src/main/java/com/qxueyou/scc/stucontroller/StuSubjectController.java
@@ -48,11 +48,11 @@
import javax.servlet.http.HttpServletResponse;
/**
 * 学习端 课程前端控制器
 * 学习端 课程前端控制器
 *
 * @author chenjunliang
 */
@Api(tags = "课程管理-学员端")
@Api(tags = "课程管理-学员端")
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping(value = "stu/subject")
@@ -79,18 +79,18 @@
    @Autowired
    IEvaluateService evaluateService;
    //--------------------------------------------------------------app端接口---------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------app端接口---------------------------------------------------------------------------------------------------
    /**
     * 学习端获取 所有课件
     * 学习端获取 所有课件
     *
     * @param classId
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     */
    @ApiOperation(value = "获取班级所有课件-学习端", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiOperation(value = "获取班级所有课件-学习端", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/getCoursewareLstByClassId")
    public Result appCoursewareLst(String classId, @RequestParam(defaultValue = "desc") String sort, Pager pager) {
@@ -99,49 +99,49 @@
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "学习端获取课程学年列表")
    @ApiOperation(value = "学习端获取课程学年列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/termList")
    public Result termList(String classId) {
        classId = CommonUtils.getClassId(classId);
        if (StringUtils.isEmpty(classId)) {
            return new Result(false, "班级id不能为空");
            return new Result(false, "班级id不能为空");
        }
        //课程
        //课程
        List<Map<String, Object>> lstSubject = subjectService.clsSubjectlist(classId, null, null);
        //组装的学期和课程
        //组装的学期和课程
        List<Map<String, Object>> lstTerm = subjectService.termSubjectList(classId, lstSubject);
        return new Result(true, "success", CollectionUtils.newObjectMap("termList", lstTerm, "allSubject", lstSubject));
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "我的课程按学期分类")
    @ApiOperation(value = "我的课程按学期分类")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/myTermSubjectList")
    public Result myTermSubjectList(String classId) {
        classId = CommonUtils.getClassId(classId);
        System.out.println("vvvvvvvvv" + classId);
        if (StringUtils.isEmpty(classId)) {
            return new Result(false, "班级id不能为空");
            return new Result(false, "班级id不能为空");
        }
        return new Result(true, "success", subjectService.myTermSubjectList(classId));
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "我的课程按时间排序")
    @ApiOperation(value = "我的课程按时间排序")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/mySubjectList")
    public Result mySubjectList(String classId, Pager pager) {
@@ -153,53 +153,53 @@
    }
    /**
     * 我的课程详情
     * 我的课程详情
     *
     * @param subjectId
     * @param classId
     * @return
     */
    @ApiOperation(value = "我的课程详情")
    @ApiOperation(value = "我的课程详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/mySubjectInfo")
    public Result mySubjectInfo(String subjectId, String classId) {
        classId = CommonUtils.getClassId(classId);
        if (StringUtils.isEmpty(classId)) {
            return new Result(false, "班级id不能为空");
            return new Result(false, "班级id不能为空");
        }
        if (StringUtils.isEmpty(subjectId)) {
            return new Result(false, "课程id不能为空");
            return new Result(false, "课程id不能为空");
        }
        return new Result(true, "success", subjectService.mySubjectInfo(subjectId, classId));
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "我的班级信息")
    @ApiOperation(value = "我的班级信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/myClassInfo")
    public Result myClassInfo(String classId) {
        classId = ClientUtils.getClassId();
        if (StringUtils.isEmpty(classId)) {
            return new Result(false, "班级id不能为空");
            return new Result(false, "班级id不能为空");
        }
        return new Result(true, "success", subjectService.myClassInfo(classId));
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "学习端获取课程列表")
    @ApiOperation(value = "学习端获取课程列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "schoolYear", value = "学年", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "term", value = "学期", required = true, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "schoolYear", value = "学年", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "term", value = "学期", required = true, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "/app/subjectList")
    public Result subjectList(String classId, Integer schoolYear, Integer term) {
@@ -207,12 +207,12 @@
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "学习端获取课程下课件,按创建时间排序")
    @ApiOperation(value = "学习端获取课程下课件,按创建时间排序")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sort", value = "排序方式(desc从大到小,asc从小到大)", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "/app/listLectureBySubject")
    public Result listLectureBySubject(String subjectId, String classId, @RequestParam(defaultValue = "desc") String sort, Pager pager) {
@@ -220,9 +220,9 @@
    }
    /**
     * 学习端获取其他课件统计
     * 学习端获取其他课件统计
     */
    @ApiOperation(value = "学习端获取其他课件统计")
    @ApiOperation(value = "学习端获取其他课件统计")
    @GetMapping(value = "/app/otherLectureCount")
    public Result otherLectureCount() {
        return new Result(true, "success", CollectionUtils.newObjectMap("topicCount",
@@ -230,20 +230,20 @@
    }
    /**
     * 学习端获取课程列表
     * 学习端获取课程列表
     */
    @ApiOperation(value = "学习端获取课程下课件,按目录分类", notes = "")
    @ApiOperation(value = "学习端获取课程下课件,按目录分类", notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, 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 = false, 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) {
        classId = CommonUtils.getClassId(classId);
        if (StringUtils.isEmpty(subjectId)) {
            return new Result(false, "课程id不能为空");
            return new Result(false, "课程id不能为空");
        }
        return this.clsLectureService.coursewareChapterList(classId, subjectId, type);
@@ -251,40 +251,40 @@
    }
    /**
     * 我的公开课列表
     * 我的公开课列表
     */
    @ApiOperation(value = "我的公开课列表", notes = "")
    @ApiOperation(value = "我的公开课列表", notes = "")
    @GetMapping(value = "/app/myOpenSubjectList")
    public Result myOpenSubjectList(Pager pager, @RequestParam(defaultValue = "") String keyword) {
        return new Result(true, "success", this.subjectService.myOpenSubjectList(pager.getOffset(), pager.getPageSize(), keyword));
    }
    /**
     * 公开课列表
     * 公开课列表
     */
    @ApiOperation(value = "公开课列表", notes = "")
    @ApiOperation(value = "公开课列表", notes = "")
    @GetMapping(value = "/app/openSubjectList")
    public Result openSubjectList(Pager pager, @RequestParam(defaultValue = "") String keyword) {
        return new Result(true, "success", this.subjectService.openSubjectList(pager.getOffset(), pager.getPageSize(), keyword));
    }
    /**
     * 公开课详情
     * 公开课详情
     */
    @ApiOperation(value = "公开课详情", notes = "")
    @ApiOperation(value = "公开课详情", notes = "")
    @GetMapping(value = "/app/openSubjectInfo")
    public Result openSubjectInfo(@RequestParam(defaultValue = "") String subjectId) {
        return new Result(true, "success", this.subjectService.openSubjectInfo(subjectId));
    }
    //--------------------------------------------------------后台端接口---------------------------------------------------------------------------------------------------
    //--------------------------------------------------------后台端接口---------------------------------------------------------------------------------------------------
    /**
     * 加载课件tree
     * 加载课件tree
     */
    @ApiOperation(value = "加载课件tree", notes = "")
    @ApiOperation(value = "加载课件tree", notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "categoryTree")
    public Result categoryTree(String subjectId, String parentId) {
@@ -292,7 +292,7 @@
        List<SubjectProgressTreeV> chapterLst = clsLectureService.getChapterTreeVList(subjectId, parentId);
        for (SubjectProgressTreeV v : chapterLst) {
            v.setNodeName(v.getNodeName() + "(" + String.format("%.2f", v.getPercent() * 100) + "%)"); //保留两位小数
            v.setNodeName(v.getNodeName() + "(" + String.format("%.2f", v.getPercent() * 100) + "%)"); //保留两位小数
        }
        return new Result(true, "success", QBeanUtils.listBean2ListMap(chapterLst, CollectionUtils
@@ -300,20 +300,20 @@
    }
    /**
     * 学习端获取 所有课件
     * 学习端获取 所有课件
     *
     * @param classId
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     */
    @ApiOperation(value = "学习端获取 所有课件", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiOperation(value = "学习端获取 所有课件", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "subjectId", value = "班级id", required = false, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "getCoursewareLstByClassId")
    public Result getCoursewareLst(String subjectId) {
        List<ClsSubjectLecture> lectureLst = clsLectureService.listLecture(subjectId);
        // id为小节id //返回的数据按照tree的小节排序
        // id为小节id //返回的数据按照tree的小节排序
        return new Result(true, "success",
                QBeanUtils.listBean2ListMap(lectureLst, CollectionUtils.newStringMap("name", "name", "lectureId", "id",
@@ -321,19 +321,19 @@
    }
    /**
     * 获取课件列表
     * 获取课件列表
     *
     * @param chapterId 章节id
     * @param type      课件类型
     * @param keyword   搜索关键字
     * @param limit     每页显示几条
     * @param pageNum   页码
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     * @param chapterId 章节id
     * @param type      课件类型
     * @param keyword   搜索关键字
     * @param limit     每页显示几条
     * @param pageNum   页码
     * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。)
     */
    @ApiOperation(value = "根据章节获取课件列表", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiOperation(value = "根据章节获取课件列表", notes = "状态说明(0,视频。1,音频。2,文档。3,练习。)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "type", value = "课件类型", required = false, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "coursewareListByChapterId")
    public Result coursewareList(String chapterId, String type, String keyword, Integer limit, @RequestParam(defaultValue = "1") Integer pageNum) {
@@ -350,41 +350,41 @@
    }
    /**
     * 课件学习进度提交 stu/subject/study
     * 课件学习进度提交 stu/subject/study
     *
     * @param lectureId 课件id
     * @param from      开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数
     * @param to        结束学习位置,同to
     * @param lectureId 课件id
     * @param from      开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数
     * @param to        结束学习位置,同to
     */
    @ApiOperation(value = "提交学习进度")
    @ApiOperation(value = "提交学习进度")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "from", value = "开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数", required = true, paramType = "query", dataType = "Double"),
            @ApiImplicitParam(name = "to", value = "结束学习位置,同to", required = true, paramType = "query", dataType = "Double"),
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "lectureParentId", value = "父课件id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "from", value = "开始学习位置 ,如视频,则为时分秒(00:10:12),如文档,则无需提交该参数", required = true, paramType = "query", dataType = "Double"),
            @ApiImplicitParam(name = "to", value = "结束学习位置,同to", required = true, paramType = "query", dataType = "Double"),
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "lectureParentId", value = "父课件id", required = false, paramType = "query", dataType = "String"),
    })
    @GetMapping(value = "study")
    public Result study(String lectureId, @RequestParam(defaultValue = "1") Double from,
                        @RequestParam(defaultValue = "0") Double to, String subjectId, String classId, String lectureParentId) {
        String userId = ClientUtils.getUserId();
        classId = CommonUtils.getClassId(classId);
        progressDao.putStudyById(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员每个课程的学习位置;
        progressDao.putStudyByUserId(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员上次学习的位置;
        progressDao.putStudyById(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员每个课程的学习位置;
        progressDao.putStudyByUserId(userId, subjectId, lectureId, lectureParentId, classId);// 记录学员上次学习的位置;
        return clsLectureService.doStudy(lectureId, from, to);
    }
    /**
     * 音频时长提交 stu/subject/submitAudioDuration
     * 音频时长提交 stu/subject/submitAudioDuration
     *
     * @param lectureId 课件id
     * @param seconds   时长
     * @param lectureId 课件id
     * @param seconds   时长
     */
    @ApiOperation(value = "音频时长提交")
    @ApiOperation(value = "音频时长提交")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "seconds", value = "时长", required = true, paramType = "query", dataType = "Double")
            @ApiImplicitParam(name = "lectureId", value = "课件id", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "seconds", value = "时长", required = true, paramType = "query", dataType = "Double")
    })
    @CacheEvict(value = "LectureAudioV", key = "#lectureId")
    @GetMapping(value = "submitAudioDuration")
@@ -397,15 +397,15 @@
    }
    /**
     * 课程列表
     * 课程列表
     *
     * @param clssId    班级id
     * @param startTime 开班时间
     * @param clssId    班级id
     * @param startTime 开班时间
     */
    @ApiOperation(value = "课程列表")
    @ApiOperation(value = "课程列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "startTime", value = "开班时间", required = false, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "startTime", value = "开班时间", required = false, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "getSubjectLst")
    public Result getList(String userId, String classId, String startTime, Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, HttpServletRequest request) {
@@ -454,13 +454,13 @@
    }
    /**
     * 进入课程
     * 进入课程
     *
     * @param subjectId 课程id
     * @param subjectId 课程id
     */
    @ApiOperation(value = "课程详情")
    @ApiOperation(value = "课程详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType = "query", dataType = "String")
    })
    @GetMapping(value = "getSubjectDetail")
    public Result getSubjectDetail(String subjectId) {
@@ -487,8 +487,6 @@
            progressLst.get(0).put("percent", subject.getPercent());
            progressLst.get(0).put("studyTime", subject.getProgressValue());
            coursewareName = myLectureVList.get(0).getLectureName();
        }else {
        }
        return new Result(true, "success",
                CollectionUtils.newObjectMap("subject", QBeanUtils.bean2Map(subject,