Browse Source

小题分析

ywx
王宁 1 month ago
parent
commit
2b0571c7b0
17 changed files with 396 additions and 117 deletions
  1. 2
    0
      smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperQtypeQuestionMapper.java
  2. 1
    2
      smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportother/MsrReportparamMapper.java
  3. 7
    0
      smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaperQtypeQuestion.java
  4. 6
    6
      smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQtype.java
  5. 6
    2
      smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQuestion.java
  6. 10
    4
      smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQuestionObj.java
  7. 4
    4
      smarking/src/main/java/com/xhkjedu/smarking/model/report/reportsubject/MsrSubjectPoint.java
  8. 0
    4
      smarking/src/main/java/com/xhkjedu/smarking/model/stupaper/MsPaperStudentQuestion.java
  9. 177
    1
      smarking/src/main/java/com/xhkjedu/smarking/service/report/generate/ReportGenerateQuestionService.java
  10. 3
    5
      smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrReportparamService.java
  11. 117
    80
      smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java
  12. 18
    0
      smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportother/RankGroupVo.java
  13. 30
    0
      smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportother/SzJsonVo.java
  14. 1
    1
      smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml
  15. 8
    0
      smarking/src/main/resources/mapper/paper/MsPaperQtypeQuestionMapper.xml
  16. 5
    5
      smarking/src/main/resources/mapper/report/reportother/MsrReportparamMapper.xml
  17. 1
    3
      smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperQtypeQuestionMapper.java View File

54
     int updateBatchQuestionCoor(@Param("list") List<MsPaperQtypeQuestion> list);
54
     int updateBatchQuestionCoor(@Param("list") List<MsPaperQtypeQuestion> list);
55
     //清空试题切割坐标
55
     //清空试题切割坐标
56
     int updateQuestionCoorByMpid(@Param("mpid")Integer mpid);
56
     int updateQuestionCoorByMpid(@Param("mpid")Integer mpid);
57
+    //试卷中所有试题-考试报告
58
+    List<MsPaperQtypeQuestion> listQuestionsForReport(@Param("mpid")Integer mpid);
57
 
59
 
58
 }
60
 }

+ 1
- 2
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportother/MsrReportparamMapper.java View File

2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
4
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
5
-import com.xhkjedu.smarking.vo.report.reportother.ReportParams;
6
 import org.apache.ibatis.annotations.Param;
5
 import org.apache.ibatis.annotations.Param;
7
 
6
 
8
 import java.util.List;
7
 import java.util.List;
15
 public interface MsrReportparamMapper extends TkMapper<MsrReportparam> {
14
 public interface MsrReportparamMapper extends TkMapper<MsrReportparam> {
16
 
15
 
17
     //获取考试指定图例对应参数
16
     //获取考试指定图例对应参数
18
-    List<MsrReportparam> listReportparamByRpbelong(@Param("rp") ReportParams reportParams);
17
+    List<MsrReportparam> listReportparamByRpbelong(@Param("examid") Integer examid, @Param("rpbelong") String rpbelong, @Param("reportcode") String reportcode);
19
 
18
 
20
     //批量删除
19
     //批量删除
21
     int deleteBatchReportparam(@Param("list") List<Integer> list);
20
     int deleteBatchReportparam(@Param("list") List<Integer> list);

+ 7
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaperQtypeQuestion.java View File

60
     //试题知识点
60
     //试题知识点
61
     @Transient
61
     @Transient
62
     private List<MsPaperQtypeQuestionPoint> points;
62
     private List<MsPaperQtypeQuestionPoint> points;
63
+
64
+    @Transient
65
+    private String mptqn;//大题题号
66
+    @Transient
67
+    private Integer mptnum;//题型下试题数量
68
+    @Transient
69
+    private Double mptscore;//题型下试题分值
63
 }
70
 }

+ 6
- 6
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQtype.java View File

40
     //满分
40
     //满分
41
     private Double fullscore;
41
     private Double fullscore;
42
     //满分人数
42
     //满分人数
43
-    private Integer fullnum;
43
+    private Integer mfnum;
44
     //满分人ids
44
     //满分人ids
45
-    private String fullids;
45
+    private String mfids;
46
     //满人人数占比
46
     //满人人数占比
47
-    private Double fullrate;
47
+    private Double mfrate;
48
     //零分人数
48
     //零分人数
49
-    private Integer zeronum;
49
+    private Integer lfnum;
50
     //零分人ids
50
     //零分人ids
51
-    private String zeroids;
51
+    private String lfids;
52
     //零分人数占比
52
     //零分人数占比
53
-    private Double zerorate;
53
+    private Double lfrate;
54
 }
54
 }

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

19
     private Integer cqid;
19
     private Integer cqid;
20
     //考试ID
20
     //考试ID
21
     private Integer examid;
21
     private Integer examid;
22
-    //科目ID(含总分)
22
+    //科目ID
23
     private String subjectid;
23
     private String subjectid;
24
     //班级ID(含全体)
24
     //班级ID(含全体)
25
     private Integer classid;
25
     private Integer classid;
60
     //标准差
60
     //标准差
61
     private Double bzc;
61
     private Double bzc;
62
     //差异系数
62
     //差异系数
63
-    private Double cxxs;
63
+    private Double cyxs;
64
     //区分度
64
     //区分度
65
     private Double qfd;
65
     private Double qfd;
66
     //区分度描述
66
     //区分度描述
73
     private Double zqrate;
73
     private Double zqrate;
74
     //零分人数
74
     //零分人数
75
     private Integer lfnum;
75
     private Integer lfnum;
76
+    //零分人数ID
77
+    private String lfids;
76
     //零分率
78
     //零分率
77
     private Double lfrate;
79
     private Double lfrate;
78
     //满分人数
80
     //满分人数
79
     private Integer mfnum;
81
     private Integer mfnum;
82
+    //满分人数ID
83
+    private String mfids;
80
     //满分人数占比
84
     //满分人数占比
81
     private Double mfrate;
85
     private Double mfrate;
82
 }
86
 }

+ 10
- 4
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQuestionObj.java View File

17
     @Id
17
     @Id
18
     //阅卷报告-班级试题小题分析-客观题答案分析ID
18
     //阅卷报告-班级试题小题分析-客观题答案分析ID
19
     private Integer cqoid;
19
     private Integer cqoid;
20
-    //班级试题小题分析表ID
21
-    private Integer cqid;
20
+    //考试ID
21
+    private Integer examid;
22
+    //科目ID
23
+    private String subjectid;
24
+    //班级ID(含全体)
25
+    private Integer classid;
26
+    //试卷试题id
27
+    private Integer mptqid;
22
     //选项答案
28
     //选项答案
23
     private String xxda;
29
     private String xxda;
24
     //人数
30
     //人数
25
-    private Integer onum;
31
+    private Integer xxnum;
26
     //比例
32
     //比例
27
-    private Double orate;
33
+    private Double xxrate;
28
     //生学id字符串
34
     //生学id字符串
29
     private String stuids;
35
     private String stuids;
30
 }
36
 }

+ 4
- 4
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportsubject/MsrSubjectPoint.java View File

30
     //满分
30
     //满分
31
     private Double fullscore;
31
     private Double fullscore;
32
     //满分人数
32
     //满分人数
33
-    private Integer fullnum;
33
+    private Integer mfnum;
34
     //满分人数ids
34
     //满分人数ids
35
-    private String fullids;
35
+    private String mfids;
36
     //零分人数
36
     //零分人数
37
-    private Integer zeronum;
37
+    private Integer lfnum;
38
     //零分人数id
38
     //零分人数id
39
-    private String zeroids;
39
+    private String lfids;
40
     //最高分
40
     //最高分
41
     private Double maxscore;
41
     private Double maxscore;
42
     //最低分
42
     //最低分

+ 0
- 4
smarking/src/main/java/com/xhkjedu/smarking/model/stupaper/MsPaperStudentQuestion.java View File

113
     private Integer hasanswer;//试卷是否设置了正确
113
     private Integer hasanswer;//试卷是否设置了正确
114
     @Transient
114
     @Transient
115
     private String qanswer;//试题正确答案
115
     private String qanswer;//试题正确答案
116
-    @Transient
117
-    private Integer qtype;//类型1客观题2主观题
118
-    @Transient
119
-    private String mptqn;//题型题号
120
 }
116
 }

+ 177
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/report/generate/ReportGenerateQuestionService.java View File

1
 package com.xhkjedu.smarking.service.report.generate;
1
 package com.xhkjedu.smarking.service.report.generate;
2
 
2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.smarking.mapper.exam.MsClassStudentMapper;
5
+import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
6
+import com.xhkjedu.smarking.mapper.paper.MsPaperQtypeQuestionMapper;
7
+import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
3
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
8
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
9
+import com.xhkjedu.smarking.model.exam.MsClassStudent;
10
+import com.xhkjedu.smarking.model.paper.MsPaper;
11
+import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
12
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion;
13
+import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
4
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
14
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
15
+import com.xhkjedu.smarking.utils.MarkingUtil;
16
+import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
5
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
6
 
18
 
7
 import javax.annotation.Resource;
19
 import javax.annotation.Resource;
20
+import java.util.ArrayList;
8
 import java.util.List;
21
 import java.util.List;
22
+import java.util.stream.Collectors;
9
 
23
 
10
 /**
24
 /**
11
  * @Description:试题对应报告内容
25
  * @Description:试题对应报告内容
16
 public class ReportGenerateQuestionService {
30
 public class ReportGenerateQuestionService {
17
     @Resource
31
     @Resource
18
     private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
32
     private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
33
+    @Resource
34
+    private MsClassStudentMapper msClassStudentMapper;
35
+    @Resource
36
+    private MsSubjectMapper msSubjectMapper;
37
+    @Resource
38
+    private MsPaperQtypeQuestionMapper msPaperQtypeQuestionMapper;
39
+    @Resource
40
+    private MsrReportparamMapper msrReportparamMapper;
19
 
41
 
20
-    public void generateQuestion(Integer examid){
42
+    public void generateQuestion(Integer examid,Integer exammode){
21
         //查询所有学生试题
43
         //查询所有学生试题
22
         List<MsPaperStudentQuestion> stuQuestions = msPaperStudentQuestionMapper.listAllStuQuesByExamid(examid);
44
         List<MsPaperStudentQuestion> stuQuestions = msPaperStudentQuestionMapper.listAllStuQuesByExamid(examid);
45
+        List<MsClassStudent> classStudents = msClassStudentMapper.listStudentByExamId(examid);
46
+        List<MsPaper> subjects = msSubjectMapper.listReportSubject(examid, exammode);
47
+        //获取考试参数
48
+        List<MsrReportparam> params = msrReportparamMapper.listReportparamByRpbelong(examid,"quesummary",null);
49
+
50
+        //根据科目进行区分
51
+        for(MsPaper subject : subjects){
52
+            String subjectid = subject.getSubjectid();
53
+            //获取科目下所有学生试题
54
+            List<MsPaperStudentQuestion> subjectStuQuestions = stuQuestions.stream().filter(stuQuestion -> stuQuestion.getSubjectid().equals(subjectid)).collect(Collectors.toList());
55
+            //科目下所有班级学生
56
+            List<MsClassStudent> subjectClassStudents = classStudents.stream().filter(classStudent -> classStudent.getSubjectid().equals(subjectid)).collect(Collectors.toList());
57
+            //获取试卷中所有小题基础信息包含大题信息
58
+            List<MsPaperQtypeQuestion> questions = msPaperQtypeQuestionMapper.listQuestionsForReport(subject.getMpid());
59
+
60
+            List<MsrReportparam> subjectParams = params.stream().filter(p -> p.getRpbelong().equals(subjectid)).collect(Collectors.toList());
61
+        }
62
+    }
63
+
64
+    //处理单个试题分析
65
+    private void handleQuestion(List<MsPaperStudentQuestion> subjectStuQuestions, List<MsClassStudent> subjectClassStudents,List<MsPaperQtypeQuestion> questions,List<MsrReportparam> params,Integer examid,String subjectid){
66
+
67
+        List<MsrClassQuestion> saveQuestions = new ArrayList<>();//小题分析
68
+
69
+        //处理小题信息
70
+        for(MsPaperQtypeQuestion question : questions){
71
+            //获取第一小题所有作答情况,全校作答情况
72
+            List<MsPaperStudentQuestion> stuQuestions = subjectStuQuestions.stream().filter(q -> q.getMptqid().equals(question.getMptqid())).collect(Collectors.toList());
73
+            int stunum = stuQuestions.size();//学生数量
74
+            Double sumQScore = question.getQscore() * stunum;//小题得分
75
+            List<Double> stuScores = stuQuestions.stream().map(q -> q.getStuscore()).collect(Collectors.toList());//所有学生得分
76
+
77
+            Double maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);//最高分
78
+            Double minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);//最低分
79
+            Double avgScore = MarkingUtil.calculateAverage(stuScores);//平均分
80
+            Double avgScoreRate = MarkingUtil.calculateRate(avgScore,sumQScore);//平均得分率
81
+
82
+            MsrClassQuestion schoolQ = new MsrClassQuestion();
83
+            schoolQ.setClassid(0);//全体班级
84
+            schoolQ.setExamid(examid);
85
+            schoolQ.setSubjectid(subjectid);
86
+            schoolQ.setSchoolmaxscore(maxScore);
87
+            schoolQ.setSchoolminscore(minScore);
88
+            schoolQ.setSchoolavgscore(avgScore);
89
+            schoolQ.setSchoolavgrate(avgScoreRate);
90
+            //班级试题情况
91
+            MsrClassQuestion schoolQue = handleQuestionClass(stuQuestions,question,params,schoolQ);
92
+            saveQuestions.add(schoolQue);
93
+
94
+            //班级试题--客观题选项情况
95
+
96
+
97
+            //处理班级情况
98
+            for(MsClassStudent classStudent : subjectClassStudents){
99
+                //获取班级下学生id
100
+                List<Integer> classStuIds = subjectClassStudents.stream().map(MsClassStudent::getStudentid).collect(Collectors.toList());
101
+                //获取班级下学生试题
102
+                List<MsPaperStudentQuestion> classStuQuestions = stuQuestions.stream().filter(q -> classStuIds.contains(q.getStudentid())).collect(Collectors.toList());
103
+                MsrClassQuestion classQue = handleQuestionClass(classStuQuestions,question,params,schoolQ);
104
+                saveQuestions.add(classQue);
105
+            }
106
+
107
+
108
+        }
109
+    }
110
+
111
+    //处理单个试题分析-学校、班级分析
112
+    private MsrClassQuestion handleQuestionClass(List<MsPaperStudentQuestion> stuQuestions,MsPaperQtypeQuestion question,List<MsrReportparam> params,MsrClassQuestion schoolQ){
113
+        int stunum = stuQuestions.size();//学生数量
114
+        Double qScore = question.getQscore();//试题分值
115
+        Double sumQScore = question.getQscore() * stunum;//小题得分
116
+        List<Double> stuScores = stuQuestions.stream().map(q -> q.getStuscore()).collect(Collectors.toList());//所有学生得分
117
+        Double sumStuScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();//综合
118
+
119
+        Double maxScore;//最高分
120
+        Double minScore;//最低分
121
+        Double avgScore;//平均分
122
+        Double avgScoreRate;//平均得分率
123
+        if(schoolQ.getClassid() == 0){
124
+            //代表是校级
125
+            maxScore = schoolQ.getSchoolmaxscore();
126
+            minScore = schoolQ.getSchoolminscore();
127
+            avgScore = schoolQ.getSchoolavgscore();
128
+            avgScoreRate = schoolQ.getSchoolavgrate();
129
+        }else{
130
+            //指定班级
131
+            maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);//最高分
132
+            minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);//最低分
133
+            avgScore = MarkingUtil.calculateAverage(stuScores);//平均分
134
+            avgScoreRate = MarkingUtil.calculateRate(avgScore,sumQScore);//平均得分率
135
+        }
136
+        Double stuScoreRate = MarkingUtil.calculateRate(sumStuScore,sumQScore);//学生得分率
137
+        MsrClassQuestion classQ = new MsrClassQuestion();
138
+        classQ.setExamid(schoolQ.getExamid());
139
+        classQ.setSubjectid(schoolQ.getSubjectid());
140
+        classQ.setClassid(schoolQ.getClassid());//班级id
141
+        classQ.setMptqid(question.getMptqid());
142
+        classQ.setQtype(question.getQtype());
143
+        classQ.setQn(question.getMptqn() + "." + question.getQn());
144
+        classQ.setFullscore(question.getQscore());
145
+        classQ.setStunum(stunum);
146
+        classQ.setClassmaxscore(maxScore);
147
+        classQ.setClassminscore(minScore);
148
+        classQ.setClassavgscore(avgScore);
149
+        classQ.setClassavgrate(avgScoreRate);
150
+
151
+        classQ.setSchoolmaxscore(schoolQ.getSchoolmaxscore());
152
+        classQ.setSchoolminscore(schoolQ.getSchoolminscore());
153
+        classQ.setSchoolavgscore(schoolQ.getSchoolavgscore());
154
+        classQ.setSchoolavgrate(schoolQ.getSchoolavgrate());
155
+
156
+        classQ.setScorerate(stuScoreRate);
157
+        classQ.setScoreratec(MarkingUtil.sub(MarkingUtil.calculateRate(maxScore,qScore),MarkingUtil.calculateRate(minScore,qScore)));//得分率差=最高得分率-最低得分率
158
+        classQ.setNd(MarkingUtil.div(stuScoreRate,qScore));//难度
159
+        classQ.setNdms(handleQuestionNdAndQfd(params,1,classQ.getNd()));//难度描述
160
+        classQ.setQfd(MarkingUtil.qfd(stuScores));//区分度
161
+        classQ.setQfdms(handleQuestionNdAndQfd(params,2, classQ.getQfd()));//区分度描述
162
+        classQ.setBzc(MarkingUtil.bzc(stuScores));//标准差
163
+        classQ.setCyxs(MarkingUtil.div(classQ.getBzc(),avgScore));//差异系数
164
+        classQ.setJbzs(MarkingUtil.jbzs(stuScores,stuScoreRate));//鉴别指数
165
+        //获取所有满分学生
166
+        List<MsPaperStudentQuestion> fullStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(q.getQscore())).collect(Collectors.toList());
167
+        String mfids = fullStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));//满分学生id
168
+        classQ.setMfnum(fullStuQuestions.size());
169
+        classQ.setMfrate(MarkingUtil.div(classQ.getMfnum(), stunum));////正确率、满分人数占比
170
+        classQ.setMfids(mfids);
171
+        //获取零分学生
172
+        List<MsPaperStudentQuestion> lfStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(0)).collect(Collectors.toList());
173
+        String lfids = lfStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));//零分学生id
174
+        classQ.setLfnum(lfStuQuestions.size());
175
+        classQ.setLfrate(MarkingUtil.div(lfStuQuestions.size(),stunum));////零分人数占比
176
+        classQ.setLfids(lfids);
177
+        return classQ;
178
+    }
23
 
179
 
180
+    private String handleQuestionNdAndQfd(List<MsrReportparam> params,Integer rptype,Double nd){
181
+        //获取难度或者区分度
182
+        MsrReportparam ndParam = params.stream().filter(p -> p.getRptype().equals(rptype)).findFirst().orElse(null);//难度
183
+        String ndms = "";
184
+        if(ndParam!= null){
185
+            List<SzJsonVo> szList = JSON.parseArray(ndParam.getSzjson(), SzJsonVo.class);
186
+            for (SzJsonVo sz : szList) {
187
+                if (nd == 1 && sz.getMaxvalue() == 1) {
188
+                    ndms = sz.getDjkey();
189
+                    break;
190
+                } else if (nd == 0 && sz.getMinvalue() == 0) {
191
+                    ndms = sz.getDjkey();
192
+                    break;
193
+                } else if(nd >= sz.getMinvalue() && nd < sz.getMaxvalue()) {
194
+                    ndms = sz.getDjkey();
195
+                    break;
196
+                }
197
+            }
198
+        }
199
+        return ndms;
24
     }
200
     }
25
 }
201
 }

+ 3
- 5
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrReportparamService.java View File

37
      **/
37
      **/
38
     @Transactional(rollbackFor = Exception.class)
38
     @Transactional(rollbackFor = Exception.class)
39
     public void saveReportparam(ReportParams reportParams) {
39
     public void saveReportparam(ReportParams reportParams) {
40
-        List<MsrReportparam> originalParams = msrReportparamMapper.listReportparamByRpbelong(reportParams);
40
+        List<MsrReportparam> originalParams = msrReportparamMapper.listReportparamByRpbelong(reportParams.getExamid(),reportParams.getRpbelong(),reportParams.getReportcode());
41
 
41
 
42
         Integer timestamp = N_Utils.getSecondTimestamp();
42
         Integer timestamp = N_Utils.getSecondTimestamp();
43
         List<MsrReportparam> params = reportParams.getParams();
43
         List<MsrReportparam> params = reportParams.getParams();
78
      * @Return java.util.List<com.xhkjedu.smarking.model.report.reportother.MsrReportparam>
78
      * @Return java.util.List<com.xhkjedu.smarking.model.report.reportother.MsrReportparam>
79
      **/
79
      **/
80
     public List<MsrReportparam> listReportparamByRpbelong(ReportParams reportParams) {
80
     public List<MsrReportparam> listReportparamByRpbelong(ReportParams reportParams) {
81
-        return msrReportparamMapper.listReportparamByRpbelong(reportParams);
81
+        return msrReportparamMapper.listReportparamByRpbelong(reportParams.getExamid(),reportParams.getRpbelong(),reportParams.getReportcode());
82
     }
82
     }
83
 
83
 
84
     /*
84
     /*
90
      **/
90
      **/
91
     public List<MsrReportparam> initReportparam(Integer schoolid,Integer gradeid,Integer examid,Integer handleid) {
91
     public List<MsrReportparam> initReportparam(Integer schoolid,Integer gradeid,Integer examid,Integer handleid) {
92
         //初始化时判断参数是否已经存在
92
         //初始化时判断参数是否已经存在
93
-        ReportParams ep = new ReportParams();
94
-        ep.setExamid(examid);
95
-        List<MsrReportparam> examParams = msrReportparamMapper.listReportparamByRpbelong(ep);
93
+        List<MsrReportparam> examParams = msrReportparamMapper.listReportparamByRpbelong(examid,null,null);
96
         if(examParams!= null && examParams.size() > 0){
94
         if(examParams!= null && examParams.size() > 0){
97
             //说明考试已经有参数存在
95
             //说明考试已经有参数存在
98
             return examParams;
96
             return examParams;

+ 117
- 80
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

4
 import com.alibaba.fastjson.JSONArray;
4
 import com.alibaba.fastjson.JSONArray;
5
 import com.xhkjedu.smarking.config.ConfigKey;
5
 import com.xhkjedu.smarking.config.ConfigKey;
6
 import com.xhkjedu.smarking.vo.paper.PaperFileVo;
6
 import com.xhkjedu.smarking.vo.paper.PaperFileVo;
7
+import com.xhkjedu.smarking.vo.report.reportother.RankGroupVo;
7
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.vo.ResultVo;
9
 import com.xhkjedu.vo.ResultVo;
9
 import lombok.extern.slf4j.Slf4j;
10
 import lombok.extern.slf4j.Slf4j;
34
 
35
 
35
     /**
36
     /**
36
      * 删除Html标签
37
      * 删除Html标签
37
-     *
38
      */
38
      */
39
     public static String htmlRemoveTag(String inputString) {
39
     public static String htmlRemoveTag(String inputString) {
40
         if (inputString == null)
40
         if (inputString == null)
48
         java.util.regex.Pattern p_html;
48
         java.util.regex.Pattern p_html;
49
         java.util.regex.Matcher m_html;
49
         java.util.regex.Matcher m_html;
50
         try {
50
         try {
51
-            //定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
51
+            // 定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
52
             String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
52
             String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
53
-            //定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
53
+            // 定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
54
             String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
54
             String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
55
             String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
55
             String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
56
             p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
56
             p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
76
      * @Param [str1, str2]
76
      * @Param [str1, str2]
77
      * @Return int
77
      * @Return int
78
      **/
78
      **/
79
-    public static int isEqualStringCheck(String str1,String str2){
79
+    public static int isEqualStringCheck(String str1, String str2) {
80
         char[] charArray1 = str1.toCharArray();
80
         char[] charArray1 = str1.toCharArray();
81
         char[] charArray2 = str2.toCharArray();
81
         char[] charArray2 = str2.toCharArray();
82
         Arrays.sort(charArray1);
82
         Arrays.sort(charArray1);
83
         Arrays.sort(charArray2);
83
         Arrays.sort(charArray2);
84
-        int eqResult = 0;//0代表不相等 1表示两个字符串相等 2代表字符串1包含字符串2
85
-        if(Arrays.equals(charArray1, charArray2)){
84
+        int eqResult = 0;// 0代表不相等 1表示两个字符串相等 2代表字符串1包含字符串2
85
+        if (Arrays.equals(charArray1, charArray2)) {
86
             eqResult = 1;
86
             eqResult = 1;
87
         }
87
         }
88
 
88
 
89
-        if(Collections.singletonList(charArray1).contains(charArray2)){
89
+        if (Collections.singletonList(charArray1).contains(charArray2)) {
90
             eqResult = 2;
90
             eqResult = 2;
91
         }
91
         }
92
 
92
 
100
      * @Param [stuanswer, q]
100
      * @Param [stuanswer, q]
101
      * @Return java.lang.Double
101
      * @Return java.lang.Double
102
      **/
102
      **/
103
-    public static Double checkObjectiveStuAnswer(String stuanswer, int ctype,String qanswer,Double loseoption,Double qscore){
104
-        String qanswerCort = JSON.parseArray(qanswer, String.class).get(0);//试题正确答案
103
+    public static Double checkObjectiveStuAnswer(String stuanswer, int ctype, String qanswer, Double loseoption, Double qscore) {
104
+        String qanswerCort = JSON.parseArray(qanswer, String.class).get(0);// 试题正确答案
105
         Double stuscore = 0D;
105
         Double stuscore = 0D;
106
-        if(N_Utils.isNotEmpty(stuanswer)){
107
-            if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
108
-                if(qanswerCort.equalsIgnoreCase(stuanswer)){
106
+        if (N_Utils.isNotEmpty(stuanswer)) {
107
+            if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
108
+                if (qanswerCort.equalsIgnoreCase(stuanswer)) {
109
                     stuscore = qscore;
109
                     stuscore = qscore;
110
                 }
110
                 }
111
-            }else if(ctype == 2){
112
-                //多选题进行判断,
111
+            } else if (ctype == 2) {
112
+                // 多选题进行判断,
113
                 int isEqualStr = isEqualStringCheck(qanswerCort, stuanswer);
113
                 int isEqualStr = isEqualStringCheck(qanswerCort, stuanswer);
114
-                if(isEqualStr == 1){
114
+                if (isEqualStr == 1) {
115
                     stuscore = qscore;
115
                     stuscore = qscore;
116
-                }else if(isEqualStr == 2){
117
-                    stuscore = loseoption;//少选得分
116
+                } else if (isEqualStr == 2) {
117
+                    stuscore = loseoption;// 少选得分
118
                 }
118
                 }
119
             }
119
             }
120
         }
120
         }
135
         return b1.add(b2).doubleValue();
135
         return b1.add(b2).doubleValue();
136
     }
136
     }
137
 
137
 
138
-    //两数相减
138
+    // 两数相减
139
     public static long subtract(long a, long b) {
139
     public static long subtract(long a, long b) {
140
         BigInteger biginta = new BigInteger(a + "");
140
         BigInteger biginta = new BigInteger(a + "");
141
         BigInteger bigintb = new BigInteger(b + "");
141
         BigInteger bigintb = new BigInteger(b + "");
143
 
143
 
144
     }
144
     }
145
 
145
 
146
-    //两数相减
146
+    // 两数相减
147
     public static Integer subtractInt(Integer a, Integer b) {
147
     public static Integer subtractInt(Integer a, Integer b) {
148
         BigInteger biginta = new BigInteger(a + "");
148
         BigInteger biginta = new BigInteger(a + "");
149
         BigInteger bigintb = new BigInteger(b + "");
149
         BigInteger bigintb = new BigInteger(b + "");
166
 
166
 
167
     /**
167
     /**
168
      * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后2位,以后的数字舍弃。
168
      * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后2位,以后的数字舍弃。
169
+     *
169
      * @param v1 被除数
170
      * @param v1 被除数
170
      * @param v2 除数
171
      * @param v2 除数
171
      * @return 两个参数的商
172
      * @return 两个参数的商
189
 
190
 
190
     /**
191
     /**
191
      * 向上取值
192
      * 向上取值
192
-     * @param score 原始得分
193
+     *
194
+     * @param score    原始得分
193
      * @param interval 取值间隔
195
      * @param interval 取值间隔
194
      * @return 向上取值后的结果
196
      * @return 向上取值后的结果
195
      */
197
      */
199
 
201
 
200
     /**
202
     /**
201
      * 向下取值
203
      * 向下取值
202
-     * @param score 原始得分
204
+     *
205
+     * @param score    原始得分
203
      * @param interval 取值间隔
206
      * @param interval 取值间隔
204
      * @return 向下取值后的结果
207
      * @return 向下取值后的结果
205
      */
208
      */
209
 
212
 
210
     /**
213
     /**
211
      * 计算总分并处理超过满分的情况
214
      * 计算总分并处理超过满分的情况
212
-     * @param scores 得分数组
215
+     *
216
+     * @param scores   得分数组
213
      * @param interval 取值间隔
217
      * @param interval 取值间隔
214
      * @param maxScore 满分
218
      * @param maxScore 满分
215
      * @return 最终总分
219
      * @return 最终总分
226
 
230
 
227
     /**
231
     /**
228
      * 计算两个分数之间的分差
232
      * 计算两个分数之间的分差
233
+     *
229
      * @param score1 第一个分数
234
      * @param score1 第一个分数
230
      * @param score2 第二个分数
235
      * @param score2 第二个分数
231
      * @return 分差
236
      * @return 分差
248
         return b1.subtract(b2).doubleValue();
253
         return b1.subtract(b2).doubleValue();
249
     }
254
     }
250
 
255
 
251
-    //字符串转为时间戳(秒)
256
+    // 字符串转为时间戳(秒)
252
     public static long strToTimestamp(String str) {
257
     public static long strToTimestamp(String str) {
253
         if (str == null || str.isEmpty()) return 0;
258
         if (str == null || str.isEmpty()) return 0;
254
         DateTimeFormatter ftf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
259
         DateTimeFormatter ftf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
263
      * @Author wn
268
      * @Author wn
264
      * @Date 2022/10/27 11:36
269
      * @Date 2022/10/27 11:36
265
      **/
270
      **/
266
-    public static long getTimestrToTimetamp(String time){
271
+    public static long getTimestrToTimetamp(String time) {
267
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
272
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
268
         Date date = new Date();
273
         Date date = new Date();
269
         try {
274
         try {
270
             date = sdf.parse(time);
275
             date = sdf.parse(time);
271
-        }catch (Exception e){
276
+        } catch (Exception e) {
272
             log.error("字符串转时间戳出错:" + e.getMessage());
277
             log.error("字符串转时间戳出错:" + e.getMessage());
273
         }
278
         }
274
-        return date.getTime()/1000;
279
+        return date.getTime() / 1000;
275
     }
280
     }
276
 
281
 
277
     /*
282
     /*
281
      * @Param [stupic, merged, saveFloder]
286
      * @Param [stupic, merged, saveFloder]
282
      * @Return java.lang.String
287
      * @Return java.lang.String
283
      **/
288
      **/
284
-    public static String uploadBase64Img(String stupic,Integer merged,String saveFloder) {
289
+    public static String uploadBase64Img(String stupic, Integer merged, String saveFloder) {
285
         String apiMethod;
290
         String apiMethod;
286
-        if(merged == 1){
287
-            //说明上传的图片为单张保存
291
+        if (merged == 1) {
292
+            // 说明上传的图片为单张保存
288
             apiMethod = "bs/base";
293
             apiMethod = "bs/base";
289
-        }else{
290
-            //上传的多张图片需要合并为一张
294
+        } else {
295
+            // 上传的多张图片需要合并为一张
291
             apiMethod = "bs/mbase_merge";
296
             apiMethod = "bs/mbase_merge";
292
         }
297
         }
293
-        String stubase64;//防止内容被更改
298
+        String stubase64;// 防止内容被更改
294
         try {
299
         try {
295
             stubase64 = URLEncoder.encode(stupic, "UTF-8");
300
             stubase64 = URLEncoder.encode(stupic, "UTF-8");
296
         } catch (UnsupportedEncodingException e) {
301
         } catch (UnsupportedEncodingException e) {
297
             log.error("base64格式化内容出错" + e.getMessage());
302
             log.error("base64格式化内容出错" + e.getMessage());
298
             throw new RuntimeException(e);
303
             throw new RuntimeException(e);
299
         }
304
         }
300
-        //处理字段那种图片路径,base64转图片
305
+        // 处理字段那种图片路径,base64转图片
301
         String params = "base64path=" + stubase64 + "&savefolder=" + saveFloder;
306
         String params = "base64path=" + stubase64 + "&savefolder=" + saveFloder;
302
         String fileInfoStr = N_Utils.sendPost(ConfigKey.fileapi + apiMethod, params);
307
         String fileInfoStr = N_Utils.sendPost(ConfigKey.fileapi + apiMethod, params);
303
-        if(N_Utils.isEmpty(fileInfoStr)){
308
+        if (N_Utils.isEmpty(fileInfoStr)) {
304
             return "";
309
             return "";
305
         }
310
         }
306
         ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
311
         ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
307
         if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
312
         if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
308
             return fileResult.getObj().toString();
313
             return fileResult.getObj().toString();
309
-        }else{
314
+        } else {
310
             return "";
315
             return "";
311
         }
316
         }
312
     }
317
     }
318
      * @Param [stupic, saveFloder]
323
      * @Param [stupic, saveFloder]
319
      * @Return java.util.List<java.lang.String>
324
      * @Return java.util.List<java.lang.String>
320
      **/
325
      **/
321
-    public static PaperFileVo uploadBatchBase64ImgPdf(List<String> imgList, String saveFloder){
322
-        //处理字段那种图片路径,base64转图片
326
+    public static PaperFileVo uploadBatchBase64ImgPdf(List<String> imgList, String saveFloder) {
327
+        // 处理字段那种图片路径,base64转图片
323
         String base64path = JSON.toJSONString(imgList);
328
         String base64path = JSON.toJSONString(imgList);
324
         try {
329
         try {
325
             base64path = URLEncoder.encode(base64path, "UTF-8");
330
             base64path = URLEncoder.encode(base64path, "UTF-8");
333
         ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
338
         ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
334
         if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
339
         if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
335
             return JSONArray.parseObject(fileResult.getObj().toString(), PaperFileVo.class);
340
             return JSONArray.parseObject(fileResult.getObj().toString(), PaperFileVo.class);
336
-        }else{
341
+        } else {
337
             return null;
342
             return null;
338
         }
343
         }
339
     }
344
     }
351
         Matcher matcher = pattern.matcher(input);
356
         Matcher matcher = pattern.matcher(input);
352
 
357
 
353
         while (matcher.find()) {
358
         while (matcher.find()) {
354
-            if (matcher.group(1)!= null) {
359
+            if (matcher.group(1) != null) {
355
                 result.add(matcher.group(1));
360
                 result.add(matcher.group(1));
356
-            } else if (matcher.group(2)!= null) {
361
+            } else if (matcher.group(2) != null) {
357
                 String str = matcher.group(2);
362
                 String str = matcher.group(2);
358
-                for(char c : str.toCharArray()){
359
-                    result.add(c+"");
363
+                for (char c : str.toCharArray()) {
364
+                    result.add(c + "");
360
                 }
365
                 }
361
             }
366
             }
362
         }
367
         }
364
         return result;
369
         return result;
365
     }
370
     }
366
 
371
 
367
-    public static String[] qnArr = {"一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十",
368
-            "二十一","二十二","二十三","二十四","二十五","二十六","二十七","二十八","二十九","三十"};
372
+    public static String[] qnArr = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十",
373
+            "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十"};
369
 
374
 
370
-    //获取题号
371
-    public static String getQnByOrder(Integer qorder){
375
+    // 获取题号
376
+    public static String getQnByOrder(Integer qorder) {
372
         String rtnStr;
377
         String rtnStr;
373
-        if(qorder == null || qorder == 0 || qorder > 30){
378
+        if (qorder == null || qorder == 0 || qorder > 30) {
374
             rtnStr = qnArr[0];
379
             rtnStr = qnArr[0];
375
         }
380
         }
376
-        rtnStr = qnArr[qorder-1];
381
+        rtnStr = qnArr[qorder - 1];
377
         return rtnStr;
382
         return rtnStr;
378
     }
383
     }
379
 
384
 
380
-    //方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
385
+    // 方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
381
     public static double fc(List<Double> x) {
386
     public static double fc(List<Double> x) {
382
         if (N_Utils.isListEmpty(x)) return 0;
387
         if (N_Utils.isListEmpty(x)) return 0;
383
         int m = x.size();
388
         int m = x.size();
384
         double sum = 0;
389
         double sum = 0;
385
-        for (int i = 0; i < m; i++) {//求和
390
+        for (int i = 0; i < m; i++) {// 求和
386
             sum += x.get(i);
391
             sum += x.get(i);
387
         }
392
         }
388
-        double dAve = sum / m;//求平均值
393
+        double dAve = sum / m;// 求平均值
389
         double dVar = 0;
394
         double dVar = 0;
390
-        for (int i = 0; i < m; i++) {//求方差
395
+        for (int i = 0; i < m; i++) {// 求方差
391
             dVar += (x.get(i) - dAve) * (x.get(i) - dAve);
396
             dVar += (x.get(i) - dAve) * (x.get(i) - dAve);
392
         }
397
         }
393
         return dVar / m;
398
         return dVar / m;
394
     }
399
     }
395
 
400
 
396
-    //标准差σ=sqrt(s^2)
401
+    // 标准差σ=sqrt(s^2)
397
     public static double bzc(List<Double> x) {
402
     public static double bzc(List<Double> x) {
398
         if (N_Utils.isListEmpty(x)) return 0;
403
         if (N_Utils.isListEmpty(x)) return 0;
399
         return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
404
         return N_Utils.formatDouble(Math.sqrt(fc(x)), 2);
400
     }
405
     }
401
 
406
 
402
 
407
 
403
-    //中位数
404
-    public static double zws(List<Double> list){
408
+    // 中位数
409
+    public static double zws(List<Double> list) {
405
         if (N_Utils.isListEmpty(list)) return 0;
410
         if (N_Utils.isListEmpty(list)) return 0;
406
         // 先对列表进行排序
411
         // 先对列表进行排序
407
         List<Double> sorteList = list.stream().sorted().collect(Collectors.toList());
412
         List<Double> sorteList = list.stream().sorted().collect(Collectors.toList());
418
         }
423
         }
419
     }
424
     }
420
 
425
 
421
-    //区分度=2×(高分组平均分-低分组平均分)/100
426
+    // 区分度=2×(高分组平均分-低分组平均分)/100
422
     public static double qfd(List<Double> scores) {
427
     public static double qfd(List<Double> scores) {
423
         if (N_Utils.isListEmpty(scores)) return 0;
428
         if (N_Utils.isListEmpty(scores)) return 0;
424
 
429
 
434
         return div(mul(2, sub(highGroupAvg, lowGroupAvg)), 100);
439
         return div(mul(2, sub(highGroupAvg, lowGroupAvg)), 100);
435
     }
440
     }
436
 
441
 
437
-    //计算平均分
442
+    // 计算平均分
438
     public static double calculateAverage(List<Double> scores) {
443
     public static double calculateAverage(List<Double> scores) {
439
         if (N_Utils.isListEmpty(scores)) return 0;
444
         if (N_Utils.isListEmpty(scores)) return 0;
440
         double sum = 0.0;
445
         double sum = 0.0;
444
         return div(sum, scores.size());
449
         return div(sum, scores.size());
445
     }
450
     }
446
 
451
 
447
-    //众数
448
-    public static List<Double> zs(List<Double> list){
452
+    //计算占比
453
+    public static double calculateRate(Object v1,Object v2){
454
+        BigDecimal b1 = new BigDecimal(v1.toString());
455
+        BigDecimal b2 = new BigDecimal(v2.toString());
456
+
457
+        BigDecimal b3 = b1.divide(b2, 4, BigDecimal.ROUND_DOWN);
458
+        return b3.multiply(new BigDecimal("100")).doubleValue();
459
+    }
460
+
461
+    // 众数
462
+    public static List<Double> zs(List<Double> list) {
449
         List<Double> modes = new ArrayList<>();
463
         List<Double> modes = new ArrayList<>();
450
         if (N_Utils.isListEmpty(list)) return modes;
464
         if (N_Utils.isListEmpty(list)) return modes;
451
 
465
 
452
         // 使用HashMap来统计每个元素出现的次数
466
         // 使用HashMap来统计每个元素出现的次数
453
         Map<Double, Long> countMap = list.stream()
467
         Map<Double, Long> countMap = list.stream()
454
-                                            .collect(Collectors.groupingBy(e -> e, Collectors.counting()));
468
+                                         .collect(Collectors.groupingBy(e -> e, Collectors.counting()));
455
 
469
 
456
         long maxCount = 0;
470
         long maxCount = 0;
457
         // 找出最大的出现次数
471
         // 找出最大的出现次数
468
         return modes;
482
         return modes;
469
     }
483
     }
470
 
484
 
471
-    //超均率 =(个人单科得分-全校平均分)÷全校平均分
472
-    public static double cjl(Object v1,Object v2){
473
-        if(v2 == null || "0".equals(v2)) return 0;
485
+    // 超均率 =(个人单科得分-全校平均分)÷全校平均分
486
+    public static double cjl(Object v1, Object v2) {
487
+        if (v2 == null || "0".equals(v2)) return 0;
474
 
488
 
475
         BigDecimal b1 = new BigDecimal(v1.toString());
489
         BigDecimal b1 = new BigDecimal(v1.toString());
476
         BigDecimal b2 = new BigDecimal(v2.toString());
490
         BigDecimal b2 = new BigDecimal(v2.toString());
477
         return b1.subtract(b2).divide(b2, 2, BigDecimal.ROUND_DOWN).doubleValue();
491
         return b1.subtract(b2).divide(b2, 2, BigDecimal.ROUND_DOWN).doubleValue();
478
     }
492
     }
479
 
493
 
480
-    //标准分 班级标准分 =(班级得分-全校平均分)÷年级标准差
494
+    // 标准分 班级标准分 =(班级得分-全校平均分)÷年级标准差
481
     public static double bzf(Double score, Double avgscore, Double bzc) {
495
     public static double bzf(Double score, Double avgscore, Double bzc) {
482
         double bzscore = div(sub(score, avgscore), bzc);
496
         double bzscore = div(sub(score, avgscore), bzc);
483
         return N_Utils.formatDouble(bzscore, 2);
497
         return N_Utils.formatDouble(bzscore, 2);
484
     }
498
     }
485
 
499
 
486
-    //综合率 固定计算=平均得分率*50%+优秀率*25%+及格率*25%
500
+    // 综合率 固定计算=平均得分率*50%+优秀率*25%+及格率*25%
487
     public static double zhl(Double v1, Double v2, Double v3) {
501
     public static double zhl(Double v1, Double v2, Double v3) {
488
         double s1 = mul(v1, 0.5);
502
         double s1 = mul(v1, 0.5);
489
         double s2 = mul(v2, 0.25);
503
         double s2 = mul(v2, 0.25);
491
         return add(s1, add(s2, s3));
505
         return add(s1, add(s2, s3));
492
     }
506
     }
493
 
507
 
494
-    //学科上线贡献率  班级学科上线贡献率=(班级学科上线率-班级总分上线率)-(学校学科的上线率-学校总分上线率)
495
-    public static double sxgxl(Double v1,Double v2,Double v3,Double v4){
496
-        double s1 = sub(v1,v2);
497
-        double s2 = sub(v3,v4);
498
-        return sub(s1,s2);
508
+    // 学科上线贡献率  班级学科上线贡献率=(班级学科上线率-班级总分上线率)-(学校学科的上线率-学校总分上线率)
509
+    public static double sxgxl(Double v1, Double v2, Double v3, Double v4) {
510
+        double s1 = sub(v1, v2);
511
+        double s2 = sub(v3, v4);
512
+        return sub(s1, s2);
499
     }
513
     }
500
 
514
 
501
-    //短板学生 学科短板学生:偏科指数=(单科分值-全科平均分)÷全科标准差 ,如果偏科指数>1,标识此科为短板学科
502
-    public static double dbxs(Double v1,Double v2,Double v3){
503
-        return div(sub(v1,v2),v3);
515
+    // 短板学生 学科短板学生:偏科指数=(单科分值-全科平均分)÷全科标准差 ,如果偏科指数>1,标识此科为短板学科
516
+    public static double dbxs(Double v1, Double v2, Double v3) {
517
+        return div(sub(v1, v2), v3);
504
     }
518
     }
505
 
519
 
506
-    //鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
507
-    //将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
508
-    public static double jbzs(List<Double> list,Double qscore){
520
+    // 鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
521
+    // 将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
522
+    public static double jbzs(List<Double> list, Double scoreRate) {
509
         List<Double> sortList = list.stream().sorted().collect(Collectors.toList());
523
         List<Double> sortList = list.stream().sorted().collect(Collectors.toList());
510
         int size = sortList.size();
524
         int size = sortList.size();
511
-        int count = (int)(size * 0.27);//27%学生数量
525
+        int count = (int) (size * 0.27);// 27%学生数量
512
 
526
 
513
         // 前27%的学生
527
         // 前27%的学生
514
         List<Double> topGroup = sortList.subList(0, count);
528
         List<Double> topGroup = sortList.subList(0, count);
515
         double topScore = topGroup.stream().mapToDouble(Double::doubleValue).sum();
529
         double topScore = topGroup.stream().mapToDouble(Double::doubleValue).sum();
516
-        double topRate = div(topScore, mul(qscore, count));
530
+        double topRate = div(topScore, mul(scoreRate, count));
517
 
531
 
518
         // 后27%的学生
532
         // 后27%的学生
519
         List<Double> bottomGroup = sortList.subList(size - count, size);
533
         List<Double> bottomGroup = sortList.subList(size - count, size);
520
         double bottomScore = bottomGroup.stream().mapToDouble(Double::doubleValue).sum();
534
         double bottomScore = bottomGroup.stream().mapToDouble(Double::doubleValue).sum();
521
-        double bottomRate = div(bottomScore, mul(qscore, count));
535
+        double bottomRate = div(bottomScore, mul(scoreRate, count));
522
 
536
 
523
         // 鉴别指数
537
         // 鉴别指数
524
         return sub(topRate, bottomRate);
538
         return sub(topRate, bottomRate);
525
     }
539
     }
526
 
540
 
541
+    //排名分组计算 用于第一组(第1-10名)
542
+    public static List<RankGroupVo> rankGroup(Integer total) {
543
+        List<RankGroupVo> rtnList = new ArrayList<>();
544
+
545
+        int count = total / 10;
546
+        for (int i = 0; i < count; i++) {
547
+            RankGroupVo rg = new RankGroupVo();
548
+            rg.setMaxvalue((i + 1) * 10);
549
+            rg.setMinvalue(i * 10 + 1);
550
+            rtnList.add(rg);
551
+        }
552
+
553
+        if (total % 10 > 0) {
554
+            //未被整除,添加最后一组
555
+            RankGroupVo rg = new RankGroupVo();
556
+            rg.setMaxvalue(total);
557
+            rg.setMinvalue(count * 10 + 1);
558
+            rtnList.add(rg);
559
+        }
560
+        return rtnList;
561
+    }
562
+
527
     public static void main(String[] args) {
563
     public static void main(String[] args) {
528
-        System.out.println(cjl(50,40));
564
+        System.out.println(cjl(50, 40));
565
+
529
     }
566
     }
530
 
567
 
531
 
568
 

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

1
+package com.xhkjedu.smarking.vo.report.reportother;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description:分段分值
7
+ * @Author: WN
8
+ * @Date: 2024/12/10 16:44:02
9
+ **/
10
+@Data
11
+public class RankGroupVo {
12
+
13
+    //最大值
14
+    private Integer maxvalue;
15
+
16
+    //最小值
17
+    private Integer minvalue;
18
+}

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

1
+package com.xhkjedu.smarking.vo.report.reportother;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description:数值json解析对象
7
+ * @Author: WN
8
+ * @Date: 2024/12/11 10:48:19
9
+ **/
10
+@Data
11
+public class SzJsonVo {
12
+    private String djkey;//数据项key
13
+    private Object djvalue;//数据项值
14
+    private Double djscore;//数据项值对应分值
15
+
16
+    private Double maxvalue;//最大值
17
+    private Double minvalue;//最小值
18
+
19
+    private String calformula;//综合率-计算
20
+    private String custname;//综合率-名称
21
+    private String selname;//综合率-指标名称
22
+
23
+    private Integer alltop;//全体考生前多少名
24
+    private Integer allbottom;//全体考生后多少名
25
+    private Integer goodtype;//优秀学生类型1按名次 2按比例
26
+    private Integer goodvalue;//优秀学生前N名
27
+    private Integer badtype;//提高学生类型1按名次 2按比例
28
+    private Integer badvalue;//待提高学生前N名
29
+
30
+}

+ 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,s.subjectname,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,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}
173
         <if test="exammode!=3">
173
         <if test="exammode!=3">

+ 8
- 0
smarking/src/main/resources/mapper/paper/MsPaperQtypeQuestionMapper.xml View File

134
     <update id="updateQuestionCoorByMpid">
134
     <update id="updateQuestionCoorByMpid">
135
         update ms_paper_qtype_question set pagenum=0,stemcoor=null,quecoor=null where mpid=#{mpid}
135
         update ms_paper_qtype_question set pagenum=0,stemcoor=null,quecoor=null where mpid=#{mpid}
136
     </update>
136
     </update>
137
+
138
+    <!--试卷中所有试题-考试报告-->
139
+    <select id="listQuestionsForReport" resultType="com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion">
140
+        select q.mptqid,q.mptid,q.mpid,q.ctype,q.qtype,q.questionid,q.qtypeid,q.qtypename,q.qn,
141
+        q.qscore,q.qorder,q.optionnum,q.qanswer,qt.mptqn,qt.mptnum,qt.mptscore
142
+        from ms_paper_qtype_question q left join ms_paper_qtype qt on q.mptid=qt.mptid
143
+        where q.mpid=#{mpid} order by qt.mptorder,q.qorder
144
+    </select>
137
 </mapper>
145
 </mapper>

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

4
 
4
 
5
     <!--获取考试对应参数-->
5
     <!--获取考试对应参数-->
6
     <select id="listReportparamByRpbelong" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
6
     <select id="listReportparamByRpbelong" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
7
-        select * from msr_reportparam where examid=#{rp.examid}
8
-        <if test="rp.rpbelong!= null and rp.rpbelong!= ''">
9
-            and rpbelong = #{rp.rpbelong}
7
+        select * from msr_reportparam where examid=#{examid}
8
+        <if test="rpbelong!= null and rpbelong!= ''">
9
+            and rpbelong = #{rpbelong}
10
         </if>
10
         </if>
11
-        <if test="rp.reportcode!= null and rp.reportcode!= ''">
12
-            and reportcode = #{rp.reportcode}
11
+        <if test="reportcode!= null and reportcode!= ''">
12
+            and reportcode = #{reportcode}
13
         </if>
13
         </if>
14
         order by rpid
14
         order by rpid
15
     </select>
15
     </select>

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

331
     <!--获取考试所有参考学生作答情况-->
331
     <!--获取考试所有参考学生作答情况-->
332
     <select id="listAllStuQuesByExamid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
332
     <select id="listAllStuQuesByExamid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
333
         select sq.mpsqid,sq.studentid,sq.subjectid,sq.mpid,sq.mpsid,sq.mptid,sq.mptqid,sq.ctype,sq.questionid,sq.qn,sq.qorder,
333
         select sq.mpsqid,sq.studentid,sq.subjectid,sq.mpid,sq.mpsid,sq.mptid,sq.mptqid,sq.ctype,sq.questionid,sq.qn,sq.qorder,
334
-        sq.qscore,sq.answered,sq.answertype,sq.stuanswer,sq.stuscore,sq.stumerge,sq.hasgood,sq.hasbad,q.qtype,q.qanswer,qt.mptqn
334
+        sq.qscore,sq.answered,sq.answertype,sq.stuanswer,sq.stuscore,sq.stumerge,sq.hasgood,sq.hasbad
335
         from ms_paper_student_question sq
335
         from ms_paper_student_question sq
336
         left join ms_paper_student ps on sq.mpsid=ps.mpsid
336
         left join ms_paper_student ps on sq.mpsid=ps.mpsid
337
-        left join ms_paper_qtype_question q on sq.mptqid=q.mptqid
338
-        left join ms_paper_qtype qt on q.mptid=qt.mptid
339
         where sq.examid=#{examid} and ps.sstate=2 order by sq.mpid,sq.studentid
337
         where sq.examid=#{examid} and ps.sstate=2 order by sq.mpid,sq.studentid
340
     </select>
338
     </select>
341
 </mapper>
339
 </mapper>

Loading…
Cancel
Save