From bc4e4bcdcc47788e8c8d45bce36446e1f7839785 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Thu, 1 Dec 2022 10:06:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=B8=88=E7=AB=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E7=9A=84=E5=AD=A6=E7=94=9F=E5=88=86=E6=95=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E6=8F=90=E4=BA=A4=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/GeneralQuestionLogScoreInfo.java | 17 ++++--- ...TeacherOpenCourseQuestionLogScoreInfo.java | 16 +++++-- .../dto/GeneralQuestionTestSimpleInfoDTO.java | 7 +++ ...erOpenCourseQuestionTestSimpleInfoDTO.java | 7 +++ .../jlw/enums/QuestionLogAddTypeEnum.java | 10 +++- .../GeneralQuestionSettingService.java | 4 ++ ...neralResourcesQuestionSnapshotService.java | 18 ++++--- .../ResourcesQuestionSnapshotService.java | 16 +++++-- ...acherOpenCourseQuestionSettingService.java | 7 +++ .../web/GeneralQuestionSettingController.java | 16 +++++++ ...alResourcesQuestionSnapshotController.java | 48 ++++++++++++++----- .../ResourcesQuestionSnapshotController.java | 17 +++---- ...erOpenCourseQuestionSettingController.java | 15 ++++++ .../jlw/generalResourcesQuestionSnapshot.md | 10 ++-- .../sql/jlw/resourcesQuestionSnapshot.md | 10 ++-- 15 files changed, 163 insertions(+), 55 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java index a49b085f..ba8e05c1 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/GeneralQuestionLogScoreInfo.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import lombok.Data; import lombok.EqualsAndHashCode; import org.beetl.sql.annotation.entity.Auto; @@ -34,8 +35,8 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { // 开课题目设置ID private Long generalQuestionSettingId; - // 学生ID - private Long studentId; + // 查询指定的题目分数 + private QuestionLogAddTypeEnum questionLogAddType; // @FetchOne("studentId") // @DictDeep @@ -60,7 +61,7 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { @FetchSql("select count(1) from general_question_log t " + "where 1 = 1 " + - "and t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "and t.general_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -71,7 +72,7 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { // 答错数量 @FetchSql("select count(1) from general_question_log t " + - "where t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "where t.general_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -83,7 +84,7 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { // 总得分 @FetchSql("select sum(IFNULL(t.student_score, 0)) as total_score " + "from general_question_log t " + - "where t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "where t.general_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -102,6 +103,7 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + + "and t.question_log_add_type = #questionLogAddType# " + "and t.general_question_setting_id = #generalQuestionSettingId# " ) private List questionLogList; @@ -111,7 +113,8 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { */ @FetchSql(value = "SELECT max(TIMEDIFF( t.general_question_log_update_time , t.general_question_log_add_time )) as finish_time " + "FROM general_question_log t " + - "WHERE t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "WHERE t.general_question_log_status = 1 " + + "and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -124,7 +127,7 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity { // */ // @FetchSql(value = "SELECT max(ifnull(t.general_question_log_finish_time , 0)) as finish_time " + // "FROM general_question_log t " + -// "WHERE t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + +// "WHERE t.general_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + // "@if(!isEmpty(studentId)) { \n" + // "and t.student_id = #studentId# \n" + // "@} \n" + diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java index 3d22b208..65b10c14 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseQuestionLogScoreInfo.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import lombok.Data; import lombok.EqualsAndHashCode; import org.beetl.sql.annotation.entity.Auto; @@ -36,6 +37,10 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { // 学生ID private Long studentId; + + // 题目提交类型 + + private QuestionLogAddTypeEnum questionAddType; // @FetchOne("studentId") // @DictDeep @@ -60,7 +65,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { @FetchSql("select sum( ifnull( t.student_score > 0 , 0)) from teacher_open_course_question_log t " + "where 1 = 1 " + - "and t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "and t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -70,7 +75,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { // 答错数量 @FetchSql("select sum( ifnull( t.student_score <= 0 , 0)) from teacher_open_course_question_log t " + - "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -81,7 +86,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { // 总得分 @FetchSql("select sum( IFNULL(t.student_score, 0) ) as total_score " + "from teacher_open_course_question_log t " + - "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -99,6 +104,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + + "and t.question_log_add_type = #questionLogAddType# " + "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " ) private List questionLogList; @@ -108,7 +114,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { */ @FetchSql(value = "SELECT max(TIMEDIFF( t.teacher_open_course_question_log_update_time , t.teacher_open_course_question_log_add_time )) as finish_time " + "FROM teacher_open_course_question_log t " + - "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + + "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + "@if(!isEmpty(studentId)) { \n" + "and t.student_id = #studentId# \n" + "@} \n" + @@ -121,7 +127,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity { // */ // @FetchSql(value = "SELECT max(ifnull(t.teacher_open_course_question_log_finish_time , 0)) as finish_time " + // "FROM teacher_open_course_question_log t " + -// "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" + +// "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = #questionLogAddType# \n" + // "@if(!isEmpty(studentId)) { \n" + // "and t.student_id = #studentId# \n" + // "@} \n" + diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/GeneralQuestionTestSimpleInfoDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/GeneralQuestionTestSimpleInfoDTO.java index dffbede2..b74a81ab 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/dto/GeneralQuestionTestSimpleInfoDTO.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/GeneralQuestionTestSimpleInfoDTO.java @@ -2,6 +2,7 @@ package com.ibeetl.jlw.entity.dto; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.ibeetl.admin.core.web.query.PageParam; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum; import lombok.*; import lombok.experimental.Accessors; @@ -34,6 +35,12 @@ public class GeneralQuestionTestSimpleInfoDTO extends PageParam { @NotNull(message = "题目配置类型不能为空!") private ResourcesQuestionSnapshotFromTypeEnum generalQuestionSettingType; + /** + * 题目提交类型(可以查看其他类型的分数占比情况,最好都取最终提交) + * 非必传 + */ + private QuestionLogAddTypeEnum questionLogAddType; + } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionTestSimpleInfoDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionTestSimpleInfoDTO.java index 9e2b1312..941590e0 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionTestSimpleInfoDTO.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/TeacherOpenCourseQuestionTestSimpleInfoDTO.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity.dto; import cn.jlw.validate.ValidateConfig; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.ibeetl.admin.core.web.query.PageParam; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum; import lombok.*; import lombok.experimental.Accessors; @@ -37,6 +38,12 @@ public class TeacherOpenCourseQuestionTestSimpleInfoDTO extends PageParam { @NotNull(message = "题目配置类型不能为空!", groups = ValidateConfig.ADD.class) private ResourcesQuestionSnapshotFromTypeEnum teacherOpenCourseQuestionSettingType; + /** + * 题目提交类型(可以查看其他类型的分数占比情况,最好都取最终提交) + * 非必传 + */ + private QuestionLogAddTypeEnum questionLogAddType; + } diff --git a/web/src/main/java/com/ibeetl/jlw/enums/QuestionLogAddTypeEnum.java b/web/src/main/java/com/ibeetl/jlw/enums/QuestionLogAddTypeEnum.java index b8d4e7eb..a3bc5aae 100644 --- a/web/src/main/java/com/ibeetl/jlw/enums/QuestionLogAddTypeEnum.java +++ b/web/src/main/java/com/ibeetl/jlw/enums/QuestionLogAddTypeEnum.java @@ -30,7 +30,15 @@ public enum QuestionLogAddTypeEnum { LOCK(2, "锁定题目", "题目在选中答案以后,无法更改选项,这个时候需要锁定状态"), FINALLY_SUBMIT(3,"最终提交", "简单理解就是交卷"), // TODO 暂时没用到,后面估计会用 - RE_EXAM_VOIDED(4, "申请重考", "标记这套试卷作废,目前还没用到这个枚举") + RE_EXAM_VOIDED(4, "申请重考", "标记这套试卷作废,目前还没用到这个枚举"), + + // 错题练习 + ERROR_TEST_PRE_SUBMIT(100, "错题练习-预提交", "错题练习-预提交"), + ERROR_TEST_FINALLY_SUBMIT(101, "错题练习-最终提交", "错题练习-最终提交"), + + // 收藏夹练习 + TUCK_PRE_SUBMIT(200, "收藏夹练习-预提交", "错题练习-预提交"), + TUCK_FINALLY_SUBMIT(201, "收藏夹练习-预提交", "错题练习-最终提交") ; final private Integer code; diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java index 25bf90f5..2c785067 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java @@ -669,4 +669,8 @@ public class GeneralQuestionSettingService extends CoreBaseService getQuestionTestSimpleInfo(GeneralQuestionTestSimpleInfoDTO query) { + public PageQuery getQuestionTestSimpleInfo(@NotNull GeneralQuestionTestSimpleInfoDTO query) { Student student = getStudent(); Assert.notNull(student, "该接口只允许学生访问"); PageQuery pageQuery = query.getPageQuery(); pageQuery.setPara("studentId", student.getStudentId()); + // 默认只查询普通最终提交 + query.setQuestionLogAddType(defaultIfNull(query.getQuestionLogAddType(), FINALLY_SUBMIT)); PageQuery questionTestSimpleInfo = generalResourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(pageQuery); dictParser(questionTestSimpleInfo.getList()); return questionTestSimpleInfo; @@ -445,10 +450,12 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService getQuestionTestSimpleInfo(TeacherOpenCourseQuestionTestSimpleInfoDTO query) { + public PageQuery getQuestionTestSimpleInfo(@NotNull TeacherOpenCourseQuestionTestSimpleInfoDTO query) { Student student = getStudent(); Assert.notNull(student, "该接口只允许学生访问"); PageQuery pageQuery = query.getPageQuery(); pageQuery.setPara("studentId", student.getStudentId()); + // 默认只查询普通最终提交 + query.setQuestionLogAddType(defaultIfNull(query.getQuestionLogAddType(), FINALLY_SUBMIT)); PageQuery questionTestSimpleInfo = resourcesQuestionSnapshotDao.getQuestionTestSimpleInfo(pageQuery); dictParser(questionTestSimpleInfo.getList()); return questionTestSimpleInfo; diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java index 264804c9..0011379d 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java @@ -808,4 +808,11 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService + * 错题练习,错题库根据试卷来 + * + * @param questionSettingIds + * @param coreUser + * @return {@link JsonResult} + * @Author: 87966 + * @Date: 2022/12/1 9:27 + */ + @PostMapping(API + "/errorQuestionTest.do") + public JsonResult errorQuestionTest(Long questionSettingIds, @SCoreUser CoreUser coreUser){ + return JsonResult.success(generalQuestionSettingService.errorQuestionTest(questionSettingIds, getStudent())); + } + /** * 编辑发布状态 * @param ids diff --git a/web/src/main/java/com/ibeetl/jlw/web/GeneralResourcesQuestionSnapshotController.java b/web/src/main/java/com/ibeetl/jlw/web/GeneralResourcesQuestionSnapshotController.java index 3c6c39d1..f1894330 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/GeneralResourcesQuestionSnapshotController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/GeneralResourcesQuestionSnapshotController.java @@ -15,6 +15,7 @@ import com.ibeetl.jlw.entity.FileEntity; import com.ibeetl.jlw.entity.GeneralQuestionLogScoreInfo; import com.ibeetl.jlw.entity.GeneralResourcesQuestionSnapshot; import com.ibeetl.jlw.entity.dto.GeneralQuestionTestSimpleInfoDTO; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.service.GeneralResourcesQuestionSnapshotService; import com.ibeetl.jlw.web.query.GeneralResourcesQuestionSnapshotQuery; import org.apache.commons.lang3.StringUtils; @@ -28,10 +29,7 @@ import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -100,11 +98,13 @@ public class GeneralResourcesQuestionSnapshotController{ /** * 学生端-查询分数信息 + * 查询指定题目提交类型 * * 支持根据来源类型查询 * 考试完以后,查看分数情况。 * * @param questionSettingId 题目配置ID + * @param questionAddType 题目提交类型 * @param coreUser * @return */ @@ -112,9 +112,25 @@ public class GeneralResourcesQuestionSnapshotController{ @ResponseBody public JsonResult getScoreInfoDo( Long questionSettingId, + @RequestParam(required = false, defaultValue = "FINALLY_SUBMIT") QuestionLogAddTypeEnum questionAddType, @SCoreUser CoreUser coreUser) { - return JsonResult.success(generalResourcesQuestionSnapshotService.getScoreInfo(questionSettingId)); + return JsonResult.success(generalResourcesQuestionSnapshotService.getScoreInfo(questionSettingId, questionAddType)); + } + + /** + * 学生端-获取章节练习的简单信息 + * 支持根据来源类型查询 + * + * @param dto 分页参数 + * @param coreUser + * @return + */ + @PostMapping(API + "/getQuestionTestSimpleInfo.do") + public JsonResult getQuestionTestSimpleInfoDo(@Validated GeneralQuestionTestSimpleInfoDTO dto, + @SCoreUser CoreUser coreUser) { + Assert.isTrue(coreUser.isStudent(), "非学生身份,无法获取数据!"); + return JsonResult.success(generalResourcesQuestionSnapshotService.getQuestionTestSimpleInfo(dto)); } @@ -447,18 +463,24 @@ public class GeneralResourcesQuestionSnapshotController{ } /** - * 学生端-获取章节练习的简单信息 + * 学生端-查询分数信息 + * * 支持根据来源类型查询 + * 考试完以后,查看分数情况。 * - * @param dto 分页参数 + * @param questionSettingId 开课题目配置ID + * @param questionAddType 题目提交类型 * @param coreUser * @return */ - @PostMapping(API + "/getQuestionTestSimpleInfo.do") - public JsonResult getQuestionTestSimpleInfoDo(@Validated GeneralQuestionTestSimpleInfoDTO dto, - @SCoreUser CoreUser coreUser) { - Assert.isTrue(coreUser.isStudent(), "非学生身份,无法获取数据!"); - return JsonResult.success(generalResourcesQuestionSnapshotService.getQuestionTestSimpleInfo(dto)); + @PostMapping(MODEL + "/getScoreInfo.json") + @Function("teacherOpenCourseQuestionLog.query") + @ResponseBody + public JsonResult getScoreInfo( + Long questionSettingId, + @RequestParam(required = false, defaultValue = "FINALLY_SUBMIT") QuestionLogAddTypeEnum questionAddType, + @SCoreUser + CoreUser coreUser) { + return JsonResult.success(generalResourcesQuestionSnapshotService.getScoreInfo(questionSettingId, questionAddType)); } - } diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java index 26d7bc3c..63e0ce24 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java @@ -14,6 +14,7 @@ import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionLogScoreInfo; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionTestDetailDTO; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseQuestionTestSimpleInfoDTO; import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionTestDetailVO; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.service.ResourcesQuestionSnapshotService; import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery; import org.apache.commons.lang3.StringUtils; @@ -23,10 +24,7 @@ import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.io.IOException; @@ -113,9 +111,10 @@ public class ResourcesQuestionSnapshotController extends BaseController { @ResponseBody public JsonResult getScoreInfoDo( Long questionSettingId, + @RequestParam(required = false, defaultValue = "FINALLY_SUBMIT") QuestionLogAddTypeEnum questionAddType, @SCoreUser CoreUser coreUser) { - return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(questionSettingId)); + return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(questionSettingId, questionAddType)); } /** @@ -298,7 +297,8 @@ public class ResourcesQuestionSnapshotController extends BaseController { * 支持根据来源类型查询 * 考试完以后,查看分数情况。 * - * @param teacherOpenCourseQuestionSettingId 开课题目配置ID + * @param questionSettingId 开课题目配置ID + * @param questionAddType 题目提交类型 * @param coreUser * @return */ @@ -306,10 +306,11 @@ public class ResourcesQuestionSnapshotController extends BaseController { @Function("teacherOpenCourseQuestionLog.query") @ResponseBody public JsonResult getScoreInfo( - Long teacherOpenCourseQuestionSettingId, + Long questionSettingId, + @RequestParam(required = false, defaultValue = "FINALLY_SUBMIT") QuestionLogAddTypeEnum questionAddType, @SCoreUser CoreUser coreUser) { - return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(teacherOpenCourseQuestionSettingId)); + return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(questionSettingId, questionAddType)); } /** diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java index 352948c0..81b8ff12 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java @@ -139,6 +139,21 @@ public class TeacherOpenCourseQuestionSettingController{ return JsonResult.success(teacherOpenCourseQuestionSettingService.analysis(teacherOpenCourseId, questionSettingType)); } + /** + * 功能描述:
+ * 错题练习,错题库根据试卷来 + * + * @param questionSettingId 题目配置ID(试卷ID) + * @param coreUser 登录用户 + * @return {@link JsonResult} + * @Author: 87966 + * @Date: 2022/12/1 9:27 + */ + @PostMapping(API + "/errorQuestionTest.do") + public JsonResult errorQuestionTest(Long questionSettingId, @SCoreUser CoreUser coreUser){ + return JsonResult.success(teacherOpenCourseQuestionSettingService.errorQuestionTest(questionSettingId, getStudent())); + } + /** * 逻辑删除 * @param ids diff --git a/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md b/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md index 5b72b021..d8b24902 100644 --- a/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md +++ b/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md @@ -812,7 +812,7 @@ getQuestionTestSimpleInfo SELECT sum( @ // 已经交卷的状态才算分 - CASE WHEN ta.question_log_add_type = 'FINALLY_SUBMIT' THEN IFNULL( ta.student_score, 0 ) ELSE 0 END + CASE WHEN ta.question_log_add_type = #questionLogAddType# THEN IFNULL( ta.student_score, 0 ) ELSE 0 END ) FROM general_question_log ta @@ -841,7 +841,7 @@ getQuestionTestSimpleInfo tc.general_question_setting_id = t.general_question_setting_id AND tc.general_question_log_status = 1 @ // 是否已交卷 - AND tc.question_log_add_type = 'FINALLY_SUBMIT' + AND tc.question_log_add_type = #questionLogAddType# LIMIT 1 ) AS is_finished, ( @@ -851,7 +851,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and td.student_id = #studentId# @} - and td.question_log_add_type = 'FINALLY_SUBMIT' + and td.question_log_add_type = #questionLogAddType# and td.general_question_setting_id = t.general_question_setting_id AND td.general_question_log_update_time IS NOT NULL ) as finish_time, @@ -862,7 +862,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and te.student_id = #studentId# @} - and te.question_log_add_type = 'FINALLY_SUBMIT' + and te.question_log_add_type = #questionLogAddType# and te.general_question_setting_id = t.general_question_setting_id AND te.general_question_log_update_time IS NOT NULL ) as finish_second_time, @@ -874,7 +874,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and tf.student_id = #studentId# @} - and tf.question_log_add_type = 'FINALLY_SUBMIT' + and tf.question_log_add_type = #questionLogAddType# and tf.general_question_setting_id = t.general_question_setting_id AND tf.general_question_log_update_time IS NOT NULL ) as correct_rate diff --git a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md index 52562833..b6ef0be8 100644 --- a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md +++ b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md @@ -600,7 +600,7 @@ getQuestionTestSimpleInfo SELECT sum( @ // 已经交卷的状态才算分 - CASE WHEN ta.question_log_add_type = 'FINALLY_SUBMIT' THEN IFNULL( ta.student_score, 0 ) ELSE 0 END + CASE WHEN ta.question_log_add_type = #questionLogAddType# THEN IFNULL( ta.student_score, 0 ) ELSE 0 END ) FROM teacher_open_course_question_log ta @@ -629,7 +629,7 @@ getQuestionTestSimpleInfo tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND tc.teacher_open_course_question_log_status = 1 @ // 是否已交卷 - AND tc.question_log_add_type = 'FINALLY_SUBMIT' + AND tc.question_log_add_type = #questionLogAddType# LIMIT 1 ) AS is_finished, ( @@ -639,7 +639,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and td.student_id = #studentId# @} - and td.question_log_add_type = 'FINALLY_SUBMIT' + and td.question_log_add_type = #questionLogAddType# and td.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND td.teacher_open_course_question_log_update_time IS NOT NULL ) as finish_time, @@ -650,7 +650,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and te.student_id = #studentId# @} - and te.question_log_add_type = 'FINALLY_SUBMIT' + and te.question_log_add_type = #questionLogAddType# and te.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND te.teacher_open_course_question_log_update_time IS NOT NULL ) as finish_second_time, @@ -662,7 +662,7 @@ getQuestionTestSimpleInfo @if(!isEmpty(studentId)) { and tf.student_id = #studentId# @} - and tf.question_log_add_type = 'FINALLY_SUBMIT' + and tf.question_log_add_type = #questionLogAddType# and tf.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND tf.teacher_open_course_question_log_update_time IS NOT NULL ) as correct_rate