|
|
|
@ -3,6 +3,7 @@ package com.ibeetl.jlw.service;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.jlw.util.EnumUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import cn.jlw.validate.ValidateConfig;
|
|
|
|
@ -629,25 +630,42 @@ public class GeneralQuestionSettingService extends CoreBaseService<GeneralQuesti
|
|
|
|
|
*
|
|
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
|
|
* @param studentId 学生ID
|
|
|
|
|
* @param throwMessage 异常的信息外部定义
|
|
|
|
|
* @param nothingThrowMessage 没找到任何题目时候异常信息
|
|
|
|
|
* @param notSubmitThrowMessage 异常的信息外部定义
|
|
|
|
|
* @Author: lx
|
|
|
|
|
* @Date: 2022/11/30 23:51
|
|
|
|
|
*/
|
|
|
|
|
public void validateFinallySubmitThrow(Long questionSettingId, Long studentId, String throwMessage) {
|
|
|
|
|
public void validateFinallySubmitThrow(Long questionSettingId, Long studentId, String nothingThrowMessage, String notSubmitThrowMessage) {
|
|
|
|
|
boolean isZeroCount = false;
|
|
|
|
|
if (ObjectUtil.isAllNotEmpty(questionSettingId, studentId)) {
|
|
|
|
|
// 查询未提交题目数量,
|
|
|
|
|
// 查询未提交题目数量
|
|
|
|
|
long notSubmitCount = generalQuestionLogDao.createLambdaQuery()
|
|
|
|
|
.andEq(GeneralQuestionLog::getGeneralQuestionSettingId, questionSettingId)
|
|
|
|
|
.andNotEq(GeneralQuestionLog::getQuestionLogAddType, FINALLY_SUBMIT)
|
|
|
|
|
.andEq(GeneralQuestionLog::getGeneralQuestionLogStatus, 1)
|
|
|
|
|
.andEq(GeneralQuestionLog::getStudentId, studentId)
|
|
|
|
|
.count();
|
|
|
|
|
|
|
|
|
|
// 查询所有日志题目
|
|
|
|
|
long allCount = generalQuestionLogDao.createLambdaQuery()
|
|
|
|
|
.andEq(GeneralQuestionLog::getGeneralQuestionSettingId, questionSettingId)
|
|
|
|
|
.andEq(GeneralQuestionLog::getGeneralQuestionLogStatus, 1)
|
|
|
|
|
.andEq(GeneralQuestionLog::getStudentId, studentId)
|
|
|
|
|
.count();
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(nothingThrowMessage)) {
|
|
|
|
|
// 验证这个试卷是否有题目
|
|
|
|
|
Assert.isTrue(allCount > 0, nothingThrowMessage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 为空代表,试卷是完全提交的状态,这样判断比较保险一些
|
|
|
|
|
isZeroCount = notSubmitCount == 0;
|
|
|
|
|
}
|
|
|
|
|
// 异常的消息,交给调用方来定义
|
|
|
|
|
Assert.isTrue(isZeroCount, throwMessage);
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(notSubmitThrowMessage)) {
|
|
|
|
|
// 异常的消息,交给调用方来定义
|
|
|
|
|
Assert.isTrue(isZeroCount, notSubmitThrowMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|