差个选项打乱功能

beetlsql3-dev
Mlxa0324 2 years ago
parent 62da14583e
commit d68e7d0757

@ -50,7 +50,6 @@ 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.ResourcesQuestionSnapshotFromTypeEnum.EXAM;
import static java.util.stream.Collectors.groupingBy;
/**
@ -603,13 +602,16 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
/**
* ID
*
* @param studentId
* @param setting
* @param resourcesQuestionSnapshots
* @param studentId ID
* @param setting
* @param resourcesQuestionSnapshots
* @param isReSend
*/
public void preSubmitStudentQuestionLog(@NotNull(message = "学生ID不能为空") final Long studentId,
@NotNull(message = "题目配置不能为空!") final GeneralQuestionSetting setting,
@NotEmpty(message = "题目快照列表不能为空!") List<GeneralResourcesQuestionSnapshot> resourcesQuestionSnapshots) {
@NotEmpty(message = "题目快照列表不能为空!") List<GeneralResourcesQuestionSnapshot> resourcesQuestionSnapshots,
boolean isReSend
) {
if (CollectionUtil.isEmpty(resourcesQuestionSnapshots)) {
return;
@ -619,12 +621,12 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
// 逻辑删除之前的题目日志,防止学生做题统计数据异常
// 保证试卷是最新的
// 考试逻辑删除记录,作业或者章节测试都是直接删除记录。
if (setting.getGeneralQuestionSettingType().equals(EXAM)) {
logicDeleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
}
else {
deleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
}
// if (setting.getGeneralQuestionSettingType().equals(EXAM)) {
// logicDeleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
// }
// else {
// deleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
// }
// 断言
Assert.notBlank(resourcesQuestionSnapshots.get(0).getQuestionAnswer(), "题目快照选项不能为空!");

@ -519,7 +519,7 @@ public class GeneralQuestionSettingService extends CoreBaseService<GeneralQuesti
// 学生身份屏蔽答案,且记录在做题日志表中,这里不为空的判断有点多余
if (student != null) {
// 做题日志关联学生, 初步提交做题日志信息,不包含学生提交的答案和得分情况
generalQuestionLogService.preSubmitStudentQuestionLog(student.getStudentId(), hwSetting, resourcesQuestionSnapshots);
generalQuestionLogService.preSubmitStudentQuestionLog(student.getStudentId(), hwSetting, resourcesQuestionSnapshots, false);
// 学生身份,需要屏蔽答案,再丢给前端
resourcesQuestionSnapshots.forEach(GeneralResourcesQuestionSnapshot::hideAnswer);
}

@ -415,27 +415,49 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
/**
* ID
*
* @param studentId
* @param studentId ID
* @param setting
* @param resourcesQuestionSnapshots
* @param isReSend
*/
public void preSubmitStudentQuestionLog(@NotNull(message = "学生ID不能为空") final Long studentId,
@NotNull(message = "题目配置ID不能为空") TeacherOpenCourseQuestionSetting setting,
@NotEmpty(message = "题目快照列表不能为空!") List<ResourcesQuestionSnapshot> resourcesQuestionSnapshots) {
@NotEmpty(message = "题目快照列表不能为空!") List<ResourcesQuestionSnapshot> resourcesQuestionSnapshots,
boolean isReSend
) {
if (CollectionUtil.isEmpty(resourcesQuestionSnapshots)) {
return;
}
// 不是强制发题,则不覆盖现有的题目日志,则继续做题
if(!isReSend) {
TeacherOpenCourseQuestionLogQuery questionLogQuery = new TeacherOpenCourseQuestionLogQuery();
questionLogQuery.setStudentId(studentId);
questionLogQuery.setTeacherOpenCourseQuestionSettingId(setting.getTeacherOpenCourseQuestionSettingId());
questionLogQuery.setTeacherOpenCourseQuestionLogStatus(1);
List<TeacherOpenCourseQuestionLog> existsList = getValuesByQueryNotWithPermission(questionLogQuery);
// 如果题目日志里存在预先布置的题目,则直接返回
if (CollectionUtil.isNotEmpty(existsList)) {
return;
}
}
// teacherOpenCourseQuestionSettingId类似试卷ID题目日志里会出现重复的试卷ID
// 逻辑删除之前的题目日志,防止学生做题统计数据异常
// 保证试卷是最新的
// 考试逻辑删除记录,作业或者章节测试都是直接删除记录。
Long teacherOpenCourseQuestionSettingId = setting.getTeacherOpenCourseQuestionSettingId();
// 强制发题
if (isReSend) {
if (setting.getTeacherOpenCourseQuestionSettingType().equals(EXAM)) {
logicDeleteBySettingIds(teacherOpenCourseQuestionSettingId.toString());
}
else {
deleteBySettingIds(teacherOpenCourseQuestionSettingId.toString());
}
}
// 断言
Assert.notBlank(resourcesQuestionSnapshots.get(0).getQuestionAnswer(), "题目快照选项不能为空!");

@ -710,7 +710,7 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
// 学生身份屏蔽答案,且记录在做题日志表中,这里不为空的判断有点多余
if (student != null) {
// 做题日志关联学生, 初步提交做题日志信息,不包含学生提交的答案和得分情况
teacherOpenCourseQuestionLogService.preSubmitStudentQuestionLog(student.getStudentId(), hwSetting, resourcesQuestionSnapshots);
teacherOpenCourseQuestionLogService.preSubmitStudentQuestionLog(student.getStudentId(), hwSetting, resourcesQuestionSnapshots, false);
// 学生身份,需要屏蔽答案,再丢给前端
resourcesQuestionSnapshots.forEach(ResourcesQuestionSnapshot::hideAnswer);
}

Loading…
Cancel
Save