【修改】试题拉取增加编号,mysql增加判空写入

This commit is contained in:
YOHO\20373
2025-06-13 17:24:05 +08:00
parent 28e611df48
commit 0ea1272909
3 changed files with 17 additions and 2 deletions

View File

@@ -599,6 +599,12 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
//如果没有,就是新增
String quId = IdUtils.simpleUUID();
examQuestion.setQuId(quId);
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
int count= examQuestionMapper.selectCountQu();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", ++count);
String quNum =loginTenantId +"-"+formattedNumber;
examQuestion.setQuNum(quNum);
//新增
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
@@ -646,6 +652,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
//有就是覆盖
else{
examQuestion.setQuId(question.getQuId());
examQuestion.setQuNum(question.getQuNum());
String quId = question.getQuId();
examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId);
sysFileMapper.deleteSysFileByQuesId(quId);

View File

@@ -200,10 +200,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<insert id="insertOrUpdateList">
INSERT INTO exam_question (qu_id, qu_bank_id, chapterId_dict_text, subject_name,specialty_name, course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual)
INSERT INTO exam_question (qu_id, qu_bank_id, qu_num,chapterId_dict_text, subject_name,specialty_name, course_name, qu_level, content, audit, status, content_text, analysis, point_names, keywords, manual)
VALUES
<foreach collection="collection" item="item" separator=",">
(#{item.quId}, #{item.quBankId}, #{item.chapteridDictText}, #{item.subjectName},
(#{item.quId}, #{item.quBankId},#{item.quNum}, #{item.chapteridDictText}, #{item.subjectName},
#{item.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, #{item.manual})
</foreach>

View File

@@ -811,6 +811,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
}
//如果这个小题对了,直接累加对应的权值分
private double accumulateScoreAndLog(List<ExamMysqlKeyword> examMysqlKeywordList, AtomicInteger total, String answerLogPath, String sql2, String totalKeyScore, double score,String answerId,double scoreTotal) {
if(StringUtils.isBlank(answerId)){
appendToFile(answerLogPath, "❌该语句找不到试题id请检查出题内容" );
return 0.0;
}
//用answerid查对应答案的权值 。除以总权值
String scoreRateStr= examQuestionAnswerMapper.selectExamQuestionAnswerScoreByAnswerId(answerId);
@@ -843,6 +847,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
public double calculateTotalScoreRate(String sql, List<ExamMysqlKeyword> examQuestionKeywords, String totalKeyScore, double score,String answerId,double scoreTotal) {
if(StringUtils.isBlank(answerId)){
appendToFile(answerLogPath, "❌该语句找不到试题id请检查出题内容" );
return 0.0;
}
//用answerid查对应答案的权值 。除以总权值
String scoreRateStr= examQuestionAnswerMapper.selectExamQuestionAnswerScoreByAnswerId(answerId);