【修改】 修改成绩明细中,试卷分析没有按照题目排序的问题

This commit is contained in:
DESKTOP-932OMT8\REN
2025-06-13 16:05:46 +08:00
parent a450424b18
commit 80e280ed5f
9 changed files with 341 additions and 26 deletions

View File

@@ -11,10 +11,12 @@ import org.springframework.web.bind.annotation.RestController;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperInfoDO;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper;
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
import pc.exam.pp.module.exam.service.stuPaperInfo.StuPaperInfoService;
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService;
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuPaperReqVo;
@@ -55,7 +57,7 @@ public class AutoToolsController {
@Resource
IExamQuestionService examQuestionService;
@Resource
StuPaperFileService stuPaperFileService;
StuPaperInfoService stuPaperInfoService;
@GetMapping("/get")
public CommonResult<BigDecimal> get(StuPaperReqVo stuPaperReqVo) throws Exception {
@@ -96,14 +98,11 @@ public class AutoToolsController {
List<ExamQuestion> examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds);
stuPaperScoreInfoVos.setExamQuestionList(examQuestionList);
// 5、查询学生试卷分析
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(), stuPaperReqVo.getPaperId());
String judgementStr = " ";
for (StuPaperFileDO stuPaperFileDOs : stuPaperFileDOList) {
if (stuPaperFileDOs.getType() == 0) {
if (stuPaperFileDOs.getContent() != null) {
judgementStr = stuPaperFileDOs.getContent();
}
}
List<StuPaperInfoDO> stuPaperInfoDOList = stuPaperInfoService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(), stuPaperReqVo.getPaperId());
String judgementStr = "<p>试卷分析</p>";
for (StuPaperInfoDO stuPaperInfoDO : stuPaperInfoDOList) {
judgementStr += "<p></p>";
judgementStr += stuPaperInfoDO.getContent();
}
stuPaperScoreInfoVos.setPaperAnalysis(judgementStr);
return CommonResult.success(stuPaperScoreInfoVos);

View File

@@ -16,6 +16,7 @@ import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperInfoDO;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper;
@@ -24,6 +25,7 @@ import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperScoreMapper;
import pc.exam.pp.module.exam.service.paper.IEducationPaperQuService;
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
import pc.exam.pp.module.exam.service.stuPaperInfo.StuPaperInfoService;
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService;
import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO;
@@ -59,6 +61,8 @@ public class AutoToolsServiceImpl implements AutoToolsService{
@Resource
private StuPaperFileService stuPaperFileService;
@Resource
private StuPaperInfoService stuPaperInfoService;
@Resource
ConfigService configService;
@Resource
IExamQuestionService examQuestionService;
@@ -94,8 +98,6 @@ public class AutoToolsServiceImpl implements AutoToolsService{
EducationPaperSchemeMapper educationPaperSchemeMapper;
@Resource
EducationPaperMapper educationPaperMapper;
@Resource
IEducationPaperQuService iEducationPaperQuService;
@Override
public String downloadStudentFile(String fileUrl, String filePath) {
try {
@@ -197,7 +199,6 @@ public class AutoToolsServiceImpl implements AutoToolsService{
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
StuPaperFileDO stuPaperFileDO = null;
StuPaperFileDO noZipFileDO = null;
String judgementStr = " ";
for (StuPaperFileDO stuPaperFileDOs : stuPaperFileDOList) {
if (stuPaperFileDOs.getType() == 1) {
noZipFileDO = stuPaperFileDOs;
@@ -205,9 +206,6 @@ public class AutoToolsServiceImpl implements AutoToolsService{
}
if (stuPaperFileDOs.getType() == 0) {
stuPaperFileDO = stuPaperFileDOs;
if (stuPaperFileDOs.getContent() != null) {
judgementStr = stuPaperFileDOs.getContent();
}
}
}
@@ -372,8 +370,26 @@ public class AutoToolsServiceImpl implements AutoToolsService{
String judgementStr_C = "";
SourceAndText cpojo = judgementService.ProgrammingC(Double.parseDouble(quScore), one_file.getPath(), file_one.getName(), examQuestion, judgementStr_C);
double c_score = cpojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += cpojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score += c_score;
stuPaperScoreDO.setScore(new BigDecimal(c_score));
// 原始正确分数
@@ -402,8 +418,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{
String judgementStrWord = "";
SourceAndText wordpojo = judgementWpsWordService.judgementWpsWord(Double.parseDouble(quScore), one_file.getPath(), file_one.getPath(), examQuestion, judgementStrWord);
double wps_word_score = wordpojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += wordpojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score += wps_word_score;
stuPaperScoreDO.setScore(new BigDecimal(wps_word_score));
// 原始正确分数
@@ -431,8 +463,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{
String judgementStrPptx = "";
SourceAndText pptxpojo = judgementWpsPptxService.judgementWpsPptx(Double.parseDouble(quScore), one_file.getPath(), file_one.getPath(), examQuestion, judgementStrPptx);
double wps_pptx_score = pptxpojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += pptxpojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score += wps_pptx_score;
stuPaperScoreDO.setScore(new BigDecimal(wps_pptx_score));
// 原始正确分数
@@ -487,8 +535,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{
File win_file = new File(one_file.getPath());
SourceAndText winfilepojo = fileServerice.run_file_point(Double.parseDouble(quScore),win_file, examQuestion, judgementStrFile);
double win_file_score = winfilepojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += winfilepojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score += win_file_score;
stuPaperScoreDO.setScore(new BigDecimal(win_file_score));
// 原始正确分数
@@ -520,8 +584,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{
File edge_file = new File(one_file.getPath());
SourceAndText browsepojo= browserServerice.Judgement(Double.parseDouble(quScore),edge_file,examQuestion, judgementStrBrow);
double browse_score = browsepojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += browsepojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score += browse_score;
stuPaperScoreDO.setScore(new BigDecimal(browse_score));
// 原始正确分数
@@ -552,8 +632,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{
File mysql_file = new File(one_file.getPath());
SourceAndText judgementpojo = mysqlServerice.Judgement(Double.parseDouble(quScore),mysql_file, examQuestion, judgementStrMysql);
double judgement = judgementpojo.getScore();
judgementStr += "<p>-----------------------------------------------------------</p>";
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += judgementpojo.getText();
// 通过学号+试卷ID+试题ID进行查询
StuPaperInfoDO stuPaperInfoDO = stuPaperInfoService.findByStuIDAndPaperIdAndExamId(stuId, paperId, examQuestion.getQuId());
if (stuPaperInfoDO != null) {
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.updateStuPaperInfo(stuPaperInfoDO);
} else {
stuPaperInfoDO = new StuPaperInfoDO();
stuPaperInfoDO.setStuId(stuId);
stuPaperInfoDO.setPaperId(paperId);
stuPaperInfoDO.setQuId(examQuestion.getQuId());
stuPaperInfoDO.setContent(judgementStr);
stuPaperInfoDO.setSort(stuPaperScoreDO.getSort());
stuPaperInfoService.insertStuPaperInfo(stuPaperInfoDO);
}
score+=judgement;
stuPaperScoreDO.setScore(new BigDecimal(judgement));
// 原始正确分数
@@ -589,10 +685,6 @@ public class AutoToolsServiceImpl implements AutoToolsService{
// 9、上传文件
MultipartFile file = new CustomMultipartFile(zipPath);
String path = null;
if (stuPaperFileDO != null) {
stuPaperFileDO.setContent(judgementStr);
stuPaperFileService.updateStuPaperFile(stuPaperFileDO);
}
fileService.createStuFile(stuId, paperId, file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()));
// 更新学生分数
endStuMonitorUtils.endStuMonitor(String.valueOf(stuId),paperId,score);

View File

@@ -0,0 +1,57 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReflectionAnalyzer {
public static String analyzeReflection(String reflectionTag) {
Map<String, String> attrMap = new HashMap<>();
// 提取属性
Pattern pattern = Pattern.compile("(\\w+)=\"([^\"]+)\"");
Matcher matcher = pattern.matcher(reflectionTag);
while (matcher.find()) {
attrMap.put(matcher.group(1), matcher.group(2));
}
// 读取关键属性
int sy = Integer.parseInt(attrMap.getOrDefault("sy", "0"));
String algn = attrMap.getOrDefault("algn", "");
// 分类 sy 类型
String scaleType;
if (sy == -100000) {
scaleType = "镜像倒影";
} else if (sy < -100000) {
scaleType = "放大倒影";
} else if (sy < 0) {
scaleType = "缩小倒影";
} else {
scaleType = "非倒影或非法值";
}
// 分类 algn 类型
String contactType = switch (algn) {
case "bl", "b" -> "接触";
case "ctr", "t", "tl", "tr" -> "不接触";
default -> "未知";
};
return scaleType + "" + contactType;
}
public static void main(String[] args) {
String input1 = "<a:reflection blurRad=\"6350\" stA=\"52000\" endA=\"300\" endPos=\"35000\" dir=\"5400000\" sy=\"-100000\" algn=\"bl\" rotWithShape=\"0\"/>";
String input2 = "<a:reflection blurRad=\"4000\" stA=\"60000\" endA=\"5000\" endPos=\"20000\" dir=\"5400000\" sy=\"-80000\" algn=\"ctr\"/>";
String input3 = "<a:reflection sy=\"-120000\" algn=\"b\"/>";
String input4 = "<a:reflection sy=\"50000\" algn=\"tr\"/>";
System.out.println(analyzeReflection(input1)); // 镜像倒影,接触
System.out.println(analyzeReflection(input2)); // 缩小倒影,不接触
System.out.println(analyzeReflection(input3)); // 放大倒影,接触
System.out.println(analyzeReflection(input4)); // 非倒影或非法值,不接触
}
}

View File

@@ -160,7 +160,7 @@ public class WpsPptxUtils {
if (dur == null) {
value = "0秒";
} else {
value = Integer.parseInt(dur) / 1000 + "";
value = String.valueOf((double) Integer.parseInt(dur) / 1000);
}
WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
@@ -186,6 +186,18 @@ public class WpsPptxUtils {
judgementDto.setScoreRate("1");
judgementList.add(judgementDto);
}
} else if (pptxInfoPointsVo.getName().contains("形状效果") && pptxInfoPointsVo.getName().contains("预设")) {
slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
if (slideCursor.toNextSelection()) {
String value = slideCursor.xmlText();
value = ReflectionAnalyzer.analyzeReflection(value);
WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
judgementDto.setScoreRate("1");
judgementList.add(judgementDto);
}
} else {
slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
if (slideCursor.toNextSelection()) {