Browse Source

题型分析

ywx
王宁 4 weeks ago
parent
commit
eb80068bd9

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

39
     private Double graderate;
39
     private Double graderate;
40
     //知识点对应试题题号
40
     //知识点对应试题题号
41
     private String qns;
41
     private String qns;
42
+    //知识点对应试题ID
43
+    private String mptqid;
42
 }
44
 }

+ 30
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/report/generate/ReportGeneratePointService.java View File

1
+package com.xhkjedu.smarking.service.report.generate;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.smarking.mapper.paper.MsPaperAnalyzeMapper;
5
+import com.xhkjedu.smarking.model.paper.MsPaperAnalyze;
6
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
7
+import com.xhkjedu.smarking.vo.paper.QuestionPointVo;
8
+import org.springframework.stereotype.Service;
9
+
10
+import javax.annotation.Resource;
11
+import java.util.List;
12
+
13
+/**
14
+ * @Description:生成知识点相关分析
15
+ * @Author: WN
16
+ * @Date: 2024/12/16 11:30:54
17
+ **/
18
+@Service
19
+public class ReportGeneratePointService {
20
+    @Resource
21
+    private MsPaperAnalyzeMapper msPaperAnalyzeMapper;
22
+
23
+    public void generatePoint(List<MsPaperStudentQuestion> stuQuestions,Integer mpid) {
24
+        //获取试卷分析
25
+        MsPaperAnalyze paperAnalyze = msPaperAnalyzeMapper.getObjByMpId(mpid);
26
+        if(paperAnalyze == null) return;
27
+
28
+        QuestionPointVo qpointvo = JSON.parseObject(paperAnalyze.getPointjson(), QuestionPointVo.class);
29
+    }
30
+}

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

4
 import com.xhkjedu.smarking.mapper.exam.MsClassStudentMapper;
4
 import com.xhkjedu.smarking.mapper.exam.MsClassStudentMapper;
5
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
5
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
6
 import com.xhkjedu.smarking.mapper.paper.MsPaperQtypeQuestionMapper;
6
 import com.xhkjedu.smarking.mapper.paper.MsPaperQtypeQuestionMapper;
7
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQobjsubMapper;
8
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQtypeMapper;
9
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQuestionMapper;
10
+import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQuestionObjMapper;
7
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
11
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
8
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
12
 import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentMapper;
13
+import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectQuestionRankgroupMapper;
14
+import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectQuestionSectionMapper;
9
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
15
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
10
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
16
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
11
 import com.xhkjedu.smarking.model.paper.MsPaper;
17
 import com.xhkjedu.smarking.model.paper.MsPaper;
49
     private MsrReportparamMapper msrReportparamMapper;
55
     private MsrReportparamMapper msrReportparamMapper;
50
     @Resource
56
     @Resource
51
     private MsrStudentMapper msrStudentMapper;
57
     private MsrStudentMapper msrStudentMapper;
58
+    @Resource
59
+    private MsrClassQuestionMapper msrClassQuestionMapper;
60
+    @Resource
61
+    private MsrClassQuestionObjMapper msrClassQuestionObjMapper;
62
+    @Resource
63
+    private MsrClassQobjsubMapper msrClassQobjsubMapper;
64
+    @Resource
65
+    private MsrClassQtypeMapper msrClassQtypeMapper;
66
+    @Resource
67
+    MsrSubjectQuestionRankgroupMapper msrSubjectQuestionRankgroupMapper;
68
+    @Resource
69
+    MsrSubjectQuestionSectionMapper msrSubjectQuestionSectionMapper;
70
+
52
 
71
 
53
     public void generateQuestion(Integer examid, Integer exammode) {
72
     public void generateQuestion(Integer examid, Integer exammode) {
54
         // 查询所有学生试题
73
         // 查询所有学生试题
78
             handleQuestion(subjectStuQuestions, subjectClassStudents, questions, subjectParams, subjectStuPapers, examid, subjectid,subject.getPscore());
97
             handleQuestion(subjectStuQuestions, subjectClassStudents, questions, subjectParams, subjectStuPapers, examid, subjectid,subject.getPscore());
79
             //处理题型
98
             //处理题型
80
             handleQtype(subjectStuQuestions, subjectClassStudents, questions, subjectParams, examid, subjectid);
99
             handleQtype(subjectStuQuestions, subjectClassStudents, questions, subjectParams, examid, subjectid);
100
+            //客观题、主观题
101
+            handleObjSub(subjectStuQuestions, subjectClassStudents, questions, subjectStuPapers, examid, subjectid,subject.getPscore());
81
         }
102
         }
82
     }
103
     }
83
 
104
 
88
         List<MsrClassQuestion> saveQuestions = new ArrayList<>();// 小题分析
109
         List<MsrClassQuestion> saveQuestions = new ArrayList<>();// 小题分析
89
         List<MsrClassQuestionObj> saveQuestionObjs = new ArrayList<>();// 小题-客观题选项分析
110
         List<MsrClassQuestionObj> saveQuestionObjs = new ArrayList<>();// 小题-客观题选项分析
90
         List<MsrSubjectQuestionSection> saveSectionQuestions = new ArrayList<>();// 学科分段之间学生在该题的整体得分率
111
         List<MsrSubjectQuestionSection> saveSectionQuestions = new ArrayList<>();// 学科分段之间学生在该题的整体得分率
91
-        List<MsrSubjectQuestionRankgroup> saveRankGroupQuestions = new ArrayList<>();
112
+        List<MsrSubjectQuestionRankgroup> saveRankGroupQuestions = new ArrayList<>();//分组分数分布
92
 
113
 
93
         // 获取学生科目得分-科目默认分段学生
114
         // 获取学生科目得分-科目默认分段学生
94
         List<MsrSubjectQuestionSection> subjectSectionQuestions = subjectSectionForQuestion(subjectStuPapers, pscore);
115
         List<MsrSubjectQuestionSection> subjectSectionQuestions = subjectSectionForQuestion(subjectStuPapers, pscore);
114
             schoolQ.setSchoolminscore(minScore);
135
             schoolQ.setSchoolminscore(minScore);
115
             schoolQ.setSchoolavgscore(avgScore);
136
             schoolQ.setSchoolavgscore(avgScore);
116
             schoolQ.setSchoolavgrate(avgScoreRate);
137
             schoolQ.setSchoolavgrate(avgScoreRate);
138
+            schoolQ.setMptqid(question.getMptqid());
139
+            schoolQ.setQn(question.getMptqn() + "." + question.getQn());
117
             // 全校班级试题情况
140
             // 全校班级试题情况
118
             MsrClassQuestion schoolQue = questionClass(stuQuestions, question, params, schoolQ);
141
             MsrClassQuestion schoolQue = questionClass(stuQuestions, question, params, schoolQ);
119
             saveQuestions.add(schoolQue);
142
             saveQuestions.add(schoolQue);
130
             }
153
             }
131
 
154
 
132
             // 学科分段之间学生在该题的整体得分率
155
             // 学科分段之间学生在该题的整体得分率
133
-            List<MsrSubjectQuestionSection> sectionQuestions = subjectSectionQuestion(stuQuestions, subjectSectionQuestions, question);
156
+            List<MsrSubjectQuestionSection> sectionQuestions = subjectSectionQuestion(stuQuestions, subjectSectionQuestions, 1,question.getQscore(),question.getMptqid());
134
             saveSectionQuestions.addAll(sectionQuestions);
157
             saveSectionQuestions.addAll(sectionQuestions);
135
             //试题分组分数分布、客观题选项分组
158
             //试题分组分数分布、客观题选项分组
136
-            List<MsrSubjectQuestionRankgroup> rankGroupQuestions = questionScoreRankGroup(stuQuestions, subjectStuPapers,examid,subjectid,question);
159
+            List<MsrSubjectQuestionRankgroup> rankGroupQuestions = questionScoreRankGroup(stuQuestions, subjectStuPapers,examid,subjectid,question.getQtype(),question.getQscore(),question.getQtype());
137
             saveRankGroupQuestions.addAll(rankGroupQuestions);
160
             saveRankGroupQuestions.addAll(rankGroupQuestions);
138
 
161
 
139
             // 班级试题分析
162
             // 班级试题分析
157
                 }
180
                 }
158
             }
181
             }
159
         }
182
         }
183
+
184
+        if(!saveQuestions.isEmpty()) msrClassQuestionMapper.insertList(saveQuestions);
185
+        if(!saveQuestionObjs.isEmpty()) msrClassQuestionObjMapper.insertList(saveQuestionObjs);
186
+        if(!saveSectionQuestions.isEmpty()) msrSubjectQuestionSectionMapper.insertList(saveSectionQuestions);
187
+        if(!saveRankGroupQuestions.isEmpty()) msrSubjectQuestionRankgroupMapper.insertList(saveRankGroupQuestions);
188
+
160
     }
189
     }
161
 
190
 
162
     // 单个试题分析-学校、班级分析
191
     // 单个试题分析-学校、班级分析
221
         List<MsPaperStudentQuestion> fullStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(q.getQscore())).collect(Collectors.toList());
250
         List<MsPaperStudentQuestion> fullStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(q.getQscore())).collect(Collectors.toList());
222
         String mfids = fullStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 满分学生id
251
         String mfids = fullStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 满分学生id
223
         classQ.setMfnum(fullStuQuestions.size());
252
         classQ.setMfnum(fullStuQuestions.size());
224
-        classQ.setMfrate(MarkingUtil.div(classQ.getMfnum(), stunum));////正确率、满分人数占比
253
+        classQ.setMfrate(MarkingUtil.calculateRate(classQ.getMfnum(), stunum));////正确率、满分人数占比
225
         classQ.setMfids(mfids);
254
         classQ.setMfids(mfids);
226
         // 获取零分学生
255
         // 获取零分学生
227
         List<MsPaperStudentQuestion> lfStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore() == 0).collect(Collectors.toList());
256
         List<MsPaperStudentQuestion> lfStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore() == 0).collect(Collectors.toList());
228
         String lfids = lfStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 零分学生id
257
         String lfids = lfStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 零分学生id
229
         classQ.setLfnum(lfStuQuestions.size());
258
         classQ.setLfnum(lfStuQuestions.size());
230
-        classQ.setLfrate(MarkingUtil.div(lfStuQuestions.size(), stunum));////零分人数占比
259
+        classQ.setLfrate(MarkingUtil.calculateRate(lfStuQuestions.size(), stunum));////零分人数占比
231
         classQ.setLfids(lfids);
260
         classQ.setLfids(lfids);
232
         return classQ;
261
         return classQ;
233
     }
262
     }
287
         return qobjList;
316
         return qobjList;
288
     }
317
     }
289
     // 单个试题分析-小题分组分布、客观题选项分组分布
318
     // 单个试题分析-小题分组分布、客观题选项分组分布
290
-    private List<MsrSubjectQuestionRankgroup> questionScoreRankGroup(List<MsPaperStudentQuestion> stuQuestions,List<MsrStudent> stuPapers,Integer examid,String subjectid,MsPaperQtypeQuestion question){
319
+    private List<MsrSubjectQuestionRankgroup> questionScoreRankGroup(List<MsPaperStudentQuestion> stuQuestions,List<MsrStudent> stuPapers,Integer examid,String subjectid,Integer qtype,Double fullScore,Integer mptqid){
291
         //获取学生排名最大名次的树
320
         //获取学生排名最大名次的树
292
         Integer totalRank = stuPapers.stream().mapToInt(MsrStudent::getSchoolrank).max().orElse(0);
321
         Integer totalRank = stuPapers.stream().mapToInt(MsrStudent::getSchoolrank).max().orElse(0);
293
         //获取排名分组,默认分为7组
322
         //获取排名分组,默认分为7组
294
         List<RankGroupVo> rankGroups = MarkingUtil.rankGroup(totalRank,7);
323
         List<RankGroupVo> rankGroups = MarkingUtil.rankGroup(totalRank,7);
295
         //获取试题分段,1分1段
324
         //获取试题分段,1分1段
296
-        List<SectionScoreVo> sectionScores = MarkingUtil.fdScoreForOne(question.getQscore());
325
+        List<SectionScoreVo> sectionScores = MarkingUtil.fdScoreForOne(fullScore);
297
 
326
 
298
         //获取所有客观题选项内容
327
         //获取所有客观题选项内容
299
         List<String> options = new ArrayList<>();
328
         List<String> options = new ArrayList<>();
300
-        if(question.getQtype() == 1){
329
+        if(qtype == 1){
301
             options = stuQuestions.stream().map(MsPaperStudentQuestion::getStuanswer).distinct().collect(Collectors.toList());
330
             options = stuQuestions.stream().map(MsPaperStudentQuestion::getStuanswer).distinct().collect(Collectors.toList());
302
         }
331
         }
303
 
332
 
308
             MsrSubjectQuestionRankgroup sqr = new MsrSubjectQuestionRankgroup();
337
             MsrSubjectQuestionRankgroup sqr = new MsrSubjectQuestionRankgroup();
309
             sqr.setExamid(examid);
338
             sqr.setExamid(examid);
310
             sqr.setSubjectid(subjectid);
339
             sqr.setSubjectid(subjectid);
311
-            sqr.setQntype(1);
312
-            sqr.setMptqid(question.getMptqid());
340
+            if(qtype == 1){
341
+                sqr.setQntype(1);//类型1小题2客观题3主观题
342
+                sqr.setRgtype(1);//类型1客观题选项 2客/主分值
343
+            }else{
344
+                //类型1小题2客观题3主观题
345
+                if(qtype == 2){
346
+                    sqr.setQntype(1);
347
+                }else if(qtype == 11){
348
+                    sqr.setQntype(2);
349
+                }else{
350
+                    sqr.setQntype(3);
351
+                }
352
+
353
+                sqr.setRgtype(2);//类型1客观题选项 2客/主分值
354
+            }
355
+            sqr.setMptqid(mptqid);
313
             sqr.setRgroup(rankGroup.getGroupname());
356
             sqr.setRgroup(rankGroup.getGroupname());
314
-            sqr.setRgtype(2);
357
+
315
             List<Integer> groupStuids;
358
             List<Integer> groupStuids;
316
             List<MsPaperStudentQuestion> groupStuQuestions = null;
359
             List<MsPaperStudentQuestion> groupStuQuestions = null;
317
             if(!groupStus.isEmpty()){
360
             if(!groupStus.isEmpty()){
322
                 double avgScore = MarkingUtil.div(sumScore, groupStuQuestions.size());
365
                 double avgScore = MarkingUtil.div(sumScore, groupStuQuestions.size());
323
                 sqr.setStunum(groupStuQuestions.size());
366
                 sqr.setStunum(groupStuQuestions.size());
324
                 sqr.setStuids(groupStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
367
                 sqr.setStuids(groupStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
325
-                sqr.setScorerate(MarkingUtil.calculateRate(sumScore, groupStuQuestions.size() * question.getQscore()));
326
-                sqr.setAvgrate(MarkingUtil.calculateRate(avgScore, question.getQscore()));
368
+                sqr.setScorerate(MarkingUtil.calculateRate(sumScore, groupStuQuestions.size() * fullScore));
369
+                sqr.setAvgrate(MarkingUtil.calculateRate(avgScore, fullScore));
327
             } else {
370
             } else {
328
                 groupStuids = null;
371
                 groupStuids = null;
329
                 sqr.setStunum(0);
372
                 sqr.setStunum(0);
337
                 sqrg.setExamid(examid);
380
                 sqrg.setExamid(examid);
338
                 sqrg.setSubjectid(subjectid);
381
                 sqrg.setSubjectid(subjectid);
339
                 sqrg.setQntype(1);
382
                 sqrg.setQntype(1);
340
-                sqrg.setMptqid(question.getMptqid());
383
+                sqrg.setMptqid(mptqid);
341
                 sqrg.setRgroup(rankGroup.getGroupname());
384
                 sqrg.setRgroup(rankGroup.getGroupname());
342
                 sqrg.setRgtype(2);
385
                 sqrg.setRgtype(2);
343
                 sqrg.setRgvalue(sectionScore.getSectionname());
386
                 sqrg.setRgvalue(sectionScore.getSectionname());
345
                 if(groupStuids != null && !groupStuids.isEmpty()){
388
                 if(groupStuids != null && !groupStuids.isEmpty()){
346
                     //名次分组下有学生,进行学生分数段计算
389
                     //名次分组下有学生,进行学生分数段计算
347
                     List<MsPaperStudentQuestion> sectionStuQuestions;
390
                     List<MsPaperStudentQuestion> sectionStuQuestions;
348
-                    if(sectionScore.getMinvalue() == question.getQscore()){
391
+                    if(sectionScore.getMinvalue() == fullScore){
349
                         //最小值为满分时分段形式为[qscore,qscore)
392
                         //最小值为满分时分段形式为[qscore,qscore)
350
                         sectionStuQuestions = groupStuQuestions.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue()).collect(Collectors.toList());
393
                         sectionStuQuestions = groupStuQuestions.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue()).collect(Collectors.toList());
351
                     }else{
394
                     }else{
355
                     double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
398
                     double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
356
                     sqrg.setStunum(sectionStuQuestions.size());
399
                     sqrg.setStunum(sectionStuQuestions.size());
357
                     sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
400
                     sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
358
-                    sqrg.setScorerate(MarkingUtil.calculateRate(sectionStuSumScore, sectionStuQuestions.size() * question.getQscore()));
359
-                    sqrg.setAvgrate(MarkingUtil.calculateRate(sectionStuAvgScore, question.getQscore()));
401
+                    sqrg.setScorerate(MarkingUtil.calculateRate(sectionStuSumScore, sectionStuQuestions.size() * fullScore));
402
+                    sqrg.setAvgrate(MarkingUtil.calculateRate(sectionStuAvgScore, fullScore));
360
                 }else{
403
                 }else{
361
                     sqrg.setStunum(0);
404
                     sqrg.setStunum(0);
362
                     sqrg.setScorerate(0.0);
405
                     sqrg.setScorerate(0.0);
366
             }
409
             }
367
 
410
 
368
             //客观题选项
411
             //客观题选项
369
-            if(question.getQtype() == 1){
412
+            if(qtype == 1){
370
                 if(options.isEmpty()){
413
                 if(options.isEmpty()){
371
                     options = new ArrayList<>();
414
                     options = new ArrayList<>();
372
                     options.add("");
415
                     options.add("");
395
 
438
 
396
                         optionObj.setStunum(optionStuQuestions.size());
439
                         optionObj.setStunum(optionStuQuestions.size());
397
                         optionObj.setStuids(optionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
440
                         optionObj.setStuids(optionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
398
-                        optionObj.setScorerate(MarkingUtil.calculateRate(optionStuSumScore, optionStuQuestions.size() * question.getQscore()));
399
-                        optionObj.setAvgrate(MarkingUtil.calculateRate(optionStuAvgScore, question.getQscore()));
441
+                        optionObj.setScorerate(MarkingUtil.calculateRate(optionStuSumScore, optionStuQuestions.size() * fullScore));
442
+                        optionObj.setAvgrate(MarkingUtil.calculateRate(optionStuAvgScore, fullScore));
400
                     }else{
443
                     }else{
401
                         optionObj.setStunum(0);
444
                         optionObj.setStunum(0);
402
                         optionObj.setScorerate(0.0);
445
                         optionObj.setScorerate(0.0);
439
 
482
 
440
     // 单个试题分析-科目分段区间得分率
483
     // 单个试题分析-科目分段区间得分率
441
     private List<MsrSubjectQuestionSection> subjectSectionQuestion(List<MsPaperStudentQuestion> stuQuestions, List<MsrSubjectQuestionSection> sections,
484
     private List<MsrSubjectQuestionSection> subjectSectionQuestion(List<MsPaperStudentQuestion> stuQuestions, List<MsrSubjectQuestionSection> sections,
442
-                                                                         MsPaperQtypeQuestion question) {
485
+                            Integer qtype,Double fullScore,Integer mptqid) {
443
         List<MsrSubjectQuestionSection> rtnList = new ArrayList<>();
486
         List<MsrSubjectQuestionSection> rtnList = new ArrayList<>();
444
         for (MsrSubjectQuestionSection section : sections) {
487
         for (MsrSubjectQuestionSection section : sections) {
445
             String[] userids = section.getFdids().split(",");
488
             String[] userids = section.getFdids().split(",");
451
             // 获取平均分
494
             // 获取平均分
452
             double avgScore = MarkingUtil.div(sumScore, stuNum);
495
             double avgScore = MarkingUtil.div(sumScore, stuNum);
453
             // 获取平均得分率
496
             // 获取平均得分率
454
-            double avgScoreRate = MarkingUtil.calculateRate(avgScore, question.getQscore());
497
+            double avgScoreRate = MarkingUtil.calculateRate(avgScore, fullScore);
455
             section.setAvgscore(avgScore);
498
             section.setAvgscore(avgScore);
456
             section.setAvgrate(avgScoreRate);
499
             section.setAvgrate(avgScoreRate);
457
-            section.setQntype(1);
458
-            section.setMptqid(question.getMptqid());
500
+            if(qtype == 1){
501
+                section.setQntype(qtype);//类型1小题2客观题3主观题
502
+            }else{
503
+                section.setQntype(qtype+1);
504
+            }
505
+            section.setMptqid(mptqid);
459
             rtnList.add(section);
506
             rtnList.add(section);
460
         }
507
         }
461
         return rtnList;
508
         return rtnList;
463
 
510
 
464
     // 题型分析
511
     // 题型分析
465
     private void handleQtype(List<MsPaperStudentQuestion> subjectStuQuestions,List<MsClassStudent> subjectClassStudents, List<MsPaperQtypeQuestion> questions,
512
     private void handleQtype(List<MsPaperStudentQuestion> subjectStuQuestions,List<MsClassStudent> subjectClassStudents, List<MsPaperQtypeQuestion> questions,
466
-                             List<MsrReportparam> params,Integer examid, String subjectid) {
513
+                            List<MsrReportparam> params,Integer examid, String subjectid) {
467
         List<MsrClassQtype> saveQtypes = new ArrayList<>();//班级题型分析
514
         List<MsrClassQtype> saveQtypes = new ArrayList<>();//班级题型分析
468
         // 处理大题
515
         // 处理大题
469
         Map<Integer, List<MsPaperQtypeQuestion>> qtypeMap = questions.stream().collect(Collectors.groupingBy(MsPaperQtypeQuestion::getMptid));
516
         Map<Integer, List<MsPaperQtypeQuestion>> qtypeMap = questions.stream().collect(Collectors.groupingBy(MsPaperQtypeQuestion::getMptid));
503
                 saveQtypes.add(qtypeClass);
550
                 saveQtypes.add(qtypeClass);
504
             }
551
             }
505
         }
552
         }
553
+        if(!saveQtypes.isEmpty()) msrClassQtypeMapper.insertList(saveQtypes);
506
     }
554
     }
507
     // 题型分析-学校、班级分析
555
     // 题型分析-学校、班级分析
508
     private MsrClassQtype qtypeClass(List<MsPaperStudentQuestion> stuQuestions, List<MsrReportparam> params,MsrClassQtype schoolQtype){
556
     private MsrClassQtype qtypeClass(List<MsPaperStudentQuestion> stuQuestions, List<MsrReportparam> params,MsrClassQtype schoolQtype){
545
         classQtype.setQfd(MarkingUtil.qfd(stuScores));
593
         classQtype.setQfd(MarkingUtil.qfd(stuScores));
546
         classQtype.setQfdms(questionNdAndQfd(params, 2, schoolQtype.getQfd())[0]);
594
         classQtype.setQfdms(questionNdAndQfd(params, 2, schoolQtype.getQfd())[0]);
547
         classQtype.setMfnum(mfnum);
595
         classQtype.setMfnum(mfnum);
548
-        classQtype.setMfrate(MarkingUtil.div(mfnum, stuNum));
596
+        classQtype.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
549
         if(mfnum > 0){
597
         if(mfnum > 0){
550
             schoolQtype.setMfids(mfids.substring(0,mfids.length()-1));
598
             schoolQtype.setMfids(mfids.substring(0,mfids.length()-1));
551
         }
599
         }
552
         classQtype.setMfids(mfids.toString());
600
         classQtype.setMfids(mfids.toString());
553
         classQtype.setLfnum(lfnum);
601
         classQtype.setLfnum(lfnum);
554
-        classQtype.setLfrate(MarkingUtil.div(lfnum, stuNum));
602
+        classQtype.setLfrate(MarkingUtil.calculateRate(lfnum, stuNum));
555
         if(lfnum > 0){
603
         if(lfnum > 0){
556
             classQtype.setMfids(lfids.substring(0,lfids.length()-1));
604
             classQtype.setMfids(lfids.substring(0,lfids.length()-1));
557
         }
605
         }
561
 
609
 
562
     //客观题/主观题分析
610
     //客观题/主观题分析
563
     private void handleObjSub(List<MsPaperStudentQuestion> subjectStuQuestions,List<MsClassStudent> subjectClassStudents, List<MsPaperQtypeQuestion> questions,
611
     private void handleObjSub(List<MsPaperStudentQuestion> subjectStuQuestions,List<MsClassStudent> subjectClassStudents, List<MsPaperQtypeQuestion> questions,
564
-                              List<MsrReportparam> params,Integer examid, String subjectid){
612
+                                List<MsrStudent> subjectStuPapers,Integer examid, String subjectid,Double pscore){
565
 
613
 
566
         List<MsrClassQobjsub> saveObjSubs = new ArrayList<>();//客观题/主观题分析
614
         List<MsrClassQobjsub> saveObjSubs = new ArrayList<>();//客观题/主观题分析
615
+        List<MsrSubjectQuestionSection> saveSectionQuestions = new ArrayList<>();// 学科分段之间学生在该题的整体得分率
616
+        List<MsrSubjectQuestionRankgroup> saveRankGroupQuestions = new ArrayList<>();//分组分数分布
617
+
618
+        // 获取学生科目得分-科目默认分段学生
619
+        List<MsrSubjectQuestionSection> subjectSectionQuestions = subjectSectionForQuestion(subjectStuPapers, pscore);
567
 
620
 
568
         //根据试题类型分组
621
         //根据试题类型分组
569
         Map<Integer,List<MsPaperQtypeQuestion>> objSubMap = questions.stream().collect(Collectors.groupingBy(MsPaperQtypeQuestion::getQtype));
622
         Map<Integer,List<MsPaperQtypeQuestion>> objSubMap = questions.stream().collect(Collectors.groupingBy(MsPaperQtypeQuestion::getQtype));
584
             MsrClassQobjsub objSubSchool = qobjsubClass(stuQuestions, schoolObjSub);
637
             MsrClassQobjsub objSubSchool = qobjsubClass(stuQuestions, schoolObjSub);
585
             saveObjSubs.add(objSubSchool);
638
             saveObjSubs.add(objSubSchool);
586
 
639
 
640
+            // 学科分段之间学生在该题的整体得分率,qntype=1小题2客观题3主观题
641
+            List<MsrSubjectQuestionSection> sectionQuestions = subjectSectionQuestion(stuQuestions, subjectSectionQuestions,entry.getKey(), fullScore,null);
642
+            saveSectionQuestions.addAll(sectionQuestions);
643
+
644
+
645
+            Integer qobjsubtype;//为了区分表中存放值
646
+            if(entry.getKey() == 1){
647
+                qobjsubtype = 11;
648
+            }else{
649
+                qobjsubtype = 12;
650
+            }
651
+            //试题分组分数分布、客观题选项分组、客观题主观题分组分数分布
652
+            List<MsrSubjectQuestionRankgroup> rankGroupQuestions = questionScoreRankGroup(stuQuestions, subjectStuPapers,examid,subjectid, qobjsubtype, fullScore,null);
653
+            saveRankGroupQuestions.addAll(rankGroupQuestions);
654
+
587
             List<Integer> classIds = subjectClassStudents.stream().map(MsClassStudent::getClassid).distinct().collect(Collectors.toList());
655
             List<Integer> classIds = subjectClassStudents.stream().map(MsClassStudent::getClassid).distinct().collect(Collectors.toList());
588
             for (Integer classid : classIds) {
656
             for (Integer classid : classIds) {
589
                 schoolObjSub.setClassid(classid);
657
                 schoolObjSub.setClassid(classid);
597
                 saveObjSubs.add(objSubClass);
665
                 saveObjSubs.add(objSubClass);
598
             }
666
             }
599
         }
667
         }
668
+
669
+        if(!saveObjSubs.isEmpty()) msrClassQobjsubMapper.insertList(saveObjSubs);
670
+        if(!saveSectionQuestions.isEmpty()) msrSubjectQuestionSectionMapper.insertList(saveSectionQuestions);
671
+        if(!saveRankGroupQuestions.isEmpty()) msrSubjectQuestionRankgroupMapper.insertList(saveRankGroupQuestions);
600
     }
672
     }
601
     //客观题/主观题分析--学校、班级分析
673
     //客观题/主观题分析--学校、班级分析
602
     private MsrClassQobjsub qobjsubClass(List<MsPaperStudentQuestion> stuQuestions, MsrClassQobjsub schoolObjsub){
674
     private MsrClassQobjsub qobjsubClass(List<MsPaperStudentQuestion> stuQuestions, MsrClassQobjsub schoolObjsub){
643
         objSub.setCyxs(MarkingUtil.div(objSub.getBzc(), avgScore));
715
         objSub.setCyxs(MarkingUtil.div(objSub.getBzc(), avgScore));
644
         objSub.setJbzs(MarkingUtil.jbzs(stuScores, stuScoreRate));
716
         objSub.setJbzs(MarkingUtil.jbzs(stuScores, stuScoreRate));
645
         objSub.setMfnum(mfnum);
717
         objSub.setMfnum(mfnum);
646
-        objSub.setMfrate(MarkingUtil.div(mfnum, stuNum));
718
+        objSub.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
647
         if(mfnum > 0){
719
         if(mfnum > 0){
648
             objSub.setMfids(mfids.substring(0,mfids.length()-1));
720
             objSub.setMfids(mfids.substring(0,mfids.length()-1));
649
         }
721
         }
650
         objSub.setLfnum(lfnum);
722
         objSub.setLfnum(lfnum);
651
-        objSub.setLfrate(MarkingUtil.div(lfnum, stuNum));
723
+        objSub.setLfrate(MarkingUtil.calculateRate(lfnum, stuNum));
652
         if(lfnum > 0){
724
         if(lfnum > 0){
653
             objSub.setLfids(lfids.substring(0,lfids.length()-1));
725
             objSub.setLfids(lfids.substring(0,lfids.length()-1));
654
         }
726
         }

Loading…
Cancel
Save