Browse Source

班级学科前60分析

ywx
雍文秀 1 month ago
parent
commit
c790a2db05

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

23
     private Integer classid;
23
     private Integer classid;
24
     //科目ID(含总分)
24
     //科目ID(含总分)
25
     private String subjectid;
25
     private String subjectid;
26
+    //参考人数
27
+    private Integer stunum;
26
     //班级前60%人数
28
     //班级前60%人数
27
     private Integer btnum;
29
     private Integer btnum;
28
     //班前60%所占班级人数比例
30
     //班前60%所占班级人数比例

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

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.xhkjedu.smarking.mapper.exam.*;
4
 import com.xhkjedu.smarking.mapper.exam.*;
5
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectMapper;
6
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassTopMapper;
5
 import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
7
 import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
6
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
8
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
7
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
9
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
10
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
12
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
11
 import com.xhkjedu.smarking.model.exam.*;
13
 import com.xhkjedu.smarking.model.exam.*;
12
 import com.xhkjedu.smarking.model.paper.MsPaper;
14
 import com.xhkjedu.smarking.model.paper.MsPaper;
15
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubject;
16
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassTop;
13
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
17
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
14
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
18
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
15
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
19
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
16
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
20
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
17
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubjectClass;
21
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubjectClass;
18
 import com.xhkjedu.smarking.utils.MarkingUtil;
22
 import com.xhkjedu.smarking.utils.MarkingUtil;
23
+import com.xhkjedu.smarking.vo.report.reportclass.ClassTopVo;
19
 import com.xhkjedu.smarking.vo.report.reportother.StuRankVo;
24
 import com.xhkjedu.smarking.vo.report.reportother.StuRankVo;
20
 import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
25
 import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
21
 import com.xhkjedu.utils.N_Utils;
26
 import com.xhkjedu.utils.N_Utils;
52
     private MsrReportparamMapper msrReportparamMapper;
57
     private MsrReportparamMapper msrReportparamMapper;
53
     @Resource
58
     @Resource
54
     private MsrSubjectClassMapper msrSubjectClassMapper;
59
     private MsrSubjectClassMapper msrSubjectClassMapper;
60
+    @Resource
61
+    private MsrClassSubjectMapper msrClassSubjectMapper;
62
+    @Resource
63
+    private MsrClassTopMapper msrClassTopMapper;
64
+
55
 
65
 
56
     /**
66
     /**
57
      * @Description 生成报告
67
      * @Description 生成报告
248
         msrStudents.addAll(classSubjectStudents);
258
         msrStudents.addAll(classSubjectStudents);
249
         if (N_Utils.isListNotEmpty(msrStudents)) msrStudentMapper.insertList(msrStudents);
259
         if (N_Utils.isListNotEmpty(msrStudents)) msrStudentMapper.insertList(msrStudents);
250
 
260
 
251
-        //科目班级分数分布区间分析
261
+        //科目班级分数分布区间分析、班级学科分析
252
         //区间参数
262
         //区间参数
253
-        List<MsrReportparam> qjParams = msrReportparamMapper.listReportparamByRpbelong(examid, "scoresection", "");
263
+        List<MsrReportparam> qjParams = msrReportparamMapper.listReportparamByRpbelong(examid, "scoresection", "xk");
254
         Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
264
         Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
255
         for (MsrReportparam param : qjParams) {
265
         for (MsrReportparam param : qjParams) {
256
             qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
266
             qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
257
         }
267
         }
258
-        List<MsrSubjectClass> msrSubjectClasses = new ArrayList<>();
268
+        List<MsrSubjectClass> msrSubjectClasses = new ArrayList<>();//科目班级分数分布区间分析
269
+        List<MsrClassSubject> msrClassSubjects = new ArrayList<>();//班级学科分析
270
+        List<MsrClassTop> msrClassTops = new ArrayList<>();//班级学科前60分析
271
+        Map<String, ClassTopVo> lsMap = new HashMap<>();//处于年级60%得分map
272
+        for (MsrSubject subject : msrSubjects) {
273
+            Double lsscore = subject.getLsscore();
274
+            String subjectid1 = subject.getSubjectid();
275
+            List<MsrStudent> lsstudents = msrStudents.stream().filter(s -> s.getSubjectid().equals(subjectid1) && s.getStuscore().compareTo(lsscore) >= 0).collect(Collectors.toList());
276
+            ClassTopVo classTopVo = new ClassTopVo();
277
+            classTopVo.setSubjectid(subjectid1);
278
+            classTopVo.setLsscore(lsscore);
279
+            classTopVo.setXtnum(lsstudents.size());
280
+            double average = lsstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
281
+            classTopVo.setXtavgscore(N_Utils.formatDouble(average, 2));
282
+        }
259
         Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
283
         Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
260
         for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
284
         for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
261
             String key = entry.getKey();
285
             String key = entry.getKey();
263
             subjectid = key.split("_")[1];
287
             subjectid = key.split("_")[1];
264
             List<SzJsonVo> list = qjMap.get(subjectid);
288
             List<SzJsonVo> list = qjMap.get(subjectid);
265
             List<MsrStudent> studentList = entry.getValue();
289
             List<MsrStudent> studentList = entry.getValue();
266
-            for (SzJsonVo vo : list) {
267
-                Object djvalue = vo.getDjvalue();
290
+            totalnum = studentList.size();//区间总人数
291
+            Double fullscore1 = studentList.get(0).getFullscore();
292
+            List<int[]> fdScore = MarkingUtil.fdScore(fullscore1, N_Utils.obj2Int(list.get(0).getDjvalue()));
293
+            for (int[] scores : fdScore) {
294
+                int minscore = scores[0];
295
+                int maxscore = scores[1];
296
+                String qjname = "[" + minscore + "," + maxscore;
297
+                double min = MarkingUtil.objToDouble(minscore);
298
+                double max = MarkingUtil.objToDouble(maxscore);
299
+                List<MsrStudent> qjstudents;
300
+                if (fullscore1.compareTo(max) == 0) {
301
+                    qjname += "]";
302
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0).collect(Collectors.toList());
303
+                } else {
304
+                    qjname += ")";
305
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0 && s.getStuscore().compareTo(max) < 0).collect(Collectors.toList());
306
+                }
307
+                int qjnum = qjstudents.size();
268
                 MsrSubjectClass msrSubjectClass = new MsrSubjectClass();
308
                 MsrSubjectClass msrSubjectClass = new MsrSubjectClass();
269
                 msrSubjectClass.setExamid(examid);
309
                 msrSubjectClass.setExamid(examid);
270
-                msrSubjectClass.setClassid(classid);
271
                 msrSubjectClass.setSubjectid(subjectid);
310
                 msrSubjectClass.setSubjectid(subjectid);
272
-                msrSubjectClass.setQjname(vo.getDjkey());
311
+                msrSubjectClass.setClassid(classid);
312
+                msrSubjectClass.setQjname(qjname);
313
+                msrSubjectClass.setQjnum(qjnum);
314
+                msrSubjectClass.setQjrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
315
+                double qjavg = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
316
+                msrSubjectClass.setQjavgrate(N_Utils.getDoubleDivideAndMulitiply(qjavg, fullscore1));
273
                 msrSubjectClasses.add(msrSubjectClass);
317
                 msrSubjectClasses.add(msrSubjectClass);
274
             }
318
             }
319
+
320
+            MsrClassSubject msrClassSubject = new MsrClassSubject();
321
+            msrClassSubject.setExamid(examid);
322
+            msrClassSubject.setSubjectid(subjectid);
323
+            msrClassSubject.setClassid(classid);
324
+            msrClassSubject.setFullscore(fullscore1);
325
+            msrClassSubjects.add(msrClassSubject);
326
+
327
+            MsrClassTop msrClassTop = new MsrClassTop();
328
+            msrClassTop.setExamid(examid);
329
+            msrClassTop.setClassid(classid);
330
+            msrClassTop.setSubjectid(subjectid);
331
+            msrClassTop.setStunum(totalnum);
332
+            ClassTopVo classTopVo = lsMap.get(subjectid);//处于年级60%得分
333
+            Double lsscore = classTopVo.getLsscore();
334
+            List<MsrStudent> lsstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(lsscore) >= 0).collect(Collectors.toList());
335
+            msrClassTop.setBtnum(lsstudents.size());
336
+            msrClassTop.setBtrate(N_Utils.getIntegerDivideAndMulitiply(msrClassTop.getBtnum(), totalnum));
337
+            double average = lsstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
338
+            msrClassTop.setBtavgscore(N_Utils.formatDouble(average, 2));
339
+            msrClassTop.setXtnum(classTopVo.getXtnum());
340
+            msrClassTop.setXtavgscore(classTopVo.getXtavgscore());
341
+            msrClassTops.add(msrClassTop);
275
         }
342
         }
276
         msrSubjectClassMapper.insertList(msrSubjectClasses);
343
         msrSubjectClassMapper.insertList(msrSubjectClasses);
344
+        msrClassSubjectMapper.insertList(msrClassSubjects);
345
+        msrClassTopMapper.insertList(msrClassTops);
277
 
346
 
278
         examMapper.updateExamState(examid, 3);
347
         examMapper.updateExamState(examid, 3);
279
     }
348
     }

+ 20
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportclass/ClassTopVo.java View File

1
+package com.xhkjedu.smarking.vo.report.reportclass;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description
7
+ * @Author ywx
8
+ * Date 2024/12/13 10:35
9
+ **/
10
+@Data
11
+public class ClassTopVo {
12
+    //科目ID(含总分)
13
+    private String subjectid;
14
+    //处于年级60%得分
15
+    private Double lsscore;
16
+    //校级前60%人数
17
+    private Integer xtnum;
18
+    //校前60%人数平均分
19
+    private Double xtavgscore;
20
+}

Loading…
Cancel
Save