|
|
@ -12,6 +12,7 @@ import com.project.question.domain.service.QuestionBaseService; |
|
|
import com.project.task.domain.entity.TaskEntity; |
|
|
import com.project.task.domain.entity.TaskEntity; |
|
|
import com.project.task.domain.enums.QuestionTypeEnum; |
|
|
import com.project.task.domain.enums.QuestionTypeEnum; |
|
|
import com.project.task.domain.enums.TaskUserStatusEnum; |
|
|
import com.project.task.domain.enums.TaskUserStatusEnum; |
|
|
|
|
|
import com.project.exam.domain.enums.ExamRecordScoringStatusEnum; |
|
|
import com.project.task.mapper.TaskMapper; |
|
|
import com.project.task.mapper.TaskMapper; |
|
|
import com.project.task.mapper.TaskUserMapper; |
|
|
import com.project.task.mapper.TaskUserMapper; |
|
|
import com.project.task.domain.service.TaskBaseService; |
|
|
import com.project.task.domain.service.TaskBaseService; |
|
|
@ -87,20 +88,30 @@ public class ShortAnswerScoringJob { |
|
|
int processed = 0; |
|
|
int processed = 0; |
|
|
|
|
|
|
|
|
for (ExamRecordEntity record : records) { |
|
|
for (ExamRecordEntity record : records) { |
|
|
if (processed >= batchSize) break; |
|
|
if (processed >= batchSize) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<ExamRecordEntity.QuestionSnapshot> snapshots = record.getAnswerSnapshot(); |
|
|
List<ExamRecordEntity.QuestionSnapshot> snapshots = record.getAnswerSnapshot(); |
|
|
if (snapshots == null || snapshots.isEmpty()) continue; |
|
|
if (snapshots == null || snapshots.isEmpty()) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
boolean updated = false; |
|
|
boolean updated = false; |
|
|
|
|
|
|
|
|
for (int i = 0; i < snapshots.size(); i++) { |
|
|
for (int i = 0; i < snapshots.size(); i++) { |
|
|
if (processed >= batchSize) break; |
|
|
if (processed >= batchSize) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ExamRecordEntity.QuestionSnapshot snapshot = snapshots.get(i); |
|
|
ExamRecordEntity.QuestionSnapshot snapshot = snapshots.get(i); |
|
|
// 只处理简答题且待评分状态
|
|
|
// 只处理简答题且待评分状态
|
|
|
if (!QuestionTypeEnum.SHORT_ANSWER.getValue().equals(snapshot.getType())) continue; |
|
|
if (!QuestionTypeEnum.SHORT_ANSWER.getValue().equals(snapshot.getType())) { |
|
|
if (!Objects.equals(0, snapshot.getScoringStatus())) continue; |
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if (!Objects.equals(ExamRecordScoringStatusEnum.PENDING.getValue(), snapshot.getScoringStatus())) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
log.info(">>> [简答题评分任务] 开始评分, recordId={}, questionId={}", |
|
|
log.info(">>> [简答题评分任务] 开始评分, recordId={}, questionId={}", |
|
|
record.getId(), snapshot.getQuestionId()); |
|
|
record.getId(), snapshot.getQuestionId()); |
|
|
@ -197,7 +208,9 @@ public class ShortAnswerScoringJob { |
|
|
hitPoints.add(i); |
|
|
hitPoints.add(i); |
|
|
} |
|
|
} |
|
|
if (ps.getReason() != null && !ps.getReason().isEmpty()) { |
|
|
if (ps.getReason() != null && !ps.getReason().isEmpty()) { |
|
|
if (comment.length() > 0) comment.append("; "); |
|
|
if (comment.length() > 0) { |
|
|
|
|
|
comment.append("; "); |
|
|
|
|
|
} |
|
|
comment.append(ps.getReason()); |
|
|
comment.append(ps.getReason()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -205,25 +218,27 @@ public class ShortAnswerScoringJob { |
|
|
snapshot.setAiScore(aiScore); |
|
|
snapshot.setAiScore(aiScore); |
|
|
snapshot.setAiComment(comment.toString()); |
|
|
snapshot.setAiComment(comment.toString()); |
|
|
snapshot.setHitPoints(hitPoints); |
|
|
snapshot.setHitPoints(hitPoints); |
|
|
snapshot.setScoringStatus(1); |
|
|
snapshot.setScoringStatus(ExamRecordScoringStatusEnum.COMPLETED.getValue()); |
|
|
|
|
|
|
|
|
log.info(">>> [简答题评分任务] 评分完成, questionId={}, shortAnswerScore={}, totalPoints={}, hitPoints={}, aiScore={}", |
|
|
log.info(">>> [简答题评分任务] 评分完成, questionId={}, shortAnswerScore={}, totalPoints={}, hitPoints={}, aiScore={}", |
|
|
snapshot.getQuestionId(), shortAnswerScore, totalPoints, hitPoints, aiScore); |
|
|
snapshot.getQuestionId(), shortAnswerScore, totalPoints, hitPoints, aiScore); |
|
|
} else { |
|
|
} else { |
|
|
log.warn(">>> [简答题评分任务] 评分失败, questionId={}, message={}", |
|
|
log.warn(">>> [简答题评分任务] 评分失败, questionId={}, message={}", |
|
|
snapshot.getQuestionId(), response.getMessage()); |
|
|
snapshot.getQuestionId(), response.getMessage()); |
|
|
snapshot.setScoringStatus(2); |
|
|
snapshot.setScoringStatus(ExamRecordScoringStatusEnum.FAILED.getValue()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error(">>> [简答题评分任务] 评分异常, questionId={}", snapshot.getQuestionId(), e); |
|
|
log.error(">>> [简答题评分任务] 评分异常, questionId={}", snapshot.getQuestionId(), e); |
|
|
snapshot.setScoringStatus(2); |
|
|
snapshot.setScoringStatus(ExamRecordScoringStatusEnum.FAILED.getValue()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void recalcTotalScore(ExamRecordEntity record) { |
|
|
private void recalcTotalScore(ExamRecordEntity record) { |
|
|
List<ExamRecordEntity.QuestionSnapshot> snapshots = record.getAnswerSnapshot(); |
|
|
List<ExamRecordEntity.QuestionSnapshot> snapshots = record.getAnswerSnapshot(); |
|
|
if (snapshots == null || snapshots.isEmpty()) return; |
|
|
if (snapshots == null || snapshots.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
double total = 0.0; |
|
|
double total = 0.0; |
|
|
boolean allShortDone = true; |
|
|
boolean allShortDone = true; |
|
|
@ -231,7 +246,7 @@ public class ShortAnswerScoringJob { |
|
|
for (ExamRecordEntity.QuestionSnapshot s : snapshots) { |
|
|
for (ExamRecordEntity.QuestionSnapshot s : snapshots) { |
|
|
boolean isShort = QuestionTypeEnum.SHORT_ANSWER.getValue().equals(s.getType()); |
|
|
boolean isShort = QuestionTypeEnum.SHORT_ANSWER.getValue().equals(s.getType()); |
|
|
if (isShort) { |
|
|
if (isShort) { |
|
|
if (!Objects.equals(1, s.getScoringStatus())) { |
|
|
if (!Objects.equals(ExamRecordScoringStatusEnum.COMPLETED.getValue(), s.getScoringStatus())) { |
|
|
allShortDone = false; |
|
|
allShortDone = false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
@ -245,6 +260,7 @@ public class ShortAnswerScoringJob { |
|
|
|
|
|
|
|
|
if (allShortDone) { |
|
|
if (allShortDone) { |
|
|
record.setScore(total); |
|
|
record.setScore(total); |
|
|
|
|
|
record.setScoringStatus(ExamRecordScoringStatusEnum.COMPLETED.getValue()); |
|
|
// 查询任务及格线
|
|
|
// 查询任务及格线
|
|
|
double passScore = 60.0; |
|
|
double passScore = 60.0; |
|
|
TaskEntity task = null; |
|
|
TaskEntity task = null; |
|
|
|