【修改】试题拉取增加编号,mysql增加判空写入
This commit is contained in:
@@ -599,6 +599,12 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
|||||||
//如果没有,就是新增
|
//如果没有,就是新增
|
||||||
String quId = IdUtils.simpleUUID();
|
String quId = IdUtils.simpleUUID();
|
||||||
examQuestion.setQuId(quId);
|
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();
|
List<ExamQuestionAnswer> answerList = examQuestion.getAnswerList();
|
||||||
@@ -646,6 +652,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
|||||||
//有就是覆盖
|
//有就是覆盖
|
||||||
else{
|
else{
|
||||||
examQuestion.setQuId(question.getQuId());
|
examQuestion.setQuId(question.getQuId());
|
||||||
|
examQuestion.setQuNum(question.getQuNum());
|
||||||
String quId = question.getQuId();
|
String quId = question.getQuId();
|
||||||
examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId);
|
examQuestionAnswerMapper.deleteExamQuestionAnswerByQuesId(quId);
|
||||||
sysFileMapper.deleteSysFileByQuesId(quId);
|
sysFileMapper.deleteSysFileByQuesId(quId);
|
||||||
|
@@ -200,10 +200,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</insert>
|
</insert>
|
||||||
<insert id="insertOrUpdateList">
|
<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
|
VALUES
|
||||||
<foreach collection="collection" item="item" separator=",">
|
<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.specialtyName}, #{item.courseName}, #{item.quLevel}, #{item.content}, #{item.audit}
|
||||||
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, #{item.manual})
|
, #{item.status}, #{item.contentText}, #{item.analysis}, #{item.pointNames}, #{item.keywords}, #{item.manual})
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@@ -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) {
|
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查对应答案的权值 。除以总权值
|
//用answerid查对应答案的权值 。除以总权值
|
||||||
String scoreRateStr= examQuestionAnswerMapper.selectExamQuestionAnswerScoreByAnswerId(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) {
|
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查对应答案的权值 。除以总权值
|
//用answerid查对应答案的权值 。除以总权值
|
||||||
String scoreRateStr= examQuestionAnswerMapper.selectExamQuestionAnswerScoreByAnswerId(answerId);
|
String scoreRateStr= examQuestionAnswerMapper.selectExamQuestionAnswerScoreByAnswerId(answerId);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user