|
@@ -14,7 +14,6 @@ import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
|
-import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubject;
|
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubjectGroup;
|
|
|
import cn.com.qmth.stmms.biz.report.service.ReportSubjectGroupService;
|
|
@@ -45,6 +44,8 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
protected LevelRange[] difficulityLevelConfig, discriminationLevelConfig;
|
|
|
|
|
|
+ protected Map<String, Set<String>> paperTypes;
|
|
|
+
|
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
|
this.context = context;
|
|
|
this.provider = provider;
|
|
@@ -54,6 +55,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
|
this.discriminationLevelConfig = context.getDiscriminationLevelConfig();
|
|
|
+ this.paperTypes = new HashMap<String, Set<String>>();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -81,11 +83,11 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
beforeSave();
|
|
|
ReportSubjectService subjectService = SpringContextHolder.getBean(ReportSubjectService.class);
|
|
|
ReportSubjectGroupService groupService = SpringContextHolder.getBean(ReportSubjectGroupService.class);
|
|
|
- ExamQuestionService questionService = SpringContextHolder.getBean(ExamQuestionService.class);
|
|
|
- for (String key : this.difficulityLevels.keySet()) {
|
|
|
+ for (Entry<String, QuestionCounter> entry : difficulityLevels.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
String s[] = key.split("\t");
|
|
|
String subjectCode = s[0];
|
|
|
- QuestionCounter difficulityCounter = difficulityLevels.get(key);
|
|
|
+ QuestionCounter difficulityCounter = entry.getValue();
|
|
|
QuestionCounter discriminationCounter = discriminationLevels.get(key);
|
|
|
JSONObject difficulityLevel = new JSONObject();
|
|
|
for (int i = 0; i < difficulityCounter.levelCount; i++) {
|
|
@@ -135,8 +137,8 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
if (s.length == 1 || s.length == 2) {
|
|
|
if (s.length == 2) {
|
|
|
String paperType = StringUtils.trimToNull(s[1]);
|
|
|
- List<String> paperTypes = questionService.getPaperTypeWitnNull(context.getExamId(), subjectCode);
|
|
|
- if(!contains(paperTypes,paperType)){
|
|
|
+ Set<String> paperTypes = this.paperTypes.get(subjectCode);
|
|
|
+ if (paperType != null && !contains(paperTypes, paperType)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -158,16 +160,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean contains(List<String> paperTypes, String paperType) {
|
|
|
- if (paperType == null) {
|
|
|
- if (paperTypes.contains(paperType)) {
|
|
|
- // null卷型
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- paperTypes.remove(null);
|
|
|
+ private boolean contains(Set<String> paperTypes, String paperType) {
|
|
|
for (String s : paperTypes) {
|
|
|
if (paperType.equalsIgnoreCase(s)) {
|
|
|
return true;
|
|
@@ -177,8 +170,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
}
|
|
|
|
|
|
protected void beforeSave() {
|
|
|
- // paperType集合
|
|
|
- Map<String, Set<String>> paperTypes = new HashMap<String, Set<String>>();
|
|
|
+
|
|
|
// 遍历客观题
|
|
|
for (Entry<String, List<ExamQuestion>> entry : objectiveQuestions.entrySet()) {
|
|
|
String[] keys = entry.getKey().split("\t");
|