考试作业的灵异bug修复

beetlsql3-dev
maLix 2 years ago
parent 53632946cf
commit 9e750fb2a3

@ -716,11 +716,11 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
// 计算学生分数,并标记错题 // 计算学生分数,并标记错题
// calculateScoreOnSubmit(updateList); // calculateScoreOnSubmit(updateList);
// 学生做的题目的答案与日志关联 // 学生做的题目的答案与日志关联
updateBatchTemplate(updateList); // updateBatchTemplate(updateList);
// 添加到题目日志汇总中 // 添加到题目日志汇总中
addQuestionLogSummary(student, questionSetting.getGeneralQuestionSettingId(), updateList); addQuestionLogSummary(student, questionSetting.getGeneralQuestionSettingId(), updateList);
// 最终提交以后将日志更改为2 删除状态,仅用于查看 // 最终提交以后将日志更改为2 删除状态,仅用于查看
deleteGeneralQuestionLog(listJoin(updateList, GeneralQuestionLog::getGeneralQuestionLogId)); deleteGeneralQuestionLog(listJoin(this.getValuesBySettingIds(questionSettingId.toString(), studentId), GeneralQuestionLog::getGeneralQuestionLogId));
} }
} }
@ -814,7 +814,7 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
return; return;
} }
List<GeneralQuestionLog> logList = getValuesBySettingIds(questionSettingId.toString()); List<GeneralQuestionLog> logList = getValuesBySettingIds(questionSettingId.toString(), student.getStudentId());
setErrorSuccessCountField(updateList, logList); setErrorSuccessCountField(updateList, logList);
@ -858,9 +858,10 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
}); });
} }
private List<GeneralQuestionLog> getValuesBySettingIds(String settingIds) { private List<GeneralQuestionLog> getValuesBySettingIds(String settingIds, Long studentId) {
GeneralQuestionLogQuery logQuery = new GeneralQuestionLogQuery(); GeneralQuestionLogQuery logQuery = new GeneralQuestionLogQuery();
logQuery.setGeneralQuestionSettingIdPlural(settingIds); logQuery.setGeneralQuestionSettingIdPlural(settingIds);
logQuery.setStudentId(studentId);
logQuery.setGeneralQuestionLogStatus(1); logQuery.setGeneralQuestionLogStatus(1);
return generalQuestionLogDao.getValuesByQueryNotWithPermission(logQuery); return generalQuestionLogDao.getValuesByQueryNotWithPermission(logQuery);
} }

@ -242,9 +242,10 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
return teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(teacherOpenCourseQuestionLogQuery); return teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(teacherOpenCourseQuestionLogQuery);
} }
public List<TeacherOpenCourseQuestionLog> getValuesBySettingIds (String settingIds){ public List<TeacherOpenCourseQuestionLog> getValuesBySettingIds (String settingIds, Long studentId){
TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery(); TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery();
logQuery.setTeacherOpenCourseQuestionSettingIdPlural(settingIds); logQuery.setTeacherOpenCourseQuestionSettingIdPlural(settingIds);
logQuery.setStudentId(studentId);
logQuery.setTeacherOpenCourseQuestionLogStatus(1); logQuery.setTeacherOpenCourseQuestionLogStatus(1);
return teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(logQuery); return teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(logQuery);
} }
@ -478,21 +479,19 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
.studentId(student.getStudentId()) .studentId(student.getStudentId())
.teacherOpenCourseQuestionSettingId(questionSettingId) .teacherOpenCourseQuestionSettingId(questionSettingId)
.build(); .build();
List<TeacherOpenCourseQuestionLog> logList = teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery); List<TeacherOpenCourseQuestionLog> logListBySnapshotIds = teacherOpenCourseQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery);
final List<QuestionLogAddTypeEnum> tempList = Arrays.asList(PRE_SUBMIT, null); final List<QuestionLogAddTypeEnum> tempList = Arrays.asList(PRE_SUBMIT, null);
// 只是未提交的数据 // 只是未提交的数据
logList = logList.stream().filter(item -> tempList.contains(item.getQuestionLogAddType())).collect(Collectors.toList()); logListBySnapshotIds = logListBySnapshotIds.stream().filter(item -> tempList.contains(item.getQuestionLogAddType())).collect(Collectors.toList());
Assert.notEmpty(logList, "未查询到题目信息!"); Assert.notEmpty(logListBySnapshotIds, "未查询到题目信息!");
// 题目日志IDs汇总
String logsIds = logList.stream().map(item -> item.getTeacherOpenCourseQuestionLogId().toString()).collect(joining(","));
// 当前时间, 存储要更新的题目日志集合 // 当前时间, 存储要更新的题目日志集合
Date now = new Date(); List<TeacherOpenCourseQuestionLog> updateList = new ArrayList<>(); Date now = new Date(); List<TeacherOpenCourseQuestionLog> updateList = new ArrayList<>();
// 代表填空题和分析题的类型 // 代表填空题和分析题的类型
List<Integer> questionType = Arrays.asList(4, 5); List<Integer> questionType = Arrays.asList(4, 5);
// 处理答案和分数 // 处理答案和分数
logList.forEach(questionLog -> { logListBySnapshotIds.forEach(questionLog -> {
// 验证最新的提交时间,防止网络延迟 // 验证最新的提交时间,防止网络延迟
if (!validateQuestionLogAddTimeLatest(questionSettingId, questionLog.getResourcesQuestionSnapshotId().toString(), studentId, addTime)) { if (!validateQuestionLogAddTimeLatest(questionSettingId, questionLog.getResourcesQuestionSnapshotId().toString(), studentId, addTime)) {
return; return;
@ -585,14 +584,14 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
if (addType.equals(FINALLY_SUBMIT)) { if (addType.equals(FINALLY_SUBMIT)) {
// 计算学生分数,并标记错题 // 计算学生分数,并标记错题
// calculateScoreOnSubmit(updateList); // calculateScoreOnSubmit(updateList);
updateBatchTemplate(updateList); // updateBatchTemplate(updateList);
// 添加到题目日志汇总中 // 添加到题目日志汇总中
addQuestionLogSummary(student, questionSettingId, updateList); addQuestionLogSummary(student, questionSettingId, updateList);
// 批量插入错题集错题库方法内部自带分数判断。内部方法更新log中的错题标记。 // 批量插入错题集错题库方法内部自带分数判断。内部方法更新log中的错题标记。
teacherOpenCourseQuestionLogWrongService.insertBatchByQuestionLogList(updateList); teacherOpenCourseQuestionLogWrongService.insertBatchByQuestionLogList(updateList);
// 最终提交以后将日志更改为2 删除状态,仅用于查看 // 最终提交以后将日志更改为2 删除状态,仅用于查看
deleteTeacherOpenCourseQuestionLog(listJoin(updateList, TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogId)); deleteTeacherOpenCourseQuestionLog(listJoin(this.getValuesBySettingIds(questionSettingId.toString(), studentId), TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogId));
} }
} }
@ -691,7 +690,7 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
return; return;
} }
List<TeacherOpenCourseQuestionLog> logList = new CopyOnWriteArrayList<>(getValuesBySettingIds(questionSettingId.toString())); List<TeacherOpenCourseQuestionLog> logList = new CopyOnWriteArrayList<>(getValuesBySettingIds(questionSettingId.toString(), student.getStudentId()));
setErrorSuccessCountField(updateList, logList); setErrorSuccessCountField(updateList, logList);

Loading…
Cancel
Save