Browse Source

校级报告

ywx
雍文秀 2 weeks ago
parent
commit
c8b2451c9b

+ 66
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/report/XjReportController.java View File

@@ -0,0 +1,66 @@
1
+package com.xhkjedu.smarking.controller.report;
2
+
3
+import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
4
+import com.xhkjedu.smarking.service.report.report.MsrStudentService;
5
+import com.xhkjedu.smarking.service.report.report.MsrSubjectService;
6
+import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.vo.ResultVo;
9
+import org.springframework.web.bind.annotation.*;
10
+
11
+import javax.annotation.Resource;
12
+
13
+/**
14
+ *@Description 校级报告
15
+ *@Author ywx
16
+ *Date 2025/1/10 14:31
17
+ **/
18
+@RestController
19
+@RequestMapping("/rxj")
20
+public class XjReportController {
21
+    @Resource
22
+    private MsrSubjectService msrSubjectService;
23
+    @Resource
24
+    private MsrStudentService msrStudentService;
25
+
26
+    /**
27
+     * @Description 总体情况汇总分析-总分基本情况成绩分析
28
+     * @Date 2025/1/10 14:54
29
+     * @Author YWX
30
+     * @Param [subject]
31
+     * @Return com.xhkjedu.vo.ResultVo
32
+     **/
33
+    @PostMapping("/hz_zf")
34
+    public ResultVo getExamForHzZf(@RequestBody MsrSubject subject) {
35
+        Integer examid = subject.getExamid();
36
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
37
+        return new ResultVo(0, "获取成功", msrSubjectService.getExamForHzZf(examid));
38
+    }
39
+
40
+    /**
41
+     * @Description 总体情况汇总分析-各学科基本数据对比情况
42
+     * @Date 2025/1/10 15:04
43
+     * @Author YWX
44
+     * @Param [params]
45
+     * @Return com.xhkjedu.vo.ResultVo
46
+     **/
47
+    @PostMapping("/hz_xk")
48
+    public ResultVo listSubjectForHzXk(@RequestBody StudentParams params) {
49
+        N_Utils.validation(new Object[]{params.getExamid(), "考试id", 1});
50
+        return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForHzXk(params));
51
+    }
52
+
53
+    /**
54
+     * @Description 总分分布
55
+     * @Date 2025/1/10 17:28
56
+     * @Author YWX
57
+     * @Param [params]
58
+     * @Return com.xhkjedu.vo.ResultVo
59
+     **/
60
+    @PostMapping("/zffb")
61
+    public ResultVo listScoreForZfFb(@RequestBody StudentParams params) {
62
+        N_Utils.validation(new Object[]{params.getExamid(), "考试id", 1});
63
+        return new ResultVo(0, "获取成功", msrStudentService.listScoreForZfFb(params));
64
+    }
65
+
66
+}

+ 7
- 1
smarking/src/main/java/com/xhkjedu/smarking/controller/report/ZhReportController.java View File

@@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.smarking.model.exam.MsSubject;
6 6
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
7
-import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
8 7
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudentAction;
9 8
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
10 9
 import com.xhkjedu.smarking.service.report.report.*;
@@ -56,6 +55,13 @@ public class ZhReportController {
56 55
         return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForZgl(subject));
57 56
     }
58 57
 
58
+    /**
59
+     * @Description 排行榜-指标
60
+     * @Date 2025/1/10 14:49
61
+     * @Author YWX
62
+     * @Param []
63
+     * @Return com.xhkjedu.vo.ResultVo
64
+     **/
59 65
     @PostMapping("/phb_zb")
60 66
     public ResultVo listPhbZb() {
61 67
         return new ResultVo(0, "获取成功", msrStudentService.listPhbZb());

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportother/MsrExamMapper.java View File

@@ -18,4 +18,7 @@ public interface MsrExamMapper extends TkMapper<MsrExam> {
18 18
 
19 19
     //获取单次考试的总分和最高分
20 20
     Map<String, Object> getFullAndMaxScoreByExamId(@Param("examid") Integer examid);
21
+
22
+    //总分基本情况成绩分析
23
+    Map getExamForHzZf(@Param("examid") Integer examid);
21 24
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportstu/MsrStudentMapper.java View File

@@ -27,4 +27,7 @@ public interface MsrStudentMapper extends TkMapper<MsrStudent> {
27 27
 
28 28
     //综合报告-排行榜
29 29
     List<Map> listStudentForPhb(@Param("sql") String sql, @Param("params") StudentParams params);
30
+
31
+    //学生成绩分析
32
+    List<MsrStudent> listStudentBySql(@Param("sql") String sql);
30 33
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportsubject/MsrSubjectMapper.java View File

@@ -19,4 +19,7 @@ public interface MsrSubjectMapper extends TkMapper<MsrSubject> {
19 19
 
20 20
     //科目分析
21 21
     List<Map> listSubjectForZgl(@Param("examid") Integer examid);
22
+
23
+    //科目分析列表
24
+    List<Map> listSubjectBySql(@Param("sql") String sql);
22 25
 }

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

@@ -37,6 +37,8 @@ public class MsrExam extends BaseBean {
37 37
     private Double maxscore;
38 38
     //最低分
39 39
     private Double minscore;
40
+    //平均分
41
+    private Double avgscore;
40 42
     //标准差
41 43
     private Double bzc;
42 44
     //保存时间

+ 40
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/report/report/MsrStudentService.java View File

@@ -2,8 +2,10 @@ package com.xhkjedu.smarking.service.report.report;
2 2
 
3 3
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
4 4
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentPointMapper;
5
+import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
5 6
 import com.xhkjedu.smarking.utils.MarkingUtil;
6 7
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
8
+import com.xhkjedu.smarking.vo.report.reportother.ScoreGroupVo;
7 9
 import com.xhkjedu.smarking.vo.report.reportstu.LabelVo;
8 10
 import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
9 11
 import com.xhkjedu.utils.N_Utils;
@@ -137,4 +139,42 @@ public class MsrStudentService {
137 139
         labels.add(new LabelVo("超均率", 2, "cjl"));
138 140
         return labels;
139 141
     }
142
+
143
+    /**
144
+     * @Description 校级报告-总分分布
145
+     * @Date 2025/1/10 17:29
146
+     * @Author YWX
147
+     * @Param [params]
148
+     * @Return java.lang.Object
149
+     **/
150
+    public Object listScoreForZfFb(StudentParams params) {
151
+        StringBuilder sql = new StringBuilder();
152
+        sql.append("s.fullscore,s.stuscore,s.studentid");
153
+        sql.append(" from msr_student s ");
154
+        sql.append(" where s.examid=").append(params.getExamid());
155
+        sql.append(" and s.subjectid='zf'");
156
+        sql.append(" group by s.studentid");
157
+        List<MsrStudent> list = msrStudentMapper.listStudentBySql(sql.toString());
158
+        if (N_Utils.isListEmpty(list)) {
159
+            return new ArrayList<>();
160
+        }
161
+        Double fullscore = list.get(0).getFullscore();
162
+        int totalNum = list.size();
163
+        List<ScoreGroupVo> groups = MarkingUtil.scoreGroup(fullscore, 12);
164
+        long num;
165
+        for (ScoreGroupVo group : groups) {
166
+            Double minvalue = group.getMinvalue();
167
+            Double maxvalue = group.getMaxvalue();
168
+            if (minvalue.equals(0.0)) {
169
+                num = list.stream().filter(s -> s.getStuscore().compareTo(maxvalue) < 0).count();
170
+            } else if (maxvalue.equals(fullscore)) {
171
+                num = list.stream().filter(s -> s.getStuscore().compareTo(minvalue) >= 0).count();
172
+            } else {
173
+                num = list.stream().filter(s -> s.getStuscore().compareTo(minvalue) >= 0 && s.getStuscore().compareTo(maxvalue) < 0).count();
174
+            }
175
+            group.setNum((int) num);
176
+            group.setNumrate(N_Utils.getIntegerDivideAndMulitiply(group.getNum(), totalNum));
177
+        }
178
+        return groups;
179
+    }
140 180
 }

+ 41
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/report/report/MsrSubjectService.java View File

@@ -1,14 +1,16 @@
1 1
 package com.xhkjedu.smarking.service.report.report;
2 2
 
3 3
 import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectGradeMapper;
4
+import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
4 5
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
5 6
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
6 7
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
8
+import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
9
+import com.xhkjedu.utils.N_Utils;
7 10
 import org.springframework.stereotype.Service;
8 11
 
9 12
 import javax.annotation.Resource;
10
-import java.util.LinkedHashMap;
11
-import java.util.Map;
13
+import java.util.*;
12 14
 
13 15
 /**
14 16
  *@Description 科目报告查询服务
@@ -23,6 +25,8 @@ public class MsrSubjectService {
23 25
     private MsrStudentMapper msrStudentMapper;
24 26
     @Resource
25 27
     private MsrClassSubjectGradeMapper msrClassSubjectGradeMapper;
28
+    @Resource
29
+    private MsrExamMapper msrExamMapper;
26 30
 
27 31
     /**
28 32
      * @Description 总概览
@@ -42,4 +46,39 @@ public class MsrSubjectService {
42 46
         map.put("scorerates", msrClassSubjectGradeMapper.getZfScoreRate(examid));
43 47
         return map;
44 48
     }
49
+
50
+    /**
51
+     * @Description 总分基本情况成绩分析
52
+     * @Date 2025/1/10 15:00
53
+     * @Author YWX
54
+     * @Param [examid]
55
+     * @Return java.util.Map
56
+     **/
57
+    public Map getExamForHzZf(Integer examid) {
58
+        return msrExamMapper.getExamForHzZf(examid);
59
+    }
60
+
61
+    /**
62
+     * @Description 总体情况汇总分析-各学科基本数据对比情况
63
+     * @Date 2025/1/10 15:05
64
+     * @Author YWX
65
+     * @Param [params]
66
+     * @Return java.lang.Object
67
+     **/
68
+    public Object listSubjectForHzXk(StudentParams params) {
69
+        StringBuilder sql = new StringBuilder();
70
+        sql.append("s.subjectid,s.subjectname,s.stunum,s.fullscore,s.maxscore,s.minscore,s.avgscore,s.bzc,s.cyxs,s.nd,s.axdxs");
71
+        sql.append(" from msr_subject s ");
72
+        sql.append(" where s.examid = " + params.getExamid());
73
+        String fieldname = params.getFieldname();
74
+        if (N_Utils.isNotEmpty(fieldname)) {
75
+            Integer od = params.getOd();
76
+            String order = "desc";
77
+            if (N_Utils.isTrueInteger(od) && od.equals(1)) {
78
+                order = "asc";
79
+            }
80
+            sql.append(" order by ").append(fieldname).append(" ").append(order);
81
+        }
82
+        return msrSubjectMapper.listSubjectBySql(sql.toString());
83
+    }
45 84
 }

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

@@ -141,6 +141,7 @@ public class MsrExamService {
141 141
         msrExam.setFullscore(msrSubject.getFullscore());
142 142
         msrExam.setMaxscore(msrSubject.getMaxscore());
143 143
         msrExam.setMinscore(msrSubject.getMinscore());
144
+        msrExam.setAvgscore(msrSubject.getAvgscore());
144 145
         msrExam.setBzc(msrSubject.getBzc());
145 146
         msrExam.setCreatetime(N_Utils.getSecondTimestamp());
146 147
         msrExamMapper.insert(msrExam);

+ 27
- 2
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

@@ -7,8 +7,7 @@ import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
7 7
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
8 8
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
9 9
 import com.xhkjedu.smarking.vo.paper.PaperFileVo;
10
-import com.xhkjedu.smarking.vo.report.reportother.RankGroupVo;
11
-import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
10
+import com.xhkjedu.smarking.vo.report.reportother.*;
12 11
 import com.xhkjedu.smarking.vo.report.reportsubject.SectionScoreVo;
13 12
 import com.xhkjedu.utils.N_Utils;
14 13
 import com.xhkjedu.vo.PageResult;
@@ -578,6 +577,32 @@ public class MarkingUtil {
578 577
         return rtnList;
579 578
     }
580 579
 
580
+    //分数分组
581
+    public static List<ScoreGroupVo> scoreGroup(Double fullScore, Integer groupNum) {
582
+        List<ScoreGroupVo> groups = new ArrayList<>();
583
+        double groupScore = Math.ceil(fullScore / groupNum);
584
+        double min = 0;
585
+        double max;
586
+        String start = "[";
587
+        String end = ")";
588
+        for (int i = 1; i <= groupNum; i++) {
589
+            ScoreGroupVo vo = new ScoreGroupVo();
590
+            max = min + groupScore;
591
+            if (i == groupNum) {
592
+                if (max > fullScore) {
593
+                    max = fullScore;
594
+                }
595
+                end = "]";
596
+            }
597
+            vo.setGroupname(start + N_Utils.formatDouble(min) + "," + N_Utils.formatDouble(max) + end);
598
+            vo.setMinvalue(min);
599
+            vo.setMaxvalue(max);
600
+            groups.add(vo);
601
+            min = max;
602
+        }
603
+        return groups;
604
+    }
605
+
581 606
     //处于年级20%得分(v=0.2)
582 607
     public static Double cynjdf(List<Double> scores, double v) {
583 608
         if (N_Utils.isListEmpty(scores)) return 0.0;

+ 17
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportother/ScoreGroupVo.java View File

@@ -0,0 +1,17 @@
1
+package com.xhkjedu.smarking.vo.report.reportother;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description 分数分组
7
+ * @Author YWX
8
+ * @Date 2025/1/10 16:48
9
+ **/
10
+@Data
11
+public class ScoreGroupVo {
12
+    private String groupname; //组名
13
+    private Double maxvalue;//最大值
14
+    private Double minvalue;//最小值
15
+    private Integer num;//人数
16
+    private Double numrate;//人数占比
17
+}

+ 5
- 0
smarking/src/main/resources/mapper/report/reportother/MsrExamMapper.xml View File

@@ -30,4 +30,9 @@
30 30
     <select id="getFullAndMaxScoreByExamId" resultType="java.util.Map">
31 31
         select fullscore,maxscore from msr_exam where examid = #{examid} limit 1
32 32
     </select>
33
+    <!--总分基本情况成绩分析-->
34
+    <select id="getExamForHzZf" resultType="java.util.Map">
35
+        select stunum,classnum,fullscore,maxscore,minscore,avgscore,bzc
36
+        from msr_exam where examid = #{examid} limit 1
37
+    </select>
33 38
 </mapper>

+ 4
- 0
smarking/src/main/resources/mapper/report/reportstu/MsrStudentMapper.xml View File

@@ -83,4 +83,8 @@
83 83
             #{classid}
84 84
         </foreach>
85 85
     </select>
86
+    <!--学生成绩分析-->
87
+    <select id="listStudentBySql" resultType="com.xhkjedu.smarking.model.report.reportstu.MsrStudent">
88
+        select ${sql}
89
+    </select>
86 90
 </mapper>

+ 4
- 0
smarking/src/main/resources/mapper/report/reportsubject/MsrSubjectMapper.xml View File

@@ -16,5 +16,9 @@
16 16
         from msr_subject
17 17
         where examid=#{examid}
18 18
     </select>
19
+    <!--科目分析列表-->
20
+    <select id="listSubjectBySql" resultType="java.util.Map">
21
+        select ${sql}
22
+    </select>
19 23
 
20 24
 </mapper>

Loading…
Cancel
Save