【新增】 1、错题集(当相同的题正确的时候,进行删除试题)2、新增错题记录

This commit is contained in:
dlaren
2025-08-28 16:14:21 +08:00
parent fa7ca1cc3c
commit ea563857e4
20 changed files with 369 additions and 49 deletions

View File

@@ -0,0 +1,44 @@
package com.example.exam.exam.dal;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.List;
/**
* 错题集
*
* @author pengchen
*/
@TableName(value = "exam_error_question_info", autoResultMap = true)
@Accessors(chain = true)
@Data
public class ExamErrorQuestionInfo {
@TableId
private String id;
/**
* 试题id
*/
private String quId;
/**
* 任务ID
*/
private String taskId;
private LocalDateTime createTime;
private String creator;
/**
* 租户id
*/
private long tenantId;
}

View File

@@ -0,0 +1,16 @@
package com.example.exam.exam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.exam.exam.dal.ExamErrorQuestionInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* 错题集记录 Mapper接口
*
* @author pengchen
*/
@Mapper
public interface ExamErrorQuestionInfoMapper extends BaseMapper<ExamErrorQuestionInfo>
{
}

View File

@@ -24,4 +24,6 @@ public interface ExamErrorQuestionMapper extends BaseMapper<ExamErrorQuestion>
wrapper.eq(ExamErrorQuestion::getTenantId, tenantId);
return selectOne(wrapper);
}
int deleteByQuIdAndUserId(@Param("quId") String quId, @Param("userId") String userId, @Param("tenantId") String tenantId);
}

View File

@@ -6,6 +6,7 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -42,6 +43,8 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
EducationPaperMapper educationPaperMapper;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题邮箱
@@ -204,14 +207,26 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isTrue == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
// 关闭文件输入流
@@ -266,15 +281,19 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
return score.setScale(1, BigDecimal.ROUND_HALF_UP);
}

View File

@@ -6,6 +6,7 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -41,6 +42,8 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
EducationPaperMapper educationPaperMapper;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题Edge
@@ -201,14 +204,26 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isTrue == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
// 关闭文件输入流
if (fileInputStream != null) {
@@ -261,15 +276,19 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
return score.setScale(1, BigDecimal.ROUND_HALF_UP);
}

View File

@@ -5,6 +5,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.brower.JudgementBrowerService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -38,6 +39,8 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题文件处理
@@ -104,14 +107,26 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -5,6 +5,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -39,6 +40,8 @@ public class AutoForCServiceImpl implements AutoForCService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题C语言
@@ -109,14 +112,26 @@ public class AutoForCServiceImpl implements AutoForCService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -6,6 +6,7 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -42,6 +43,8 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
EducationPaperMapper educationPaperMapper;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题选择题
@@ -160,14 +163,26 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = isRight ? 0 : 1;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
} else {
// 根据ID查询试题
@@ -211,6 +226,9 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
}
if (fileInputStream != null) {
@@ -271,6 +289,9 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
}
return score;

View File

@@ -5,6 +5,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.question.IExamQuestionService;
@@ -44,6 +45,8 @@ public class AutoForFileServiceImpl implements AutoForFileService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题文件处理
@@ -110,14 +113,26 @@ public class AutoForFileServiceImpl implements AutoForFileService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -5,6 +5,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.question.IExamQuestionService;
@@ -38,6 +39,8 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
/**
* 自动判题C语言
@@ -107,14 +110,26 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
}
break;

View File

@@ -4,6 +4,7 @@ import com.example.exam.exam.controller.auto.vo.StuInfoVo;
import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.ps.PsService;
@@ -37,6 +38,8 @@ public class AutoForPsServiceImpl implements AutoForPsService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
@Override
public BigDecimal autoForPs(StuInfoVo stuInfoVo) throws IOException {
@@ -100,14 +103,26 @@ public class AutoForPsServiceImpl implements AutoForPsService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -0,0 +1,24 @@
package com.example.exam.exam.service.error;
import com.example.exam.exam.dal.ExamErrorQuestionInfo;
import com.example.exam.exam.mapper.ExamErrorQuestionInfoMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
/**
* 错题集记录 Service业务层处理
*
* @author pengchen
*/
@Service
public class ExamErrorQuestionInfoServiceImpl implements IExamErrorQuestionInfoService
{
@Resource
ExamErrorQuestionInfoMapper examErrorQuestionInfoMapper;
@Override
public void insertExamErrorQuestionInfo(ExamErrorQuestionInfo examErrorQuestionInfo) {
examErrorQuestionInfoMapper.insert(examErrorQuestionInfo);
}
}

View File

@@ -29,4 +29,9 @@ public class ExamErrorQuestionServiceImpl implements IExamErrorQuestionService
public boolean isExamErrorQuestion(String quId, String userId, String tenantId) {
return examErrorQuestionMapper.selectByIdAndUserId(quId, userId, tenantId) != null;
}
@Override
public int deleteExamErrorQuestion(String quId, String userId, String tenantId) {
return examErrorQuestionMapper.deleteByQuIdAndUserId(quId, userId, tenantId);
}
}

View File

@@ -0,0 +1,16 @@
package com.example.exam.exam.service.error;
import com.example.exam.exam.dal.ExamErrorQuestionInfo;
/**
* 错题集记录 Service接口
*
* @author pengchen
*/
public interface IExamErrorQuestionInfoService {
/**
* 新增错题集数据
*/
void insertExamErrorQuestionInfo(ExamErrorQuestionInfo examErrorQuestionInfo);
}

View File

@@ -18,4 +18,9 @@ public interface IExamErrorQuestionService {
* 判断错题是否存在
*/
boolean isExamErrorQuestion(String quId, String userId, String tenantId);
/**
* 删除错题集数据
*/
int deleteExamErrorQuestion(String quId, String userId, String tenantId);
}

View File

@@ -6,6 +6,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -42,6 +43,8 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
@Override
public BigDecimal autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception {
@@ -103,14 +106,26 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -6,6 +6,7 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
@@ -42,6 +43,8 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
@Override
public BigDecimal autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception {
@@ -103,14 +106,26 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -6,20 +6,18 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
import com.example.exam.exam.service.error.IExamErrorQuestionInfoService;
import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.wpsword.JudgementWpsWordService;
import com.example.exam.exam.utils.error_question.ErrorQuestion;
import com.example.exam.exam.utils.snowflake.SnowflakeId;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
@@ -45,6 +43,8 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
SystemTenantService systemTenantService;
@Resource
IExamErrorQuestionService examErrorQuestionService;
@Resource
IExamErrorQuestionInfoService examErrorQuestionInfoService;
@Override
public BigDecimal autoForWpsWord(StuInfoVo stuInfoVo) throws Exception {
@@ -106,14 +106,26 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 判断是否进入错题集
int isError = wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
String.valueOf(stuInfoVo.getStuId()),
String.valueOf(systemTenant.getId()));
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
if (isError == 0) {
// 如果做对了
if (!isInsert) {
// 删除对应的题,但是保留记录
examErrorQuestionService.deleteExamErrorQuestion(quId, String.valueOf(stuInfoVo.getStuId()), String.valueOf(systemTenant.getId()));
}
} else {
// 如果做错了
ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
if (!isInsert) {
if (examErrorQuestion != null) {
examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
}
}
// 只要是试题错误,直接进行添加到记录表中
ExamErrorQuestionInfo examErrorQuestionInfo = ErrorQuestion.insertErrorQuestionInfo(quId, taskId, systemTenant, stuInfoVo);
examErrorQuestionInfoService.insertExamErrorQuestionInfo(examErrorQuestionInfo);
}
break;
}

View File

@@ -2,6 +2,7 @@ package com.example.exam.exam.utils.error_question;
import com.example.exam.exam.controller.auto.vo.StuInfoVo;
import com.example.exam.exam.dal.ExamErrorQuestion;
import com.example.exam.exam.dal.ExamErrorQuestionInfo;
import com.example.exam.exam.dal.ExamQuestion;
import com.example.exam.exam.dal.SystemTenant;
import com.example.exam.exam.utils.snowflake.SnowflakeId;
@@ -33,4 +34,20 @@ public class ErrorQuestion {
}
return null;
}
public static ExamErrorQuestionInfo insertErrorQuestionInfo(String quId,
String taskId,
SystemTenant systemTenant,
StuInfoVo stuInfoVo) {
ExamErrorQuestionInfo examErrorQuestionInfo = new ExamErrorQuestionInfo();
SnowflakeId idWorker = new SnowflakeId(0, 31);
examErrorQuestionInfo.setId(idWorker.nextIdStr());
examErrorQuestionInfo.setTaskId(taskId);
examErrorQuestionInfo.setQuId(quId);
examErrorQuestionInfo.setTenantId(systemTenant.getId());
examErrorQuestionInfo.setCreator(String.valueOf(stuInfoVo.getStuId()));
examErrorQuestionInfo.setCreateTime(LocalDateTime.now());
return examErrorQuestionInfo;
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.exam.exam.mapper.ExamErrorQuestionMapper">
<delete id="deleteByQuIdAndUserId" parameterType="long">
DELETE
FROM exam_error_question
WHERE qu_id = #{quId}
AND creator = #{userId}
AND tenant_id = #{tenantId}
</delete>
</mapper>