diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperInfoDO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperInfoDO.java new file mode 100644 index 00000000..0cb045a8 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperInfoDO.java @@ -0,0 +1,46 @@ +package pc.exam.pp.module.exam.dal.dataobject.student; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +/** + * 学生-试卷-判分详情表 DO + * + * @author rwb + */ +@TableName("exam_stu_paper_info") +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StuPaperInfoDO extends TenantBaseDO { + + /** + * Id + */ + @TableId + private Long id; + /** + * 学生号 + */ + private Long stuId; + /** + * 试卷ID + */ + private String paperId; + + /** + * 判分详情,富文本格式 + */ + private String content; + + /** + * 试题排序 + */ + private int sort; + + private String quId; +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperInfoMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperInfoMapper.java new file mode 100644 index 00000000..b489b76e --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperInfoMapper.java @@ -0,0 +1,23 @@ +package pc.exam.pp.module.exam.dal.mysql.student; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperInfoDO; + +import java.util.List; + +/** + * 学生-试卷-判分详情 Mapper + * + * @author rwb + */ +@Mapper +public interface StuPaperInfoMapper extends BaseMapperX { + List findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId); + + default StuPaperInfoDO findByStuIdAndPaperIdAndQuId(Long stuId, String paperId, String quId) { + return selectOne(StuPaperInfoDO::getStuId, stuId, StuPaperInfoDO::getPaperId, paperId, StuPaperInfoDO::getQuId, quId); + } + List findOneByStuIdAndPaperId(@Param("stuId")Long stuId, @Param("paperId")String paperId,@Param("type") int type); +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoService.java new file mode 100644 index 00000000..0690bf59 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoService.java @@ -0,0 +1,22 @@ +package pc.exam.pp.module.exam.service.stuPaperInfo; + +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperInfoDO; + +import java.util.List; + +/** + * 学生-试卷-判分详情 Service 接口 + * + * @author rwb + */ +public interface StuPaperInfoService { + + List findByStuIDAndPaperId(Long stuID, String paperID); + + StuPaperInfoDO findByStuIDAndPaperIdAndExamId(Long stuID, String paperID, String quId); + + void insertStuPaperInfo(StuPaperInfoDO stuPaperInfoDO); + + void updateStuPaperInfo(StuPaperInfoDO stuPaperInfoDO); +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoServiceImpl.java new file mode 100644 index 00000000..071544c8 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stuPaperInfo/StuPaperInfoServiceImpl.java @@ -0,0 +1,45 @@ +package pc.exam.pp.module.exam.service.stuPaperInfo; + +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +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.student.StuPaperFileMapper; +import pc.exam.pp.module.exam.dal.mysql.student.StuPaperInfoMapper; +import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService; + +import java.util.List; + +/** + * 学生-试卷-判分详情 Service 实现类 + * + * @author rwb + */ +@Service +@Validated +public class StuPaperInfoServiceImpl implements StuPaperInfoService { + + @Resource + private StuPaperInfoMapper stuPaperInfoMapper; + + @Override + public List findByStuIDAndPaperId(Long stuID, String paperID) { + return stuPaperInfoMapper.findByStuIdAndPaperId(stuID, paperID); + } + + @Override + public StuPaperInfoDO findByStuIDAndPaperIdAndExamId(Long stuID, String paperID, String quId) { + return stuPaperInfoMapper.findByStuIdAndPaperIdAndQuId(stuID, paperID, quId); + } + + @Override + public void insertStuPaperInfo(StuPaperInfoDO stuPaperInfoDO) { + stuPaperInfoMapper.insert(stuPaperInfoDO); + } + + @Override + public void updateStuPaperInfo(StuPaperInfoDO stuPaperInfoDO) { + stuPaperInfoMapper.updateById(stuPaperInfoDO); + } +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperInfoMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperInfoMapper.xml new file mode 100644 index 00000000..023e6188 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperInfoMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java index 3143e352..f841e5b3 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java @@ -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 get(StuPaperReqVo stuPaperReqVo) throws Exception { @@ -96,14 +98,11 @@ public class AutoToolsController { List examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds); stuPaperScoreInfoVos.setExamQuestionList(examQuestionList); // 5、查询学生试卷分析 - List 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 stuPaperInfoDOList = stuPaperInfoService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(), stuPaperReqVo.getPaperId()); + String judgementStr = "

试卷分析

"; + for (StuPaperInfoDO stuPaperInfoDO : stuPaperInfoDOList) { + judgementStr += "

"; + judgementStr += stuPaperInfoDO.getContent(); } stuPaperScoreInfoVos.setPaperAnalysis(judgementStr); return CommonResult.success(stuPaperScoreInfoVos); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java index 48df36d9..192df458 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java @@ -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 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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 += "

-----------------------------------------------------------

"; + String judgementStr = "

-----------------------------------------------------------

"; + judgementStr += "

试题编号" + examQuestion.getQuNum() + "

"; 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); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/ReflectionAnalyzer.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/ReflectionAnalyzer.java new file mode 100644 index 00000000..50906514 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/ReflectionAnalyzer.java @@ -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 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 = ""; + String input2 = ""; + String input3 = ""; + String input4 = ""; + + System.out.println(analyzeReflection(input1)); // 镜像倒影,接触 + System.out.println(analyzeReflection(input2)); // 缩小倒影,不接触 + System.out.println(analyzeReflection(input3)); // 放大倒影,接触 + System.out.println(analyzeReflection(input4)); // 非倒影或非法值,不接触 + } +} \ No newline at end of file diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java index 42643cb2..0a1dc13a 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java @@ -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()) {