|
@@ -20,8 +20,10 @@ import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
|
20
|
20
|
import com.xhkjedu.sexam.model.reportclass.ERclassQuestionError;
|
21
|
21
|
import com.xhkjedu.sexam.model.reportclass.ERclassQuestionPoint;
|
22
|
22
|
import com.xhkjedu.sexam.model.reportstu.ERstudent;
|
|
23
|
+import com.xhkjedu.sexam.utils.ExamUtil;
|
23
|
24
|
import com.xhkjedu.sexam.vo.paper.EPaperQsVo;
|
24
|
25
|
import com.xhkjedu.sexam.vo.report.ERPaperVo;
|
|
26
|
+import com.xhkjedu.utils.N_Utils;
|
25
|
27
|
import org.springframework.stereotype.Service;
|
26
|
28
|
|
27
|
29
|
import javax.annotation.Resource;
|
|
@@ -73,8 +75,8 @@ public class EReportGenerateService {
|
73
|
75
|
int stunum = classes.stream().mapToInt(m -> (int) m.get("classnum")).sum();
|
74
|
76
|
int subjectnum = subjects.size();
|
75
|
77
|
|
76
|
|
- String subjectid = "zf";
|
77
|
|
- String subjectname = "总分";
|
|
78
|
+ String subjectid;
|
|
79
|
+ String subjectname;
|
78
|
80
|
Map<String, String> subjectMap = subjects.stream().collect(Collectors.toMap(m -> m.get("subjectid").toString(),
|
79
|
81
|
m -> m.get("subjectname").toString()));
|
80
|
82
|
Map<String, ERPaperVo> paperMap = papers.stream().collect(Collectors.toMap(m -> m.getSubjectid(), m -> m));
|
|
@@ -83,11 +85,10 @@ public class EReportGenerateService {
|
83
|
85
|
List<ERstudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
|
84
|
86
|
List<ERstudent> classStudents = new ArrayList<>();//班级学生成绩
|
85
|
87
|
List<ERstudent> classSubjectStudents = new ArrayList<>();//班级科目学生成绩
|
86
|
|
- Map<String, Integer> schoolRank = new HashMap<>();//学校分数排名
|
87
|
|
- Map<String, Integer> schoolSubjectRank = new HashMap<>();//学校科目分数排名
|
88
|
|
- Map<String, Integer> classRank = new HashMap<>();//班级分数排名
|
89
|
|
- Map<String, Integer> classSubjectRank = new HashMap<>();//班级科目分数排名
|
90
|
|
-
|
|
88
|
+ Map<String, Integer> schoolStuRank = new HashMap<>();//学校学生分数排名
|
|
89
|
+ Map<String, Integer> schoolSubStuRank = new HashMap<>();//学校科目学生分数排名
|
|
90
|
+ Map<String, Integer> classStuRank = new HashMap<>();//班级学生分数排名
|
|
91
|
+ Map<String, Integer> classSubStuRank = new HashMap<>();//班级科目学生分数排名
|
91
|
92
|
List<ERstudent> students = ePaperStudentMapper.listByExamId(examid);
|
92
|
93
|
Map<Integer, List<ERstudent>> schoolCollect = students.stream().collect(Collectors.groupingBy(s -> s.getStudentid()));
|
93
|
94
|
for (Map.Entry<Integer, List<ERstudent>> entry : schoolCollect.entrySet()) {
|
|
@@ -100,7 +101,10 @@ public class EReportGenerateService {
|
100
|
101
|
Map<Integer, List<ERstudent>> cCollect = students.stream().collect(Collectors.groupingBy(s -> s.getClassid()));
|
101
|
102
|
for (Map.Entry<Integer, List<ERstudent>> entry : cCollect.entrySet()) {
|
102
|
103
|
Integer classid = entry.getKey();
|
|
104
|
+ subjectid = "zf";
|
|
105
|
+ subjectname = "总分";
|
103
|
106
|
List<ERstudent> studentList = entry.getValue();
|
|
107
|
+
|
104
|
108
|
Map<Integer, List<ERstudent>> sCollect = studentList.stream().collect(Collectors.groupingBy(s -> s.getStudentid()));
|
105
|
109
|
for (Map.Entry<Integer, List<ERstudent>> csEntry : sCollect.entrySet()) {
|
106
|
110
|
ERstudent cs = new ERstudent();
|
|
@@ -124,7 +128,6 @@ public class EReportGenerateService {
|
124
|
128
|
}
|
125
|
129
|
|
126
|
130
|
DoubleSummaryStatistics schoolStatistics = schoolStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
127
|
|
- DoubleSummaryStatistics sSStatistics = schoolSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
128
|
131
|
DoubleSummaryStatistics classStatistics = classStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
129
|
132
|
DoubleSummaryStatistics cSStatistics = classSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
130
|
133
|
double schoolStatisticsMax = schoolStatistics.getMax();
|
|
@@ -180,26 +183,58 @@ public class EReportGenerateService {
|
180
|
183
|
rs.setMaxscore(statistics.getMax());
|
181
|
184
|
rs.setMinscore(statistics.getMin());
|
182
|
185
|
rs.setAvgscore(statistics.getAverage());
|
183
|
|
- rs.setStunum(list.stream().filter(l -> l.getSstate() == 2).collect(Collectors.toList()).size());
|
184
|
|
- rs.setMissnum(list.stream().filter(l -> l.getSstate() == 3).collect(Collectors.toList()).size());
|
|
186
|
+ int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
|
|
187
|
+ .collect(Collectors.toList()).size();
|
|
188
|
+ int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
|
|
189
|
+ .collect(Collectors.toList()).size();
|
|
190
|
+ int jgnum = list.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
|
|
191
|
+ .collect(Collectors.toList()).size();
|
|
192
|
+ int dfnum = list.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
|
|
193
|
+ .collect(Collectors.toList()).size();
|
|
194
|
+ List<Double> scores = list.stream().map(l -> l.getScore()).collect(Collectors.toList());
|
|
195
|
+ rs.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
|
|
196
|
+ rs.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
|
|
197
|
+ rs.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
|
|
198
|
+ rs.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
|
|
199
|
+ rs.setBzc(ExamUtil.standardDiviation(scores));
|
|
200
|
+ int sknum = list.size();
|
|
201
|
+ rs.setStunum(sknum);//实考人数
|
|
202
|
+ rs.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
|
185
|
203
|
subjectList.add(rs);
|
186
|
204
|
|
187
|
205
|
Map<Integer, List<ERstudent>> claCollect = list.stream().collect(Collectors.groupingBy(s -> s.getClassid()));
|
188
|
206
|
for (Map.Entry<Integer, List<ERstudent>> entry : claCollect.entrySet()) {
|
189
|
207
|
Integer classid = entry.getKey();
|
190
|
208
|
List<ERstudent> rstudentList = entry.getValue();
|
191
|
|
- statistics = rstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
|
209
|
+ DoubleSummaryStatistics claStatistics = rstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
192
|
210
|
ERclass rc = new ERclass();
|
193
|
211
|
rc.setExamid(examid);
|
194
|
212
|
rc.setClassid(classid);
|
195
|
213
|
rc.setSubjectid(subjectid);
|
196
|
214
|
rc.setSubjectname(subjectname);
|
197
|
215
|
rc.setAllscore(allscore);
|
198
|
|
- rc.setClassmaxscore(statistics.getMax());
|
199
|
|
- rc.setClassminscore(statistics.getMin());
|
200
|
|
- rc.setClassavgscore(statistics.getAverage());
|
201
|
|
- rc.setStunum(rstudentList.stream().filter(l -> l.getSstate() == 2).collect(Collectors.toList()).size());
|
202
|
|
- rc.setMissnum(rstudentList.stream().filter(l -> l.getSstate() == 3).collect(Collectors.toList()).size());
|
|
216
|
+ rc.setClassmaxscore(claStatistics.getMax());
|
|
217
|
+ rc.setClassminscore(claStatistics.getMin());
|
|
218
|
+ rc.setClassavgscore(claStatistics.getAverage());
|
|
219
|
+ rc.setSchoolmaxscore(statistics.getMax());
|
|
220
|
+ rc.setSchoolavgscore(statistics.getAverage());
|
|
221
|
+ sknum = rstudentList.size();
|
|
222
|
+ rc.setStunum(sknum);//实考人数
|
|
223
|
+ rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
|
|
224
|
+ yxnum = rstudentList.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
|
|
225
|
+ .collect(Collectors.toList()).size();
|
|
226
|
+ lhnum = rstudentList.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
|
|
227
|
+ .collect(Collectors.toList()).size();
|
|
228
|
+ jgnum = rstudentList.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
|
|
229
|
+ .collect(Collectors.toList()).size();
|
|
230
|
+ dfnum = rstudentList.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
|
|
231
|
+ .collect(Collectors.toList()).size();
|
|
232
|
+ scores = rstudentList.stream().map(l -> l.getScore()).collect(Collectors.toList());
|
|
233
|
+ rc.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
|
|
234
|
+ rc.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
|
|
235
|
+ rc.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
|
|
236
|
+ rc.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
|
|
237
|
+ rc.setBzc(ExamUtil.standardDiviation(scores));
|
203
|
238
|
classList.add(rc);
|
204
|
239
|
List<EPaperQsVo> typelist = JSON.parseArray(rp.getQnumjson(), EPaperQsVo.class);
|
205
|
240
|
for (EPaperQsVo t : typelist) {
|
|
@@ -231,29 +266,31 @@ public class EReportGenerateService {
|
231
|
266
|
eRclassMapper.insertList(classList);
|
232
|
267
|
eRsubjectMapper.insertList(subjectList);
|
233
|
268
|
|
234
|
|
- setRank(schoolStudents, schoolRank, 1);//学校分数排名
|
235
|
|
- setRank(schoolSubjectStudents, schoolSubjectRank, 2);//学校科目分数排名
|
236
|
|
- setRank(classStudents, classRank, 3);//班级分数排名
|
237
|
|
- setRank(classSubjectStudents, classSubjectRank, 4);//班级科目分数排名
|
|
269
|
+ setRank(schoolStudents, schoolStuRank, 1);//学校学生分数排名
|
|
270
|
+ setRank(schoolSubjectStudents, schoolSubStuRank, 2);//学校科目学生分数排名
|
|
271
|
+ setRank(classStudents, classStuRank, 3);//班级学生分数排名
|
|
272
|
+ setRank(classSubjectStudents, classSubStuRank, 4);//班级科目学生分数排名
|
238
|
273
|
|
239
|
274
|
for (ERstudent cs : classStudents) {
|
240
|
275
|
Integer studentid = cs.getStudentid();
|
241
|
|
- cs.setClassrank(classRank.get(cs.getClassid() + "_" + studentid));
|
|
276
|
+ cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
|
242
|
277
|
cs.setClassmaxscore(classStatistics.getMax());
|
243
|
278
|
cs.setClassavgscore(classStatistics.getAverage());
|
244
|
|
- cs.setSchoolrank(schoolRank.get(studentid));
|
|
279
|
+ cs.setSchoolrank(schoolStuRank.get(studentid));
|
245
|
280
|
cs.setSchoolmaxscore(schoolStatisticsMax);
|
246
|
281
|
cs.setSchoolavgscore(schoolStatisticsAverage);
|
247
|
282
|
}
|
248
|
283
|
eRstudentMapper.insertList(classStudents);
|
249
|
284
|
|
|
285
|
+ DoubleSummaryStatistics sSStatistics = schoolSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
250
|
286
|
for (ERstudent cs : classSubjectStudents) {
|
251
|
287
|
Integer studentid = cs.getStudentid();
|
252
|
288
|
Integer classid = cs.getClassid();
|
253
|
|
- cs.setClassrank(classRank.get(classid + "_" + studentid));
|
254
|
|
- cs.setClassmaxscore(classStatistics.getMax());
|
255
|
|
- cs.setClassavgscore(classStatistics.getAverage());
|
256
|
|
- cs.setSchoolrank(schoolSubjectRank.get(classid + "_" + cs.getSubjectid() + "_" + studentid));
|
|
289
|
+ subjectid = cs.getSubjectid();
|
|
290
|
+ cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
|
|
291
|
+ cs.setClassmaxscore(cSStatistics.getMax());
|
|
292
|
+ cs.setClassavgscore(cSStatistics.getAverage());
|
|
293
|
+ cs.setSchoolrank(schoolSubStuRank.get(subjectid + "_" + studentid));
|
257
|
294
|
cs.setSchoolmaxscore(sSStatistics.getMax());
|
258
|
295
|
cs.setSchoolavgscore(sSStatistics.getAverage());
|
259
|
296
|
}
|
|
@@ -274,13 +311,13 @@ public class EReportGenerateService {
|
274
|
311
|
Integer studentid = cgs.getStudentid();
|
275
|
312
|
Integer classid = cgs.getClassid();
|
276
|
313
|
String subjectid = cgs.getSubjectid();
|
277
|
|
- if (code == 1) {//学校
|
|
314
|
+ if (code == 1) {//学校学生
|
278
|
315
|
key = studentid.toString();
|
279
|
|
- } else if (code == 2) {//学校科目
|
|
316
|
+ } else if (code == 2) {//学校科目学生
|
280
|
317
|
key = subjectid + "_" + studentid;
|
281
|
|
- } else if (code == 3) {//班级
|
|
318
|
+ } else if (code == 3) {//班级学生
|
282
|
319
|
key = classid + "_" + studentid;
|
283
|
|
- } else {//班级科目
|
|
320
|
+ } else {//班级科目学生
|
284
|
321
|
key = classid + "_" + subjectid + "_" + studentid;
|
285
|
322
|
}
|
286
|
323
|
rank.put(key, index);
|