diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java index 8295c8bd..2d52e992 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java @@ -50,6 +50,7 @@ import static cn.hutool.core.date.DateUnit.MINUTE; import static cn.hutool.core.util.ArrayUtil.join; import static cn.jlw.util.CacheUserUtil.getStudent; import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; +import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.PRE_SUBMIT; import static java.util.stream.Collectors.groupingBy; /** @@ -561,7 +562,8 @@ public class GeneralQuestionLogService extends CoreBaseService> questionAnalysis(@NotNull(message = "题目配置ID不能为空!") Long questionSettingId, @NotNull(message = "学生ID不能为空!") Long studentId) { @@ -497,6 +499,30 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService questionAnalysisNotType(Long questionSettingId, Long studentId) { + Map> tempMap = questionAnalysis(questionSettingId, studentId); + List collect = tempMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList()); + List result = new ArrayList<>(); + + Map build = MapUtil.builder("courseInfoId", "teacherOpenCourseMergeCourseInfoId").build(); + CopyOptions copyOptions = CopyOptions.create().setFieldMapping(build); + Optional.ofNullable(collect).ifPresent(item -> { + for (TeacherOpenCourseQuestionLog questionLog : item) { + ResourcesQuestionSnapshot resourcesQuestionSnapshot = new ResourcesQuestionSnapshot(); + BeanUtil.copyProperties(questionLog, resourcesQuestionSnapshot, copyOptions); + resourcesQuestionSnapshot.set("teacherOpenCourseQuestionLogAnswer", questionLog.getTeacherOpenCourseQuestionLogAnswer()); + result.add(resourcesQuestionSnapshot); + } + }); + return result; + } + /** * 根据题目快照ID查询题目快照,并根据类型分组 * diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeResourcesQuestionController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeResourcesQuestionController.java index fa50fe36..d273a9fb 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeResourcesQuestionController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseMergeResourcesQuestionController.java @@ -519,13 +519,12 @@ public class TeacherOpenCourseMergeResourcesQuestionController extends BaseContr MyValidateExcelCellDataListener listener = new MyValidateExcelCellDataListener<>(); ExcelUtil.readExcelNotContainHeader(file, TeacherOpenCourseMergeResourcesQuestionImport.class, listener); + // 判断错误的结果集 + Assert.isTrue(MapUtil.isEmpty(listener.getFailMap()), JSONUtil.toJsonStr(listener.getFailMap())); // 类型转换 List options = listener.getData().stream() .map(TeacherOpenCourseMergeResourcesQuestionImport::pojo).collect(Collectors.toList()); - // 判断错误的结果集 - Assert.isTrue(MapUtil.isEmpty(listener.getFailMap()), JSONUtil.toJsonStr(listener.getFailMap())); - // 只复制用户ID和组织ID BeanUtil.beanPropertyCopyToList(user, options, MapUtil.of("id", "userId"), "userId", "orgId"); diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionLogController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionLogController.java index 273d239c..e65e97d4 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionLogController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionLogController.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.jlw.Interceptor.SCoreUser; +import cn.jlw.Interceptor.TStudent; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; @@ -162,12 +163,25 @@ public class TeacherOpenCourseQuestionLogController { * @return */ @PostMapping(API + "/questionAnalysisBySettingId.do") - public JsonResult questionAnalysisBySettingId(Long questionSettingId) { + public JsonResult>> questionAnalysisBySettingId(Long questionSettingId) { Student student = getStudent(); Assert.notNull(student, "非学生身份,无法获取题目分析!"); return JsonResult.success(teacherOpenCourseQuestionLogService.questionAnalysis(questionSettingId, student.getStudentId())); } + + /** + * 学生端-答题后显示答案、和分析。 + * + * @param questionSettingId 题目配置ID + * @return + */ + @PostMapping(API + "/questionAnalysisBySettingId.do") + public JsonResult> questionAnalysisBySettingId(Long questionSettingId, @TStudent Student student) { + Assert.notNull(student, "非学生身份,无法获取题目分析!"); + return JsonResult.success(teacherOpenCourseQuestionLogService.questionAnalysis(questionSettingId, student.getStudentId())); + } + /** * 学生端-教师端-学生总得分列表 * @@ -190,7 +204,7 @@ public class TeacherOpenCourseQuestionLogController { * @return */ @PostMapping(API + "/tuck.do") - public JsonResult tuck(String teacherOpenCourseQuestionLogIds, boolean isTuck) { + public JsonResult tuck(String questionSettingId, String questionSnapshotIds, String teacherOpenCourseQuestionLogIds, boolean isTuck) { teacherOpenCourseQuestionLogService.tuck(teacherOpenCourseQuestionLogIds, isTuck); return JsonResult.success(); } diff --git a/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md b/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md index 07d275e0..7ad1623a 100644 --- a/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md +++ b/web/src/main/resources/sql/jlw/generalResourcesQuestionSnapshot.md @@ -474,7 +474,7 @@ selectStudentAnswerFragment and b.general_question_setting_id = t.general_question_setting_id and b.general_resources_question_snapshot_id = t.general_resources_question_snapshot_id order by general_question_log_add_time desc limit 1 - ) as student_answer + ) as teacher_open_course_question_log_answer @} getValuesByQueryNotWithPermission diff --git a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md index fa7a32c4..3b6e31d9 100644 --- a/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md +++ b/web/src/main/resources/sql/jlw/resourcesQuestionSnapshot.md @@ -482,14 +482,14 @@ selectStudentAnswerFragment * 查询学生的分数 @if(!isEmpty(studentId!)){ - ,(select b.teacher_open_course_question_log_answer - from teacher_open_course_question_log b + ,(select b.general_question_log_answer + from general_question_log b where 1 = 1 and b.student_id = #studentId# - and b.teacher_open_course_question_log_status = 1 - and b.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id - and b.resources_question_snapshot_id = t.resources_question_snapshot_id - order by teacher_open_course_question_log_add_time desc limit 1 - ) as student_answer + and b.general_question_log_status = 1 + and b.general_question_setting_id = t.general_question_setting_id + and b.general_resources_question_snapshot_id = t.general_resources_question_snapshot_id + order by general_question_log_add_time desc limit 1 + ) as general_question_log_answer @}