|
@@ -2,9 +2,11 @@ package cn.com.qmth.stmms.biz.report.utils.module;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
+import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.Map.Entry;
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
@@ -35,9 +37,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
protected QuestionCalculatorProvider provider;
|
|
protected QuestionCalculatorProvider provider;
|
|
|
|
|
|
- protected Map<String, List<ExamQuestion>> objectiveQuestions;
|
|
|
|
-
|
|
|
|
- protected Map<String, List<ExamQuestion>> subjectiveQuestions;
|
|
|
|
|
|
+ protected Map<String, List<ExamQuestion>> questions;
|
|
|
|
|
|
protected Map<String, QuestionCounter> difficulityLevels, discriminationLevels;
|
|
protected Map<String, QuestionCounter> difficulityLevels, discriminationLevels;
|
|
|
|
|
|
@@ -46,8 +46,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
this.context = context;
|
|
this.context = context;
|
|
this.provider = provider;
|
|
this.provider = provider;
|
|
- this.objectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
|
|
- this.subjectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
|
|
|
|
+ this.questions = new HashMap<String, List<ExamQuestion>>();
|
|
this.difficulityLevels = new HashMap<String, QuestionCounter>();
|
|
this.difficulityLevels = new HashMap<String, QuestionCounter>();
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
@@ -56,20 +55,13 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void process(ExamStudent student) {
|
|
public void process(ExamStudent student) {
|
|
- // 添加客观题列表
|
|
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
- List<ExamQuestion> olist = objectiveQuestions.get(key);
|
|
|
|
- if (olist == null) {
|
|
|
|
- olist = new ArrayList<ExamQuestion>();
|
|
|
|
- objectiveQuestions.put(key, olist);
|
|
|
|
- olist.addAll(student.getObjectiveQuestionList());
|
|
|
|
- }
|
|
|
|
- // 添加主观题列表
|
|
|
|
- List<ExamQuestion> slist = subjectiveQuestions.get(student.getSubjectCode());
|
|
|
|
- if (slist == null) {
|
|
|
|
- slist = new ArrayList<ExamQuestion>();
|
|
|
|
- subjectiveQuestions.put(student.getSubjectCode(), slist);
|
|
|
|
- slist.addAll(student.getSubjectiveQuestionList());
|
|
|
|
|
|
+ List<ExamQuestion> list = questions.get(key);
|
|
|
|
+ if (list == null) {
|
|
|
|
+ list = new ArrayList<ExamQuestion>();
|
|
|
|
+ questions.put(key, list);
|
|
|
|
+ list.addAll(student.getObjectiveQuestionList());
|
|
|
|
+ list.addAll(student.getSubjectiveQuestionList());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -146,14 +138,8 @@ public class SubjectQuestionLevelModule implements Module {
|
|
}
|
|
}
|
|
|
|
|
|
protected void beforeSave() {
|
|
protected void beforeSave() {
|
|
- // 客观题预处理
|
|
|
|
- beforeSave(objectiveQuestions);
|
|
|
|
- // 主观题预处理
|
|
|
|
- beforeSave(subjectiveQuestions);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- protected void beforeSave(Map<String, List<ExamQuestion>> questionMap) {
|
|
|
|
- for (Entry<String, List<ExamQuestion>> entry : questionMap.entrySet()) {
|
|
|
|
|
|
+ for (Entry<String, List<ExamQuestion>> entry : questions.entrySet()) {
|
|
|
|
+ Set<String> subjectiveSet = new HashSet<String>();
|
|
String key = entry.getKey();
|
|
String key = entry.getKey();
|
|
for (ExamQuestion question : entry.getValue()) {
|
|
for (ExamQuestion question : entry.getValue()) {
|
|
if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|
|
if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|
|
@@ -163,6 +149,14 @@ public class SubjectQuestionLevelModule implements Module {
|
|
if (calculator == null) {
|
|
if (calculator == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if (!question.isObjective()) {
|
|
|
|
+ String number = question.getQuestionNumber();
|
|
|
|
+ if (subjectiveSet.contains(number)) {
|
|
|
|
+ continue;
|
|
|
|
+ } else {
|
|
|
|
+ subjectiveSet.add(number);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 按全卷维度统计
|
|
// 按全卷维度统计
|
|
findDifficulityLevelCounter(key).process(question, calculator.difficulty);
|
|
findDifficulityLevelCounter(key).process(question, calculator.difficulty);
|
|
findDiscriminationLevelCounter(key).process(question, calculator.discrimination);
|
|
findDiscriminationLevelCounter(key).process(question, calculator.discrimination);
|
|
@@ -170,6 +164,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
findDifficulityLevelCounter(getGroupKey(question)).process(question, calculator.difficulty);
|
|
findDifficulityLevelCounter(getGroupKey(question)).process(question, calculator.difficulty);
|
|
findDiscriminationLevelCounter(getGroupKey(question)).process(question, calculator.discrimination);
|
|
findDiscriminationLevelCounter(getGroupKey(question)).process(question, calculator.discrimination);
|
|
}
|
|
}
|
|
|
|
+ subjectiveSet.clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|