|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
@ -20,6 +21,7 @@ import com.ibeetl.jlw.dao.StudentDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.dto.QuestionLogAddDTO;
|
|
|
|
|
import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum;
|
|
|
|
|
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
|
|
|
|
|
import com.ibeetl.jlw.web.query.GeneralQuestionLogQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.GeneralQuestionSettingQuery;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -51,6 +53,8 @@ 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 com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
|
|
|
|
|
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.EXAM;
|
|
|
|
|
import static java.util.stream.Collectors.groupingBy;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -622,16 +626,32 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 不是强制发题,则不覆盖现有的题目日志,则继续做题
|
|
|
|
|
// 验证题目日志,是否已经存在试卷
|
|
|
|
|
if(!isReSend) {
|
|
|
|
|
GeneralQuestionLogQuery questionLogQuery = new GeneralQuestionLogQuery();
|
|
|
|
|
questionLogQuery.setStudentId(studentId);
|
|
|
|
|
questionLogQuery.setGeneralQuestionSettingId(setting.getGeneralQuestionSettingId());
|
|
|
|
|
questionLogQuery.setGeneralQuestionLogStatus(1);
|
|
|
|
|
List<GeneralQuestionLog> existsList = getValuesByQueryNotWithPermission(questionLogQuery);
|
|
|
|
|
|
|
|
|
|
// 如果题目日志里存在预先布置的题目,则直接返回
|
|
|
|
|
if (CollectionUtil.isNotEmpty(existsList)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// generalQuestionSettingId:类似试卷ID,题目日志里会出现重复的试卷ID
|
|
|
|
|
// 逻辑删除之前的题目日志,防止学生做题统计数据异常
|
|
|
|
|
// 保证试卷是最新的
|
|
|
|
|
// 考试逻辑删除记录,作业或者章节测试都是直接删除记录。
|
|
|
|
|
// if (setting.getGeneralQuestionSettingType().equals(EXAM)) {
|
|
|
|
|
// logicDeleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// deleteBySettingIds(setting.getGeneralQuestionSettingId().toString());
|
|
|
|
|
// }
|
|
|
|
|
Long teacherOpenCourseQuestionSettingId = setting.getGeneralQuestionSettingId();
|
|
|
|
|
// 强制发题
|
|
|
|
|
if (isReSend) {
|
|
|
|
|
if (setting.getGeneralQuestionSettingType().equals(EXAM)) {
|
|
|
|
|
logicDeleteBySettingIds(teacherOpenCourseQuestionSettingId.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 断言
|
|
|
|
|
Assert.notBlank(resourcesQuestionSnapshots.get(0).getQuestionAnswer(), "题目快照选项不能为空!");
|
|
|
|
@ -764,4 +784,26 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
|
|
|
|
|
public PageQuery<GeneralQuestionLogScoreDetailsInfo> getQuestionLogScoreDetailsInfo(PageQuery query) {
|
|
|
|
|
return generalQuestionLogDao.getQuestionLogScoreDetailsInfo(query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 验证是否需要重新发题,则返回重新发题的标记
|
|
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
|
|
* @param studentId 学生ID
|
|
|
|
|
* @param questionSettingType 题目配置类型
|
|
|
|
|
* @param questionLogAddType 题目日志添加类型(用于判断是否交卷)
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public boolean verifyLogAddTypeIsReSend(Long questionSettingId,
|
|
|
|
|
Long studentId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType,
|
|
|
|
|
QuestionLogAddTypeEnum questionLogAddType) {
|
|
|
|
|
// 只有章节练习,才能进行重发试题的操作
|
|
|
|
|
if (!questionSettingType.equals(CHAPTER_EXERCISE)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isAllNotEmpty(questionSettingId, studentId, questionSettingType, questionLogAddType)) {
|
|
|
|
|
return generalQuestionLogDao.verifyLogAddTypeIsReSend(questionSettingId, studentId, questionSettingType, questionLogAddType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|