考试验证

beetlsql3-dev
Mlxa0324 2 years ago
parent 23205808f2
commit 9dd2db6ede

@ -138,6 +138,7 @@ public class GetFile implements HandlerMethodArgumentResolver {
String name = part.getName();
try {
part.getInputStream();
part.write("/" + part.getSubmittedFileName());
} catch (IOException e) {
throw new RuntimeException(e);
}

@ -7,14 +7,18 @@ import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import com.ibeetl.jlw.web.query.GeneralQuestionLogQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.query.LambdaQuery;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.annotation.Update;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Dao
@ -79,5 +83,31 @@ public interface GeneralQuestionLogDao extends BaseMapper<GeneralQuestionLog> {
*/
boolean verifyLogAddTypeIsReSend(Long questionSettingId, Long studentId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, QuestionLogAddTypeEnum questionLogAddType);
/**
* : <br>
* ID
*
* @param questionSettingId ID
* @param type
* @return {@link long}
* @Author: lx
* @Date: 2022/12/6 22:59
*/
default long getCountByQuestionLogAddType(@NotNull Long questionSettingId, String ...type) {
LambdaQuery<GeneralQuestionLog> lambdaQuery = createLambdaQuery();
LambdaQuery<GeneralQuestionLog> andCondition = lambdaQuery.condition();
boolean isNull = Arrays.stream(type).anyMatch(item -> item == null);
List<String> notNullList = Arrays.stream(type).filter(item -> item != null).collect(Collectors.toList());
// 是否添加Null条件
andCondition = isNull ? andCondition.andIsNull(GeneralQuestionLog::getQuestionLogAddType) : andCondition;
andCondition.orIn(GeneralQuestionLog::getQuestionLogAddType, notNullList);
return lambdaQuery.and(andCondition)
.andEq(GeneralQuestionLog::getGeneralQuestionLogStatus, 1)
.andEq(GeneralQuestionLog::getGeneralQuestionSettingId, questionSettingId)
.count();
}
}

@ -6,13 +6,17 @@ import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionLogQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.query.LambdaQuery;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.annotation.Update;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* Dao
@ -83,4 +87,31 @@ public interface TeacherOpenCourseQuestionLogDao extends BaseMapper<TeacherOpenC
* @return boolean
*/
boolean verifyLogAddTypeIsReSend(Long questionSettingId, Long studentId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, QuestionLogAddTypeEnum questionLogAddType);
/**
* : <br>
* ID
*
* @param questionSettingId ID
* @param type
* @return {@link long}
* @Author: lx
* @Date: 2022/12/6 22:59
*/
default long getCountByQuestionLogAddType(@NotNull Long questionSettingId, String ...type) {
LambdaQuery<TeacherOpenCourseQuestionLog> lambdaQuery = createLambdaQuery();
LambdaQuery<TeacherOpenCourseQuestionLog> andCondition = lambdaQuery.condition();
boolean isNull = Arrays.stream(type).anyMatch(item -> item == null);
List<String> notNullList = Arrays.stream(type).filter(item -> item != null).collect(Collectors.toList());
// 是否添加Null条件
andCondition = isNull ? andCondition.andIsNull(TeacherOpenCourseQuestionLog::getQuestionLogAddType) : andCondition;
andCondition.orIn(TeacherOpenCourseQuestionLog::getQuestionLogAddType, notNullList);
return lambdaQuery.and(andCondition)
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogStatus, 1)
.andEq(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionSettingId, questionSettingId)
.count();
}
}

@ -7,7 +7,6 @@ import org.beetl.sql.annotation.entity.AssignID;
import org.beetl.sql.annotation.entity.InsertIgnore;
import org.beetl.sql.annotation.entity.UpdateIgnore;
import org.beetl.sql.fetch.annotation.Fetch;
import org.beetl.sql.fetch.annotation.FetchSql;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ -97,12 +96,6 @@ public class ResourcesQuestionSnapshot extends BaseEntity {
@UpdateIgnore
@InsertIgnore
@FetchSql("select count(1) > 0 from teacher_open_course_question_log t " +
"where 1 = 1 " +
"and t.teacher_open_course_question_log_status = 1 " +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and t.resources_question_snapshot_id = #resourcesQuestionSnapshotId# " +
"and t.is_tuck = 1 ")
private Boolean isTuck;
public ResourcesQuestionSnapshot(){

@ -9,6 +9,7 @@ import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;
import org.beetl.sql.annotation.entity.AssignID;
import org.beetl.sql.fetch.annotation.Fetch;
@ -25,6 +26,7 @@ import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
@Data
@EqualsAndHashCode(callSuper=false)
@Fetch
@FieldNameConstants
public class TeacherOpenCourseQuestionLog extends BaseEntity {
//学生做题日志ID

@ -605,6 +605,9 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
.build();
List<GeneralQuestionLog> logList = generalQuestionLogDao.getValuesByQuery(questionLogQuery);
final List<QuestionLogAddTypeEnum> tempList = Arrays.asList(PRE_SUBMIT, null);
// 只是未提交的数据
logList = logList.stream().filter(item -> tempList.contains(item.getQuestionLogAddType())).collect(Collectors.toList());
Assert.notEmpty(logList, "未查询到题目信息!");
// 当前时间, 存储要更新的题目日志集合
@ -838,16 +841,10 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
// 不是强制发题,则不覆盖现有的题目日志,则继续做题
// 验证题目日志,是否已经存在试卷
if(!isReSend) {
GeneralQuestionLogQuery questionLogQuery = new GeneralQuestionLogQuery();
questionLogQuery.setStudentId(studentId);
// 正在做题的话,再次进来如果这个试卷没提交,则继续做题,不会重新生成题目
questionLogQuery.setQuestionLogAddType(PRE_SUBMIT);
questionLogQuery.setGeneralQuestionSettingId(questionSettingId);
questionLogQuery.setGeneralQuestionLogStatus(1);
List<GeneralQuestionLog> existsList = getValuesByQueryNotWithPermission(questionLogQuery);
long logCount = generalQuestionLogDao.getCountByQuestionLogAddType(questionSettingId, PRE_SUBMIT.name(), null);
// 如果题目日志里存在预先布置的题目,则直接返回
if (CollectionUtil.isNotEmpty(existsList)) {
if (logCount > 0) {
return;
}
}

@ -436,6 +436,9 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
.build();
List<TeacherOpenCourseQuestionLog> logList = teacherOpenCourseQuestionLogDao.getValuesByQuery(questionLogQuery);
final List<QuestionLogAddTypeEnum> tempList = Arrays.asList(PRE_SUBMIT, null);
// 只是未提交的数据
logList = logList.stream().filter(item -> tempList.contains(item.getQuestionLogAddType())).collect(Collectors.toList());
Assert.notEmpty(logList, "未查询到题目信息!");
// 当前时间, 存储要更新的题目日志集合
@ -668,16 +671,10 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
// 不是强制发题,则不覆盖现有的题目日志,则继续做题
// 验证题目日志,是否已经存在试卷
if(!isReSend) {
TeacherOpenCourseQuestionLogQuery questionLogQuery = new TeacherOpenCourseQuestionLogQuery();
questionLogQuery.setStudentId(studentId);
// 正在做题的话,再次进来如果这个试卷没提交,则继续做题,不会重新生成题目
questionLogQuery.setQuestionLogAddType(judgeAddType);
questionLogQuery.setTeacherOpenCourseQuestionSettingId(questionSettingId);
questionLogQuery.setTeacherOpenCourseQuestionLogStatus(1);
List<TeacherOpenCourseQuestionLog> existsList = getValuesByQueryNotWithPermission(questionLogQuery);
long logCount = teacherOpenCourseQuestionLogDao.getCountByQuestionLogAddType(questionSettingId, judgeAddType.name(), null);
// 如果题目日志里存在预先布置的题目,则直接返回
if (CollectionUtil.isNotEmpty(existsList)) {
if (logCount > 0) {
return;
}
}

@ -486,12 +486,17 @@ selectStudentAnswerFragment
from teacher_open_course_question_log b
where 1 = 1 and b.student_id = #studentId#
and b.teacher_open_course_question_log_status = 1
and find_in_set(b.question_log_add_type, 'LOCK,FINALLY_SUBMIT')
@// and find_in_set(b.question_log_add_type, 'LOCK,FINALLY_SUBMIT')
and b.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and b.resources_question_snapshot_id = t.resources_question_snapshot_id
order by teacher_open_course_question_log_add_time desc limit 1
) as teacher_open_course_question_log_answer
@}
) as teacher_open_course_question_log_answer,
(select count(1) > 0 from teacher_open_course_question_log ba
where 1 = 1 and ba.teacher_open_course_question_log_status = 1
and ba.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and ba.resources_question_snapshot_id = t.resources_question_snapshot_id
and ba.is_tuck = 1 limit 1) as is_tuck
@}
getValuesByQueryNotWithPermission

@ -13,7 +13,7 @@ queryByCondition
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@ -128,7 +128,7 @@ queryByCondition
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@ -149,7 +149,7 @@ queryByConditionQuery
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@ -262,7 +262,7 @@ queryByConditionQuery
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@ -396,7 +396,7 @@ studentScoreList
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@ -550,7 +550,7 @@ getTeacherOpenCourseQuestionLogValues
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@ -617,7 +617,7 @@ getValuesByQuery
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1 and #function("teacherOpenCourseQuestionLog.query")#
@ -697,7 +697,7 @@ getValuesByQuery
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@ -718,7 +718,7 @@ getValuesByQueryNotWithPermission
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@ -798,7 +798,7 @@ getValuesByQueryNotWithPermission
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@ -834,7 +834,7 @@ getQuestionLogScoreDetailsInfo
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
@if(!isEmpty(questionLogAddType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where

Loading…
Cancel
Save