|
@@ -133,6 +133,12 @@ public class MarkServiceImpl implements MarkService {
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Set<Long> listCurrentStudent(Long examId, String paperNumber) {
|
|
|
|
+ TaskLock taskLock = TaskLockUtil.getFormalTask(examId + "_" + paperNumber);
|
|
|
|
+ return taskLock.list().stream().map(m -> Long.valueOf(m.get("studentId").toString())).collect(Collectors.toSet());
|
|
|
|
+ }
|
|
|
|
+
|
|
private TaskLock getTaskLock(MarkQuestion markQuestion) {
|
|
private TaskLock getTaskLock(MarkQuestion markQuestion) {
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(markQuestion.getExamId(),
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(markQuestion.getExamId(),
|
|
markQuestion.getPaperNumber());
|
|
markQuestion.getPaperNumber());
|
|
@@ -785,9 +791,7 @@ public class MarkServiceImpl implements MarkService {
|
|
// 全部评完,更新考生主观题得分
|
|
// 全部评完,更新考生主观题得分
|
|
// markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.MARKED, totalScore.doubleValue(),
|
|
// markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.MARKED, totalScore.doubleValue(),
|
|
// MarkStudent.buildScoreList(scoreList));
|
|
// MarkStudent.buildScoreList(scoreList));
|
|
- if (autoCalc) {
|
|
|
|
- markStudentService.updateSubjectiveScoreByVersion(studentId, SubjectiveStatus.MARKED, totalScore.doubleValue(), MarkStudent.buildScoreList(scoreList), version);
|
|
|
|
- }
|
|
|
|
|
|
+ markStudentService.updateSubjectiveScoreByVersion(studentId, SubjectiveStatus.MARKED, totalScore.doubleValue(), MarkStudent.buildScoreList(scoreList), version, autoCalc);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -854,7 +858,7 @@ public class MarkServiceImpl implements MarkService {
|
|
dto = new MarkStatusDto(markQuestionService.getById(question.getQuestionId()), markUserPaper.getMarkedQuestionId());
|
|
dto = new MarkStatusDto(markQuestionService.getById(question.getQuestionId()), markUserPaper.getMarkedQuestionId());
|
|
List<Long> questionIds = Arrays.asList(question.getQuestionId());
|
|
List<Long> questionIds = Arrays.asList(question.getQuestionId());
|
|
MarkStatusDto statusDto = getDto(dto, examId, paperNumber, userId, classNames, questionIds);
|
|
MarkStatusDto statusDto = getDto(dto, examId, paperNumber, userId, classNames, questionIds);
|
|
- statusDto.setLeftCount(countLeftCountForSingle(statusDto.getLeftCount(), question.getQuestionId(), userId, classNames));
|
|
|
|
|
|
+ statusDto.setLeftCount(countLeftCountForSingle(examId, paperNumber, statusDto.getLeftCount(), question.getQuestionId(), userId, classNames));
|
|
dtoList.add(statusDto);
|
|
dtoList.add(statusDto);
|
|
}
|
|
}
|
|
} else if (QuestionModel.MULTI.equals(questionModel)) {
|
|
} else if (QuestionModel.MULTI.equals(questionModel)) {
|
|
@@ -868,20 +872,24 @@ public class MarkServiceImpl implements MarkService {
|
|
return dtoList;
|
|
return dtoList;
|
|
}
|
|
}
|
|
|
|
|
|
- private int countLeftCountForSingle(int leftCount, Long questionId, Long userId, List<String> classNames) {
|
|
|
|
|
|
+ private int countLeftCountForSingle(Long examId, String paperNumber, int leftCount, Long questionId, Long userId, List<String> classNames) {
|
|
MarkQuestion markQuestion = markQuestionService.getById(questionId);
|
|
MarkQuestion markQuestion = markQuestionService.getById(questionId);
|
|
|
|
+ Set<Long> currentStudent = this.listCurrentStudent(examId, paperNumber);
|
|
|
|
+
|
|
|
|
+ int userCurrentCount = this.applyCurrentCount(markQuestion, userId);
|
|
if (CollectionUtils.isEmpty(classNames)) {
|
|
if (CollectionUtils.isEmpty(classNames)) {
|
|
- int currentCount = this.applyCurrentCount(markQuestion);
|
|
|
|
- int userCurrentCount = this.applyCurrentCount(markQuestion, userId);
|
|
|
|
- return leftCount - currentCount + userCurrentCount;
|
|
|
|
|
|
+ return leftCount - currentStudent.size() + userCurrentCount;
|
|
} else {
|
|
} else {
|
|
- List<MarkUserClass> markUserClassList = markUserClassService.listByExamIdAndPaperNumber(markQuestion.getExamId(), markQuestion.getPaperNumber());
|
|
|
|
- Set<MarkUserClass> markUserClasses = markUserClassList.stream().filter(m -> classNames.contains(m.getClassName()) && !m.getUserId().equals(userId)).collect(Collectors.toSet());
|
|
|
|
- int count = 0;
|
|
|
|
- for (MarkUserClass markUserClass : markUserClasses) {
|
|
|
|
- count += this.applyCurrentCount(markQuestion, markUserClass.getUserId());
|
|
|
|
- }
|
|
|
|
- return leftCount - count;
|
|
|
|
|
|
+// List<MarkUserClass> markUserClassList = markUserClassService.listByExamIdAndPaperNumber(markQuestion.getExamId(), markQuestion.getPaperNumber());
|
|
|
|
+// Set<MarkUserClass> markUserClasses = markUserClassList.stream().filter(m -> classNames.contains(m.getClassName()) && !m.getUserId().equals(userId)).collect(Collectors.toSet());
|
|
|
|
+// int count = 0;
|
|
|
|
+// for (MarkUserClass markUserClass : markUserClasses) {
|
|
|
|
+// count += this.applyCurrentCount(markQuestion, markUserClass.getUserId());
|
|
|
|
+// }
|
|
|
|
+// return leftCount - count;
|
|
|
|
+ Set<Long> studentIds = markStudentService.listStudentIds(examId, paperNumber, classNames);
|
|
|
|
+ Collection<Long> collection = CollectionUtils.intersection(currentStudent, studentIds);
|
|
|
|
+ return leftCount - collection.size() + userCurrentCount;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -982,8 +990,8 @@ public class MarkServiceImpl implements MarkService {
|
|
headerHistory.setCreateTime(System.currentTimeMillis());
|
|
headerHistory.setCreateTime(System.currentTimeMillis());
|
|
markHeaderHistoryService.save(headerHistory);
|
|
markHeaderHistoryService.save(headerHistory);
|
|
}
|
|
}
|
|
- markSubjectiveScore.setScore(score);
|
|
|
|
- markSubjectiveScoreService.saveOrUpdateByMultiId(markSubjectiveScore);
|
|
|
|
|
|
+// markSubjectiveScore.setScore(score);
|
|
|
|
+// markSubjectiveScoreService.saveOrUpdateByMultiId(markSubjectiveScore);
|
|
|
|
|
|
// 记录日志
|
|
// 记录日志
|
|
// if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
|
|
// if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
|