|
@@ -19,8 +19,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamService;
|
|
-import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubject;
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubject;
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubjectClass;
|
|
import cn.com.qmth.stmms.biz.report.model.ReportSubjectClass;
|
|
@@ -82,7 +82,7 @@ public class ReportController {
|
|
private ReportSubjectService reportSubjectService;
|
|
private ReportSubjectService reportSubjectService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private ExamStudentService studentService;
|
|
|
|
|
|
+ private ExamQuestionService examQuestionService;
|
|
|
|
|
|
public static final String ANSWER_SPLIT = ",";
|
|
public static final String ANSWER_SPLIT = ",";
|
|
|
|
|
|
@@ -110,10 +110,10 @@ public class ReportController {
|
|
result.accumulate("message", "找不到对应科目");
|
|
result.accumulate("message", "找不到对应科目");
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
- List<String> paperTypes = studentService.findDistinctPaperType(examId, subjectCode);
|
|
|
|
- if (!paperTypes.contains(paperType)) {
|
|
|
|
|
|
+ List<String> paperTypes = examQuestionService.getPaperTypeWitnNull(examId, subjectCode);
|
|
|
|
+ if (!contains(subject.getObjectiveScore() > 0, paperTypes, paperType)) {
|
|
result.accumulate("code", "500");
|
|
result.accumulate("code", "500");
|
|
- result.accumulate("message", "没有对应的卷型");
|
|
|
|
|
|
+ result.accumulate("message", "试卷结构中没有对应的卷型");
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
@@ -131,24 +131,24 @@ public class ReportController {
|
|
ReportSubject reportSubject = reportSubjectService.findOne(query.getExamId(), query.getSubjectCode());
|
|
ReportSubject reportSubject = reportSubjectService.findOne(query.getExamId(), query.getSubjectCode());
|
|
List<ReportSubjectClass> subjectClasses = classService.findByQuery(query);
|
|
List<ReportSubjectClass> subjectClasses = classService.findByQuery(query);
|
|
List<ReportSubjectGroup> subjectGroups = new ArrayList<ReportSubjectGroup>();
|
|
List<ReportSubjectGroup> subjectGroups = new ArrayList<ReportSubjectGroup>();
|
|
- query.setObjective(true);
|
|
|
|
- List<ReportSubjectGroup> subjectGroupO = groupService.findByQuery(query);
|
|
|
|
- query.setObjective(false);
|
|
|
|
- List<ReportSubjectGroup> subjectGroupsS = groupService.findByQuery(query);
|
|
|
|
- subjectGroups.addAll(subjectGroupO);
|
|
|
|
- subjectGroups.addAll(subjectGroupsS);
|
|
|
|
|
|
+ List<ReportSubjectGroup> objectiveGroup = groupService.findByExamIdAndSubjectCodeAndObjectiveAndPaperType(
|
|
|
|
+ examId, subjectCode, true, paperType);
|
|
|
|
+ List<ReportSubjectGroup> subjectiveGroup = groupService.findByExamIdAndSubjectCodeAndObjectiveAndPaperType(
|
|
|
|
+ examId, subjectCode, false, paperType);
|
|
|
|
+ subjectGroups.addAll(objectiveGroup);
|
|
|
|
+ subjectGroups.addAll(subjectiveGroup);
|
|
result.accumulate("basic_paper", getPaperJson(reportSubject));
|
|
result.accumulate("basic_paper", getPaperJson(reportSubject));
|
|
- result.accumulate("basic_question_subjective", getQuestionJson(query, false, null));
|
|
|
|
- result.accumulate("basic_question_objective", getQuestionJson(query, true, paperType));
|
|
|
|
|
|
+ result.accumulate("basic_question_subjective", getQuestionJson(examId, subjectCode, false, null));
|
|
|
|
+ result.accumulate("basic_question_objective", getQuestionJson(examId, subjectCode, true, paperType));
|
|
result.accumulate("basic_class", getClassJson(subjectClasses));
|
|
result.accumulate("basic_class", getClassJson(subjectClasses));
|
|
result.accumulate("basic_teacher", getTeacerJson(query));
|
|
result.accumulate("basic_teacher", getTeacerJson(query));
|
|
result.accumulate("basic_college", getCollegeJson(query));
|
|
result.accumulate("basic_college", getCollegeJson(query));
|
|
result.accumulate("basic_main_question", getGroupJson(subjectGroups));
|
|
result.accumulate("basic_main_question", getGroupJson(subjectGroups));
|
|
- result.accumulate("basic_question_option", getOptionJson(query, reportSubject, paperType));
|
|
|
|
|
|
+ result.accumulate("basic_question_option", getOptionJson(reportSubject, paperType));
|
|
result.accumulate("discrimination_level",
|
|
result.accumulate("discrimination_level",
|
|
- getDiscrimination(query, paperType, reportSubject, subjectClasses, subjectGroups));
|
|
|
|
|
|
+ getDiscrimination(examId, subjectCode, paperType, reportSubject, subjectClasses, subjectGroups));
|
|
result.accumulate("difficulty_level",
|
|
result.accumulate("difficulty_level",
|
|
- getDifficulty(query, paperType, reportSubject, subjectClasses, subjectGroups));
|
|
|
|
|
|
+ getDifficulty(examId, subjectCode, paperType, reportSubject, subjectClasses, subjectGroups));
|
|
result.accumulate("range_level", getRangeLevel(query, reportSubject, subjectClasses));
|
|
result.accumulate("range_level", getRangeLevel(query, reportSubject, subjectClasses));
|
|
result.accumulate("range_10_totalScore", getRange10(reportSubject, subjectClasses));
|
|
result.accumulate("range_10_totalScore", getRange10(reportSubject, subjectClasses));
|
|
result.accumulate("range_1_totalScore", getRange1(reportSubject, subjectClasses));
|
|
result.accumulate("range_1_totalScore", getRange1(reportSubject, subjectClasses));
|
|
@@ -162,6 +162,27 @@ public class ReportController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private boolean contains(boolean objective, List<String> paperTypes, String paperType) {
|
|
|
|
+ if (paperType == null) {
|
|
|
|
+ if (!objective) {
|
|
|
|
+ // 纯主观题
|
|
|
|
+ return true;
|
|
|
|
+ } else if (paperTypes.contains(paperType)) {
|
|
|
|
+ // null卷型
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ paperTypes.remove(null);
|
|
|
|
+ for (String s : paperTypes) {
|
|
|
|
+ if (paperType.equalsIgnoreCase(s)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
private String getPaperJson(ReportSubject r) {
|
|
private String getPaperJson(ReportSubject r) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.accumulate("fullScore", r.getTotalScore());
|
|
jsonObject.accumulate("fullScore", r.getTotalScore());
|
|
@@ -349,7 +370,7 @@ public class ReportController {
|
|
return array.toString();
|
|
return array.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getDifficulty(ReportSubjectQuery query, String paperType, ReportSubject reportSubject,
|
|
|
|
|
|
+ private String getDifficulty(Integer examId, String subjectCode, String paperType, ReportSubject reportSubject,
|
|
List<ReportSubjectClass> subjectClasses, List<ReportSubjectGroup> subjectGroups) {
|
|
List<ReportSubjectClass> subjectClasses, List<ReportSubjectGroup> subjectGroups) {
|
|
JSONObject defaultLevels = new JSONObject();
|
|
JSONObject defaultLevels = new JSONObject();
|
|
JSONObject content = new JSONObject();
|
|
JSONObject content = new JSONObject();
|
|
@@ -397,13 +418,13 @@ public class ReportController {
|
|
group.accumulate("levels", reportSubjectClass.getDifficulityLevel() == null ? defaultLevels.toString()
|
|
group.accumulate("levels", reportSubjectClass.getDifficulityLevel() == null ? defaultLevels.toString()
|
|
: reportSubjectClass.getDifficulityLevel());
|
|
: reportSubjectClass.getDifficulityLevel());
|
|
classGroups.add(group);
|
|
classGroups.add(group);
|
|
- query.setClassName(reportSubjectClass.getClassName());
|
|
|
|
List<ReportSubjectClassGroup> classGroupsList = new ArrayList<ReportSubjectClassGroup>();
|
|
List<ReportSubjectClassGroup> classGroupsList = new ArrayList<ReportSubjectClassGroup>();
|
|
- query.setObjective(true);
|
|
|
|
- query.setPaperType(paperType);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsListO = classGroupService.findByQuery(query);
|
|
|
|
- query.setObjective(false);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsListS = classGroupService.findByQuery(query);
|
|
|
|
|
|
+ List<ReportSubjectClassGroup> classGroupsListO = classGroupService
|
|
|
|
+ .findByExamIdAndSubjectCodeAndObjectiveAndPaperType(examId, subjectCode, true, paperType,
|
|
|
|
+ reportSubjectClass.getClassName());
|
|
|
|
+ List<ReportSubjectClassGroup> classGroupsListS = classGroupService
|
|
|
|
+ .findByExamIdAndSubjectCodeAndObjectiveAndPaperType(examId, subjectCode, false, paperType,
|
|
|
|
+ reportSubjectClass.getClassName());
|
|
classGroupsList.addAll(classGroupsListO);
|
|
classGroupsList.addAll(classGroupsListO);
|
|
classGroupsList.addAll(classGroupsListS);
|
|
classGroupsList.addAll(classGroupsListS);
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
@@ -422,7 +443,7 @@ public class ReportController {
|
|
return result.toString();
|
|
return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getDiscrimination(ReportSubjectQuery query, String paperType, ReportSubject reportSubject,
|
|
|
|
|
|
+ private String getDiscrimination(Integer examId, String subjectCode, String paperType, ReportSubject reportSubject,
|
|
List<ReportSubjectClass> subjectClasses, List<ReportSubjectGroup> subjectGroups) {
|
|
List<ReportSubjectClass> subjectClasses, List<ReportSubjectGroup> subjectGroups) {
|
|
JSONObject defaultLevels = new JSONObject();
|
|
JSONObject defaultLevels = new JSONObject();
|
|
JSONObject content = new JSONObject();
|
|
JSONObject content = new JSONObject();
|
|
@@ -471,13 +492,13 @@ public class ReportController {
|
|
group.accumulate("levels", reportSubjectClass.getDiscriminationLevel() == null ? defaultLevels.toString()
|
|
group.accumulate("levels", reportSubjectClass.getDiscriminationLevel() == null ? defaultLevels.toString()
|
|
: reportSubjectClass.getDiscriminationLevel());
|
|
: reportSubjectClass.getDiscriminationLevel());
|
|
classGroups.add(group);
|
|
classGroups.add(group);
|
|
- query.setClassName(reportSubjectClass.getClassName());
|
|
|
|
List<ReportSubjectClassGroup> classGroupsList = new ArrayList<ReportSubjectClassGroup>();
|
|
List<ReportSubjectClassGroup> classGroupsList = new ArrayList<ReportSubjectClassGroup>();
|
|
- query.setObjective(true);
|
|
|
|
- query.setPaperType(paperType);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsListO = classGroupService.findByQuery(query);
|
|
|
|
- query.setObjective(false);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsListS = classGroupService.findByQuery(query);
|
|
|
|
|
|
+ List<ReportSubjectClassGroup> classGroupsListO = classGroupService
|
|
|
|
+ .findByExamIdAndSubjectCodeAndObjectiveAndPaperType(examId, subjectCode, true, paperType,
|
|
|
|
+ reportSubjectClass.getClassName());
|
|
|
|
+ List<ReportSubjectClassGroup> classGroupsListS = classGroupService
|
|
|
|
+ .findByExamIdAndSubjectCodeAndObjectiveAndPaperType(examId, subjectCode, false, paperType,
|
|
|
|
+ reportSubjectClass.getClassName());
|
|
classGroupsList.addAll(classGroupsListO);
|
|
classGroupsList.addAll(classGroupsListO);
|
|
classGroupsList.addAll(classGroupsListS);
|
|
classGroupsList.addAll(classGroupsListS);
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
@@ -496,12 +517,12 @@ public class ReportController {
|
|
return result.toString();
|
|
return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getOptionJson(ReportSubjectQuery query, ReportSubject reportSubject, String paperType) {
|
|
|
|
|
|
+ private String getOptionJson(ReportSubject reportSubject, String paperType) {
|
|
JSONObject value = new JSONObject();
|
|
JSONObject value = new JSONObject();
|
|
- value.accumulate("options", reportSubject.getOptions() == null?new JSONArray().toString():reportSubject.getOptions().split(ANSWER_SPLIT));
|
|
|
|
- query.setObjective(true);
|
|
|
|
- query.setPaperType(paperType);
|
|
|
|
- List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
|
|
|
|
+ value.accumulate("options", reportSubject.getOptions() == null ? new JSONArray().toString() : reportSubject
|
|
|
|
+ .getOptions().split(ANSWER_SPLIT));
|
|
|
|
+ List<ReportSubjectQuestion> list = questionService.findByExamIdAndSubjectCodeAndObjectiveAndPaperType(
|
|
|
|
+ reportSubject.getExamId(), reportSubject.getSubjectCode(), true, paperType);
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
for (ReportSubjectQuestion r : list) {
|
|
for (ReportSubjectQuestion r : list) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
@@ -614,13 +635,10 @@ public class ReportController {
|
|
return array.toString();
|
|
return array.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getQuestionJson(ReportSubjectQuery query, boolean isObjective, String paperType) {
|
|
|
|
- query.setObjective(isObjective);
|
|
|
|
- if (isObjective) {
|
|
|
|
- query.setPaperType(paperType);
|
|
|
|
- }
|
|
|
|
|
|
+ private String getQuestionJson(Integer examId, String subjectCode, boolean isObjective, String paperType) {
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
- List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
|
|
|
|
+ List<ReportSubjectQuestion> list = questionService.findByExamIdAndSubjectCodeAndObjectiveAndPaperType(examId,
|
|
|
|
+ subjectCode, isObjective, paperType);
|
|
for (ReportSubjectQuestion r : list) {
|
|
for (ReportSubjectQuestion r : list) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.accumulate("name", r.getQuestionName());
|
|
jsonObject.accumulate("name", r.getQuestionName());
|
|
@@ -642,5 +660,4 @@ public class ReportController {
|
|
}
|
|
}
|
|
return array.toString();
|
|
return array.toString();
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|