From 33bacf48c491ce215881ee92bb9e8a5a819c6180 Mon Sep 17 00:00:00 2001 From: "MSI\\letre" Date: Mon, 7 Jul 2025 16:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=20?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=88=86=E6=95=B0=E5=92=8C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=88=86=E6=95=B0=EF=BC=8C=E4=BF=9D=E7=95=99=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B91=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exam/controller/auto/AutoController.java | 42 ++++++++++++++----- .../exam/controller/auto/vo/StuInfoVo.java | 6 +++ .../autoforbrower/AutoForBrowerService.java | 3 +- .../AutoForBrowerServiceImpl.java | 10 ++--- .../service/autoforc/AutoForCService.java | 4 +- .../service/autoforc/AutoForCServiceImpl.java | 10 ++--- .../AutoForChoiceServiceImpl.java | 4 +- .../autoforfile/AutoForFileService.java | 3 +- .../autoforfile/AutoForFileServiceImpl.java | 10 ++--- .../autoformysql/AutoForMysqlService.java | 3 +- .../autoformysql/AutoForMysqlServiceImpl.java | 10 ++--- .../service/autoforps/AutoForPsService.java | 3 +- .../autoforps/AutoForPsServiceImpl.java | 10 ++--- .../excel/JudgementForExcelService.java | 4 +- .../excel/JudgementForExcelServiceImpl.java | 10 ++--- .../wpspptx/pptx/JudgementForPptxService.java | 4 +- .../pptx/JudgementForPptxServiceImpl.java | 10 ++--- .../wpsword/word/JudgementForWordService.java | 4 +- .../word/JudgementForWordServiceImpl.java | 10 ++--- 19 files changed, 100 insertions(+), 60 deletions(-) diff --git a/src/main/java/com/example/exam/exam/controller/auto/AutoController.java b/src/main/java/com/example/exam/exam/controller/auto/AutoController.java index 184c53a..4f1cfd4 100644 --- a/src/main/java/com/example/exam/exam/controller/auto/AutoController.java +++ b/src/main/java/com/example/exam/exam/controller/auto/AutoController.java @@ -1,6 +1,7 @@ package com.example.exam.exam.controller.auto; import com.example.exam.exam.controller.auto.vo.StuInfoVo; +import com.example.exam.exam.service.autoForWinEdgeSetting.AutoForWinEdgeSettingService; import com.example.exam.exam.service.autoforbrower.AutoForBrowerService; import com.example.exam.exam.service.autoforps.AutoForPsService; import com.example.exam.exam.service.brower.JudgementBrowerService; @@ -18,6 +19,8 @@ import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.*; import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.sql.SQLException; import java.util.List; @@ -50,6 +53,8 @@ public class AutoController { StuPaperScoreService stuPaperScoreService; @Resource AutoForPsService autoForPsService; + @Resource + AutoForWinEdgeSettingService autoForWinEdgeSettingService; // C语言 @@ -59,30 +64,30 @@ public class AutoController { * @return 判分结果 */ @PostMapping("/judgementForC") - public Result judgementForC(@RequestBody StuInfoVo stuInfoVo){ + public Result judgementForC(@RequestBody StuInfoVo stuInfoVo){ return Result.success(autoService.autoForC(stuInfoVo)); } // WPS-WORD @PostMapping("/judgementForWord") - public Result judgementForWord(@RequestBody StuInfoVo stuInfoVo) throws Exception { + public Result judgementForWord(@RequestBody StuInfoVo stuInfoVo) throws Exception { return Result.success(judgementForWordService.autoForWpsWord(stuInfoVo)); } // WPS-EXCEL @PostMapping("/judgementForExcel") - public Result judgementForExcel(@RequestBody StuInfoVo stuInfoVo) throws Exception { + public Result judgementForExcel(@RequestBody StuInfoVo stuInfoVo) throws Exception { return Result.success(judgementForExcelService.autoForWpsExcel(stuInfoVo)); } // WPS-PPT @PostMapping("/judgementForPptx") - public Result judgementForPptx(@RequestBody StuInfoVo stuInfoVo) throws Exception { + public Result judgementForPptx(@RequestBody StuInfoVo stuInfoVo) throws Exception { return Result.success(judgementForPptxService.autoForWpsPptx(stuInfoVo)); } // Mysql @PostMapping("/judgementForMysql") - public Result judgementForMysql(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { + public Result judgementForMysql(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { return Result.success(autoForMysqlService.autoForMysql(stuInfoVo)); } // Mysql文件 @@ -102,23 +107,40 @@ public class AutoController { // 文件处理 @PostMapping("/judgementForFile") - public Result judgementForFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { + public Result judgementForFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { return Result.success(autoForFileService.autoForFile(stuInfoVo)); } // 浏览器 @PostMapping("/judgementForBrower") - public Result judgementForBrower(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { + public Result judgementForBrower(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { return Result.success(autoForBrowerService.autoForBrower(stuInfoVo)); } - // 浏览器设置 - + // windows网络设置 + /** + * 将浏览器的页面写入到JSON文件中 + * @param stuInfoVo 学生选择题信息 + * @return String + */ + @PostMapping("/judgementForEdgeDummyToJson") + public Result judgementForEdgeDummyToJson(@RequestBody List stuInfoVo){ + return Result.success(autoForWinEdgeSettingService.autoForEdgeToJson(stuInfoVo)); + } + /** + * windows网络设置判分 + * @param stuInfoVo 学生选择题信息 + * @return String + */ + @PostMapping("/judgementForEdgeDummy") + public Result judgementForEdgeDummy(@RequestBody StuInfoVo stuInfoVo) throws IOException { + return Result.success(autoForWinEdgeSettingService.autoForEdge(stuInfoVo)); + } // QQ邮箱 // win10虚拟界面 //PS @PostMapping("/judgementForPS") - public Result judgementForPS(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { + public Result judgementForPS(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException { return Result.success(autoForPsService.autoForPs(stuInfoVo)); } diff --git a/src/main/java/com/example/exam/exam/controller/auto/vo/StuInfoVo.java b/src/main/java/com/example/exam/exam/controller/auto/vo/StuInfoVo.java index 0225c66..38adfd4 100644 --- a/src/main/java/com/example/exam/exam/controller/auto/vo/StuInfoVo.java +++ b/src/main/java/com/example/exam/exam/controller/auto/vo/StuInfoVo.java @@ -23,6 +23,12 @@ public class StuInfoVo { // 选择题学生答案 private String choiceAnswerId; + // Edge学生设置Key + private String edgeAnswerKeys; + + // Edge学生设置Value + private String edgeAnswerValues; + // 学校名称 private String schoolName; } diff --git a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerService.java b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerService.java index 3f60611..866258b 100644 --- a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerService.java +++ b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerService.java @@ -3,6 +3,7 @@ package com.example.exam.exam.service.autoforbrower; import com.example.exam.exam.controller.auto.vo.StuInfoVo; import java.io.IOException; +import java.math.BigDecimal; /** * @author REN @@ -10,6 +11,6 @@ import java.io.IOException; public interface AutoForBrowerService { - Double autoForBrower(StuInfoVo stuInfoVo) throws IOException; + BigDecimal autoForBrower(StuInfoVo stuInfoVo) throws IOException; } diff --git a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java index 9220a10..8985ca1 100644 --- a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java @@ -40,9 +40,9 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService { * @return 是否通过 */ @Override - public Double autoForBrower(StuInfoVo stuInfoVo) throws IOException { + public BigDecimal autoForBrower(StuInfoVo stuInfoVo) throws IOException { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -73,7 +73,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr); - score += cpojo.getScore(); + score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = cpojo.getText(); judgementStr += "

试题得分:" + cpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -81,7 +81,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -94,7 +94,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(cpojo.getScore())); + insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCService.java b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCService.java index 57b5cae..403536f 100644 --- a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCService.java +++ b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCService.java @@ -2,6 +2,8 @@ package com.example.exam.exam.service.autoforc; import com.example.exam.exam.controller.auto.vo.StuInfoVo; +import java.math.BigDecimal; + /** * @author REN */ @@ -11,5 +13,5 @@ public interface AutoForCService { * 自动判题 C语言 * @param stuInfoVo 学生信息 */ - Double autoForC(StuInfoVo stuInfoVo); + BigDecimal autoForC(StuInfoVo stuInfoVo); } diff --git a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java index 7631c60..454a3e2 100644 --- a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java @@ -37,9 +37,9 @@ public class AutoForCServiceImpl implements AutoForCService { * @return 是否通过 */ @Override - public Double autoForC(StuInfoVo stuInfoVo) { + public BigDecimal autoForC(StuInfoVo stuInfoVo) { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -77,10 +77,10 @@ public class AutoForCServiceImpl implements AutoForCService { // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 // 通过 quId,stuId,paperId 查询 StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); - score += cpojo.getScore(); + score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -93,7 +93,7 @@ public class AutoForCServiceImpl implements AutoForCService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(cpojo.getScore())); + insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java index 788e4e7..3a53107 100644 --- a/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java @@ -142,7 +142,7 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(quScore)); + stuPaperScoreDO.setScore(isRight ? new BigDecimal(quScore) : new BigDecimal(0)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName("选择题"); @@ -155,7 +155,7 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(0)); + insertInfo.setScore(isRight ? new BigDecimal(quScore) : new BigDecimal(0)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName("选择题"); diff --git a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileService.java b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileService.java index 7d79dd7..d6f0244 100644 --- a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileService.java +++ b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileService.java @@ -3,6 +3,7 @@ package com.example.exam.exam.service.autoforfile; import com.example.exam.exam.controller.auto.vo.StuInfoVo; import java.io.IOException; +import java.math.BigDecimal; /** * @author REN @@ -10,6 +11,6 @@ import java.io.IOException; public interface AutoForFileService { - Double autoForFile(StuInfoVo stuInfoVo) throws IOException; + BigDecimal autoForFile(StuInfoVo stuInfoVo) throws IOException; } diff --git a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java index 5877eaf..f3f6d97 100644 --- a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java @@ -46,9 +46,9 @@ public class AutoForFileServiceImpl implements AutoForFileService { * @return 是否通过 */ @Override - public Double autoForFile(StuInfoVo stuInfoVo) throws IOException { + public BigDecimal autoForFile(StuInfoVo stuInfoVo) throws IOException { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -82,7 +82,7 @@ public class AutoForFileServiceImpl implements AutoForFileService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr); - score += cpojo.getScore(); + score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = cpojo.getText(); judgementStr += "

试题得分:" + cpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -90,7 +90,7 @@ public class AutoForFileServiceImpl implements AutoForFileService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -103,7 +103,7 @@ public class AutoForFileServiceImpl implements AutoForFileService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(cpojo.getScore())); + insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlService.java b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlService.java index 7ea8160..b705567 100644 --- a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlService.java +++ b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlService.java @@ -3,6 +3,7 @@ package com.example.exam.exam.service.autoformysql; import com.example.exam.exam.controller.auto.vo.StuInfoVo; import java.io.IOException; +import java.math.BigDecimal; import java.sql.SQLException; /** @@ -14,7 +15,7 @@ public interface AutoForMysqlService { * 自动判题 Mysql * @param stuInfoVo 学生信息 */ - Double autoForMysql(StuInfoVo stuInfoVo) throws SQLException, IOException; + BigDecimal autoForMysql(StuInfoVo stuInfoVo) throws SQLException, IOException; String autoForMysqlFile(StuInfoVo stuInfoVo); diff --git a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java index dbb8107..c90d23b 100644 --- a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java @@ -40,9 +40,9 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService { * @return 是否通过 */ @Override - public Double autoForMysql(StuInfoVo stuInfoVo) throws SQLException, IOException { + public BigDecimal autoForMysql(StuInfoVo stuInfoVo) throws SQLException, IOException { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -73,7 +73,7 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr); - score += cpojo.getScore(); + score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = cpojo.getText(); judgementStr += "

试题得分:" + cpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -81,7 +81,7 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -94,7 +94,7 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(cpojo.getScore())); + insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(one_file.getName()); diff --git a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsService.java b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsService.java index 3330432..734bcc4 100644 --- a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsService.java +++ b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsService.java @@ -3,11 +3,12 @@ package com.example.exam.exam.service.autoforps; import com.example.exam.exam.controller.auto.vo.StuInfoVo; import java.io.IOException; +import java.math.BigDecimal; public interface AutoForPsService { /** * 自动判题 Ps * @param stuInfoVo 学生信息 */ - Double autoForPs(StuInfoVo stuInfoVo) throws IOException; + BigDecimal autoForPs(StuInfoVo stuInfoVo) throws IOException; } diff --git a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java index 4c326b7..7b03eba 100644 --- a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java @@ -35,9 +35,9 @@ public class AutoForPsServiceImpl implements AutoForPsService{ SystemTenantService systemTenantService; @Override - public Double autoForPs(StuInfoVo stuInfoVo) throws IOException { + public BigDecimal autoForPs(StuInfoVo stuInfoVo) throws IOException { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -71,7 +71,7 @@ public class AutoForPsServiceImpl implements AutoForPsService{ judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), lastFilePath, lastFile.getPath(), examQuestion, judgementStr); - score += wordpojo.getScore(); + score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = wordpojo.getText(); judgementStr += "

试题得分:" + wordpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -79,7 +79,7 @@ public class AutoForPsServiceImpl implements AutoForPsService{ StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -92,7 +92,7 @@ public class AutoForPsServiceImpl implements AutoForPsService{ insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(wordpojo.getScore())); + insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelService.java b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelService.java index 9d00b0c..0dba4cb 100644 --- a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelService.java +++ b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelService.java @@ -4,6 +4,8 @@ package com.example.exam.exam.service.wpsexcel.excel; import com.example.exam.exam.controller.auto.vo.StuInfoVo; +import java.math.BigDecimal; + /** * 判分逻辑集合(wps word) * @@ -16,5 +18,5 @@ public interface JudgementForExcelService { * @param stuInfoVo 学生考试信息 * @return 结果 */ - Double autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception; + BigDecimal autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception; } diff --git a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java index b9d1052..452ee0e 100644 --- a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java @@ -41,9 +41,9 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService { SystemTenantService systemTenantService; @Override - public Double autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception { + public BigDecimal autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -77,7 +77,7 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText excelpojo = judgementWpsExcelService.judgementWpsXlsx(Double.parseDouble(quScore), lastFilePath, lastFile.getPath(), examQuestion, judgementStr); - score += excelpojo.getScore(); + score = score.add(new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = excelpojo.getText(); judgementStr += "

试题得分:" + excelpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -85,7 +85,7 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(excelpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -98,7 +98,7 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(excelpojo.getScore())); + insertInfo.setScore(new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxService.java b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxService.java index d28c45f..54280c5 100644 --- a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxService.java +++ b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxService.java @@ -4,6 +4,8 @@ package com.example.exam.exam.service.wpspptx.pptx; import com.example.exam.exam.controller.auto.vo.StuInfoVo; +import java.math.BigDecimal; + /** * 判分逻辑集合(wps word) * @@ -16,5 +18,5 @@ public interface JudgementForPptxService { * @param stuInfoVo 学生考试信息 * @return 结果 */ - Double autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception; + BigDecimal autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception; } diff --git a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java index 595b702..1c3918f 100644 --- a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java @@ -42,9 +42,9 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService { SystemTenantService systemTenantService; @Override - public Double autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception { + public BigDecimal autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -78,7 +78,7 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText pptxpojo = judgementWpsPptxService.judgementWpsPptx(Double.parseDouble(quScore), lastFilePath, lastFile.getPath(), examQuestion, judgementStr); - score += pptxpojo.getScore(); + score = score.add(new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = pptxpojo.getText(); judgementStr += "

试题得分:" + pptxpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -86,7 +86,7 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(pptxpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -99,7 +99,7 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(pptxpojo.getScore())); + insertInfo.setScore(new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name); diff --git a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordService.java b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordService.java index 7710500..7f71af3 100644 --- a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordService.java +++ b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordService.java @@ -4,6 +4,8 @@ package com.example.exam.exam.service.wpsword.word; import com.example.exam.exam.controller.auto.vo.StuInfoVo; +import java.math.BigDecimal; + /** * 判分逻辑集合(wps word) * @@ -16,5 +18,5 @@ public interface JudgementForWordService { * @param stuInfoVo 学生考试信息 * @return 结果 */ - Double autoForWpsWord(StuInfoVo stuInfoVo) throws Exception; + BigDecimal autoForWpsWord(StuInfoVo stuInfoVo) throws Exception; } diff --git a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java index 9a7a1b4..d07888e 100644 --- a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java +++ b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java @@ -39,9 +39,9 @@ public class JudgementForWordServiceImpl implements JudgementForWordService { @Resource SystemTenantService systemTenantService; @Override - public Double autoForWpsWord(StuInfoVo stuInfoVo) throws Exception { + public BigDecimal autoForWpsWord(StuInfoVo stuInfoVo) throws Exception { SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName()); - Double score = 0.0; + BigDecimal score = new BigDecimal(0); // 0、获取到试卷信息(试卷详情) List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId()); List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId()); @@ -75,7 +75,7 @@ public class JudgementForWordServiceImpl implements JudgementForWordService { judgementStr += "

试题分数:" + Double.parseDouble(quScore) + "

"; judgementStr += "

试题名称:" + name + "

"; SourceAndText wordpojo = judgementWpsWordService.judgementWpsWord(Double.parseDouble(quScore), lastFilePath, lastFile.getPath(), examQuestion, judgementStr); - score += wordpojo.getScore(); + score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr = wordpojo.getText(); judgementStr += "

试题得分:" + wordpojo.getScore() + "

"; // 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息 @@ -83,7 +83,7 @@ public class JudgementForWordServiceImpl implements JudgementForWordService { StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); if (stuPaperScoreDO != null) { // 说明已经是做过该题,需要更新数据 - stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore())); + stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); stuPaperScoreDO.setContent(judgementStr); stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setSubjectName(name); @@ -96,7 +96,7 @@ public class JudgementForWordServiceImpl implements JudgementForWordService { insertInfo.setStuId(stuInfoVo.getStuId()); insertInfo.setPaperId(stuInfoVo.getPaperId()); insertInfo.setQuId(quId); - insertInfo.setScore(new BigDecimal(wordpojo.getScore())); + insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setContent(judgementStr); insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setSubjectName(name);