浏览代码

新增训练说明

zouxuan 9 月之前
父节点
当前提交
3c3104ff4f

+ 98 - 0
mec-application/src/main/java/com/ym/mec/student/controller/open/OpenLessonExaminationController.java

@@ -0,0 +1,98 @@
+package com.ym.mec.student.controller.open;
+
+
+import com.ym.mec.biz.dal.dto.CourseHomeworkWrapper;
+import com.ym.mec.biz.dal.dto.LessonExaminationResultDto;
+import com.ym.mec.biz.dal.dto.StudentLessonExaminationDto;
+import com.ym.mec.biz.dal.dto.StudentLessonTrainingDetailWrapper;
+import com.ym.mec.biz.dal.entity.StudentCourseHomework;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.enums.ELessonTrainingType;
+import com.ym.mec.biz.dal.page.LessonExaminationQueryInfo;
+import com.ym.mec.biz.dal.page.StudentLessonExaminationQueryInfo;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.util.CollectionUtils;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Api(tags = "进度评测表")
+@RestController
+@RequestMapping("${app-config.url.student:}/open/")
+public class OpenLessonExaminationController extends BaseController {
+
+    @Resource
+    private LessonExaminationService lessonExaminationService;
+    @Resource
+    private StudentLessonExaminationService studentLessonExaminationService;
+    @Resource
+    private CourseHomeworkService courseHomeworkService;
+    @Resource
+    private StudentCourseHomeworkService studentCourseHomeworkService;
+    @Resource
+    private SubjectService subjectService;
+
+    @ApiOperation(value = "获取学员列表")
+    @PostMapping("studentLessonExamination/queryPage")
+    public HttpResponseResult<PageInfo<StudentLessonExaminationDto>> queryPage(@RequestBody StudentLessonExaminationQueryInfo queryInfo) {
+        return succeed(studentLessonExaminationService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "获取单个作业")
+    @GetMapping("lessonExamination/getOne")
+    public HttpResponseResult<LessonExaminationResultDto> queryPage(Long lessonExaminationId) {
+        LessonExaminationQueryInfo queryInfo = new LessonExaminationQueryInfo();
+        queryInfo.setLessonExaminationId(lessonExaminationId);
+        LessonExaminationResultDto resultDto = lessonExaminationService.queryPage(queryInfo).getRows().get(0);
+        return succeed(resultDto);
+    }
+
+    @ApiOperation(value = "获取作业详情")
+    @GetMapping(value = "courseHomework/findCourseHomeworkDetail")
+    public HttpResponseResult<CourseHomeworkWrapper.CourseHomeworkList> findCourseHomeworkDetail(Integer courseScheduleId, ELessonTrainingType type){
+        if (ELessonTrainingType.HOMEWORK.equals(type)) {
+
+            return succeed(courseHomeworkService.findCourseHomeworkDetail(courseScheduleId));
+        } else {
+            return succeed(courseHomeworkService.findCourseExtraHomeworkDetail(courseScheduleId));
+        }
+    }
+
+    @ApiOperation(value = "根据课程计划获取需要交作业的学生声部-公用")
+    @PostMapping("findCourseStudentsSubjectPublic/v2")
+    public HttpResponseResult<List<Subject>> findCourseStudentsSubjectPublicV2(@Validated @RequestBody StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query){
+        List<StudentCourseHomework> studentCourseHomeworkByCourseV2;
+        if(ELessonTrainingType.HOMEWORK.equals(query.getType())){
+            if (Objects.isNull(query.getCourseScheduleId())) {
+                throw new BizException("请指定课程");
+            }
+            studentCourseHomeworkByCourseV2 = studentCourseHomeworkService.findStudentCourseHomeworkByCourseV2(
+                    query);
+        }else{
+            studentCourseHomeworkByCourseV2 = studentCourseHomeworkService.findExtraExerciseStudentsV2(query);
+        }
+
+        if (CollectionUtils.isEmpty(studentCourseHomeworkByCourseV2)) {
+            return succeed(new ArrayList<>());
+        }
+        // 获取声部
+        List<Integer> collect = studentCourseHomeworkByCourseV2.stream().map(StudentCourseHomework::getSubjectId).collect(
+                Collectors.toList());
+
+        return succeed(subjectService.findBySubjectByIdList(collect));
+
+    }
+
+}
+