【修改】 1、教师分配科目权限之后BUG修改;2、判分,默认记录所有选择题

This commit is contained in:
DESKTOP-932OMT8\REN
2025-06-05 13:53:42 +08:00
parent 5d84d16b78
commit 905133b810
4 changed files with 47 additions and 15 deletions

View File

@@ -180,6 +180,8 @@ public class AutoToolsServiceImpl implements AutoToolsService{
*/
@Override
public CommonResult<BigDecimal> judgementScore(Long stuId, String paperId) throws Exception {
// 先删除考试明细
stuPaperScoreService.deleteStuPaperScore(stuId, paperId);
// 监控管理 生成选择题文件路径
endStuMonitorUtils.endStuMonitor(String.valueOf(stuId), paperId);
// 获取平台文件参数
@@ -224,9 +226,10 @@ public class AutoToolsServiceImpl implements AutoToolsService{
// 1-1-3、进行选择题判分
for (ExamQuestion examQuestion : quList) {
if ("选择题".equals(examQuestion.getSubjectName())) {
for (String key : stu.getQuestionResultMap().keySet()) {
Optional<ExamQuestion> result = quList.stream().filter(quLists -> quLists.getQuId().equals(key)).findFirst();
ExamQuestion examQuestions = result.get();
Optional<String> result = stu.getQuestionResultMap().keySet().stream().filter(strs -> strs.equals(examQuestion.getQuId())).findFirst();
if (!result.isEmpty()) {
String key = result.get();
String value = stu.getQuestionResultMap().get(key);
// 查询该题的成绩
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key);
// 判断是否做过该题
@@ -238,15 +241,22 @@ public class AutoToolsServiceImpl implements AutoToolsService{
stuPaperScoreDO.setPaperId(paperId);
isNull = true;
}
if (examQuestions != null) {
String value = stu.getQuestionResultMap().get(key);
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, value, stuPaperScoreDO, isNull);
score += selectScore;
} else {
// 说明学生没有答题,直接给零分
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, "", stuPaperScoreDO, isNull);
score += selectScore;
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), key, value, stuPaperScoreDO, isNull);
score += selectScore;
} else {
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, examQuestion.getQuId());
// 判断是否做过该题
boolean isNull = false;
if (stuPaperScoreDO == null) {
stuPaperScoreDO = new StuPaperScoreDO();
stuPaperScoreDO.setStuId(stuId);
stuPaperScoreDO.setQuId(examQuestion.getQuId());
stuPaperScoreDO.setPaperId(paperId);
isNull = true;
}
// 说明学生没有答题,直接给零分
double selectScore = judgementChoiceService.programmingChoice(Double.parseDouble(examQuestion.getQuScores()), examQuestion.getQuId(), "", stuPaperScoreDO, isNull);
score += selectScore;
}
}
}