Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 1 month ago
parent
commit
04285ebbac

+ 2
- 1
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentMapper.java View File

3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
4
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
5
 import com.xhkjedu.smarking.model.paper.MsPaperQtype;
5
 import com.xhkjedu.smarking.model.paper.MsPaperQtype;
6
+import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
6
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
7
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
7
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentScore;
8
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentScore;
8
 import com.xhkjedu.smarking.vo.exam.CStudentVo;
9
 import com.xhkjedu.smarking.vo.exam.CStudentVo;
90
     void updateStudentPaperScoreByMpsId(@Param("mpsid") Integer mpsid);
91
     void updateStudentPaperScoreByMpsId(@Param("mpsid") Integer mpsid);
91
 
92
 
92
     //试学生成绩列表
93
     //试学生成绩列表
93
-    List<MsPaperStudent> listPaperStudentByExamId(@Param("examid") Integer examid,@Param("mpids") List<Integer> mpids);
94
+    List<MsrStudent> listPaperStudentByExamId(@Param("examid") Integer examid, @Param("mpids") List<Integer> mpids);
94
 }
95
 }

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

31
     private Double minscore;
31
     private Double minscore;
32
     //平均分
32
     //平均分
33
     private Double avgscore;
33
     private Double avgscore;
34
-    //平均成绩排名
34
+    //平均成绩排名
35
     private Integer avgrank;
35
     private Integer avgrank;
36
+    //平均成绩排名率
37
+    private Double avgrankrate;
36
     //得分率
38
     //得分率
37
     private Double scorerate;
39
     private Double scorerate;
38
     //总人数
40
     //总人数

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/stupaper/MsPaperStudent.java View File

67
     //试题
67
     //试题
68
     @Transient
68
     @Transient
69
     List<MsPaperStudentQuestion> questions;
69
     List<MsPaperStudentQuestion> questions;
70
+    @Transient
71
+    //得分率
72
+    private Double scorerate;
70
 
73
 
71
 }
74
 }

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

2
 
2
 
3
 import com.xhkjedu.smarking.mapper.exam.*;
3
 import com.xhkjedu.smarking.mapper.exam.*;
4
 import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
4
 import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
5
+import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
6
+import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
5
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
7
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
6
 import com.xhkjedu.smarking.model.exam.*;
8
 import com.xhkjedu.smarking.model.exam.*;
7
 import com.xhkjedu.smarking.model.paper.MsPaper;
9
 import com.xhkjedu.smarking.model.paper.MsPaper;
8
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
10
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
9
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
11
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
10
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
12
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
11
-import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
12
 import com.xhkjedu.smarking.utils.MarkingUtil;
13
 import com.xhkjedu.smarking.utils.MarkingUtil;
13
 import com.xhkjedu.utils.N_Utils;
14
 import com.xhkjedu.utils.N_Utils;
14
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
36
     private MsClassStudentMapper classStudentMapper;
37
     private MsClassStudentMapper classStudentMapper;
37
     @Resource
38
     @Resource
38
     private MsPaperStudentMapper paperStudentMapper;
39
     private MsPaperStudentMapper paperStudentMapper;
40
+    @Resource
41
+    private MsrSubjectMapper msrSubjectMapper;
42
+    @Resource
43
+    private MsrStudentMapper msrStudentMapper;
39
 
44
 
40
     /**
45
     /**
41
      * @Description 生成报告
46
      * @Description 生成报告
51
         if (N_Utils.isListEmpty(subjects)) return;
56
         if (N_Utils.isListEmpty(subjects)) return;
52
         List<MsClass> classes = classMapper.listClassByExamId(examid);//获取考试关联班级
57
         List<MsClass> classes = classMapper.listClassByExamId(examid);//获取考试关联班级
53
         List<MsClassStudent> students = classStudentMapper.listStudentByExamId(examid);//获取考试关联学生
58
         List<MsClassStudent> students = classStudentMapper.listStudentByExamId(examid);//获取考试关联学生
54
-        List<Integer> mpids = subjects.stream().map(MsPaper::getMpid).collect(Collectors.toList());
55
-        List<MsPaperStudent> paperStudents = paperStudentMapper.listPaperStudentByExamId(examid, mpids);//试学生成绩列表
59
+        List<Integer> mpids = new ArrayList<>();
60
+        for (MsPaper subject : subjects) {
61
+            Integer mpid = subject.getMpid();
62
+            mpids.add(mpid);
63
+        }
64
+        List<MsrStudent> paperStudents = paperStudentMapper.listPaperStudentByExamId(examid, mpids);//试学生成绩列表
65
+        for (MsrStudent student : paperStudents) {
66
+            student.setScorerate(N_Utils.getDoubleDivideAndMulitiply(student.getStuscore(), student.getFullscore()));
67
+        }
56
 
68
 
57
         Integer classnum = N_Utils.obj2Int(classes.stream().map(MsClass::getClassid).distinct().count());
69
         Integer classnum = N_Utils.obj2Int(classes.stream().map(MsClass::getClassid).distinct().count());
58
         Integer totalnum = N_Utils.obj2Int(students.stream().map(MsClassStudent::getStudentid).distinct().count());
70
         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());
71
+        Integer stunum = N_Utils.obj2Int(paperStudents.stream().filter(s -> s.getSstate().equals(2)).map(MsrStudent::getStudentid).distinct().count());
60
         Integer missnum = totalnum - stunum;
72
         Integer missnum = totalnum - stunum;
61
         double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
73
         double fullscore = subjects.stream().mapToDouble(MsPaper::getPscore).sum();
62
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
74
         List<MsrStudent> schoolStudents = new ArrayList<>();//学校学生成绩
63
-        List<MsrStudent> schoolSubjectStudents = new ArrayList<>();//学校科目学生成绩
64
-        List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩
75
+        List<MsrStudent> classStudents = new ArrayList<>();//班级学生成绩(总分)
65
         List<MsrStudent> classSubjectStudents = new ArrayList<>();//班级科目学生成绩
76
         List<MsrStudent> classSubjectStudents = new ArrayList<>();//班级科目学生成绩
66
         Map<String, Integer> schoolStuRank = new HashMap<>();//学校学生分数排名
77
         Map<String, Integer> schoolStuRank = new HashMap<>();//学校学生分数排名
67
         Map<String, Integer> schoolSubStuRank = new HashMap<>();//学校科目学生分数排名
78
         Map<String, Integer> schoolSubStuRank = new HashMap<>();//学校科目学生分数排名
68
         Map<String, Integer> classStuRank = new HashMap<>();//班级学生分数排名
79
         Map<String, Integer> classStuRank = new HashMap<>();//班级学生分数排名
69
         Map<String, Integer> classSubStuRank = new HashMap<>();//班级科目学生分数排名
80
         Map<String, Integer> classSubStuRank = new HashMap<>();//班级科目学生分数排名
70
-        Integer stuzero = exam.getStuzero();
71
-        Map<Integer, List<MsPaperStudent>> schoolCollect = paperStudents.stream().collect(Collectors.groupingBy(MsPaperStudent::getStudentid));
72
-        for (Map.Entry<Integer, List<MsPaperStudent>> entry : schoolCollect.entrySet()) {
81
+        Map<Integer, List<MsrStudent>> schoolCollect = paperStudents.stream().collect(Collectors.groupingBy(MsrStudent::getStudentid));
82
+        for (Map.Entry<Integer, List<MsrStudent>> entry : schoolCollect.entrySet()) {
73
             Integer studentid = entry.getKey();
83
             Integer studentid = entry.getKey();
74
             MsrStudent cs = new MsrStudent();
84
             MsrStudent cs = new MsrStudent();
75
-            List<MsPaperStudent> list = entry.getValue();
85
+            List<MsrStudent> list = entry.getValue();
76
             cs.setClassid(0);
86
             cs.setClassid(0);
77
             cs.setStudentid(studentid);
87
             cs.setStudentid(studentid);
78
-            cs.setStuscore(list.stream().mapToDouble(MsPaperStudent::getStuscore).sum());
79
-            cs.setSstate(list.stream().max(Comparator.comparing(MsPaperStudent::getSstate)).get().getSstate());
88
+            cs.setStuscore(list.stream().mapToDouble(MsrStudent::getStuscore).sum());
89
+            cs.setSstate(list.stream().max(Comparator.comparing(MsrStudent::getSstate)).get().getSstate());
80
             cs.setScorerate(N_Utils.getDoubleDivideAndMulitiply(cs.getStuscore(), fullscore));
90
             cs.setScorerate(N_Utils.getDoubleDivideAndMulitiply(cs.getStuscore(), fullscore));
81
             schoolStudents.add(cs);
91
             schoolStudents.add(cs);
82
         }
92
         }
83
         List<MsrStudent> paperStudents2 = new ArrayList<>();
93
         List<MsrStudent> paperStudents2 = new ArrayList<>();
84
         Map<String, List<MsClassStudent>> sClassStudent = students.stream().collect(Collectors.groupingBy(s -> s.getSubjectid() + "_" + s.getStudentid()));
94
         Map<String, List<MsClassStudent>> sClassStudent = students.stream().collect(Collectors.groupingBy(s -> s.getSubjectid() + "_" + s.getStudentid()));
85
-        for (MsPaperStudent paperStudent : paperStudents) {
95
+        for (MsrStudent paperStudent : paperStudents) {
86
             String subjectid = paperStudent.getSubjectid();
96
             String subjectid = paperStudent.getSubjectid();
87
             Integer studentid = paperStudent.getStudentid();
97
             Integer studentid = paperStudent.getStudentid();
88
             Double stuscore = paperStudent.getStuscore();
98
             Double stuscore = paperStudent.getStuscore();
98
             }
108
             }
99
         }
109
         }
100
         String subjectid;
110
         String subjectid;
111
+        Map<String, Double> bjdfMap = new HashMap<>();//班级得分
101
         Map<Integer, List<MsrStudent>> cCollect = paperStudents2.stream().collect(Collectors.groupingBy(MsrStudent::getClassid));
112
         Map<Integer, List<MsrStudent>> cCollect = paperStudents2.stream().collect(Collectors.groupingBy(MsrStudent::getClassid));
102
         for (Map.Entry<Integer, List<MsrStudent>> entry : cCollect.entrySet()) {
113
         for (Map.Entry<Integer, List<MsrStudent>> entry : cCollect.entrySet()) {
103
             Integer classid = entry.getKey();
114
             Integer classid = entry.getKey();
115
                 cs.setStuscore(csEntry.getValue().stream().mapToDouble(MsrStudent::getStuscore).sum());
126
                 cs.setStuscore(csEntry.getValue().stream().mapToDouble(MsrStudent::getStuscore).sum());
116
                 rstudents.add(cs);
127
                 rstudents.add(cs);
117
             }
128
             }
129
+            bjdfMap.put(classid + "_" + subjectid, rstudents.stream().mapToDouble(MsrStudent::getStuscore).sum());
118
             setRank(rstudents, classStuRank, 3);//班级学生分数排名
130
             setRank(rstudents, classStuRank, 3);//班级学生分数排名
119
             classStudents.addAll(rstudents);
131
             classStudents.addAll(rstudents);
120
             Map<String, List<MsrStudent>> subCollect = studentList.stream().collect(Collectors.groupingBy(MsrStudent::getSubjectid));
132
             Map<String, List<MsrStudent>> subCollect = studentList.stream().collect(Collectors.groupingBy(MsrStudent::getSubjectid));
121
             for (Map.Entry<String, List<MsrStudent>> ssEntry : subCollect.entrySet()) {
133
             for (Map.Entry<String, List<MsrStudent>> ssEntry : subCollect.entrySet()) {
134
+                subjectid = ssEntry.getKey();
122
                 rstudents = ssEntry.getValue();
135
                 rstudents = ssEntry.getValue();
136
+                bjdfMap.put(classid + "_" + subjectid, rstudents.stream().mapToDouble(MsrStudent::getStuscore).sum());
123
                 setRank(rstudents, classSubStuRank, 4);//班级科目学生分数排名
137
                 setRank(rstudents, classSubStuRank, 4);//班级科目学生分数排名
124
                 classSubjectStudents.addAll(rstudents);
138
                 classSubjectStudents.addAll(rstudents);
125
             }
139
             }
126
         }
140
         }
141
+        setRank(schoolStudents, schoolStuRank, 1);//学校学生分数排名
127
 
142
 
128
-        List<MsrStudent> schoolStudents2;//参与统计学生列表
129
-        if (stuzero.equals(0)) {//0分学生不参与统计
130
-            schoolStudents2 = schoolStudents.stream().filter(s -> s.getStuscore() > 0).collect(Collectors.toList());
131
-        } else {
132
-            schoolStudents2 = schoolStudents;
133
-        }
134
-        DoubleSummaryStatistics schoolStatistics = schoolStudents2.stream().filter(s -> s.getStuscore() > 0).mapToDouble(MsrStudent::getStuscore).summaryStatistics();
143
+        List<MsrStudent> schoolStudents2 = schoolStudents.stream().filter(s -> s.getSstate().equals(2)).collect(Collectors.toList());//参与统计学生列表
144
+        DoubleSummaryStatistics schoolStatistics = schoolStudents2.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics();
135
         double schoolStatisticsMax = N_Utils.handleInfinity(schoolStatistics.getMax());
145
         double schoolStatisticsMax = N_Utils.handleInfinity(schoolStatistics.getMax());
136
         //最低分均不包括0分
146
         //最低分均不包括0分
137
-        double schoolStatisticsMin = N_Utils.handleInfinity(schoolStudents2.stream().filter(s -> s.getStuscore() > 0).mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
147
+        double schoolStatisticsMin = N_Utils.handleInfinity(schoolStatistics.getMin());
138
         double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
148
         double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
139
 
149
 
140
         //总体分析
150
         //总体分析
151
         msrExamMapper.insert(msrExam);
161
         msrExamMapper.insert(msrExam);
152
 
162
 
153
         //科目分析
163
         //科目分析
154
-        Map<String, List<MsPaperStudent>> subjectCollect = paperStudents.stream().collect(Collectors.groupingBy(MsPaperStudent::getSubjectid));
164
+        Map<String, MsrSubject> subjectMap = new HashMap<>();//科目分析map
165
+        Map<String, List<MsrStudent>> subjectCollect = paperStudents.stream().collect(Collectors.groupingBy(MsrStudent::getSubjectid));
155
         List<MsrSubject> msrSubjects = new ArrayList<>();
166
         List<MsrSubject> msrSubjects = new ArrayList<>();
156
         MsrSubject msrSubject = new MsrSubject();
167
         MsrSubject msrSubject = new MsrSubject();
157
         msrSubject.setExamid(examid);
168
         msrSubject.setExamid(examid);
158
-        msrSubject.setSubjectid("zf");
169
+        subjectid = "zf";
170
+        msrSubject.setSubjectid(subjectid);
159
         msrSubject.setSubjectname("总分");
171
         msrSubject.setSubjectname("总分");
160
         msrSubject.setFullscore(fullscore);
172
         msrSubject.setFullscore(fullscore);
161
         msrSubject.setMaxscore(schoolStatisticsMax);
173
         msrSubject.setMaxscore(schoolStatisticsMax);
162
         msrSubject.setMinscore(schoolStatisticsMin);
174
         msrSubject.setMinscore(schoolStatisticsMin);
163
         msrSubject.setAvgscore(schoolStatisticsAverage);
175
         msrSubject.setAvgscore(schoolStatisticsAverage);
164
-        msrSubject.setScorerate(N_Utils.getDoubleDivideAndMulitiply(schoolStatisticsAverage, fullscore));
165
-        List<Double> scores = schoolStudents2.stream().map(MsrStudent::getStuscore).sorted().collect(Collectors.toList());
166
-        double bzc = MarkingUtil.bzc(scores);
167
-        msrSubject.setBzc(bzc);
168
-        msrSubject.setCyxs(N_Utils.getDoubleDivideAndMulitiply(bzc, schoolStatisticsAverage));
169
-        msrSubject.setNd(MarkingUtil.div(schoolStatisticsAverage, fullscore));
170
-        msrSubject.setQfd(MarkingUtil.qfd(scores));
171
-        List<Double> scoreRates = schoolStudents2.stream().map(MsrStudent::getScorerate).sorted().collect(Collectors.toList());
172
-        double dfllc = MarkingUtil.sub(scoreRates.get(scoreRates.size() - 1), scoreRates.get(0));
173
-        msrSubject.setDflxdlc(MarkingUtil.div(dfllc, schoolStatisticsAverage));
174
-        msrSubject.setDfllc(dfllc);
175
         msrSubject.setTotalnum(totalnum);
176
         msrSubject.setTotalnum(totalnum);
176
         msrSubject.setStunum(stunum);
177
         msrSubject.setStunum(stunum);
177
         msrSubject.setMissnum(missnum);
178
         msrSubject.setMissnum(missnum);
179
+        setSubject(msrSubject, schoolStudents2);
178
         msrSubjects.add(msrSubject);
180
         msrSubjects.add(msrSubject);
181
+        subjectMap.put(subjectid, msrSubject);
179
         for (MsPaper subject : subjects) {
182
         for (MsPaper subject : subjects) {
183
+            subjectid = subject.getSubjectid();
180
             msrSubject = new MsrSubject();
184
             msrSubject = new MsrSubject();
181
             msrSubject.setExamid(examid);
185
             msrSubject.setExamid(examid);
182
-            msrSubject.setSubjectid(subject.getSubjectid());
186
+            msrSubject.setSubjectid(subjectid);
183
             msrSubject.setSubjectname(subject.getSubjectname());
187
             msrSubject.setSubjectname(subject.getSubjectname());
184
             msrSubject.setFullscore(subject.getPscore());
188
             msrSubject.setFullscore(subject.getPscore());
185
-            List<MsPaperStudent> studentList = subjectCollect.get(subject.getSubjectid());
189
+            List<MsrStudent> studentList = subjectCollect.get(subjectid);
190
+            setRank(studentList, schoolSubStuRank, 2);//学校科目学生分数排名
191
+            List<MsrStudent> studentList2 = studentList.stream().filter(s -> s.getSstate().equals(2)).collect(Collectors.toList());//参与统计学生列表
192
+            totalnum = studentList.size();
193
+            stunum = studentList2.size();
194
+            missnum = totalnum - stunum;
195
+            msrSubject.setTotalnum(totalnum);
196
+            msrSubject.setStunum(stunum);
197
+            msrSubject.setMissnum(missnum);
198
+            DoubleSummaryStatistics subjectStatistics = studentList2.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics();
199
+            double subjectStatisticsMax = N_Utils.handleInfinity(subjectStatistics.getMax());
200
+            //最低分均不包括0分
201
+            double subjectStatisticsMin = N_Utils.handleInfinity(subjectStatistics.getMin());
202
+            double subjectStatisticsAverage = N_Utils.formatDouble(subjectStatistics.getAverage(), 2);
203
+            msrSubject.setMaxscore(subjectStatisticsMax);
204
+            msrSubject.setMinscore(subjectStatisticsMin);
205
+            msrSubject.setAvgscore(subjectStatisticsAverage);
206
+            setSubject(msrSubject, studentList2);
186
             msrSubjects.add(msrSubject);
207
             msrSubjects.add(msrSubject);
208
+            subjectMap.put(subjectid, msrSubject);
209
+        }
210
+        List<Double> avgScores = msrSubjects.stream().map(MsrSubject::getAvgscore).sorted().collect(Collectors.toList());
211
+        Map<Double, Integer> fspm = MarkingUtil.fspm(avgScores);//平均分排名
212
+        for (MsrSubject subject : msrSubjects) {
213
+            subject.setAvgrank(fspm.get(subject.getAvgscore()));
214
+            subject.setAvgrankrate(MarkingUtil.div(subject.getAvgrank(), subject.getTotalnum()));
215
+        }
216
+        msrSubjectMapper.insertList(msrSubjects);
217
+
218
+        //学生成绩分析
219
+        for (MsrStudent student : classStudents) {
220
+            setStudent(student, classStuRank, schoolStuRank, classSubStuRank, schoolSubStuRank, bjdfMap, subjectMap);
221
+        }
222
+        for (MsrStudent student : classSubjectStudents) {
223
+            setStudent(student, classStuRank, schoolStuRank, classSubStuRank, schoolSubStuRank, bjdfMap, subjectMap);
187
         }
224
         }
225
+        if (N_Utils.isListNotEmpty(classStudents)) msrStudentMapper.insertList(classStudents);
226
+        if (N_Utils.isListNotEmpty(classSubjectStudents)) msrStudentMapper.insertList(classSubjectStudents);
188
 
227
 
189
         examMapper.updateExamState(examid, 3);
228
         examMapper.updateExamState(examid, 3);
190
     }
229
     }
191
 
230
 
231
+    //设置科目分析计算参数
232
+    private void setSubject(MsrSubject msrSubject, List<MsrStudent> schoolStudents2) {
233
+        Double avgscore = msrSubject.getAvgscore();
234
+        Double fullscore = msrSubject.getFullscore();
235
+        msrSubject.setScorerate(N_Utils.getDoubleDivideAndMulitiply(avgscore, fullscore));
236
+        List<Double> scores = schoolStudents2.stream().map(MsrStudent::getStuscore).sorted().collect(Collectors.toList());
237
+        double bzc = MarkingUtil.bzc(scores);
238
+        msrSubject.setBzc(bzc);
239
+        msrSubject.setCyxs(N_Utils.getDoubleDivideAndMulitiply(bzc, avgscore));
240
+        msrSubject.setNd(MarkingUtil.div(avgscore, fullscore));
241
+        msrSubject.setQfd(MarkingUtil.qfd(scores));
242
+        List<Double> scoreRates = schoolStudents2.stream().map(MsrStudent::getScorerate).sorted().collect(Collectors.toList());
243
+        double dfllc = MarkingUtil.sub(scoreRates.get(scoreRates.size() - 1), scoreRates.get(0));
244
+        msrSubject.setDfllc(dfllc);
245
+        msrSubject.setDflxdlc(MarkingUtil.div(dfllc, avgscore));
246
+        msrSubject.setEsscore(MarkingUtil.cynjdf(scores, 0.2));
247
+        msrSubject.setSsscore(MarkingUtil.cynjdf(scores, 0.4));
248
+        msrSubject.setLsscore(MarkingUtil.cynjdf(scores, 0.6));
249
+        msrSubject.setBsscore(MarkingUtil.cynjdf(scores, 0.8));
250
+    }
251
+
252
+    //设置学生分析计算参数
253
+    private void setStudent(MsrStudent student, Map<String, Integer> classStuRank, Map<String, Integer> schoolStuRank
254
+            , Map<String, Integer> classSubStuRank, Map<String, Integer> schoolSubStuRank
255
+            , Map<String, Double> bjdfMap, Map<String, MsrSubject> subjectMap) {
256
+        String subjectid;
257
+        Integer classid = student.getClassid();
258
+        Integer studentid = student.getStudentid();
259
+        subjectid = student.getSubjectid();
260
+        MsrSubject msrSubject = subjectMap.get(subjectid);
261
+        Double pjf = msrSubject.getAvgscore();//年级平均分
262
+        student.setBzf(MarkingUtil.bzf(bjdfMap.get(classid + "_" + subjectid), pjf, msrSubject.getBzc()));
263
+        Integer classrank;
264
+        Integer schoolrank;
265
+        if (subjectid.equals("zf")) {
266
+            classrank = classStuRank.get(classid + "_" + studentid);
267
+            schoolrank = schoolStuRank.get(studentid.toString());
268
+        } else {
269
+            classrank = classSubStuRank.get(classid + "_" + subjectid + "_" + studentid);
270
+            schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
271
+        }
272
+        student.setCjl(MarkingUtil.cjl(student.getStuscore(), pjf));
273
+        student.setClassrank(classrank);
274
+        student.setSchoolrank(schoolrank);
275
+        double rankrate = MarkingUtil.div(schoolrank, msrSubject.getTotalnum());
276
+        student.setRankrate(rankrate);//个人成绩排名率=自己所在学科成绩分数的名次/总人数
277
+        student.setXkqrz(MarkingUtil.sub(msrSubject.getAvgrank(), rankrate));//学科强弱值 = 平均成绩排名率- 个人成绩排名率
278
+    }
279
+
192
     //分数排名
280
     //分数排名
193
     private void setRank(List<MsrStudent> students, Map<String, Integer> rank, Integer code) {
281
     private void setRank(List<MsrStudent> students, Map<String, Integer> rank, Integer code) {
194
         List<Map.Entry<Double, List<MsrStudent>>> gslist2 = students.stream()
282
         List<Map.Entry<Double, List<MsrStudent>>> gslist2 = students.stream()

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

565
 
565
 
566
     }
566
     }
567
 
567
 
568
+    //处于年级20%得分(v=0.2)
569
+    public static Double cynjdf(List<Double> scores, double v) {
570
+        if (N_Utils.isListEmpty(scores)) return 0.0;
571
+        int totalCount = scores.size();
572
+        int topCount = (int) Math.ceil(totalCount * v); // 计算
573
+        return scores.get(totalCount - topCount);
574
+    }
575
+
576
+    //分数排名
577
+    public static Map<Double,Integer> fspm(List<Double> scores) {
578
+        // 创建一个地图来存储分数和出现次数
579
+        Map<Double, Integer> scoreCountMap = new HashMap<>();
580
+
581
+        // 遍历 scores 计算分数出现的次数
582
+        for (Double score : scores) {
583
+            scoreCountMap.put(score, scoreCountMap.getOrDefault(score, 0) + 1);
584
+        }
585
+        return scoreCountMap;
586
+    }
568
 
587
 
569
 }
588
 }

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

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,s.subjectname,p.mpid,p.pnum,p.mergepnum,p.pscore,p.correcttype,p.ptype
170
         select s.subjectid,s.subjectname,p.mpid,p.pnum,p.mergepnum,p.pscore,p.correcttype,p.ptype
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} and s.msid=2
173
         <if test="exammode!=3">
173
         <if test="exammode!=3">
174
             and s.msstate=2
174
             and s.msstate=2
175
         </if>
175
         </if>

+ 3
- 3
smarking/src/main/resources/mapper/stupaper/MsPaperStudentMapper.xml View File

255
         select * from ms_paper_student where examid=#{examid} and studentid=#{studentid}
255
         select * from ms_paper_student where examid=#{examid} and studentid=#{studentid}
256
     </select>
256
     </select>
257
     <!--考试学生成绩列表-->
257
     <!--考试学生成绩列表-->
258
-    <select id="listPaperStudentByExamId" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudent">
259
-        select mpid,subjectid,studentid,stuscore
258
+    <select id="listPaperStudentByExamId" resultType="com.xhkjedu.smarking.model.report.reportstu.MsrStudent">
259
+        select mpid,subjectid,studentid,stuscore,sstate,pscore as fullscore
260
         from ms_paper_student where examid=#{examid}
260
         from ms_paper_student where examid=#{examid}
261
-        <foreach collection="mpids" item="mpid" separator="and mpid in (">
261
+        <foreach collection="mpids" item="mpid" open="and mpid in (" separator="," close=")">
262
             #{mpid}
262
             #{mpid}
263
         </foreach>
263
         </foreach>
264
     </select>
264
     </select>

Loading…
Cancel
Save