成绩详情中的验证信息

beetlsql3-dev
Mlxa0324
parent 69f4dc4f81
commit b3364e75b5

@ -45,13 +45,14 @@ public class GeneralQuestionLogScoreInfo extends BaseEntity {
// 题目总数量
@FetchSql("select count(1) from general_question_log t " +
"where 1 = 1 " +
"and t.general_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# "
@FetchSql("SELECT" +
"count(DISTINCT(t.general_resources_question_snapshot_id)) " +
"FROM " +
"general_resources_question_snapshot t " +
"WHERE " +
"1 = 1 " +
"AND t.question_status = 1 " +
"AND t.general_question_setting_id = #generalQuestionSettingId# "
)
private Integer questionTotalCount;

@ -45,13 +45,14 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
// 题目总数量
@FetchSql("select count(1) from teacher_open_course_question_log t " +
"where 1 = 1 " +
"and t.teacher_open_course_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# "
@FetchSql("SELECT " +
"count(DISTINCT ( t.resources_question_snapshot_id )) " +
"FROM " +
"resources_question_snapshot t " +
"WHERE " +
"1 = 1 " +
"AND t.question_status = 1 " +
"AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# "
)
private Integer questionTotalCount;

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

@ -456,7 +456,7 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService<Gen
final Long studentId = student.getStudentId();
generalQuestionSettingService
.validateFinallySubmitThrow(questionSettingId, studentId, "未交卷状态,无法查看成绩!");
.validateFinallySubmitThrow(questionSettingId, studentId, "该试卷暂无题目!", "未交卷状态,无法查看成绩!");
// 给实体类传参数剩下来的交给Fetch 来处理
// 查询符合条件的实体

@ -454,7 +454,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
Long studentId = student.getStudentId();
teacherOpenCourseQuestionSettingService
.validateFinallySubmitThrow(questionSettingId, studentId, "未交卷状态,无法查看成绩!");
.validateFinallySubmitThrow(questionSettingId, studentId, "该试卷暂无题目!", "未交卷状态,无法查看成绩!");
// 给实体类传参数剩下来的交给Fetch 来处理
// 查询符合条件的实体

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.func.Func1;
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;
@ -770,11 +771,12 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
*
* @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)) {
// 查询未提交题目数量,
@ -784,10 +786,26 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1)
.andEq(TeacherOpenCourseQuestionLog::getStudentId, studentId)
.count();
// 查询未提交题目数量,
long allCount = teacherOpenCourseQuestionLogDao.createLambdaQuery()
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionSettingId, questionSettingId)
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1)
.andEq(TeacherOpenCourseQuestionLog::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);
}
}
}

Loading…
Cancel
Save