From 0ea12729092f3483080f6ddad4e824cf07d18f00 Mon Sep 17 00:00:00 2001 From: "YOHO\\20373" <2037305722@qq.com> Date: Fri, 13 Jun 2025 17:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E8=AF=95?= =?UTF-8?q?=E9=A2=98=E6=8B=89=E5=8F=96=E5=A2=9E=E5=8A=A0=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=EF=BC=8Cmysql=E5=A2=9E=E5=8A=A0=E5=88=A4=E7=A9=BA=E5=86=99?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exam/service/question/ExamQuestionServiceImpl.java | 7 +++++++ .../src/main/resources/mapper/exam/ExamQuestionMapper.xml | 4 ++-- .../controller/service/mysql/MysqlServericeImpl.java | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) 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);