|
@@ -1765,47 +1765,55 @@ public class MarkServiceImpl implements MarkService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean deleteByQuestion(ExamQuestion question) {
|
|
|
- SelectiveGroup selectiveGroup = selectiveGroupService.findOne(question.getExamId(), question.getSubjectCode(),
|
|
|
- question.getMainNumber());
|
|
|
- if (selectiveGroup != null) {
|
|
|
+ public boolean deleteByQuestion(List<ExamQuestion> list) {
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (!question.isObjective() && question.getGroupNumber() != null) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- int examId = question.getExamId();
|
|
|
- String subjectCode = question.getSubjectCode();
|
|
|
- boolean objective = question.isObjective();
|
|
|
- ExamSubject subject = subjectService.find(examId, subjectCode);
|
|
|
- double totalScore = objective ? BigDecimalUtils.sub(subject.getObjectiveScore(), question.getTotalScore())
|
|
|
- : BigDecimalUtils.sub(subject.getSubjectiveScore(), question.getTotalScore());
|
|
|
- questionService.deleteById(question.getId());
|
|
|
- if (objective) {
|
|
|
- examService.updateObjectiveStatus(examId, ObjectiveStatus.WAITING);
|
|
|
+ for (ExamQuestion question : list) {
|
|
|
+
|
|
|
+ SelectiveGroup selectiveGroup = selectiveGroupService.findOne(question.getExamId(),
|
|
|
+ question.getSubjectCode(), question.getMainNumber());
|
|
|
+ if (selectiveGroup != null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!question.isObjective() && question.getGroupNumber() != null) {
|
|
|
+ continue;
|
|
|
} else {
|
|
|
- // 未分组的题目
|
|
|
- long unGroupQuestionCount = questionService.countByExamIdAndSubjectAndObjectiveAndGroupNumberIsNull(
|
|
|
- examId, subjectCode, false);
|
|
|
- // 考生整体状态与总分更新
|
|
|
- long groupCount = groupDao.countByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
- if (groupCount == 0 || unGroupQuestionCount > 0) {
|
|
|
- studentService.updateSubjectiveStatusAndScoreAndInspectorId(examId, subjectCode,
|
|
|
- SubjectiveStatus.UNMARK, 0, null, null, null);
|
|
|
- // studentService.resetSubjectiveStatusAndScoreWithoutTrial(examId,
|
|
|
- // subjectCode);
|
|
|
- inspectHistoryService.deleteByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
+ int examId = question.getExamId();
|
|
|
+ String subjectCode = question.getSubjectCode();
|
|
|
+ boolean objective = question.isObjective();
|
|
|
+ ExamSubject subject = subjectService.find(examId, subjectCode);
|
|
|
+ double totalScore = objective ? BigDecimalUtils.sub(subject.getObjectiveScore(),
|
|
|
+ question.getTotalScore()) : BigDecimalUtils.sub(subject.getSubjectiveScore(),
|
|
|
+ question.getTotalScore());
|
|
|
+ questionService.deleteById(question.getId());
|
|
|
+ if (objective) {
|
|
|
+ examService.updateObjectiveStatus(examId, ObjectiveStatus.WAITING);
|
|
|
} else {
|
|
|
- List<Integer> studentList = studentService.findIdByExamIdAndSubjectCodeAndSubjectiveStatus(examId,
|
|
|
- subjectCode, SubjectiveStatus.UNMARK, SubjectiveStatus.MARKED, SubjectiveStatus.INSPECTED);
|
|
|
- for (Integer studentId : studentList) {
|
|
|
- checkStudentSubjective(studentId, groupCount, unGroupQuestionCount);
|
|
|
+ // 未分组的题目
|
|
|
+ long unGroupQuestionCount = questionService
|
|
|
+ .countByExamIdAndSubjectAndObjectiveAndGroupNumberIsNull(examId, subjectCode, false);
|
|
|
+ // 考生整体状态与总分更新
|
|
|
+ long groupCount = groupDao.countByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
+ if (groupCount == 0 || unGroupQuestionCount > 0) {
|
|
|
+ studentService.updateSubjectiveStatusAndScoreAndInspectorId(examId, subjectCode,
|
|
|
+ SubjectiveStatus.UNMARK, 0, null, null, null);
|
|
|
+ // studentService.resetSubjectiveStatusAndScoreWithoutTrial(examId,
|
|
|
+ // subjectCode);
|
|
|
+ inspectHistoryService.deleteByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
+ } else {
|
|
|
+ List<Integer> studentList = studentService.findIdByExamIdAndSubjectCodeAndSubjectiveStatus(
|
|
|
+ examId, subjectCode, SubjectiveStatus.UNMARK, SubjectiveStatus.MARKED,
|
|
|
+ SubjectiveStatus.INSPECTED);
|
|
|
+ for (Integer studentId : studentList) {
|
|
|
+ checkStudentSubjective(studentId, groupCount, unGroupQuestionCount);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ subjectService.updateScore(examId, subjectCode, objective, totalScore);
|
|
|
}
|
|
|
- subjectService.updateScore(examId, subjectCode, objective, totalScore);
|
|
|
- return true;
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|