|
@@ -409,7 +409,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
ReportSubject subject = reportSubjectService.findOne(examId, subjectCode);
|
|
|
if (subject != null) {
|
|
|
JSONArray array = getScoreRange(subject.getScoreRange(), subject.getTotalScore(),
|
|
|
- subject.getRealityCount(), 10);
|
|
|
+ subject.getRealityCount(), 0.25);
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
Integer score = jsonObject.getInt("score");
|
|
@@ -427,20 +427,20 @@ public class ReportServiceImpl implements ReportService {
|
|
|
FormatType.XLSX);
|
|
|
}
|
|
|
|
|
|
- private JSONArray getScoreRange(String scoreRange, double totalScore, Integer totalCount, int range) {
|
|
|
+ private JSONArray getScoreRange(String scoreRange, double totalScore, Integer totalCount, double range) {
|
|
|
JSONArray result = new JSONArray();
|
|
|
JSONObject jsonObject = JSONObject.fromObject(scoreRange);
|
|
|
int rangeCount = 0;
|
|
|
int sumCount = 0;
|
|
|
int total = (int) Math.ceil(totalScore / range);
|
|
|
for (int i = total; i >= 0; i--) {
|
|
|
- int start = i * range;
|
|
|
- int end = (i + 1) * range;
|
|
|
+ double start = i * range;
|
|
|
+ double end = (i + 1) * range;
|
|
|
if (start > totalScore) {
|
|
|
- start = (int) Math.ceil(totalScore);
|
|
|
+ start = Math.ceil(totalScore);
|
|
|
}
|
|
|
if (end > totalScore) {
|
|
|
- end = (int) Math.ceil(totalScore);
|
|
|
+ end = Math.ceil(totalScore);
|
|
|
}
|
|
|
if (end < 0) {
|
|
|
end = 0;
|
|
@@ -452,17 +452,28 @@ public class ReportServiceImpl implements ReportService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private int getSumCount(JSONObject jsonObject, int start, int end) {
|
|
|
+ private int getSumCount(JSONObject jsonObject, double start, double end) {
|
|
|
int sumCount = 0;
|
|
|
int currentCount = 0;
|
|
|
+ double rate = 0.25;
|
|
|
if (start < end) {
|
|
|
- for (int i = start; i < end; i++) {
|
|
|
- currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
+// for (int i = start; i < end; i++) {
|
|
|
+// currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
+// sumCount = sumCount + currentCount;
|
|
|
+// }
|
|
|
+ double length = (end - start) / rate;
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
+ currentCount = jsonObject.getInt(String.valueOf(start + i * rate));
|
|
|
sumCount = sumCount + currentCount;
|
|
|
}
|
|
|
} else if (start > end) {
|
|
|
- for (int i = end; i < start; i++) {
|
|
|
- currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
+// for (int i = end; i < start; i++) {
|
|
|
+// currentCount = jsonObject.getInt(String.valueOf(i));
|
|
|
+// sumCount = sumCount + currentCount;
|
|
|
+// }
|
|
|
+ double length = (start - end) / rate;
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
+ currentCount = jsonObject.getInt(String.valueOf(end + i * rate));
|
|
|
sumCount = sumCount + currentCount;
|
|
|
}
|
|
|
} else {
|
|
@@ -471,7 +482,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
return sumCount;
|
|
|
}
|
|
|
|
|
|
- private JSONObject getRangeJson(Integer totalCount, int rangeCount, int sumCount, int score) {
|
|
|
+ private JSONObject getRangeJson(Integer totalCount, int rangeCount, int sumCount, double score) {
|
|
|
JSONObject value = new JSONObject();
|
|
|
value.accumulate("score", score);
|
|
|
value.accumulate("rangeCount", rangeCount);
|