改字段名,学生提交的答案

beetlsql3-dev
Mlxa0324 2 years ago
parent 89926dd4b7
commit 9b64f1f4b0

@ -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<GeneralQuestionLo
if (!validateQuestionLogAddTimeLatest(questionSettingId, questionLog.getGeneralResourcesQuestionSnapshotId().toString(), studentId, addTime)) {
return;
}
Assert.isTrue(!questionLog.getQuestionLogAddType().equals(addType), "无法再次提交答案,题目已完成!");
Assert.isTrue(null == questionLog.getQuestionLogAddType()
|| addType.equals(PRE_SUBMIT), "无法再次提交答案,题目已完成!");
// 学生提交的答案
String answersText = join(questionLogMap.get(questionLog.getGeneralResourcesQuestionSnapshotId().toString()).split(","), ",");
// 是否是正确答案

@ -1,9 +1,11 @@
package com.ibeetl.jlw.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ReUtil;
import cn.jlw.util.ToolUtils;
@ -485,7 +487,7 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
/**
* ID
*
* @param questionSettingId
* @param questionSettingId ID
* @return
*/
public Map<Integer, List<TeacherOpenCourseQuestionLog>> questionAnalysis(@NotNull(message = "题目配置ID不能为空") Long questionSettingId, @NotNull(message = "学生ID不能为空") Long studentId) {
@ -497,6 +499,30 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
return questionAnalysis(valuesByQuery);
}
/**
*
* @param questionSettingId ID
* @param studentId ID
* @return
*/
private List<ResourcesQuestionSnapshot> questionAnalysisNotType(Long questionSettingId, Long studentId) {
Map<Integer, List<TeacherOpenCourseQuestionLog>> tempMap = questionAnalysis(questionSettingId, studentId);
List<TeacherOpenCourseQuestionLog> collect = tempMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
List<ResourcesQuestionSnapshot> result = new ArrayList<>();
Map<String, String> 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
*

@ -519,13 +519,12 @@ public class TeacherOpenCourseMergeResourcesQuestionController extends BaseContr
MyValidateExcelCellDataListener<TeacherOpenCourseMergeResourcesQuestionImport> listener = new MyValidateExcelCellDataListener<>();
ExcelUtil.readExcelNotContainHeader(file, TeacherOpenCourseMergeResourcesQuestionImport.class, listener);
// 判断错误的结果集
Assert.isTrue(MapUtil.isEmpty(listener.getFailMap()), JSONUtil.toJsonStr(listener.getFailMap()));
// 类型转换
List<TeacherOpenCourseMergeResourcesQuestion> 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");

@ -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<Map<Integer, List<TeacherOpenCourseQuestionLog>>> 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<List<TeacherOpenCourseQuestionLog>> 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();
}

@ -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

@ -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
@}

Loading…
Cancel
Save