123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- package com.zhongzheng.controller.course;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.common.utils.ServletUtils;
- import com.zhongzheng.framework.web.service.WxTokenService;
- import com.zhongzheng.modules.course.bo.*;
- import com.zhongzheng.modules.course.service.*;
- import com.zhongzheng.modules.course.vo.*;
- import com.zhongzheng.modules.goods.vo.GoodsUserVo;
- import com.zhongzheng.modules.goods.vo.GoodsVo;
- import com.zhongzheng.modules.user.entity.ClientLoginUser;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * 课程Controller
- *
- * @author hjl
- * @date 2021-10-09
- */
- @Api(value = "课程控制器", tags = {"课程管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/course")
- public class CourseController extends BaseController {
- private final ICourseService iCourseService;
- private final WxTokenService wxTokenService;
- private final ICourseModuleChapterService iCourseModuleChapterService;
- private final ICourseMenuService iCourseMenuService;
- private final ICourseChapterSectionService iCourseChapterSectionService;
- private final ICourseSectionWatchPerService iCourseSectionWatchPerService;
- /**
- * 查询课程列表
- */
- @ApiOperation("查询商品下的课程列表")
- @GetMapping("/courseList")
- public TableDataInfo<CourseUserVo> courseList(CourseQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- startPage();
- List<CourseUserVo> list = iCourseService.courseList(bo);
- return getDataTable(list);
- }
- /**
- * 获取课程详细信息
- */
- @ApiOperation("获取课程详细信息")
- @GetMapping("/{courseId}")
- public AjaxResult<CourseUserVo> getCourseUserVoInfo(@PathVariable("courseId" ) Long courseId) {
- return AjaxResult.success(iCourseService.getCourseUserVoInfo(courseId));
- }
- /**
- * 查询课程列表
- */
- @ApiOperation("查询用户拥有的商品")
- @GetMapping("/goodsList")
- public TableDataInfo<GoodsUserVo> goodsList(CourseQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- startPage();
- List<GoodsUserVo> list = iCourseService.goodsList(bo);
- return getDataTable(list);
- }
- @ApiOperation("查询用户商品重修状态")
- @GetMapping("/goodsRebuildStatus")
- public AjaxResult<Long> goodsRebuildStatus(CourseQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- return AjaxResult.success(iCourseService.goodsRebuildStatus(bo));
- }
- /**
- * 查询课程目录结构列表
- */
- @ApiOperation("查询课程目录结构列表")
- @GetMapping("/menuList")
- public TableDataInfo<CourseUserMenuVo> menuList(CourseMenuQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- startPage();
- List<CourseUserMenuVo> list = iCourseMenuService.menuList(bo);
- return getDataTable(list);
- }
- /**
- * 获取商品重修目录结构
- */
- @ApiOperation("获取商品重修目录结构")
- @GetMapping("/goods/rebuild/menu")
- public AjaxResult<List<CourseUserMenuVo>> getGoodsRebuildMenuList(CourseMenuQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<CourseUserMenuVo> list = iCourseMenuService.getGoodsRebuildMenuList(bo);
- return AjaxResult.success(list);
- }
- @ApiOperation("查询模块与章关系列表")
- @GetMapping("/chapterList")
- public AjaxResult<List<CourseUserModuleChapterVo>> chapterList(CourseMenuQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<CourseUserModuleChapterVo> list = iCourseModuleChapterService.chapterList(bo);
- return AjaxResult.success(list);
- }
- /**
- * 查询章与节关系列表
- */
- @ApiOperation("查询章与节关系列表+章卷同级展示")
- @GetMapping("/sectionList")
- public AjaxResult<List<CourseUserChapterSectionVo>> sectionList(CourseMenuQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<CourseUserChapterSectionVo> list = iCourseChapterSectionService.sectionList(bo);
- return AjaxResult.success(list);
- }
- @ApiOperation("查询章下的节卷列表")
- @GetMapping("/sectionExamList")
- public AjaxResult<List<CourseUserChapterSectionVo>> sectionExamList(CourseMenuQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<CourseUserChapterSectionVo> list = iCourseChapterSectionService.sectionExamList(bo);
- return AjaxResult.success(list);
- }
- /**
- * 获取课程小节观看权限
- */
- @ApiOperation("获取课程小节观看权限")
- @GetMapping("/watch/per")
- public AjaxResult<CourseSectionWatchPerVo> getSectionWatchPer(SectionWatchPerBo bo) {
- CourseSectionWatchPerVo vo = iCourseSectionWatchPerService.getSectionWatchPer(bo);
- return AjaxResult.success(vo);
- }
- /**
- * 课程节观看权限校验
- */
- @ApiOperation("课程节观看权限校验")
- @GetMapping("/check/watch/per")
- public AjaxResult<CheckSectionWatchVo> checkSectionWatchPer(SectionWatchQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- CheckSectionWatchVo vo = iCourseSectionWatchPerService.checkSectionWatchPer(bo);
- return AjaxResult.success(vo);
- }
- }
|