|
|
@@ -31,6 +31,7 @@ import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
|
|
import vip.xiaonuo.disk.domain.Chapter;
|
|
|
import vip.xiaonuo.disk.domain.CourseInfo;
|
|
|
+import vip.xiaonuo.disk.domain.CourseRelate;
|
|
|
import vip.xiaonuo.disk.domain.ResourceRecordUserRelate;
|
|
|
import vip.xiaonuo.disk.param.ChapterAddParam;
|
|
|
import vip.xiaonuo.disk.param.ChapterEditParam;
|
|
|
@@ -38,6 +39,7 @@ import vip.xiaonuo.disk.param.ChapterIdParam;
|
|
|
import vip.xiaonuo.disk.param.ChapterPageParam;
|
|
|
import vip.xiaonuo.disk.service.ChapterService;
|
|
|
import vip.xiaonuo.disk.service.ClassHourService;
|
|
|
+import vip.xiaonuo.disk.service.CourseRelateService;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -62,6 +64,8 @@ public class CourseChapterController {
|
|
|
private ChapterService chapterService;
|
|
|
@Resource
|
|
|
private ClassHourService classHourService;
|
|
|
+ @Resource
|
|
|
+ private CourseRelateService courseRelateService;
|
|
|
|
|
|
/**
|
|
|
* 课程章节表-分页列表
|
|
|
@@ -205,7 +209,14 @@ public class CourseChapterController {
|
|
|
@PostMapping("/disk/chapter/add")
|
|
|
public CommonResult<String> add(@RequestBody @Valid ChapterAddParam chapterAddParam) {
|
|
|
Chapter chapter = BeanUtil.toBean(chapterAddParam, Chapter.class);
|
|
|
- chapter=chapterService.addOne(chapter);
|
|
|
+ chapterService.addOne(chapter);
|
|
|
+ //添加文件,测验等关联信息
|
|
|
+ List<CourseRelate> courseRelates = chapterAddParam.getCourseRelates();
|
|
|
+ courseRelates = courseRelates.stream()
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setChapterhourType("0")) // 修改属性
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setMainId(chapter.getId())) // 修改属性
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ courseRelateService.addBatch(courseRelates);
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -222,7 +233,14 @@ public class CourseChapterController {
|
|
|
@PostMapping("/disk/chapter/edit")
|
|
|
public CommonResult<String> edit(@RequestBody @Valid ChapterEditParam chapterEditParam) {
|
|
|
Chapter chapter = BeanUtil.toBean(chapterEditParam, Chapter.class);
|
|
|
- chapter=chapterService.editOne(chapter);
|
|
|
+ chapterService.editOne(chapter);
|
|
|
+ //添加文件,测验等关联信息
|
|
|
+ List<CourseRelate> courseRelates = chapterEditParam.getCourseRelates();
|
|
|
+ courseRelates = courseRelates.stream()
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setChapterhourType("0")) // 修改属性
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setMainId(chapter.getId())) // 修改属性
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ courseRelateService.addBatch(courseRelates);
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -257,6 +275,95 @@ public class CourseChapterController {
|
|
|
Map param =new HashMap();
|
|
|
param.put("id", req.getParameter("id"));
|
|
|
Map<String,Object> result=chapterService.queryInfo(param);
|
|
|
+ //查回课程关联信息
|
|
|
+ List<Map<String,Object>> courseRelatesList=new ArrayList<>();
|
|
|
+ Map funcTypeParam =new HashMap();
|
|
|
+ funcTypeParam.put("mainId", chapterIdParam.getId());
|
|
|
+ funcTypeParam.put("chapterhourType","0");
|
|
|
+ List<CourseRelate> relateList=courseRelateService.wrapperList(funcTypeParam);
|
|
|
+ List<String>funcTypeList=CollStreamUtil.toList(relateList, CourseRelate::getFuncType);
|
|
|
+ //去重类型
|
|
|
+ funcTypeList=funcTypeList.stream().distinct().collect(Collectors.toList());
|
|
|
+ Map relateParam =new HashMap();
|
|
|
+ relateParam.put("mainId", req.getParameter("id"));
|
|
|
+ relateParam.put("chapterhourType", "0");
|
|
|
+ //分别查回视频,讲义,字幕,作业,测验等
|
|
|
+ for(String oneFunctype:funcTypeList)
|
|
|
+ {
|
|
|
+ relateParam.put("funcType", oneFunctype);
|
|
|
+ List<Map<String,Object>> videoList=courseRelateService.queryMapList(relateParam);
|
|
|
+ courseRelatesList.addAll(videoList);
|
|
|
+ }
|
|
|
+ result.put("courseRelates", courseRelatesList);
|
|
|
+ return CommonResult.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 课程中心-课程章节表详情
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/02 15:34
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation("课程中心-课程章节表详情")
|
|
|
+ @SaCheckPermission("/disk/coursecentry/chapterDetail")
|
|
|
+ @GetMapping("/disk/coursecentry/chapterDetail")
|
|
|
+ public CommonResult<Map<String,Object>> chapterDetail(@Valid ChapterIdParam chapterIdParam, HttpServletRequest req) {
|
|
|
+ Map param =new HashMap();
|
|
|
+ param.put("id", req.getParameter("id"));
|
|
|
+ Map<String,Object> result=chapterService.queryInfo(param);
|
|
|
+ //查回课程关联信息
|
|
|
+ List<Map<String,Object>> courseRelatesList=new ArrayList<>();
|
|
|
+ Map funcTypeParam =new HashMap();
|
|
|
+ funcTypeParam.put("mainId", chapterIdParam.getId());
|
|
|
+ funcTypeParam.put("chapterhourType","0");
|
|
|
+ List<CourseRelate> relateList=courseRelateService.wrapperList(funcTypeParam);
|
|
|
+ List<String>funcTypeList=CollStreamUtil.toList(relateList, CourseRelate::getFuncType);
|
|
|
+ Map relateParam =new HashMap();
|
|
|
+ relateParam.put("mainId", req.getParameter("id"));
|
|
|
+ relateParam.put("chapterhourType", "0");
|
|
|
+ //分别查回视频,讲义,字幕,作业,测验等
|
|
|
+ for(String oneFunctype:funcTypeList)
|
|
|
+ {
|
|
|
+ relateParam.put("funcType", oneFunctype);
|
|
|
+ List<Map<String,Object>> videoList=courseRelateService.queryMapList(relateParam);
|
|
|
+ courseRelatesList.addAll(videoList);
|
|
|
+ }
|
|
|
+ result.put("courseRelates", courseRelatesList);
|
|
|
+ return CommonResult.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 课程中心-获取课程章节关联资源
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/02 15:34
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation("课程中心-获取课程章节关联资源")
|
|
|
+ @SaCheckPermission("/disk/coursecentry/chapterRelate")
|
|
|
+ @GetMapping("/disk/coursecentry/chapterRelate")
|
|
|
+ public CommonResult<Map<String,Object>> chapterRelate(@Valid ChapterIdParam chapterIdParam, HttpServletRequest req) {
|
|
|
+ Map result=new HashMap();
|
|
|
+ //查回课程关联信息
|
|
|
+ List<Map<String,Object>> courseRelatesList=new ArrayList<>();
|
|
|
+ Map funcTypeParam =new HashMap();
|
|
|
+ funcTypeParam.put("mainId", chapterIdParam.getId());
|
|
|
+ funcTypeParam.put("chapterhourType","1");
|
|
|
+ funcTypeParam.put("funcType",req.getParameter("funcType"));
|
|
|
+ List<CourseRelate> relateList=courseRelateService.wrapperList(funcTypeParam);
|
|
|
+ List<String>funcTypeList=CollStreamUtil.toList(relateList, CourseRelate::getFuncType);
|
|
|
+ Map relateParam =new HashMap();
|
|
|
+ relateParam.put("mainId", req.getParameter("id"));
|
|
|
+ relateParam.put("chapterhourType", "1");
|
|
|
+ //分别查回视频,讲义,字幕,作业,测验等
|
|
|
+ for(String oneFunctype:funcTypeList)
|
|
|
+ {
|
|
|
+ relateParam.put("funcType", oneFunctype);
|
|
|
+ List<Map<String,Object>> videoList=courseRelateService.queryMapList(relateParam);
|
|
|
+ courseRelatesList.addAll(videoList);
|
|
|
+ }
|
|
|
+ result.put("courseRelates", courseRelatesList);
|
|
|
return CommonResult.data(result);
|
|
|
}
|
|
|
|