|
@@ -6,8 +6,6 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
@@ -23,6 +21,7 @@ import cn.com.qmth.stmms.biz.report.utils.unit.BaseCalculatorUnit;
|
|
|
import cn.com.qmth.stmms.biz.report.utils.unit.LevelRange;
|
|
|
import cn.com.qmth.stmms.biz.report.utils.unit.QuestionCounter;
|
|
|
import cn.com.qmth.stmms.biz.utils.SpringContextHolder;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
|
|
|
/**
|
|
|
* 按科目统计全样本小题难度等级与区分度等级
|
|
@@ -36,7 +35,9 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
protected QuestionCalculatorProvider provider;
|
|
|
|
|
|
- protected Map<String, List<ExamQuestion>> questions;
|
|
|
+ protected Map<String, List<ExamQuestion>> objectiveQuestions;
|
|
|
+
|
|
|
+ protected Map<String, List<ExamQuestion>> subjectiveQuestions;
|
|
|
|
|
|
protected Map<String, QuestionCounter> difficulityLevels, discriminationLevels;
|
|
|
|
|
@@ -45,7 +46,8 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
|
this.context = context;
|
|
|
this.provider = provider;
|
|
|
- this.questions = new HashMap<String, List<ExamQuestion>>();
|
|
|
+ this.objectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
|
+ this.subjectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
|
this.difficulityLevels = new HashMap<String, QuestionCounter>();
|
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
@@ -54,13 +56,20 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
@Override
|
|
|
public void process(ExamStudent student) {
|
|
|
+ // 添加客观题列表
|
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
|
- 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());
|
|
|
+ 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());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -137,7 +146,14 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
}
|
|
|
|
|
|
protected void beforeSave() {
|
|
|
- for (Entry<String, List<ExamQuestion>> entry : questions.entrySet()) {
|
|
|
+ // 客观题预处理
|
|
|
+ beforeSave(objectiveQuestions);
|
|
|
+ // 主观题预处理
|
|
|
+ beforeSave(subjectiveQuestions);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void beforeSave(Map<String, List<ExamQuestion>> questionMap) {
|
|
|
+ for (Entry<String, List<ExamQuestion>> entry : questionMap.entrySet()) {
|
|
|
String key = entry.getKey();
|
|
|
for (ExamQuestion question : entry.getValue()) {
|
|
|
if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|