|
@@ -7,7 +7,9 @@ import com.xhkjedu.smarking.model.exam.*;
|
7
|
7
|
import com.xhkjedu.smarking.model.paper.MsPaper;
|
8
|
8
|
import com.xhkjedu.smarking.model.report.reportother.MsrExam;
|
9
|
9
|
import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
|
|
10
|
+import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
|
10
|
11
|
import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
|
|
12
|
+import com.xhkjedu.smarking.utils.MarkingUtil;
|
11
|
13
|
import com.xhkjedu.utils.N_Utils;
|
12
|
14
|
import org.springframework.stereotype.Service;
|
13
|
15
|
|
|
@@ -53,8 +55,9 @@ public class MsrExamService {
|
53
|
55
|
List<MsPaperStudent> paperStudents = paperStudentMapper.listPaperStudentByExamId(examid, mpids);//试学生成绩列表
|
54
|
56
|
|
55
|
57
|
Integer classnum = N_Utils.obj2Int(classes.stream().map(MsClass::getClassid).distinct().count());
|
56
|
|
- Integer stunum = N_Utils.obj2Int(students.stream().map(MsClassStudent::getStudentid).distinct().count());
|
57
|
|
- Integer sknum = N_Utils.obj2Int(paperStudents.stream().filter(s -> s.getSstate().equals(2)).map(MsPaperStudent::getStudentid).distinct().count());
|
|
58
|
+ Integer totalnum = N_Utils.obj2Int(students.stream().map(MsClassStudent::getStudentid).distinct().count());
|
|
59
|
+ Integer stunum = N_Utils.obj2Int(paperStudents.stream().filter(s -> s.getSstate().equals(2)).map(MsPaperStudent::getStudentid).distinct().count());
|
|
60
|
+ Integer missnum = totalnum - stunum;
|
58
|
61
|
List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
|
59
|
62
|
List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
|
60
|
63
|
List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
|
|
@@ -130,20 +133,48 @@ public class MsrExamService {
|
130
|
133
|
double schoolStatisticsMax = N_Utils.handleInfinity(schoolStatistics.getMax());
|
131
|
134
|
//最低分均不包括0分
|
132
|
135
|
double schoolStatisticsMin = N_Utils.handleInfinity(schoolStudents2.stream().filter(s -> s.getStuscore() > 0).mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
|
133
|
|
-
|
|
136
|
+ double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
|
134
|
137
|
|
135
|
138
|
//总体分析
|
136
|
139
|
MsrExam msrExam = new MsrExam();
|
137
|
140
|
msrExam.setExamid(examid);
|
138
|
141
|
msrExam.setClassnum(classnum);
|
|
142
|
+ msrExam.setTotalnum(totalnum);
|
139
|
143
|
msrExam.setStunum(stunum);
|
140
|
|
- msrExam.setMissnum(stunum - sknum);
|
|
144
|
+ msrExam.setMissnum(missnum);
|
141
|
145
|
msrExam.setSubjectnum(subjects.size());
|
142
|
146
|
msrExam.setMaxscore(schoolStatisticsMax);
|
143
|
147
|
msrExam.setMinscore(schoolStatisticsMin);
|
144
|
148
|
msrExam.setCreatetime(N_Utils.getSecondTimestamp());
|
145
|
149
|
msrExamMapper.insert(msrExam);
|
146
|
150
|
|
|
151
|
+ //科目分析
|
|
152
|
+ Map<String, List<MsPaperStudent>> subjectCollect = paperStudents.stream().collect(Collectors.groupingBy(MsPaperStudent::getSubjectid));
|
|
153
|
+ double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
|
|
154
|
+ List<MsrSubject> msrSubjects = new ArrayList<>();
|
|
155
|
+ MsrSubject msrSubject = new MsrSubject();
|
|
156
|
+ msrSubject.setExamid(examid);
|
|
157
|
+ msrSubject.setSubjectid("zf");
|
|
158
|
+ msrSubject.setSubjectname("总分");
|
|
159
|
+ msrSubject.setFullscore(fullscore);
|
|
160
|
+ msrSubject.setMaxscore(schoolStatisticsMax);
|
|
161
|
+ msrSubject.setMinscore(schoolStatisticsMin);
|
|
162
|
+ msrSubject.setAvgscore(schoolStatisticsAverage);
|
|
163
|
+ msrSubject.setScorerate(N_Utils.getDoubleDivideAndMulitiply(schoolStatisticsAverage, fullscore));
|
|
164
|
+ msrSubject.setTotalnum(totalnum);
|
|
165
|
+ msrSubject.setStunum(stunum);
|
|
166
|
+ msrSubject.setMissnum(missnum);
|
|
167
|
+ msrSubjects.add(msrSubject);
|
|
168
|
+ for (MsPaper subject : subjects) {
|
|
169
|
+ msrSubject = new MsrSubject();
|
|
170
|
+ msrSubject.setExamid(examid);
|
|
171
|
+ msrSubject.setSubjectid(subject.getSubjectid());
|
|
172
|
+ msrSubject.setSubjectname(subject.getSubjectname());
|
|
173
|
+ msrSubject.setFullscore(subject.getPscore());
|
|
174
|
+ List<MsPaperStudent> studentList = subjectCollect.get(subject.getSubjectid());
|
|
175
|
+ msrSubjects.add(msrSubject);
|
|
176
|
+ }
|
|
177
|
+
|
147
|
178
|
examMapper.updateExamState(examid, 3);
|
148
|
179
|
}
|
149
|
180
|
|