Browse Source

校级报告

ywx
雍文秀 3 weeks ago
parent
commit
c8b2451c9b

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

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
 import com.github.pagehelper.PageInfo;
4
 import com.github.pagehelper.PageInfo;
5
 import com.xhkjedu.smarking.model.exam.MsSubject;
5
 import com.xhkjedu.smarking.model.exam.MsSubject;
6
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
6
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
7
-import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
8
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudentAction;
7
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudentAction;
9
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
8
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
10
 import com.xhkjedu.smarking.service.report.report.*;
9
 import com.xhkjedu.smarking.service.report.report.*;
56
         return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForZgl(subject));
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
     @PostMapping("/phb_zb")
65
     @PostMapping("/phb_zb")
60
     public ResultVo listPhbZb() {
66
     public ResultVo listPhbZb() {
61
         return new ResultVo(0, "获取成功", msrStudentService.listPhbZb());
67
         return new ResultVo(0, "获取成功", msrStudentService.listPhbZb());

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

18
 
18
 
19
     //获取单次考试的总分和最高分
19
     //获取单次考试的总分和最高分
20
     Map<String, Object> getFullAndMaxScoreByExamId(@Param("examid") Integer examid);
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
 
27
 
28
     //综合报告-排行榜
28
     //综合报告-排行榜
29
     List<Map> listStudentForPhb(@Param("sql") String sql, @Param("params") StudentParams params);
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
 
19
 
20
     //科目分析
20
     //科目分析
21
     List<Map> listSubjectForZgl(@Param("examid") Integer examid);
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
     private Double maxscore;
37
     private Double maxscore;
38
     //最低分
38
     //最低分
39
     private Double minscore;
39
     private Double minscore;
40
+    //平均分
41
+    private Double avgscore;
40
     //标准差
42
     //标准差
41
     private Double bzc;
43
     private Double bzc;
42
     //保存时间
44
     //保存时间

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

2
 
2
 
3
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
3
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
4
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentPointMapper;
4
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentPointMapper;
5
+import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
5
 import com.xhkjedu.smarking.utils.MarkingUtil;
6
 import com.xhkjedu.smarking.utils.MarkingUtil;
6
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
7
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
8
+import com.xhkjedu.smarking.vo.report.reportother.ScoreGroupVo;
7
 import com.xhkjedu.smarking.vo.report.reportstu.LabelVo;
9
 import com.xhkjedu.smarking.vo.report.reportstu.LabelVo;
8
 import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
10
 import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
9
 import com.xhkjedu.utils.N_Utils;
11
 import com.xhkjedu.utils.N_Utils;
137
         labels.add(new LabelVo("超均率", 2, "cjl"));
139
         labels.add(new LabelVo("超均率", 2, "cjl"));
138
         return labels;
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
 package com.xhkjedu.smarking.service.report.report;
1
 package com.xhkjedu.smarking.service.report.report;
2
 
2
 
3
 import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectGradeMapper;
3
 import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectGradeMapper;
4
+import com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper;
4
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
5
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
5
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
6
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
6
 import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
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
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
8
 
11
 
9
 import javax.annotation.Resource;
12
 import javax.annotation.Resource;
10
-import java.util.LinkedHashMap;
11
-import java.util.Map;
13
+import java.util.*;
12
 
14
 
13
 /**
15
 /**
14
  *@Description 科目报告查询服务
16
  *@Description 科目报告查询服务
23
     private MsrStudentMapper msrStudentMapper;
25
     private MsrStudentMapper msrStudentMapper;
24
     @Resource
26
     @Resource
25
     private MsrClassSubjectGradeMapper msrClassSubjectGradeMapper;
27
     private MsrClassSubjectGradeMapper msrClassSubjectGradeMapper;
28
+    @Resource
29
+    private MsrExamMapper msrExamMapper;
26
 
30
 
27
     /**
31
     /**
28
      * @Description 总概览
32
      * @Description 总概览
42
         map.put("scorerates", msrClassSubjectGradeMapper.getZfScoreRate(examid));
46
         map.put("scorerates", msrClassSubjectGradeMapper.getZfScoreRate(examid));
43
         return map;
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
         msrExam.setFullscore(msrSubject.getFullscore());
141
         msrExam.setFullscore(msrSubject.getFullscore());
142
         msrExam.setMaxscore(msrSubject.getMaxscore());
142
         msrExam.setMaxscore(msrSubject.getMaxscore());
143
         msrExam.setMinscore(msrSubject.getMinscore());
143
         msrExam.setMinscore(msrSubject.getMinscore());
144
+        msrExam.setAvgscore(msrSubject.getAvgscore());
144
         msrExam.setBzc(msrSubject.getBzc());
145
         msrExam.setBzc(msrSubject.getBzc());
145
         msrExam.setCreatetime(N_Utils.getSecondTimestamp());
146
         msrExam.setCreatetime(N_Utils.getSecondTimestamp());
146
         msrExamMapper.insert(msrExam);
147
         msrExamMapper.insert(msrExam);

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

7
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
7
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
8
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
8
 import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
9
 import com.xhkjedu.smarking.vo.paper.PaperFileVo;
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
 import com.xhkjedu.smarking.vo.report.reportsubject.SectionScoreVo;
11
 import com.xhkjedu.smarking.vo.report.reportsubject.SectionScoreVo;
13
 import com.xhkjedu.utils.N_Utils;
12
 import com.xhkjedu.utils.N_Utils;
14
 import com.xhkjedu.vo.PageResult;
13
 import com.xhkjedu.vo.PageResult;
578
         return rtnList;
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
     //处于年级20%得分(v=0.2)
606
     //处于年级20%得分(v=0.2)
582
     public static Double cynjdf(List<Double> scores, double v) {
607
     public static Double cynjdf(List<Double> scores, double v) {
583
         if (N_Utils.isListEmpty(scores)) return 0.0;
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

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
     <select id="getFullAndMaxScoreByExamId" resultType="java.util.Map">
30
     <select id="getFullAndMaxScoreByExamId" resultType="java.util.Map">
31
         select fullscore,maxscore from msr_exam where examid = #{examid} limit 1
31
         select fullscore,maxscore from msr_exam where examid = #{examid} limit 1
32
     </select>
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
 </mapper>
38
 </mapper>

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

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

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

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

Loading…
Cancel
Save