Browse Source

生成考试报告

ywx
雍文秀 2 weeks ago
parent
commit
9c4409d33f

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaper.java View File

64
     //试题
64
     //试题
65
     @Transient
65
     @Transient
66
     private List<MsPaperQtypeQuestion> questions;
66
     private List<MsPaperQtypeQuestion> questions;
67
+    @Transient
68
+    //科目名称
69
+    private String subjectname;
67
 
70
 
68
 }
71
 }

+ 3
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportother/MsrExam.java View File

21
     private Integer examid;
21
     private Integer examid;
22
     //班级数量
22
     //班级数量
23
     private Integer classnum;
23
     private Integer classnum;
24
-    //学生数量
24
+    //总人数
25
+    private Integer totalnum;
26
+    //实考人数(参考人数)
25
     private Integer stunum;
27
     private Integer stunum;
26
     //缺考数量
28
     //缺考数量
27
     private Integer missnum;
29
     private Integer missnum;

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportsubject/MsrSubject.java View File

23
     private String subjectid;
23
     private String subjectid;
24
     //科目名称
24
     //科目名称
25
     private String subjectname;
25
     private String subjectname;
26
+    //满分
27
+    private Double fullscore;
26
     //最高分
28
     //最高分
27
     private Double maxscore;
29
     private Double maxscore;
28
     //最低分
30
     //最低分

+ 35
- 4
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrExamService.java View File

7
 import com.xhkjedu.smarking.model.paper.MsPaper;
7
 import com.xhkjedu.smarking.model.paper.MsPaper;
8
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
8
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
9
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
9
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
10
+import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
10
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
11
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
12
+import com.xhkjedu.smarking.utils.MarkingUtil;
11
 import com.xhkjedu.utils.N_Utils;
13
 import com.xhkjedu.utils.N_Utils;
12
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
13
 
15
 
53
         List<MsPaperStudent> paperStudents = paperStudentMapper.listPaperStudentByExamId(examid, mpids);//试学生成绩列表
55
         List<MsPaperStudent> paperStudents = paperStudentMapper.listPaperStudentByExamId(examid, mpids);//试学生成绩列表
54
 
56
 
55
         Integer classnum = N_Utils.obj2Int(classes.stream().map(MsClass::getClassid).distinct().count());
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
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
61
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
59
         List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
62
         List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
60
         List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
63
         List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
130
         double schoolStatisticsMax = N_Utils.handleInfinity(schoolStatistics.getMax());
133
         double schoolStatisticsMax = N_Utils.handleInfinity(schoolStatistics.getMax());
131
         //最低分均不包括0分
134
         //最低分均不包括0分
132
         double schoolStatisticsMin = N_Utils.handleInfinity(schoolStudents2.stream().filter(s -> s.getStuscore() > 0).mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
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
         MsrExam msrExam = new MsrExam();
139
         MsrExam msrExam = new MsrExam();
137
         msrExam.setExamid(examid);
140
         msrExam.setExamid(examid);
138
         msrExam.setClassnum(classnum);
141
         msrExam.setClassnum(classnum);
142
+        msrExam.setTotalnum(totalnum);
139
         msrExam.setStunum(stunum);
143
         msrExam.setStunum(stunum);
140
-        msrExam.setMissnum(stunum - sknum);
144
+        msrExam.setMissnum(missnum);
141
         msrExam.setSubjectnum(subjects.size());
145
         msrExam.setSubjectnum(subjects.size());
142
         msrExam.setMaxscore(schoolStatisticsMax);
146
         msrExam.setMaxscore(schoolStatisticsMax);
143
         msrExam.setMinscore(schoolStatisticsMin);
147
         msrExam.setMinscore(schoolStatisticsMin);
144
         msrExam.setCreatetime(N_Utils.getSecondTimestamp());
148
         msrExam.setCreatetime(N_Utils.getSecondTimestamp());
145
         msrExamMapper.insert(msrExam);
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
         examMapper.updateExamState(examid, 3);
178
         examMapper.updateExamState(examid, 3);
148
     }
179
     }
149
 
180
 

+ 22
- 0
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

363
         return result;
363
         return result;
364
     }
364
     }
365
 
365
 
366
+    //方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
367
+    public static double fc(List<Double> x) {
368
+        if (N_Utils.isListEmpty(x)) return 0;
369
+        int m = x.size();
370
+        double sum = 0;
371
+        for (int i = 0; i < m; i++) {//求和
372
+            sum += x.get(i);
373
+        }
374
+        double dAve = sum / m;//求平均值
375
+        double dVar = 0;
376
+        for (int i = 0; i < m; i++) {//求方差
377
+            dVar += (x.get(i) - dAve) * (x.get(i) - dAve);
378
+        }
379
+        return dVar / m;
380
+    }
381
+
382
+    //标准差σ=sqrt(s^2)
383
+    public static double bzc(List<Double> x) {
384
+        if (N_Utils.isListEmpty(x)) return 0;
385
+        return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
386
+    }
387
+
366
     public static void main(String[] args) {
388
     public static void main(String[] args) {
367
         String str = "ADAC-D-(C)(AB)(CD)(ACB)BB";
389
         String str = "ADAC-D-(C)(AB)(CD)(ACB)BB";
368
 
390
 

+ 1
- 1
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

167
     </select>
167
     </select>
168
     <!--考试报告科目列表-->
168
     <!--考试报告科目列表-->
169
     <select id="listReportSubject" resultType="com.xhkjedu.smarking.model.paper.MsPaper">
169
     <select id="listReportSubject" resultType="com.xhkjedu.smarking.model.paper.MsPaper">
170
-        select s.subjectid,p.mpid,p.pnum,p.mergepnum,p.pscore,p.correcttype
170
+        select s.subjectid,s.subjectname,p.mpid,p.pnum,p.mergepnum,p.pscore,p.correcttype
171
         from ms_subject s inner join ms_paper p on s.msid=p.msid
171
         from ms_subject s inner join ms_paper p on s.msid=p.msid
172
         where s.examid=#{examid}
172
         where s.examid=#{examid}
173
         <if test="exammode!=3">
173
         <if test="exammode!=3">

Loading…
Cancel
Save