|
@@ -1,5 +1,6 @@
|
|
package cn.com.qmth.stmms.report;
|
|
package cn.com.qmth.stmms.report;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -108,18 +109,25 @@ public class ReportController {
|
|
query.setPageSize(Integer.MAX_VALUE);
|
|
query.setPageSize(Integer.MAX_VALUE);
|
|
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 = groupService.findByQuery(query);
|
|
|
|
|
|
+ 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);
|
|
result.accumulate("basic_paper", getPaperJson(reportSubject));
|
|
result.accumulate("basic_paper", getPaperJson(reportSubject));
|
|
- result.accumulate("basic_question_objective", getQuestionJson(query, true));
|
|
|
|
- result.accumulate("basic_question_subjective", getQuestionJson(query, false));
|
|
|
|
|
|
+ result.accumulate("basic_question_subjective", getQuestionJson(query, false, paperType));
|
|
|
|
+ result.accumulate("basic_question_objective", getQuestionJson(query, 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));
|
|
|
|
|
|
+ result.accumulate("basic_question_option", getOptionJson(query, reportSubject, paperType));
|
|
result.accumulate("discrimination_level",
|
|
result.accumulate("discrimination_level",
|
|
- getDiscrimination(query, reportSubject, subjectClasses, subjectGroups));
|
|
|
|
- result.accumulate("difficulty_level", getDifficulty(query, reportSubject, subjectClasses, subjectGroups));
|
|
|
|
|
|
+ getDiscrimination(query, paperType, reportSubject, subjectClasses, subjectGroups));
|
|
|
|
+ result.accumulate("difficulty_level",
|
|
|
|
+ getDifficulty(query, 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));
|
|
@@ -204,13 +212,13 @@ public class ReportController {
|
|
int sumCount = 0;
|
|
int sumCount = 0;
|
|
int total = (int) totalScore;
|
|
int total = (int) totalScore;
|
|
for (int i = total; i >= 0; i--) {
|
|
for (int i = total; i >= 0; i--) {
|
|
- rangeCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
- if (i == totalScore) {
|
|
|
|
- sumCount = rangeCount;
|
|
|
|
- } else {
|
|
|
|
- sumCount = sumCount + rangeCount;
|
|
|
|
- }
|
|
|
|
if (i % range == 0) {
|
|
if (i % range == 0) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ rangeCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
+ } else {
|
|
|
|
+ rangeCount = getSumCount(jsonObject, i, i - range + 1);
|
|
|
|
+ }
|
|
|
|
+ sumCount = sumCount + rangeCount;
|
|
JSONObject value = new JSONObject();
|
|
JSONObject value = new JSONObject();
|
|
value.accumulate("score", i);
|
|
value.accumulate("score", i);
|
|
value.accumulate("rangeCount", rangeCount);
|
|
value.accumulate("rangeCount", rangeCount);
|
|
@@ -230,13 +238,14 @@ public class ReportController {
|
|
int sumCount = 0;
|
|
int sumCount = 0;
|
|
int total = (int) totalScore;
|
|
int total = (int) totalScore;
|
|
for (int i = 0; i <= total; i++) {
|
|
for (int i = 0; i <= total; i++) {
|
|
- rangeCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
- if (i == 0) {
|
|
|
|
- sumCount = rangeCount;
|
|
|
|
- } else {
|
|
|
|
- sumCount = sumCount + rangeCount;
|
|
|
|
- }
|
|
|
|
if (i % range == 0) {
|
|
if (i % range == 0) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ rangeCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
+ sumCount = rangeCount;
|
|
|
|
+ } else {
|
|
|
|
+ rangeCount = getSumCount(jsonObject, i - range + 1, i);
|
|
|
|
+ sumCount = sumCount + rangeCount;
|
|
|
|
+ }
|
|
JSONObject value = new JSONObject();
|
|
JSONObject value = new JSONObject();
|
|
value.accumulate("score", i == 0 ? 0 : (i - range + 0.5) + "~" + i);
|
|
value.accumulate("score", i == 0 ? 0 : (i - range + 0.5) + "~" + i);
|
|
value.accumulate("rangeCount", rangeCount);
|
|
value.accumulate("rangeCount", rangeCount);
|
|
@@ -249,6 +258,25 @@ public class ReportController {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private int getSumCount(JSONObject jsonObject, int start, int end) {
|
|
|
|
+ int sumCount = 0;
|
|
|
|
+ int currentCount = 0;
|
|
|
|
+ if (start < end) {
|
|
|
|
+ for (int i = start; i <= end; i++) {
|
|
|
|
+ currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
+ sumCount = sumCount + currentCount;
|
|
|
|
+ }
|
|
|
|
+ } else if (start >= end) {
|
|
|
|
+ for (int i = end; i <= start; i++) {
|
|
|
|
+ currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
|
+ sumCount = sumCount + currentCount;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ sumCount = jsonObject.getInt(String.valueOf(start));
|
|
|
|
+ }
|
|
|
|
+ return sumCount;
|
|
|
|
+ }
|
|
|
|
+
|
|
private String getRangeLevel(ReportSubjectQuery query, ReportSubject reportSubject, List<ReportSubjectClass> classes) {
|
|
private String getRangeLevel(ReportSubjectQuery query, ReportSubject reportSubject, List<ReportSubjectClass> classes) {
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
JSONObject value = JSONObject.fromObject(reportSubject.getRangeLevel());
|
|
JSONObject value = JSONObject.fromObject(reportSubject.getRangeLevel());
|
|
@@ -264,7 +292,7 @@ public class ReportController {
|
|
return array.toString();
|
|
return array.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getDifficulty(ReportSubjectQuery query, ReportSubject reportSubject,
|
|
|
|
|
|
+ private String getDifficulty(ReportSubjectQuery query, 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();
|
|
@@ -313,8 +341,14 @@ public class ReportController {
|
|
: reportSubjectClass.getDifficulityLevel());
|
|
: reportSubjectClass.getDifficulityLevel());
|
|
classGroups.add(group);
|
|
classGroups.add(group);
|
|
query.setClassName(reportSubjectClass.getClassName());
|
|
query.setClassName(reportSubjectClass.getClassName());
|
|
- query.setObjective(null);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsList = classGroupService.findByQuery(query);
|
|
|
|
|
|
+ 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);
|
|
|
|
+ classGroupsList.addAll(classGroupsListO);
|
|
|
|
+ classGroupsList.addAll(classGroupsListS);
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.accumulate("name", r.getGroupName());
|
|
jsonObject.accumulate("name", r.getGroupName());
|
|
@@ -331,7 +365,7 @@ public class ReportController {
|
|
return result.toString();
|
|
return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getDiscrimination(ReportSubjectQuery query, ReportSubject reportSubject,
|
|
|
|
|
|
+ private String getDiscrimination(ReportSubjectQuery query, 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();
|
|
@@ -381,8 +415,14 @@ public class ReportController {
|
|
: reportSubjectClass.getDiscriminationLevel());
|
|
: reportSubjectClass.getDiscriminationLevel());
|
|
classGroups.add(group);
|
|
classGroups.add(group);
|
|
query.setClassName(reportSubjectClass.getClassName());
|
|
query.setClassName(reportSubjectClass.getClassName());
|
|
- query.setObjective(null);
|
|
|
|
- List<ReportSubjectClassGroup> classGroupsList = classGroupService.findByQuery(query);
|
|
|
|
|
|
+ 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);
|
|
|
|
+ classGroupsList.addAll(classGroupsListO);
|
|
|
|
+ classGroupsList.addAll(classGroupsListS);
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
for (ReportSubjectClassGroup r : classGroupsList) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.accumulate("name", r.getGroupName());
|
|
jsonObject.accumulate("name", r.getGroupName());
|
|
@@ -399,11 +439,14 @@ public class ReportController {
|
|
return result.toString();
|
|
return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getOptionJson(ReportSubjectQuery query, ReportSubject reportSubject) {
|
|
|
|
|
|
+ private String getOptionJson(ReportSubjectQuery query, ReportSubject reportSubject, String paperType) {
|
|
JSONObject value = new JSONObject();
|
|
JSONObject value = new JSONObject();
|
|
- value.accumulate("options", reportSubject.getOptions().split(ANSWER_SPLIT));
|
|
|
|
|
|
+ if (reportSubject.getOptions() != null) {
|
|
|
|
+ value.accumulate("options", reportSubject.getOptions().split(ANSWER_SPLIT));
|
|
|
|
+ }
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
query.setObjective(true);
|
|
query.setObjective(true);
|
|
|
|
+ query.setPaperType(paperType);
|
|
List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
for (ReportSubjectQuestion r : list) {
|
|
for (ReportSubjectQuestion r : list) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
@@ -516,8 +559,11 @@ public class ReportController {
|
|
return array.toString();
|
|
return array.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String getQuestionJson(ReportSubjectQuery query, boolean isObjective) {
|
|
|
|
|
|
+ private String getQuestionJson(ReportSubjectQuery query, boolean isObjective, String paperType) {
|
|
query.setObjective(isObjective);
|
|
query.setObjective(isObjective);
|
|
|
|
+ if (isObjective) {
|
|
|
|
+ query.setPaperType(paperType);
|
|
|
|
+ }
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
List<ReportSubjectQuestion> list = questionService.findByQuery(query);
|
|
for (ReportSubjectQuestion r : list) {
|
|
for (ReportSubjectQuestion r : list) {
|