|
@@ -44,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;
|
|
@@ -53,10 +55,14 @@ 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
|
|
|
public void process(ExamStudent student) {
|
|
|
+ if (!student.isUpload() || student.isAbsent()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
|
List<ExamQuestion> olist = objectiveQuestions.get(key);
|
|
|
if (olist == null) {
|
|
@@ -77,10 +83,11 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
beforeSave();
|
|
|
ReportSubjectService subjectService = SpringContextHolder.getBean(ReportSubjectService.class);
|
|
|
ReportSubjectGroupService groupService = SpringContextHolder.getBean(ReportSubjectGroupService.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++) {
|
|
@@ -128,12 +135,19 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
}
|
|
|
}
|
|
|
if (s.length == 1 || s.length == 2) {
|
|
|
+ if (s.length == 2) {
|
|
|
+ String paperType = StringUtils.trimToNull(s[1]);
|
|
|
+ Set<String> paperTypes = this.paperTypes.get(subjectCode);
|
|
|
+ if (paperType != null && !contains(paperTypes, paperType)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
ReportSubject r = subjectService.findOne(context.getExamId(), subjectCode);
|
|
|
r.setDifficulityLevel(difficulityLevel.toString());
|
|
|
r.setDiscriminationLevel(discriminationLevel.toString());
|
|
|
subjectService.save(r);
|
|
|
}
|
|
|
- if (s.length >= 4 ) {
|
|
|
+ if (s.length >= 4) {
|
|
|
Boolean objective = Boolean.parseBoolean(s[1]);
|
|
|
String paperType = StringUtils.trimToNull(s[2]);
|
|
|
Integer mainNumber = Integer.parseInt(s[3]);
|
|
@@ -146,9 +160,17 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private boolean contains(Set<String> paperTypes, String paperType) {
|
|
|
+ for (String s : paperTypes) {
|
|
|
+ if (paperType.equalsIgnoreCase(s)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
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");
|