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 30786903..c656f226 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 @@ -859,9 +859,15 @@ public class MysqlServericeImpl implements IMysqlServerice { .sum(); //乘以 对了多少个 关键字 权值 - double finalRoundedScore = new BigDecimal( - ((double) totalScoreRate / totalKeyScoreInt) * singleScore - ).setScale(2, RoundingMode.HALF_UP).doubleValue(); + double finalRoundedScore; + if (totalKeyScoreInt == 0) { + // 如果总键值为0,可以设置为0或其他默认值 + finalRoundedScore = 0.0; + } else { + finalRoundedScore = new BigDecimal( + ((double) totalScoreRate / totalKeyScoreInt) * singleScore + ).setScale(2, RoundingMode.HALF_UP).doubleValue(); + } appendToFile(answerLogPath,"❌学生语句"+sql+"不正确,语句权值:"+scoreRateStr+",关键权值:"+totalKeyScoreInt+",答对得分点为:"+matchedKeywords+",答对关键得分权值"+ totalScoreRate+ ",得分" + finalRoundedScore); return finalRoundedScore;