|
@@ -30,9 +30,11 @@ public class ReportContext {
|
|
|
private List<Module> modules;
|
|
|
|
|
|
private Map<String, ExamSubject> subjectMap;
|
|
|
-
|
|
|
+
|
|
|
private Map<String, ExamQuestion> questionMap;
|
|
|
|
|
|
+ private Map<String, ExamQuestion> groupMap;
|
|
|
+
|
|
|
public ReportContext(Exam exam) {
|
|
|
this.exam = exam;
|
|
|
this.modules = new LinkedList<Module>();
|
|
@@ -48,6 +50,7 @@ public class ReportContext {
|
|
|
|
|
|
this.subjectMap = new HashMap<String, ExamSubject>();
|
|
|
this.questionMap = new HashMap<String, ExamQuestion>();
|
|
|
+ this.groupMap = new HashMap<String, ExamQuestion>();
|
|
|
}
|
|
|
|
|
|
public void process(ExamStudent student) {
|
|
@@ -61,31 +64,40 @@ public class ReportContext {
|
|
|
subjectMap.put(student.getSubjectCode(), student.getSubject());
|
|
|
for (ExamQuestion question : student.getObjectiveQuestionList()) {
|
|
|
String key = getQuestionKey(question);
|
|
|
- if(questionMap.get(key)==null){
|
|
|
+ if (questionMap.get(key) == null) {
|
|
|
questionMap.put(key, question);
|
|
|
}
|
|
|
}
|
|
|
for (ExamQuestion question : student.getSubjectiveQuestionList()) {
|
|
|
- String key = getQuestionKey(question);
|
|
|
- if(questionMap.get(key)==null){
|
|
|
- questionMap.put(key, question);
|
|
|
+ String questionKey = getQuestionKey(question);
|
|
|
+ if (questionMap.get(questionKey) == null) {
|
|
|
+ questionMap.put(questionKey, question);
|
|
|
+ }
|
|
|
+ String groupKey = getGroupKey(question);
|
|
|
+ if (groupMap.get(groupKey) == null) {
|
|
|
+ groupMap.put(groupKey, question);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private String getQuestionKey(ExamQuestion question) {
|
|
|
return question.getSubjectCode() + "\t" + question.isObjective() + "\t"
|
|
|
+ StringUtils.trimToEmpty(question.getPaperType()) + "\t" + question.getMainNumber() + "\t"
|
|
|
+ question.getSubNumber();
|
|
|
}
|
|
|
|
|
|
+ private String getGroupKey(ExamQuestion question) {
|
|
|
+ return question.getSubjectCode() + "\t" + question.isObjective() + "\t" + question.getMainNumber();
|
|
|
+ }
|
|
|
+
|
|
|
public void save() {
|
|
|
for (Module module : modules) {
|
|
|
module.save();
|
|
|
}
|
|
|
ReportSubjectTeacherService teacherService = SpringContextHolder.getBean(ReportSubjectTeacherService.class);
|
|
|
teacherService.updateRelativeAvgScore(this.getExamId());
|
|
|
- ReportSubjectTeacherClassService teacherClassService = SpringContextHolder.getBean(ReportSubjectTeacherClassService.class);
|
|
|
+ ReportSubjectTeacherClassService teacherClassService = SpringContextHolder
|
|
|
+ .getBean(ReportSubjectTeacherClassService.class);
|
|
|
teacherClassService.updateRelativeAvgScore(this.getExamId());
|
|
|
}
|
|
|
|
|
@@ -108,8 +120,12 @@ public class ReportContext {
|
|
|
public ExamSubject getSubject(String subjectCode) {
|
|
|
return subjectMap.get(subjectCode);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public ExamQuestion getExamQuestion(String key) {
|
|
|
return questionMap.get(key);
|
|
|
}
|
|
|
+
|
|
|
+ public ExamQuestion getGroup(String key) {
|
|
|
+ return groupMap.get(key);
|
|
|
+ }
|
|
|
}
|