【修改】 返回分数和保存分数,保留小数点1位

This commit is contained in:
MSI\letre
2025-07-07 16:00:51 +08:00
parent 8743817fdf
commit 33bacf48c4
19 changed files with 100 additions and 60 deletions

View File

@@ -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<Double> judgementForC(@RequestBody StuInfoVo stuInfoVo){
public Result<BigDecimal> judgementForC(@RequestBody StuInfoVo stuInfoVo){
return Result.success(autoService.autoForC(stuInfoVo));
}
// WPS-WORD
@PostMapping("/judgementForWord")
public Result<Double> judgementForWord(@RequestBody StuInfoVo stuInfoVo) throws Exception {
public Result<BigDecimal> judgementForWord(@RequestBody StuInfoVo stuInfoVo) throws Exception {
return Result.success(judgementForWordService.autoForWpsWord(stuInfoVo));
}
// WPS-EXCEL
@PostMapping("/judgementForExcel")
public Result<Double> judgementForExcel(@RequestBody StuInfoVo stuInfoVo) throws Exception {
public Result<BigDecimal> judgementForExcel(@RequestBody StuInfoVo stuInfoVo) throws Exception {
return Result.success(judgementForExcelService.autoForWpsExcel(stuInfoVo));
}
// WPS-PPT
@PostMapping("/judgementForPptx")
public Result<Double> judgementForPptx(@RequestBody StuInfoVo stuInfoVo) throws Exception {
public Result<BigDecimal> judgementForPptx(@RequestBody StuInfoVo stuInfoVo) throws Exception {
return Result.success(judgementForPptxService.autoForWpsPptx(stuInfoVo));
}
// Mysql
@PostMapping("/judgementForMysql")
public Result<Double> judgementForMysql(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
public Result<BigDecimal> 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<Double> judgementForFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
public Result<BigDecimal> judgementForFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
return Result.success(autoForFileService.autoForFile(stuInfoVo));
}
// 浏览器
@PostMapping("/judgementForBrower")
public Result<Double> judgementForBrower(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
public Result<BigDecimal> judgementForBrower(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
return Result.success(autoForBrowerService.autoForBrower(stuInfoVo));
}
// 浏览器设置
// windows网络设置
/**
* 将浏览器的页面写入到JSON文件中
* @param stuInfoVo 学生选择题信息
* @return String
*/
@PostMapping("/judgementForEdgeDummyToJson")
public Result<String> judgementForEdgeDummyToJson(@RequestBody List<StuInfoVo> stuInfoVo){
return Result.success(autoForWinEdgeSettingService.autoForEdgeToJson(stuInfoVo));
}
/**
* windows网络设置判分
* @param stuInfoVo 学生选择题信息
* @return String
*/
@PostMapping("/judgementForEdgeDummy")
public Result<BigDecimal> judgementForEdgeDummy(@RequestBody StuInfoVo stuInfoVo) throws IOException {
return Result.success(autoForWinEdgeSettingService.autoForEdge(stuInfoVo));
}
// QQ邮箱
// win10虚拟界面
//PS
@PostMapping("/judgementForPS")
public Result<Double> judgementForPS(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
public Result<BigDecimal> judgementForPS(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
return Result.success(autoForPsService.autoForPs(stuInfoVo));
}

View File

@@ -23,6 +23,12 @@ public class StuInfoVo {
// 选择题学生答案
private String choiceAnswerId;
// Edge学生设置Key
private String edgeAnswerKeys;
// Edge学生设置Value
private String edgeAnswerValues;
// 学校名称
private String schoolName;
}

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -73,7 +73,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 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);

View File

@@ -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);
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -77,10 +77,10 @@ public class AutoForCServiceImpl implements AutoForCService {
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
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);

View File

@@ -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("选择题");

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -82,7 +82,7 @@ public class AutoForFileServiceImpl implements AutoForFileService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 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);

View File

@@ -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);

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -73,7 +73,7 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 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());

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -71,7 +71,7 @@ public class AutoForPsServiceImpl implements AutoForPsService{
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + wordpojo.getScore() + "</p>";
// 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);

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -77,7 +77,7 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + excelpojo.getScore() + "</p>";
// 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);

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -78,7 +78,7 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + pptxpojo.getScore() + "</p>";
// 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);

View File

@@ -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;
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
@@ -75,7 +75,7 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
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 += "<p>试题得分:" + wordpojo.getScore() + "</p>";
// 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);