|
|
@@ -15,11 +15,13 @@ package vip.xiaonuo.disk.controller;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollStreamUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
@@ -28,15 +30,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import vip.xiaonuo.common.annotation.CommonLog;
|
|
|
import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
|
|
-import vip.xiaonuo.disk.domain.Chapter;
|
|
|
-import vip.xiaonuo.disk.domain.ClassHour;
|
|
|
-import vip.xiaonuo.disk.domain.CourseInfo;
|
|
|
-import vip.xiaonuo.disk.domain.CourseRelate;
|
|
|
+import vip.xiaonuo.disk.domain.*;
|
|
|
import vip.xiaonuo.disk.param.*;
|
|
|
-import vip.xiaonuo.disk.service.ChapterService;
|
|
|
-import vip.xiaonuo.disk.service.ClassHourService;
|
|
|
-import vip.xiaonuo.disk.service.CourseInfoService;
|
|
|
-import vip.xiaonuo.disk.service.CourseRelateService;
|
|
|
+import vip.xiaonuo.disk.service.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -68,7 +64,8 @@ public class CourseClassHourController {
|
|
|
private ChapterService chapterService;
|
|
|
@Resource
|
|
|
private CourseInfoService courseInfoService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private CourseChapterKnowledgeService courseChapterKnowledgeService;
|
|
|
/**
|
|
|
* 获取课时表分页
|
|
|
*
|
|
|
@@ -119,17 +116,6 @@ public class CourseClassHourController {
|
|
|
List<CourseRelate> courseRelates = classHourAddParam.getCourseRelates();
|
|
|
if(courseRelates!=null && courseRelates.size()>0)
|
|
|
{
|
|
|
- //2025.8.15,应爽哥要求,考试试卷关联过的要更新一个状态,使其下次不能被选中
|
|
|
- for(CourseRelate one:courseRelates)
|
|
|
- {
|
|
|
- if(one.getFuncType().equals("4")||one.getFuncType().equals("5"))
|
|
|
- {
|
|
|
- Map upPaperSelectParam =new HashMap();
|
|
|
- upPaperSelectParam.put("id", one.getRelateId());
|
|
|
- upPaperSelectParam.put("isSelect", "1");
|
|
|
- classHourService.updatePaperSelect(upPaperSelectParam);
|
|
|
- }
|
|
|
- }
|
|
|
courseRelates = courseRelates.stream()
|
|
|
.peek(oneCourseRelate -> oneCourseRelate.setChapterhourType("1")) // 修改属性
|
|
|
.peek(oneCourseRelate -> oneCourseRelate.setMainId(classHour.getId())) // 修改属性
|
|
|
@@ -149,6 +135,21 @@ public class CourseClassHourController {
|
|
|
List<ClassHour> classHourList =classHourService.wrapperList(param);
|
|
|
courseInfo.setHourCount(String.valueOf(classHourList.size()));
|
|
|
courseInfoService.editOne(courseInfo);
|
|
|
+
|
|
|
+
|
|
|
+ //添加章节,设计知识点关联表
|
|
|
+ List<CourseChapterKnowledge> list=new ArrayList<>();
|
|
|
+ classHourAddParam.getKnowledgeIds().stream().forEach(knowledgeId -> {
|
|
|
+
|
|
|
+ CourseChapterKnowledge courseChapterKnowledge = new CourseChapterKnowledge();
|
|
|
+ courseChapterKnowledge.setCourseId(chapter.getCourseId());
|
|
|
+ courseChapterKnowledge.setChapterId(chapter.getId());
|
|
|
+ courseChapterKnowledge.setHourId(classHour.getId());
|
|
|
+ courseChapterKnowledge.setKnowledgeId(knowledgeId);
|
|
|
+ courseChapterKnowledge.setId(IdUtil.getSnowflake().nextIdStr());
|
|
|
+ list.add(courseChapterKnowledge);
|
|
|
+ });
|
|
|
+ courseChapterKnowledgeService.saveBatch(list);
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -164,8 +165,12 @@ public class CourseClassHourController {
|
|
|
@PostMapping("/disk/hour/edit")
|
|
|
public CommonResult<String> edit(@RequestBody @Valid ClassHourEditParam classHourEditParam) {
|
|
|
ClassHour classHour = classHourService.queryEntity(classHourEditParam.getId());
|
|
|
+ Chapter chapter = chapterService.queryEntity(classHour.getChapterId());
|
|
|
+ CourseInfo courseInfo = courseInfoService.queryEntity(chapter.getCourseId());
|
|
|
+ classHourEditParam.setChapterId(chapter.getId());
|
|
|
BeanUtil.copyProperties(classHourEditParam, classHour);
|
|
|
classHourService.editOne(classHour);
|
|
|
+
|
|
|
//重新添加关联内容
|
|
|
List<CourseRelate> courseRelates = classHourEditParam.getCourseRelates();
|
|
|
if(courseRelates!=null && courseRelates.size()>0)
|
|
|
@@ -178,17 +183,6 @@ public class CourseClassHourController {
|
|
|
List<CourseRelate> delCourseRelateList=courseRelateService.wrapperList(relateParam);
|
|
|
List<String> delCourseRelateIdList=CollStreamUtil.toList(delCourseRelateList, CourseRelate::getId);
|
|
|
courseRelateService.deleteByIdsReal(delCourseRelateIdList);
|
|
|
- //2025.8.15,应爽哥要求,考试试卷关联过的要更新一个状态,使其下次不能被选中
|
|
|
- for(CourseRelate one:courseRelates)
|
|
|
- {
|
|
|
- if(one.getFuncType().equals("4")||one.getFuncType().equals("5"))
|
|
|
- {
|
|
|
- Map upPaperSelectParam =new HashMap();
|
|
|
- upPaperSelectParam.put("id", one.getRelateId());
|
|
|
- upPaperSelectParam.put("isSelect", "1");
|
|
|
- classHourService.updatePaperSelect(upPaperSelectParam);
|
|
|
- }
|
|
|
- }
|
|
|
courseRelates = courseRelates.stream()
|
|
|
.peek(oneCourseRelate -> oneCourseRelate.setChapterhourType("1"))
|
|
|
.peek(oneCourseRelate -> oneCourseRelate.setMainId(classHour.getId())) // 修改属性
|
|
|
@@ -196,6 +190,30 @@ public class CourseClassHourController {
|
|
|
.collect(Collectors.toList());
|
|
|
courseRelateService.addBatch(courseRelates);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //根据章节id和课程id和课时id删除关联表
|
|
|
+ Map<String, Object> knowledgeParam = new HashMap<>();
|
|
|
+ knowledgeParam.put("COURSE_ID", courseInfo.getCourseId());
|
|
|
+ knowledgeParam.put("CHAPTER_ID", classHour.getChapterId());
|
|
|
+ knowledgeParam.put("HOUR_ID", classHour.getId());
|
|
|
+ courseChapterKnowledgeService.removeByMap(knowledgeParam);
|
|
|
+
|
|
|
+ //添加章节,设计知识点关联表
|
|
|
+ List<CourseChapterKnowledge> list=new ArrayList<>();
|
|
|
+ classHourEditParam.getKnowledgeIds().stream().forEach(knowledgeId -> {
|
|
|
+
|
|
|
+ CourseChapterKnowledge courseChapterKnowledge = new CourseChapterKnowledge();
|
|
|
+ courseChapterKnowledge.setCourseId(courseInfo.getCourseId());
|
|
|
+ courseChapterKnowledge.setChapterId(classHour.getChapterId());
|
|
|
+ courseChapterKnowledge.setHourId(classHour.getId());
|
|
|
+ courseChapterKnowledge.setKnowledgeId(knowledgeId);
|
|
|
+ courseChapterKnowledge.setId(IdUtil.getSnowflake().nextIdStr());
|
|
|
+ list.add(courseChapterKnowledge);
|
|
|
+ });
|
|
|
+ courseChapterKnowledgeService.saveBatch(list);
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -263,6 +281,17 @@ public class CourseClassHourController {
|
|
|
}
|
|
|
result.put("courseRelates", courseRelatesList);
|
|
|
|
|
|
+
|
|
|
+ String chapterId=MapUtils.getString(result, "chapterId");
|
|
|
+
|
|
|
+ Chapter chapter = chapterService.queryEntity(chapterId);
|
|
|
+ CourseInfo courseInfo = courseInfoService.queryEntity(chapter.getCourseId());
|
|
|
+
|
|
|
+
|
|
|
+ //根据章节,获得的知识点
|
|
|
+ List<String> knowledegeList=courseChapterKnowledgeService.selectknowledge(courseInfo.getCourseId(),chapterId,classHourIdParam.getId());
|
|
|
+ //章节对应知识点
|
|
|
+ result.put("knowledeges", knowledegeList);
|
|
|
return CommonResult.data(result);
|
|
|
}
|
|
|
|