From eda0fdf061188aff3a4848e243258fd2b6e9c891 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Wed, 30 Nov 2022 23:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=88=90=E7=BB=A9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GeneralQuestionSettingService.java | 27 +++++++++++++++++++ ...neralResourcesQuestionSnapshotService.java | 12 +++++---- .../ResourcesQuestionSnapshotService.java | 10 +++---- ...acherOpenCourseQuestionSettingService.java | 27 +++++++++++++++++++ 4 files changed, 66 insertions(+), 10 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java index c36dc63c..3a640f2f 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionSettingService.java @@ -621,4 +621,31 @@ public class GeneralQuestionSettingService extends CoreBaseService + * 验证学生是否提交试卷 + * + * @param questionSettingId 题目配置ID + * @param studentId 学生ID + * @param throwMessage 异常的信息外部定义 + * @Author: lx + * @Date: 2022/11/30 23:51 + */ + public void validateFinallySubmitThrow(Long questionSettingId, Long studentId, String throwMessage) { + 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(); + // 为空代表,试卷是完全提交的状态,这样判断比较保险一些 + isZeroCount = notSubmitCount == 0; + } + // 异常的消息,交给调用方来定义 + Assert.isTrue(isZeroCount, throwMessage); + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java index a9077fa4..ccf8558f 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralResourcesQuestionSnapshotService.java @@ -56,6 +56,7 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue; public class GeneralResourcesQuestionSnapshotService extends CoreBaseService{ @Autowired private GeneralResourcesQuestionSnapshotDao generalResourcesQuestionSnapshotDao; + @Autowired private GeneralQuestionSettingService generalQuestionSettingService; public PageQueryqueryByCondition(PageQuery query){ PageQuery ret = generalResourcesQuestionSnapshotDao.queryByCondition(query); @@ -452,17 +453,18 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService + * 验证学生是否提交试卷 + * + * @param questionSettingId 题目配置ID + * @param studentId 学生ID + * @param throwMessage 异常的信息外部定义 + * @Author: lx + * @Date: 2022/11/30 23:51 + */ + public void validateFinallySubmitThrow(Long questionSettingId, Long studentId, String throwMessage) { + boolean isZeroCount = false; + if (!ObjectUtil.isAllNotEmpty(questionSettingId, studentId)) { + // 查询未提交题目数量, + long notSubmitCount = teacherOpenCourseQuestionLogDao.createLambdaQuery() + .andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionSettingId, questionSettingId) + .andNotEq(TeacherOpenCourseQuestionLog::getQuestionLogAddType, FINALLY_SUBMIT) + .andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1) + .andEq(TeacherOpenCourseQuestionLog::getStudentId, studentId) + .count(); + // 为空代表,试卷是完全提交的状态,这样判断比较保险一些 + isZeroCount = notSubmitCount == 0; + } + // 异常的消息,交给调用方来定义 + Assert.isTrue(isZeroCount, throwMessage); + } }