diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java index 8bc55916..e5bb40ea 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java @@ -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 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); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml index 4358256e..190e2a50 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/ExamQuestionMapper.xml @@ -200,10 +200,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 - (#{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}) diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java index 884c3579..cba00ef0 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java @@ -811,6 +811,10 @@ public class MysqlServericeImpl implements IMysqlServerice { } //如果这个小题对了,直接累加对应的权值分 private double accumulateScoreAndLog(List 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 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);