查看成绩详情判断

beetlsql3-dev
Mlxa0324 2 years ago
parent 43cd07fca5
commit eda0fdf061

@ -621,4 +621,31 @@ public class GeneralQuestionSettingService extends CoreBaseService<GeneralQuesti
}
}
/**
* : <br>
*
*
* @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);
}
}

@ -56,6 +56,7 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
public class GeneralResourcesQuestionSnapshotService extends CoreBaseService<GeneralResourcesQuestionSnapshot>{
@Autowired private GeneralResourcesQuestionSnapshotDao generalResourcesQuestionSnapshotDao;
@Autowired private GeneralQuestionSettingService generalQuestionSettingService;
public PageQuery<GeneralResourcesQuestionSnapshot>queryByCondition(PageQuery query){
PageQuery ret = generalResourcesQuestionSnapshotDao.queryByCondition(query);
@ -452,17 +453,18 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService<Gen
// 查询学生身份
Student student = getStudent();
Assert.notNull(student, "该接口只能学生访问");
final Long studentId = student.getStudentId();
generalQuestionSettingService
.validateFinallySubmitThrow(questionSettingId, studentId, "未交卷状态,无法查看成绩!");
// 给实体类传参数剩下来的交给Fetch 来处理
// 查询符合条件的实体
GeneralQuestionLogScoreInfo scoreInfo = sqlManager.executeQueryOne(
new SQLReady("SELECT " +
"? as general_question_setting_id, " +
"? as student_id ",
questionSettingId, student.getStudentId()
),
GeneralQuestionLogScoreInfo.class
);
"? as student_id ", questionSettingId, studentId), GeneralQuestionLogScoreInfo.class);
dictParser(scoreInfo);
return scoreInfo;
}

@ -451,17 +451,17 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
// 查询学生身份
Student student = getStudent();
Assert.notNull(student, "该接口只能学生访问");
Long studentId = student.getStudentId();
teacherOpenCourseQuestionSettingService
.validateFinallySubmitThrow(questionSettingId, studentId, "未交卷状态,无法查看成绩!");
// 给实体类传参数剩下来的交给Fetch 来处理
// 查询符合条件的实体
TeacherOpenCourseQuestionLogScoreInfo scoreInfo = sqlManager.executeQueryOne(
new SQLReady("SELECT " +
"? as teacher_open_course_question_setting_id, " +
"? as student_id ",
questionSettingId, student.getStudentId()
),
TeacherOpenCourseQuestionLogScoreInfo.class
);
"? as student_id ", questionSettingId, studentId), TeacherOpenCourseQuestionLogScoreInfo.class);
dictParser(scoreInfo);
return scoreInfo;
}

@ -763,4 +763,31 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
@NotNull(message = "题目配置类型不能为空!") ResourcesQuestionSnapshotFromTypeEnum questionSettingType) {
return teacherOpenCourseQuestionSettingDao.analysis(teacherOpenCourseId, questionSettingType);
}
/**
* : <br>
*
*
* @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);
}
}

Loading…
Cancel
Save