【修改】word,excel。ps考点。对齐判分对错号

This commit is contained in:
huababa1
2025-08-26 23:15:51 +08:00
parent 0c6ff8bfaa
commit ab51693f78
16 changed files with 331 additions and 255 deletions

View File

@@ -168,13 +168,12 @@ function processLayers(layers, resultArray) {
// 读取图层样式
var styles = getLayerStyles(layer);
if (styles) {
if (styles && !isEmptyObject(styles)) {
info["图层样式"] = styles;
}
// 检测滤镜信息
var filterInfo = detectFilters(layer.name);
if (filterInfo) {
if (filterInfo && !isEmptyObject(filterInfo)) {
info["滤镜信息"] = filterInfo;
}
@@ -323,7 +322,7 @@ function processFile(path) {
processLayers(doc.layers, result["图层信息"]);
// 获取智能对象图层数(递归计算)
result["智能对象图层数"] = countSmartObjectsRecursive(doc.layers);
// result["智能对象图层数"] = countSmartObjectsRecursive(doc.layers);
// 写入 JSON 文件
var baseName = fileRef.name.replace(/\.psd$/i, "");
@@ -523,194 +522,178 @@ function getWarpTextProps() {
function getLayerStyles(layer) {
var styles = {};
// ---- 激活图层 ----
app.activeDocument.activeLayer = layer;
// ---- 获取 ActionDescriptor ----
var desc;
try {
// 尝试 CC/2025 方法
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID("Lyr "), layer.id);
var desc = executeActionGet(ref);
if (!desc.hasKey(stringIDToTypeID("layerEffects"))) {
$.writeln("图层无 layerEffects" + layer.name);
return null;
if (layer.id !== undefined) {
ref.putIdentifier(charIDToTypeID("Lyr "), layer.id);
} else {
throw "CS6 fallback";
}
desc = executeActionGet(ref);
} catch (e) {
// CS6 fallback
var ref2 = new ActionReference();
ref2.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
desc = executeActionGet(ref2);
}
// ---- 判断 layerEffects 是否存在 ----
if (!desc.hasKey(stringIDToTypeID("layerEffects"))) {
$.writeln("图层 " + layer.name + " 没有 layerEffects");
return styles; // 空对象
}
try {
var effects = desc.getObjectValue(stringIDToTypeID("layerEffects"));
var styles = {};
// ============ 描边 ===============
// ---- 描边 ----
if (effects.hasKey(stringIDToTypeID("frameFX"))) {
var frameFX = effects.getObjectValue(stringIDToTypeID("frameFX"));
var keys = [];
for (var i = 0; i < frameFX.count; i++) {
keys.push(i + ": " + typeIDToStringID(frameFX.getKey(i)));
}
var enabled = frameFX.getBoolean(stringIDToTypeID("enabled"));
styles["描边_启用"] = frameFX.getBoolean(stringIDToTypeID("enabled"));
if (enabled) {
if (frameFX.hasKey(stringIDToTypeID("size"))) {
styles["描边_大小"] = frameFX.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
}
if (frameFX.hasKey(stringIDToTypeID("color"))) {
var colorDesc = frameFX.getObjectValue(stringIDToTypeID("color"));
styles["描边_颜色"] = colorDescToHex(colorDesc);
}
if (frameFX.hasKey(stringIDToTypeID("style"))) {
var posEnum = frameFX.getEnumerationValue(stringIDToTypeID("style"));
var posStringID = typeIDToStringID(posEnum);
styles["描边_位置"] = getStrokePositionName(posStringID);
} else {
styles["描边_位置"] = "未知";
}
if (frameFX.hasKey(stringIDToTypeID("opacity"))) {
styles["描边_不透明度"] = Math.round(frameFX.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
}
if (frameFX.hasKey(stringIDToTypeID("mode"))) {
var blendMode = frameFX.getEnumerationValue(stringIDToTypeID("mode"));
styles["描边_混合模式"] = getBlendModeName(blendMode);
if (frameFX.hasKey(stringIDToTypeID("enabled"))) {
var enabled = frameFX.getBoolean(stringIDToTypeID("enabled"));
if (enabled) {
if (frameFX.hasKey(stringIDToTypeID("size"))) {
styles["描边_大小"] = frameFX.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
}
if (frameFX.hasKey(stringIDToTypeID("color"))) {
styles["描边_颜色"] = colorDescToHex(frameFX.getObjectValue(stringIDToTypeID("color")));
}
if (frameFX.hasKey(stringIDToTypeID("style"))) {
var posEnum = frameFX.getEnumerationValue(stringIDToTypeID("style"));
var posStringID = typeIDToStringID(posEnum);
styles["描边_位置"] = getStrokePositionName(posStringID);
} else {
styles["描边_位置"] = "未知";
}
if (frameFX.hasKey(stringIDToTypeID("opacity"))) {
styles["描边_不透明度"] = Math.round(frameFX.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
}
if (frameFX.hasKey(stringIDToTypeID("mode"))) {
styles["描边_混合模式"] = getBlendModeName(frameFX.getEnumerationValue(stringIDToTypeID("mode")));
}
}
}
}
// ============ 内发光 ===============
// ---- 内发光 ----
if (effects.hasKey(stringIDToTypeID("innerGlow"))) {
var innerGlow = effects.getObjectValue(stringIDToTypeID("innerGlow"));
// var keys = [];
// for (var i = 0; i < innerGlow.count; i++) {
// keys.push(i + ": " + typeIDToStringID(innerGlow.getKey(i)));
// }
styles["内发光_启用"] = innerGlow.getBoolean(stringIDToTypeID("enabled"));
if (styles["内发光_启用"]) {
if (innerGlow.hasKey(stringIDToTypeID("opacity"))) {
styles["内发光_不透明度"] = Math.round(innerGlow.getUnitDoubleValue(stringIDToTypeID("opacity")) ) + "%";
if (innerGlow.hasKey(stringIDToTypeID("enabled"))) {
var enabled = innerGlow.getBoolean(stringIDToTypeID("enabled"));
if (enabled) {
if (innerGlow.hasKey(stringIDToTypeID("opacity"))) {
styles["内发光_不透明度"] = Math.round(innerGlow.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
}
if (innerGlow.hasKey(stringIDToTypeID("color"))) {
styles["内发光_颜色"] = colorDescToHex(innerGlow.getObjectValue(stringIDToTypeID("color")));
}
if (innerGlow.hasKey(stringIDToTypeID("blur"))) {
styles["内发光_大小"] = innerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
}
if (innerGlow.hasKey(stringIDToTypeID("mode"))) {
var modeID = innerGlow.getEnumerationValue(stringIDToTypeID("mode"));
styles["内发光_混合模式"] = getBlendModeName(modeID);
}
if (innerGlow.hasKey(stringIDToTypeID("source"))) {
var source = innerGlow.getEnumerationValue(stringIDToTypeID("source"));
styles["内发光_来源"] = getInnerGlowSourceName(source);
}
}
if (innerGlow.hasKey(stringIDToTypeID("mode"))) {
var modeID = innerGlow.getEnumerationValue(stringIDToTypeID("mode"));
styles["内发光_混合模式"] = getBlendModeName(modeID);
}
if (innerGlow.hasKey(stringIDToTypeID("blur"))) {
styles["内发光_大小"] = innerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
}
if (innerGlow.hasKey(stringIDToTypeID("color"))) {
styles["内发光_颜色"] = colorDescToHex(innerGlow.getObjectValue(stringIDToTypeID("color")));
}
// if (innerGlow.hasKey(stringIDToTypeID("glowTechnique"))) {
// var tech = innerGlow.getEnumerationValue(stringIDToTypeID("glowTechnique"));
// styles["内发光_技巧"] = getInnerGlowTechniqueName(tech);
// }
if (innerGlow.hasKey(stringIDToTypeID("source"))) {
var source = innerGlow.getEnumerationValue(stringIDToTypeID("source"));
styles["内发光_来源"] = getInnerGlowSourceName(source);
}
// if (innerGlow.hasKey(stringIDToTypeID("chokeMatte"))) {
// styles["内发光_阻塞"] = innerGlow.getUnitDoubleValue(stringIDToTypeID("chokeMatte")) + " 像素";
// }
// if (innerGlow.hasKey(stringIDToTypeID("blur"))) {
// styles["内发光_模糊"] = innerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
// }
}
}
// ========= 斜面和浮雕 =========
// ---- 斜面和浮雕 ----
if (effects.hasKey(stringIDToTypeID("bevelEmboss"))) {
var bevel = effects.getObjectValue(stringIDToTypeID("bevelEmboss"));
styles["斜面_启用"] = bevel.getBoolean(stringIDToTypeID("enabled"));
if (styles["斜面_启用"]) {
styles["斜面_样式"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("style")));
styles["斜面_方法"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("technique")));
styles["斜面_深度"] = bevel.getDouble(stringIDToTypeID("strength")) + "%";
styles["斜面_方向"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("direction")));
styles["斜面_大小"] = bevel.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
styles["斜面_软化"] = bevel.getUnitDoubleValue(stringIDToTypeID("soften")) + " 像素";
styles["斜面_使用全局光"] = bevel.getBoolean(stringIDToTypeID("useGlobalAngle"));
styles["斜面_角度"] = bevel.getInteger(stringIDToTypeID("localLightingAngle")) + "°";
if (bevel.hasKey(stringIDToTypeID("enabled"))) {
var enabled = bevel.getBoolean(stringIDToTypeID("enabled"));
if (enabled) {
styles["斜面_样式"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("style")));
styles["斜面_方法"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("technique")));
styles["斜面_深度"] = bevel.getDouble(stringIDToTypeID("strength")) + "%";
styles["斜面_方向"] = typeIDToStringID(bevel.getEnumerationValue(stringIDToTypeID("direction")));
styles["斜面_大小"] = bevel.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
styles["斜面_软化"] = bevel.getUnitDoubleValue(stringIDToTypeID("soften")) + " 像素";
styles["斜面_使用全局光"] = bevel.getBoolean(stringIDToTypeID("useGlobalAngle"));
styles["斜面_角度"] = bevel.getInteger(stringIDToTypeID("localLightingAngle")) + "°";
if (bevel.hasKey(stringIDToTypeID("highlightColor"))) {
var color = bevel.getObjectValue(stringIDToTypeID("highlightColor"));
styles["斜面_高光颜色"] = colorToHex(color);
}
if (bevel.hasKey(stringIDToTypeID("highlightMode"))) {
var mode = bevel.getEnumerationValue(stringIDToTypeID("highlightMode"));
styles["斜面_高光模式"] = typeIDToStringID(mode);
if (bevel.hasKey(stringIDToTypeID("highlightColor"))) {
var color = bevel.getObjectValue(stringIDToTypeID("highlightColor"));
styles["斜面_高光颜色"] = colorToHex(color);
}
if (bevel.hasKey(stringIDToTypeID("highlightMode"))) {
var mode = bevel.getEnumerationValue(stringIDToTypeID("highlightMode"));
styles["斜面_高光模式"] = typeIDToStringID(mode);
}
}
}
}
// ========= 光泽Satin =========
if (effects.hasKey(stringIDToTypeID("satin"))) {
var satin = effects.getObjectValue(stringIDToTypeID("satin"));
styles["光泽_启用"] = satin.getBoolean(stringIDToTypeID("enabled"));
if (styles["光泽_启用"]) {
styles["光泽_混合模式"] = typeIDToStringID(satin.getEnumerationValue(stringIDToTypeID("mode")));
styles["光泽_不透明度"] = satin.getInteger(stringIDToTypeID("opacity")) + "%";
styles["光泽_角度"] = satin.getInteger(stringIDToTypeID("localLightingAngle")) + "°";
styles["光泽_距离"] = satin.getUnitDoubleValue(stringIDToTypeID("distance")) + " 像素";
styles["光泽_大小"] = satin.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
}
}
// ============ 外发光 ===============
// ---- 外发光 ----
if (effects.hasKey(stringIDToTypeID("outerGlow"))) {
var outerGlow = effects.getObjectValue(stringIDToTypeID("outerGlow"));
styles["外发光_启用"] = outerGlow.getBoolean(stringIDToTypeID("enabled"));
// 遍历输出所有 key 名称,方便调试
// var keys = [];
// for (var i = 0; i < outerGlow.count; i++) {
// var key = outerGlow.getKey(i);
// var keyName = typeIDToStringID(key);
// keys.push(keyName);
// }
if (styles["外发光_启用"]) {
if (outerGlow.hasKey(stringIDToTypeID("opacity"))) {
styles["外发光_不透明度"] = Math.round(outerGlow.getUnitDoubleValue(stringIDToTypeID("opacity")) ) + "%";
}
if (outerGlow.hasKey(stringIDToTypeID("color"))) {
styles["外发光_颜色"] = colorDescToHex(outerGlow.getObjectValue(stringIDToTypeID("color")));
}
if (outerGlow.hasKey(stringIDToTypeID("glowTechnique"))) {
var techniqueEnum = outerGlow.getEnumerationValue(stringIDToTypeID("glowTechnique"));
var techniqueStr = typeIDToStringID(techniqueEnum);
styles["外发光_图素方法"] = getOuterGlowTechniqueName(techniqueStr); // 例如返回"精确"
}
if (outerGlow.hasKey(stringIDToTypeID("blur"))) {
styles["外发光_大小"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
}
if (outerGlow.hasKey(stringIDToTypeID("chokeMatte"))) {
styles["外发光_阻塞"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("chokeMatte")) + " 像素";
}
try{
if (outerGlow.hasKey(stringIDToTypeID("transferSpec"))) {
var transferSpec = outerGlow.getObjectValue(stringIDToTypeID("transferSpec")); // 先获取对象
var nameID = stringIDToTypeID("name");
if (transferSpec.hasKey(nameID)) {
styles["外发光_等高线"] = transferSpec.getString(nameID);
}
if (outerGlow.hasKey(stringIDToTypeID("enabled"))) {
var enabled = outerGlow.getBoolean(stringIDToTypeID("enabled"));
if (styles["外发光_启用"]) {
if (outerGlow.hasKey(stringIDToTypeID("opacity"))) {
styles["外发光_不透明度"] = Math.round(outerGlow.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
}
if (outerGlow.hasKey(stringIDToTypeID("color"))) {
styles["外发光_颜色"] = colorDescToHex(outerGlow.getObjectValue(stringIDToTypeID("color")));
}
if (outerGlow.hasKey(stringIDToTypeID("glowTechnique"))) {
var techEnum = outerGlow.getEnumerationValue(stringIDToTypeID("glowTechnique"));
styles["外发光_图素方法"] = getOuterGlowTechniqueName(typeIDToStringID(techEnum));
}
if (outerGlow.hasKey(stringIDToTypeID("blur"))) {
styles["外发光_大小"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("blur")) + " 像素";
}
if (outerGlow.hasKey(stringIDToTypeID("chokeMatte"))) {
styles["外发光_阻塞"] = outerGlow.getUnitDoubleValue(stringIDToTypeID("chokeMatte")) + " 像素";
}
if (outerGlow.hasKey(stringIDToTypeID("mode"))) {
styles["外发光_混合模式"] = getBlendModeName(outerGlow.getEnumerationValue(stringIDToTypeID("mode")));
}
} catch (e) {
// alert("外发光_等高线: " + e.message);
return null;
}
if (outerGlow.hasKey(stringIDToTypeID("mode"))) {
var blendMode = outerGlow.getEnumerationValue(stringIDToTypeID("mode"));
styles["外发光_混合模式"] = getBlendModeName(blendMode);
}
}
}
// ---- 光泽Satin ----
if (effects.hasKey(stringIDToTypeID("satin"))) {
var satin = effects.getObjectValue(stringIDToTypeID("satin"));
if (satin.hasKey(stringIDToTypeID("enabled"))) {
var enabled = satin.getBoolean(stringIDToTypeID("enabled"));
if (enabled) {
if (satin.hasKey(stringIDToTypeID("opacity"))) {
styles["光泽_不透明度"] = Math.round(satin.getUnitDoubleValue(stringIDToTypeID("opacity"))) + "%";
}
if (satin.hasKey(stringIDToTypeID("color"))) {
styles["光泽_颜色"] = colorDescToHex(satin.getObjectValue(stringIDToTypeID("color")));
}
if (satin.hasKey(stringIDToTypeID("mode"))) {
styles["光泽_混合模式"] = getBlendModeName(satin.getEnumerationValue(stringIDToTypeID("mode")));
}
if (satin.hasKey(stringIDToTypeID("angle"))) {
styles["光泽_角度"] = satin.getUnitDoubleValue(stringIDToTypeID("angle")) + "°";
}
if (satin.hasKey(stringIDToTypeID("distance"))) {
styles["光泽_距离"] = satin.getUnitDoubleValue(stringIDToTypeID("distance")) + " 像素";
}
if (satin.hasKey(stringIDToTypeID("size"))) {
styles["光泽_大小"] = satin.getUnitDoubleValue(stringIDToTypeID("size")) + " 像素";
}
}
}
}
return hasOwnProperties(styles) ? styles : null;
} catch (e) {
// alert("读取图层样式异常: " + e.message);
return null;
}
}
@@ -936,5 +919,10 @@ function hasOwnProperties(obj) {
return false;
}
function isEmptyObject(obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) return false;
}
return true;
}

View File

@@ -161,7 +161,7 @@ public class AutoController {
}
/**
* 文件 判分
* 文件 判分
*
* @param stuInfoVo 学生信息
* @return 分数

View File

@@ -178,9 +178,9 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
oneScore += one_sorce;
score = score.add(new BigDecimal(one_sorce));
if (flag) {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, questionAnswer.getContentIn() + " 得分成功,得分:" + one_sorce + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】"+questionAnswer.getContentIn() + " 得分成功,得分:" + one_sorce );
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, questionAnswer.getContentIn() + " 得分失败 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败");
}
}
judgementStr += "<h2>试题得分: " + oneScore + " </h2>";

View File

@@ -178,9 +178,9 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
oneScore += one_sorce;
score = score.add(new BigDecimal(one_sorce));
if (flag) {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, questionAnswer.getContentIn() + " 得分成功,得分:" + one_sorce + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】"+questionAnswer.getContentIn() + " 得分成功,得分:" + one_sorce );
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, questionAnswer.getContentIn() + " 得分失败 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败 ");
}
}
judgementStr += "<h2>试题得分: " + oneScore + " </h2>";

View File

@@ -78,7 +78,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<p>✅ 开始网络判分</p>";
judgementStr += "<p>✅ 开始网络判分</p>";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();

View File

@@ -73,7 +73,7 @@ public class AutoForPsServiceImpl implements AutoForPsService {
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<p>✅ 开始QQ邮箱提判分</p>";
judgementStr += "<p>✅ 开始PS判分</p>";
SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), filePaths, wjFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();

View File

@@ -55,7 +55,13 @@ public class JudgementBrowerServiceImpl implements JudgementBrowerService {
// }
int correctCount = 0; // 完全正确的题目数量
int totalQuestions = answerList.size(); // 总题目数量// 总题目数量
if (totalQuestions > 0) {
}else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "未设置考点!");
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
return sourceAndText;
}
//分为两点1文件夹-- 去考生文件夹去找 文件名
// 2收藏夹--去浏览器去找 根据值 文件名 查找
@@ -97,15 +103,15 @@ public class JudgementBrowerServiceImpl implements JudgementBrowerService {
// 计算该考点的权重得分并保留一位小数
double weightScore = ((double) currentScore / totalScore) * score;
String formattedWeightScore = String.format("%.1f", weightScore);
String formattedWeightScore = String.format("%.2f", weightScore);
appendToFile(answerLogPath, "✅考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分:" + formattedWeightScore);
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分:" + formattedWeightScore + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分:" + formattedWeightScore);
//删除此书签
BookmarkDeleter.deleteBookmarkByName(chromeBookmarkPath, bookmarkNameToDelete);
} else {
appendToFile(answerLogPath, "❌考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分0");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分0 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】考点" + bookmarkNameToDelete + " -> 得分权值:" + currentScore + "-> 得分失败 ");
}
}
@@ -146,10 +152,10 @@ public class JudgementBrowerServiceImpl implements JudgementBrowerService {
double weightScore = ((double) currentScore / total) * score;
String formattedWeightScore = String.format("%.1f", weightScore);
appendToFile(answerLogPath, "✅考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore);
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore );
} else {
appendToFile(answerLogPath, "❌考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分0");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分0 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】考点" + answer.getContent() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分失败 ");
}
}
}

View File

@@ -64,7 +64,15 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
// 5.2、查询试题ID
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(examQuestion.getQuId());
int correctCount = 0; // 完全正确的题目数量
int totalQuestions = examQuestionAnswers.size(); // 总题目数量// 总题目数量
int totalQuestions = examQuestionAnswers.size(); // 总题目数量
if (totalQuestions > 0) {
}else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "未设置考点!");
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
return sourceAndText;
}
String totalKeyScore = "0";
//得出 这个题总共的权值点
totalKeyScore = examQuestionAnswerMapper.selectCountPointByQuId(examQuestion.getQuId());
@@ -239,13 +247,13 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (table1Columns.equals(table2Columns)) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】" + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuSQL, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
appendToFile(answerLogPath, "【执行】 " + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】 " + "" + showCreateTableSql + "】【验证】【表】【" + tableName + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuSQL, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -324,14 +332,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (isEquivalent) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】 " + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuSql, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
appendToFile(answerLogPath, "【执行】" + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】 " + "" + yanzheng + "】【验证】【表】【" + tableName + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuSql, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -389,14 +397,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
// appendToFile(answerLogPath, "验证通过:符合 DELETE 条件的记录已删除。");
// judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "验证通过:符合 DELETE 条件的记录已删除。");
appendToFile(answerLogPath, "【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
appendToFile(answerLogPath, "【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】 " + "" + verifySql + "】 【验证】 【表】 【" + tableName + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(null, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -499,14 +507,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (isEquivalent) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuSql, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
appendToFile(answerLogPath, "【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】 " + "" + selectSql + "】【验证】【表】【" + tableName + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuSql, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -575,7 +583,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (StringUtils.isBlank(stuAnswer.get())) {
SourceAndText sourceAndTextError = new SourceAndText();
appendToFile(answerLogPath, "考生SQL文件丢失或未作答无法评分得分0.0【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考生SQL文件丢失或未作答无法评分得分0.0【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】考生SQL文件丢失或未作答无法评分得分0.0");
sourceAndTextError.setText(judgementStr);
sourceAndTextError.setScore(0.0);
continue;
@@ -605,7 +613,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (isEquivalent) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果正确");
//todo 得分
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, String.valueOf(stuAnswer), totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
@@ -613,7 +621,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
} else {
appendToFile(answerLogPath, "【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】" + sql + "【验证】【文件】【" + fileName.get() + "】【结果失败");
SourceAndText studentScorePojo = calculateTotalScoreRate(String.valueOf(stuAnswer), examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -683,11 +691,11 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (result2 != null && result2.size() > 0) {
if (result1.size() == result2.size()) {
appendToFile(answerLogPath, "【记录数】【" + result1.size() + "】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【记录数】【" + result1.size() + "【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【记录数】【" + result1.size() + "");
}
} else {
appendToFile(answerLogPath, "【记录数】【" + result1.size() + "】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【记录数】【" + result1.size() + "【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【记录数】【" + result1.size() + "");
}
}
// 比较两个视图的结果
@@ -699,14 +707,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (isEquivalent) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】" + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuSQL, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
appendToFile(answerLogPath, "【执行】 " + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】" + "" + showCreateViewSql + "】【验证】【视图】【" + viewNam1 + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuSQL, examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -783,7 +791,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (StringUtils.isBlank(stuAnswer.get())) {
SourceAndText sourceAndTextError = new SourceAndText();
appendToFile(answerLogPath, "考生SQL文件丢失或未作答无法评分得分0.0【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考生SQL文件丢失或未作答无法评分得分0.0【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】考生SQL文件丢失或未作答无法评分得分0.0");
sourceAndTextError.setText(judgementStr);
sourceAndTextError.setScore(0.0);
continue;
@@ -814,7 +822,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (flag) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + extractCallStatements + "【验证】【文件】【" + fileName.get() + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + extractCallStatements + "【验证】【文件】 【" + fileName.get() + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + extractCallStatements + "✅】【验证】【文件】 【" + fileName.get() + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuAnswer.get(), totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -822,7 +830,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
} else {
appendToFile(answerLogPath, "【执行】" + extractCallStatements + "【验证】【文件】【" + fileName.get() + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + extractCallStatements + "【验证】【文件】【" + fileName.get() + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】" + extractCallStatements + "【验证】【文件】【" + fileName.get() + "】【结果错误");
//得分
SourceAndText studentScorePojo = calculateTotalScoreRate(stuAnswer.get(), examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
@@ -907,7 +915,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (StringUtils.isBlank(stuAnswer.get())) {
SourceAndText sourceAndTextError = new SourceAndText();
appendToFile(answerLogPath, "考生SQL文件丢失或未作答无法评分得分0.0【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "考生SQL文件丢失或未作答无法评分得分0.0【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】考生SQL文件丢失或未作答无法评分得分0.0");
sourceAndTextError.setText(judgementStr);
sourceAndTextError.setScore(0.0);
continue;
@@ -950,7 +958,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (equals) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果正确");
//todo 得分
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, stuAnswer.get(), totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
@@ -958,14 +966,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
} else {
appendToFile(answerLogPath, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【验证】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【验证】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuAnswer.get(), examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
}
} else {
appendToFile(answerLogPath, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果】【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】" + answerSQL + "【验证】【文件】 【" + fileName.get() + "】【结果错误");
SourceAndText studentScorePojo = calculateTotalScoreRate(stuAnswer.get(), examMysqlKeywordList, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
@@ -1035,13 +1043,13 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (isEquivalent) {
correctCount++; // 完全正确
appendToFile(answerLogPath, "【执行】 " + "" + selectSql + "】 【验证】 【表】 【" + tableName + "】【结果】【√】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + selectSql + "】 【验证】 【表】 【" + tableName + "】【结果】【✅");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【执行】 " + "" + selectSql + "】 【验证】 【表】 【" + tableName + "】【结果正确");
SourceAndText studentScorePojo = accumulateScoreAndLog(examMysqlKeywordList, total, answerLogPath, sql, totalKeyScore, score, answerId, scoreTotal, judgementStr);
scoreTotal += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【执行】 " + "" + selectSql + "】 【验证】 【表】 【" + tableName + "】【结果】【❌");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【执行】 " + "" + selectSql + "】 【验证】 【表】 【" + tableName + "】【结果错误");
if (answerListStu.size() >= 2) {
List<String> fieldMeta = answerListStu.get(0);
List<String> fieldValue = answerListStu.get(1);
@@ -1225,9 +1233,9 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
tableNameCheckOther = tableName.equalsIgnoreCase(tableNameStu) ? "" : "";
}
// 输出
System.out.printf("%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
appendToFile(answerLogPath, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheckOther);
System.out.printf("【%s】%02d.【数据表】【%s】【名称】【%s】\n", tableNameCheck,index, dbTable, tableName);
appendToFile(answerLogPath, "【%s】%02d.【数据表】【%s】【名称】【%s】\n", tableNameCheck,index, dbTable, tableName );
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "【%s】,%02d.【数据表】【%s】【名称】【%s】\n",tableNameCheckOther, index, dbTable, tableName);
// 把Set转成Map方便通过字段名快速取值
Map<String, Map<String, String>> standardMap = convertSetToMap(standardSet);
Map<String, Map<String, String>> studentMap = convertSetToMap(studentSet);
@@ -1241,7 +1249,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
String nameCheck = stuCol != null ? "" : "x";
String nameCheckOther = stuCol != null ? "" : "";
System.out.printf("%02d.【字段】【%s】【名称】【%s】【%s】\n", ++index, fullName, columnName, nameCheck);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index, fullName, columnName, nameCheckOther);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "【%s】%02d.【字段】【%s】【名称】【%s】\n",nameCheckOther, index, fullName, columnName );
appendToFile(answerLogPath, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index, fullName, columnName, nameCheck);
if (stuCol != null) {
@@ -1280,9 +1288,9 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
MysqlVo mysqlVo = new MysqlVo();
String mark = stdValue.equalsIgnoreCase(stuValue) ? "" : "x";
String markOther = stdValue.equalsIgnoreCase(stuValue) ? "" : "";
System.out.printf("%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, mark);
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, mark);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, markOther);
System.out.printf("【%s】%02d.【字段】【%s】【%s】【%s】\n", mark,index + 1, fullName, property, stuValue);
appendToFile(answerLogPath, "【%s】%02d.【字段】【%s】【%s】【%s】\n", mark,index + 1, fullName, property, stuValue);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "【%s】%02d.【字段】【%s】【%s】【%s】\n", markOther,index + 1, fullName, property, stuValue);
mysqlVo.setText(judgementStr);
mysqlVo.setIndex(index + 1);
return mysqlVo;
@@ -1290,9 +1298,9 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
private static MysqlVo printMissing(int index, String fullName, String property, String stdValue, String judgementStr) {
MysqlVo mysqlVo = new MysqlVo();
System.out.printf("%02d.【字段】【%s】【%s】【%s】【x】\n", index + 1, fullName, property, stdValue);
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【x】\n", index + 1, fullName, property, stdValue);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【❌】\n", index + 1, fullName, property, stdValue);
System.out.printf("【x】%02d.【字段】【%s】【%s】【%s】\n", index + 1, fullName, property, stdValue);
appendToFile(answerLogPath, "【x】%02d.【字段】【%s】【%s】【%s】\n", index + 1, fullName, property, stdValue);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "【❌】%02d.【字段】【%s】【%s】【%s】\n", index + 1, fullName, property, stdValue);
mysqlVo.setText(judgementStr);
mysqlVo.setIndex(index + 1);
return mysqlVo;
@@ -1451,7 +1459,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (keywordValue != null && !keywordValue.isEmpty()) {
// 使用正则,确保是完整单词(字段)匹配
String regex = keywordValue;
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【关键字】 【" + regex + "" + "【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【关键字】 【" + regex + "");
appendToFile(answerLogPath, "【关键字】 【" + regex + "" + "【×】");
}
}
@@ -1459,7 +1467,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "该语句未设置关键字!");
appendToFile(answerLogPath, "该语句未设置关键字!");
}
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "该语句未作答得分0.0 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】该语句未作答得分0.0 ");
appendToFile(answerLogPath, "该语句未作答得分0.0 【×】");
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
@@ -1499,14 +1507,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
if (sql.contains(regex)) {
try {
totalScoreRate += Integer.parseInt(keyword.getScoreRate());
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【关键字】 【" + regex + "" + "【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "✅】【关键字】 【" + regex + "" );
appendToFile(answerLogPath, "【关键字】 【" + regex + "" + "【√】");
matchedKeywords.add(keywordValue);
} catch (NumberFormatException e) {
System.err.println("Invalid scoreRate format for keyword: " + keywordValue);
}
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【关键字】 【" + regex + "" + "【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "❌】【关键字】 【" + regex + "" );
appendToFile(answerLogPath, "【关键字】 【" + regex + "" + "【×】");
}
}
@@ -1571,7 +1579,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
String regKey = "HKEY_USERS\\" + sid + "\\Software\\PremiumSoft\\Navicat\\Servers\\答题专用";
System.out.println("将要删除注册表路径:" + regKey);
// ---- 先检查注册表是否存在 ----
String[] queryCmd = {"reg", "query", regKey};
Process queryProcess = Runtime.getRuntime().exec(queryCmd);
int queryExit = queryProcess.waitFor();
if (queryExit != 0) {
System.out.println("⚠ 注册表路径不存在,无需删除");
return;
}
String[] cmd = {"reg", "delete", regKey, "/f"};
Process process = Runtime.getRuntime().exec(cmd);

View File

@@ -57,7 +57,19 @@ public class PsServiceImpl implements PsService {
sourceAndText.setScore(0.0);
return sourceAndText;
}
// ---- 计算每个分数 ----
int size = treeAnswerList.size();
double perScore = 0.0;
if (size > 0) {
perScore = score / size;
// 保留两位小数
perScore = Math.round(perScore * 100.0) / 100.0;
}else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "未设置考点!");
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
return sourceAndText;
}
String sthJsonPath = path.replaceAll("(?i)\\.psd$", ".json");
Path jsonFilePath = Paths.get(sthJsonPath);
@@ -82,7 +94,7 @@ public class PsServiceImpl implements PsService {
// 遍历树形结构,对比每个节点
for (ExamPsKeyword item : treeAnswerList) {
SourceAndText studentScorePojo = compareItemWithStudentJson(item, studentJson, "", judgementStr);
SourceAndText studentScorePojo = compareItemWithStudentJson(item, studentJson, "", judgementStr,perScore);
totalScore += studentScorePojo.getScore();
judgementStr = studentScorePojo.getText();
}
@@ -123,7 +135,7 @@ public class PsServiceImpl implements PsService {
}
}
private SourceAndText compareItemWithStudentJson(ExamPsKeyword item, JSONObject studentJson, String parentPath, String judgementStr) {
private SourceAndText compareItemWithStudentJson(ExamPsKeyword item, JSONObject studentJson, String parentPath, String judgementStr,double score) {
SourceAndText result = new SourceAndText();
// 当前节点路径(用中文【】包裹是为了兼容你已有的格式)
@@ -140,11 +152,11 @@ public class PsServiceImpl implements PsService {
boolean isCorrect = correctValue != null && correctValue.equals(studentValue);
if (isCorrect) {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, currentPath + "" + correctValue + "【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】"+currentPath + "" + correctValue + ",得分:"+score);
appendToFile(answerLogPath, currentPath + "" + correctValue + "" + "【√】");
result.setScore(result.getScore() + Double.parseDouble(item.getRate()));
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, currentPath + "" + correctValue + "" + "【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+currentPath + "" + correctValue + ",得分失败");
appendToFile(answerLogPath, currentPath + "" + correctValue + "" + "【×】");
}
@@ -152,7 +164,7 @@ public class PsServiceImpl implements PsService {
} else {
// 有子节点,递归比较
for (ExamPsKeyword child : item.getChildren()) {
SourceAndText childResult = compareItemWithStudentJson(child, studentJson, currentPath, judgementStr);
SourceAndText childResult = compareItemWithStudentJson(child, studentJson, currentPath, judgementStr,score);
judgementStr = childResult.getText(); // ✅ 更新外层judgementStr
result.setScore(result.getScore() + childResult.getScore());
}

View File

@@ -41,6 +41,13 @@ public class FileServericeImpl implements IFileServerice {
// answerList.add(new ExamQuestionAnswer("","","","","WUE\\PB6.txt", "考察名称", "1", "6"));
int correctCount = 0; // 完全正确的题目数量
int totalQuestions = answerList.size(); // 总题目数量// 总题目数量
if (totalQuestions > 0) {
}else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "未设置考点!");
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
return sourceAndText;
}
File stuPath = file;
// 设置日志文件路径为file所在目录下的answerLogFile.txt
@@ -112,12 +119,12 @@ public class FileServericeImpl implements IFileServerice {
correctCount++; // 完全正确
// 计算该考点的权重得分并保留一位小数
double weightScore = ((double) currentScore / total) * score;
String formattedWeightScore = String.format("%.1f", weightScore);
String formattedWeightScore = String.format("%.2f", weightScore);
appendToFile(answerLogPath, "" + answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore);
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】"+answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分:" + formattedWeightScore );
} else {
appendToFile(answerLogPath, "×" + answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分0");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分0 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate() + "-> 得分失败 ");
}
}
sourceAndText.setText(judgementStr);

View File

@@ -79,14 +79,14 @@ public class JudgementWpsExcelServiceImpl implements JudgementWpsExcelService {
if (flag) {
judgementStr = HtmlAppender.appendHtmlLine(
judgementStr,
examQuestionAnswer.getContentIn() + " 得分成功,得分:" +
new BigDecimal(one_score).setScale(1, RoundingMode.HALF_UP) + " 【✅】"
"【✅】"+examQuestionAnswer.getContentIn() + " 得分成功,得分:" +
new BigDecimal(one_score).setScale(1, RoundingMode.HALF_UP)
);
} else {
isAllTrue = false;
judgementStr = HtmlAppender.appendHtmlLine(
judgementStr,
examQuestionAnswer.getContentIn() + " 得分失败 【❌】"
"【❌】"+examQuestionAnswer.getContentIn() + " 得分失败"
);
}
}

View File

@@ -101,11 +101,20 @@ public class XlsxMaster {
String value = (String) methodWithArgs.invoke(excelFunctions, poiCell, workbook);
if (value != null) {
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction +"@"+cellRef+ "@" + value,
firstName +""+cellRef+""+ examName + value
);
if ("getCellDataFormat".equals(function)){
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction +"@"+cellRef+ "@" + value,
firstName +""+cellRef+""+ examName + ""
);
}else {
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction +"@"+cellRef+ "@" + value,
firstName +""+cellRef+""+ examName + value
);
}
}
}
}
@@ -128,11 +137,20 @@ public class XlsxMaster {
// for (String cellRef : cellRefs) {
String value = (String) methodWithArgs.invoke(rangingFunctions, rangeStr, workbook,sheetNum);
if (value != null) {
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction + "@" + rangeStr + "@" + value,
firstName + "" + rangeStr + "" + examName + value
);
if ("printCellFormatNumStyle".equals(function)){
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction + "@" + rangeStr + "@" + value,
firstName + "" + rangeStr + "" + examName + ""
);
}else {
judgementXlsxVOS = setJudgementXlsx(
judgementXlsxVOS,
docxFunction + "@" + rangeStr + "@" + value,
firstName + "" + rangeStr + "" + examName + value
);
}
}
// }
}

View File

@@ -10,7 +10,9 @@ import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -400,10 +402,17 @@ public class RangIng {
if (cell.getCellType() == CellType.FORMULA) {
CellType evaluatedType = evaluator.evaluateFormulaCell(cell);
String val;
String val = null;
switch (evaluatedType) {
case NUMERIC:
val = String.valueOf(cell.getNumericCellValue());
if (DateUtil.isCellDateFormatted(cell)) {
// 如果是日期格式,格式化为 yyyy/M/d
Date date = cell.getDateCellValue();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/M/d");
val = sdf.format(date);
} else {
val = String.valueOf(cell.getNumericCellValue());
}
break;
case STRING:
val = cell.getStringCellValue();
@@ -414,8 +423,6 @@ public class RangIng {
case ERROR:
val = "错误值";
break;
default:
val = null;
}
if (val != null) {

View File

@@ -65,10 +65,10 @@ public class JudgementWpsPptxServiceImpl implements JudgementWpsPptxService {
}
wpsPptScore += one_sorce;
if (flag) {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, examQuestionAnswer.getContentIn() + " 得分成功,得分:" + new BigDecimal(one_sorce).setScale(1, RoundingMode.HALF_UP) + " 【✅】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【✅】"+examQuestionAnswer.getContentIn() + "得分成功,得分:" + new BigDecimal(one_sorce).setScale(1, RoundingMode.HALF_UP));
} else {
isAllTrue = false;
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, examQuestionAnswer.getContentIn() + " 得分失败 【❌】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+examQuestionAnswer.getContentIn() + " 得分失败");
}
}
if (isAllTrue) {

View File

@@ -75,14 +75,14 @@ public class JudgementWpsWordServiceImpl implements JudgementWpsWordService {
if (flag) {
judgementStr = HtmlAppender.appendHtmlLine(
judgementStr,
examQuestionAnswer.getContentIn() + " 得分成功,得分:" +
new BigDecimal(one_sorce).setScale(1, RoundingMode.HALF_UP) + " 【✅】"
"【✅】"+examQuestionAnswer.getContentIn() + " 得分成功,得分:" +
new BigDecimal(one_sorce).setScale(1, RoundingMode.HALF_UP)
);
} else {
isAllTrue = false; // 有一个考点不对,标识为不全对
judgementStr = HtmlAppender.appendHtmlLine(
judgementStr,
examQuestionAnswer.getContentIn() + " 得分失败 【❌】"
"【❌】"+examQuestionAnswer.getContentIn() + " 得分失败"
);
}
}

View File

@@ -1256,27 +1256,50 @@ public class TextInfo {
return judgementWordsVOS;
}
// 文本内容
public static String getTextValue(List<JudgementWordsVO> judgementWordsVOS, Anchor anchor, int betoLong,WordprocessingMLPackage wordMLPackage){
public static String getTextValue(List<JudgementWordsVO> judgementWordsVOS,
Anchor anchor,
int betoLong,
WordprocessingMLPackage wordMLPackage) {
Object graphicData = anchor.getGraphic().getGraphicData().getAny().get(0);
// 正确处理 JAXBElement
if (graphicData instanceof JAXBElement) {
JAXBElement<?> jaxbElement = (JAXBElement<?>) graphicData;
Object value = jaxbElement.getValue();
// 现在可以尝试转换为实际类型
if (value.getClass().getName().contains("CTWordprocessingShape")) {
if (value instanceof CTWordprocessingShape) {
// 文本内容
CTWordprocessingShape textInfo = (CTWordprocessingShape) value;
String textValue = textInfo.getTxbx().getTxbxContent().getContent().toString();
if (textValue!=null){
return textValue;
if (value instanceof CTWordprocessingShape) {
CTWordprocessingShape textInfo = (CTWordprocessingShape) value;
if (textInfo.getTxbx() != null && textInfo.getTxbx().getTxbxContent() != null) {
StringBuilder sb = new StringBuilder();
List<Object> contents = textInfo.getTxbx().getTxbxContent().getContent();
for (Object obj : contents) {
// 解包 JAXBElement
Object unwrapped = (obj instanceof JAXBElement) ? ((JAXBElement<?>) obj).getValue() : obj;
if (unwrapped instanceof P) {
P para = (P) unwrapped;
List<Object> paraContents = para.getContent();
for (Object pc : paraContents) {
Object inner = (pc instanceof JAXBElement) ? ((JAXBElement<?>) pc).getValue() : pc;
if (inner instanceof R) {
R run = (R) inner;
for (Object rc : run.getContent()) {
Object rcVal = (rc instanceof JAXBElement) ? ((JAXBElement<?>) rc).getValue() : rc;
if (rcVal instanceof Text) {
sb.append(((Text) rcVal).getValue());
}
}
}
}
sb.append("\n"); // 段落换行
}
}
return sb.toString().trim();
}
}
}
return null;
return "";
}
// 文字方向
public static String getTextVert(List<JudgementWordsVO> judgementWordsVOS, Anchor anchor, int betoLong, WordprocessingMLPackage wordMLPackage) {