Accept Merge Request #126: (hyc -> master)
Merge Request: 【修改】mysql判分明细增加 Created By: @华允传 Accepted By: @华允传 URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/126?initial=true
This commit is contained in:
@@ -314,10 +314,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
String sql3 = resultStu.get(entry.getKey());
|
String sql3 = resultStu.get(entry.getKey());
|
||||||
if (table1Columns.equals(table2Columns)) {
|
if (table1Columns.equals(table2Columns)) {
|
||||||
//
|
//
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql3,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql3,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql3, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql3, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,8 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
// 正则表达式匹配表名
|
// 正则表达式匹配表名
|
||||||
Pattern pattern = Pattern.compile("INSERT INTO\\s+`?(\\w+)`?\\s*\\(");
|
Pattern pattern = Pattern.compile("INSERT INTO\\s+`?(\\w+)`?\\s*\\(");
|
||||||
Matcher matcher = pattern.matcher(entry.getValue());
|
Matcher matcher = pattern.matcher(entry.getValue());
|
||||||
|
appendToFile(answerLogPath, "正确语句: " + entry.getValue());
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "正确语句: " + entry.getValue());
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String tableName = matcher.group(1).replace("`", ""); // 获取表名
|
String tableName = matcher.group(1).replace("`", ""); // 获取表名
|
||||||
String answerId=null;
|
String answerId=null;
|
||||||
@@ -353,10 +354,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
|
|
||||||
boolean equals = sql1.equals(sql2);
|
boolean equals = sql1.equals(sql2);
|
||||||
if (equals) {
|
if (equals) {
|
||||||
double sr=accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr=accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,10 +414,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
//累加删除语句的所有权值 examQuestionKeywords累加scorerate
|
//累加删除语句的所有权值 examQuestionKeywords累加scorerate
|
||||||
appendToFile(answerLogPath, "验证通过:符合 DELETE 条件的记录已删除。");
|
appendToFile(answerLogPath, "验证通过:符合 DELETE 条件的记录已删除。");
|
||||||
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "验证通过:符合 DELETE 条件的记录已删除。");
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "验证通过:符合 DELETE 条件的记录已删除。");
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,10 +472,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
|
|
||||||
//
|
//
|
||||||
if (b) {
|
if (b) {
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -538,11 +539,11 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
|
|
||||||
if (isEquivalent) {
|
if (isEquivalent) {
|
||||||
//todo 得分
|
//todo 得分
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -629,10 +630,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
stmt.execute("DROP VIEW IF EXISTS " + viewName1);
|
stmt.execute("DROP VIEW IF EXISTS " + viewName1);
|
||||||
stmt.execute("DROP VIEW IF EXISTS " + viewName2);
|
stmt.execute("DROP VIEW IF EXISTS " + viewName2);
|
||||||
if (isEquivalent) {
|
if (isEquivalent) {
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal);
|
double sw= calculateTotalScoreRate(sql2, examMysqlKeywordList,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
@@ -714,11 +715,11 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
//todo 得分
|
//todo 得分
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList,total,answerLogPath,sql2,totalKeyScore,score,answerId,scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
//得分
|
//得分
|
||||||
double sw = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal);
|
double sw = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -762,10 +763,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
boolean equals = normalizedTriggerSql1.equals(normalizedTriggerSql2);
|
boolean equals = normalizedTriggerSql1.equals(normalizedTriggerSql2);
|
||||||
if (equals) {
|
if (equals) {
|
||||||
//todo 得分
|
//todo 得分
|
||||||
double sr= accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql2, totalKeyScore, score, answerId, scoreTotal);
|
double sr= accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql2, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
||||||
scoreTotal+=sr;
|
scoreTotal+=sr;
|
||||||
} else {
|
} else {
|
||||||
double sw = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal);
|
double sw = calculateTotalScoreRate(sql2, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal,judgementStr);
|
||||||
scoreTotal+=sw;
|
scoreTotal+=sw;
|
||||||
|
|
||||||
|
|
||||||
@@ -810,9 +811,10 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
folder.delete(); // 删除空文件夹或文件
|
folder.delete(); // 删除空文件夹或文件
|
||||||
}
|
}
|
||||||
//如果这个小题对了,直接累加对应的权值分
|
//如果这个小题对了,直接累加对应的权值分
|
||||||
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,String judgementStr) {
|
||||||
if(StringUtils.isBlank(answerId)){
|
if(StringUtils.isBlank(answerId)){
|
||||||
appendToFile(answerLogPath, "❌该语句找不到试题id,请检查出题内容!" );
|
appendToFile(answerLogPath, "❌该语句找不到试题id,请检查出题内容!" );
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌该语句找不到试题id,请检查出题内容!");
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
//用answerid查对应答案的权值 。除以总权值
|
//用answerid查对应答案的权值 。除以总权值
|
||||||
@@ -836,7 +838,7 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
System.out.println(scoreTotal);
|
System.out.println(scoreTotal);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅学生语句" + sql2 + "正确,语句得分权值:" + scoreRateStr + ",得分" + singleScore);
|
||||||
appendToFile(answerLogPath, "✅学生语句" + sql2 + "正确,语句得分权值:" + scoreRateStr + ",得分" + singleScore);
|
appendToFile(answerLogPath, "✅学生语句" + sql2 + "正确,语句得分权值:" + scoreRateStr + ",得分" + singleScore);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
System.err.println("无效的totalKeyScore值:" + totalKeyScore);
|
System.err.println("无效的totalKeyScore值:" + totalKeyScore);
|
||||||
@@ -846,8 +848,9 @@ 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,String judgementStr) {
|
||||||
if(StringUtils.isBlank(answerId)){
|
if(StringUtils.isBlank(answerId)){
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌该语句找不到试题id,请检查出题内容!");
|
||||||
appendToFile(answerLogPath, "❌该语句找不到试题id,请检查出题内容!" );
|
appendToFile(answerLogPath, "❌该语句找不到试题id,请检查出题内容!" );
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
@@ -912,6 +915,7 @@ public class MysqlServericeImpl implements IMysqlServerice {
|
|||||||
((double) totalScoreRate / totalKeyScoreInt) * singleScore
|
((double) totalScoreRate / totalKeyScoreInt) * singleScore
|
||||||
).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌学生语句"+sql+"不正确,语句权值:"+scoreRateStr+",关键权值:"+totalKeyScoreInt+",答对得分点为:"+matchedKeywords+",答对关键得分权值"+ totalScoreRate+ ",得分" + finalRoundedScore);
|
||||||
|
|
||||||
appendToFile(answerLogPath,"❌学生语句"+sql+"不正确,语句权值:"+scoreRateStr+",关键权值:"+totalKeyScoreInt+",答对得分点为:"+matchedKeywords+",答对关键得分权值"+ totalScoreRate+ ",得分" + finalRoundedScore);
|
appendToFile(answerLogPath,"❌学生语句"+sql+"不正确,语句权值:"+scoreRateStr+",关键权值:"+totalKeyScoreInt+",答对得分点为:"+matchedKeywords+",答对关键得分权值"+ totalScoreRate+ ",得分" + finalRoundedScore);
|
||||||
return finalRoundedScore;
|
return finalRoundedScore;
|
||||||
|
Reference in New Issue
Block a user