Browse Source

知识点分析

ywx
王宁 3 weeks ago
parent
commit
d7743f6016

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

2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion;
4
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion;
5
+import org.apache.ibatis.annotations.Param;
5
 
6
 
6
 /**
7
 /**
7
  * @Description 阅卷报告-班级试题小题分析表 Mapper 接口
8
  * @Description 阅卷报告-班级试题小题分析表 Mapper 接口
9
  * @Date 2024-12-09
10
  * @Date 2024-12-09
10
  */
11
  */
11
 public interface MsrClassQuestionMapper extends TkMapper<MsrClassQuestion> {
12
 public interface MsrClassQuestionMapper extends TkMapper<MsrClassQuestion> {
13
+
14
+    void deleteReportByExamid(@Param("examid") Integer examid);
12
 }
15
 }

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportother/MsrExamMapper.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.MsrExam;
4
 import com.xhkjedu.smarking.model.report.reportother.MsrExam;
5
+import org.apache.ibatis.annotations.Param;
5
 
6
 
6
 /**
7
 /**
7
  * @Description 阅卷报告-总体分析表 Mapper 接口
8
  * @Description 阅卷报告-总体分析表 Mapper 接口
9
  * @Date 2024-12-09
10
  * @Date 2024-12-09
10
  */
11
  */
11
 public interface MsrExamMapper extends TkMapper<MsrExam> {
12
 public interface MsrExamMapper extends TkMapper<MsrExam> {
13
+
14
+    //清除单次考试所有报告
15
+    void deleteReportByExamid(@Param("examid") int examid);
12
 }
16
 }

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

14
 public interface MsrStudentMapper extends TkMapper<MsrStudent> {
14
 public interface MsrStudentMapper extends TkMapper<MsrStudent> {
15
     //获取学生考试得分和排名
15
     //获取学生考试得分和排名
16
     List<MsrStudent> listStuScoreAndRankByExamid(@Param("examid") int examid);
16
     List<MsrStudent> listStuScoreAndRankByExamid(@Param("examid") int examid);
17
+    //批量修改学生主观题、客观题分值
18
+    void updateBatchObjSubScore(@Param("list") List<MsrStudent> list);
17
 }
19
 }

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsTemplateBlock.java View File

27
     private String blockname;
27
     private String blockname;
28
     //类型1客观题2主观题
28
     //类型1客观题2主观题
29
     private Integer mttype;
29
     private Integer mttype;
30
+    //客观题方向1横向2纵向
31
+    private Integer direct;
30
     //排序/首题号
32
     //排序/首题号
31
     private Integer mtborder;
33
     private Integer mtborder;
32
     //定位区坐标
34
     //定位区坐标

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

23
     private String subjectid;
23
     private String subjectid;
24
     //班级ID
24
     //班级ID
25
     private Integer classid;
25
     private Integer classid;
26
+    //参考人数
27
+    private Integer stunum;
26
     //类型1客观题2主观题
28
     //类型1客观题2主观题
27
     private Integer qtype;
29
     private Integer qtype;
28
     //满分
30
     //满分

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportother/MsrReportparam.java View File

23
     //归属报告模块编码:zh综合报告 xj校级报告 xk学科报告 bj班级报告 xs学生报告 mtzl命题质量报告 jxzl教学质量报告 xksy学科素养报告
23
     //归属报告模块编码:zh综合报告 xj校级报告 xk学科报告 bj班级报告 xs学生报告 mtzl命题质量报告 jxzl教学质量报告 xksy学科素养报告
24
     private String reportcode;
24
     private String reportcode;
25
 
25
 
26
-    //归属:rank排行榜 scorerate班级对比得分率 allrate班级对比表综合率  allrate班级对比表综合率 quesummary试题汇总 scoresection分数分段统计
26
+    //归属:rank排行榜 scorerate班级对比得分率 allrate班级对比表综合率 quesummary试题汇总 scoresection分数分段统计
27
     // rankrate名次和比例分析  gradescore分档分数线 nearline临界生群体分析 subjectshow学科考试表现 keystu重点学生信息
27
     // rankrate名次和比例分析  gradescore分档分数线 nearline临界生群体分析 subjectshow学科考试表现 keystu重点学生信息
28
     private String rpbelong;
28
     private String rpbelong;
29
     //类型
29
     //类型

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

25
     private Integer qntype;
25
     private Integer qntype;
26
     //试题ID
26
     //试题ID
27
     private Integer mptqid;
27
     private Integer mptqid;
28
-    //分数值
29
-    private Double rgscore;
30
     //组别和名次 第1组(1~70名)
28
     //组别和名次 第1组(1~70名)
31
     private String rgroup;
29
     private String rgroup;
32
     //类型1客观题选项 2客/主分值
30
     //类型1客观题选项 2客/主分值

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

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.xhkjedu.smarking.mapper.paper.MsPaperAnalyzeMapper;
4
 import com.xhkjedu.smarking.mapper.paper.MsPaperAnalyzeMapper;
5
+import com.xhkjedu.smarking.mapper.report.reportstu.MsrStudentPointMapper;
5
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectPointMapper;
6
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectPointMapper;
7
+import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectPointRankgroupMapper;
8
+import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectPointSectionMapper;
6
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
9
 import com.xhkjedu.smarking.model.exam.MsClassStudent;
7
 import com.xhkjedu.smarking.model.paper.MsPaperAnalyze;
10
 import com.xhkjedu.smarking.model.paper.MsPaperAnalyze;
8
 import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
11
 import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
39
     private MsPaperAnalyzeMapper msPaperAnalyzeMapper;
42
     private MsPaperAnalyzeMapper msPaperAnalyzeMapper;
40
     @Resource
43
     @Resource
41
     private MsrSubjectPointMapper msrSubjectPointMapper;
44
     private MsrSubjectPointMapper msrSubjectPointMapper;
45
+    @Resource
46
+    private MsrSubjectPointSectionMapper msrSubjectPointSectionMapper;
47
+    @Resource
48
+    private MsrSubjectPointRankgroupMapper msrSubjectPointRankgroupMapper;
49
+    @Resource
50
+    private MsrStudentPointMapper msrStudentPointMapper;
42
 
51
 
43
     //知识点分析,题库知识点按母题分析
52
     //知识点分析,题库知识点按母题分析
44
     public void generatePoint(List<MsPaperStudentQuestion> stuSubjectQuestions, List<MsPaperQtypeQuestion> qtypeQuestions,List<MsClassStudent> classStus,
53
     public void generatePoint(List<MsPaperStudentQuestion> stuSubjectQuestions, List<MsPaperQtypeQuestion> qtypeQuestions,List<MsClassStudent> classStus,
86
 
95
 
87
         //学科总分区间学生
96
         //学科总分区间学生
88
         List<MsrSubjectPointSection> pointSections = setPointSection(sturanks,pscore);
97
         List<MsrSubjectPointSection> pointSections = setPointSection(sturanks,pscore);
89
-        Map<Integer,String> qnMap = qtypeQuestions.stream().collect(Collectors.toMap(q-> q.getMptqid(), q -> q.getMptqn() + "." + q.getQn()));
98
+        Map<Integer,String> qnMap = qtypeQuestions.stream().collect(Collectors.toMap(MsPaperQtypeQuestion::getMptqid, q -> q.getMptqn() + "." + q.getQn()));
90
 
99
 
91
         //知识点本分分析(三级知识点分析)
100
         //知识点本分分析(三级知识点分析)
92
         for(PointQuestionVo pqvo : pointques){
101
         for(PointQuestionVo pqvo : pointques){
177
                 pointTopAndUpForOther(stuPoints,ques,qnMap,pointParams,classStus,pointSections,sturanks,saveStuPoints,saveSubjectPoints,savePointSections,savePointRankgroups);
186
                 pointTopAndUpForOther(stuPoints,ques,qnMap,pointParams,classStus,pointSections,sturanks,saveStuPoints,saveSubjectPoints,savePointSections,savePointRankgroups);
178
             }
187
             }
179
         }
188
         }
189
+
190
+        if(!saveStuPoints.isEmpty()) msrStudentPointMapper.insertList(saveStuPoints);
191
+        if(!saveSubjectPoints.isEmpty()) msrSubjectPointMapper.insertList(saveSubjectPoints);
192
+        if(!savePointSections.isEmpty()) msrSubjectPointSectionMapper.insertList(savePointSections);
193
+        if(!savePointRankgroups.isEmpty()) msrSubjectPointRankgroupMapper.insertList(savePointRankgroups);
180
     }
194
     }
181
 
195
 
182
     // 知识点:设置每个学生每个试题知识点得分
196
     // 知识点:设置每个学生每个试题知识点得分
214
         List<Double> stuScores = pointStuScores.stream().map(PointStudentVo::getStuscore).collect(Collectors.toList());
228
         List<Double> stuScores = pointStuScores.stream().map(PointStudentVo::getStuscore).collect(Collectors.toList());
215
         double sumScore = pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).sum();
229
         double sumScore = pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).sum();
216
         int stuNum = pointStuScores.size();
230
         int stuNum = pointStuScores.size();
217
-        double stuScoreRate = MarkingUtil.calculateRate(sumScore, pointStuScores.stream().mapToDouble(PointStudentVo::getScore).sum());
218
         MsrSubjectPoint classPoint = new MsrSubjectPoint();
231
         MsrSubjectPoint classPoint = new MsrSubjectPoint();
219
         classPoint.setExamid(subjectPoint.getExamid());
232
         classPoint.setExamid(subjectPoint.getExamid());
220
         classPoint.setSubjectid(subjectPoint.getSubjectid());
233
         classPoint.setSubjectid(subjectPoint.getSubjectid());
231
         classPoint.setBzc(MarkingUtil.bzc(stuScores));
244
         classPoint.setBzc(MarkingUtil.bzc(stuScores));
232
         classPoint.setCyxs(MarkingUtil.div(classPoint.getBzc(), classPoint.getAvgscore()));
245
         classPoint.setCyxs(MarkingUtil.div(classPoint.getBzc(), classPoint.getAvgscore()));
233
         classPoint.setQfd(MarkingUtil.qfd(stuScores));
246
         classPoint.setQfd(MarkingUtil.qfd(stuScores));
234
-        classPoint.setJbzs(MarkingUtil.jbzs(stuScores, stuScoreRate));
247
+        classPoint.setJbzs(MarkingUtil.jbzs(stuScores, subjectPoint.getFullscore()));
235
         classPoint.setQns(subjectPoint.getQns());
248
         classPoint.setQns(subjectPoint.getQns());
236
         classPoint.setMptqids(subjectPoint.getMptqids());
249
         classPoint.setMptqids(subjectPoint.getMptqids());
237
         return classPoint;
250
         return classPoint;
263
         return sections;
276
         return sections;
264
     }
277
     }
265
     //知识点-与总分分数区间相关性分析
278
     //知识点-与总分分数区间相关性分析
266
-    private List<MsrSubjectPointSection> pointSection(List<PointStudentVo> pointStuScores,List<MsrSubjectPointSection> sections,PointQuestionVo pqvo,Integer pointlevel){
279
+    private List<MsrSubjectPointSection> pointSection(List<PointStudentVo> pointStuScores,List<MsrSubjectPointSection> sections,PointParams pointParams){
267
         List<MsrSubjectPointSection> rtnList = new ArrayList<>();
280
         List<MsrSubjectPointSection> rtnList = new ArrayList<>();
268
         for(MsrSubjectPointSection section : sections){
281
         for(MsrSubjectPointSection section : sections){
269
             String[] userids = section.getFdids().split(",");
282
             String[] userids = section.getFdids().split(",");
270
             List<String> useridList = Arrays.asList(userids);
283
             List<String> useridList = Arrays.asList(userids);
271
             List<PointStudentVo> sectionStuPoints = pointStuScores.stream().filter(q -> useridList.contains(q.getStudentid().toString())).collect(Collectors.toList());
284
             List<PointStudentVo> sectionStuPoints = pointStuScores.stream().filter(q -> useridList.contains(q.getStudentid().toString())).collect(Collectors.toList());
272
-            // 获取总分
273
-            double sumScore = sectionStuPoints.stream().mapToDouble(PointStudentVo::getStuscore).sum();
274
-            int stuNum = sectionStuPoints.size();
275
-            // 获取平均分
276
-            double avgScore = MarkingUtil.div(sumScore, stuNum);
277
-            // 获取平均得分率
278
-            double avgScoreRate = MarkingUtil.calculateRate(avgScore, pqvo.getScore());
279
-            section.setAvgrate(avgScoreRate);
280
-            section.setAvgscore(avgScore);
281
-            section.setPointlevel(pointlevel);
282
-            section.setPointid(pqvo.getPointid());
283
-            section.setPointname(pqvo.getPointname());
284
-            rtnList.add(section);
285
+
286
+            MsrSubjectPointSection sps = new MsrSubjectPointSection();
287
+            sps.setExamid(pointParams.getExamid());
288
+            sps.setSubjectid(pointParams.getSubjectid());
289
+            sps.setPointlevel(pointParams.getPointlevel());
290
+            sps.setPointid(pointParams.getPointid());
291
+            sps.setPointname(pointParams.getPointname());
292
+            sps.setFdfw(section.getFdfw());
293
+            if(!sectionStuPoints.isEmpty()){
294
+                // 获取总分
295
+                double sumScore = sectionStuPoints.stream().mapToDouble(PointStudentVo::getStuscore).sum();
296
+                int stuNum = sectionStuPoints.size();
297
+                // 获取平均分
298
+                double avgScore = MarkingUtil.div(sumScore, stuNum);
299
+                // 获取平均得分率
300
+                double avgScoreRate = MarkingUtil.calculateRate(avgScore, pointParams.getFullscore());
301
+                sps.setAvgrate(avgScoreRate);
302
+                sps.setAvgscore(avgScore);
303
+            }else{
304
+                sps.setAvgrate(0.0);
305
+                sps.setAvgscore(0.0);
306
+            }
307
+
308
+            rtnList.add(sps);
285
         }
309
         }
286
         return rtnList;
310
         return rtnList;
287
     }
311
     }
294
         List<RankGroupVo> rankGroups = MarkingUtil.rankGroup(totalRank,7);
318
         List<RankGroupVo> rankGroups = MarkingUtil.rankGroup(totalRank,7);
295
         //获取知识点分段,1分1段
319
         //获取知识点分段,1分1段
296
         List<RankGroupVo> sectionScores = MarkingUtil.fdScore(pqvo.getScore(),5);
320
         List<RankGroupVo> sectionScores = MarkingUtil.fdScore(pqvo.getScore(),5);
297
-
298
-
299
         List<MsrSubjectPointRankgroup> rtnList = new ArrayList<>();
321
         List<MsrSubjectPointRankgroup> rtnList = new ArrayList<>();
300
         for (RankGroupVo rankGroup : rankGroups) {
322
         for (RankGroupVo rankGroup : rankGroups) {
301
             //名次下学生信息
323
             //名次下学生信息
341
                     }else{
363
                     }else{
342
                         sectionStuQuestions = groupStuPoints.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue() && q.getStuscore() < sectionScore.getMaxvalue()).collect(Collectors.toList());
364
                         sectionStuQuestions = groupStuPoints.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue() && q.getStuscore() < sectionScore.getMaxvalue()).collect(Collectors.toList());
343
                     }
365
                     }
366
+
344
                     sqrg.setStunum(sectionStuQuestions.size());
367
                     sqrg.setStunum(sectionStuQuestions.size());
345
                     sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
368
                     sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
346
                 }else{
369
                 }else{
373
             topPoint.setPointname(point.getPointname());
396
             topPoint.setPointname(point.getPointname());
374
 
397
 
375
             //获取知识点的详细信息
398
             //获取知识点的详细信息
376
-            if(pointMap.containsKey(point.getPointid())){
399
+            if(pointMap.containsKey(point.getPointid()) && pointMap.get(point.getPointid()).getPointpid()!= null){
377
                 PointVo pointVo = pointMap.get(point.getPointid());
400
                 PointVo pointVo = pointMap.get(point.getPointid());
401
+                //说明知识点的上层知识点不为空
378
                 PointVo parentNode =pointVo.getParent(points);//上层知识点
402
                 PointVo parentNode =pointVo.getParent(points);//上层知识点
379
                 upPoint.setTopPointid(parentNode.getPointid());
403
                 upPoint.setTopPointid(parentNode.getPointid());
380
                 upPoint.setTopPointname(parentNode.getPointname());
404
                 upPoint.setTopPointname(parentNode.getPointname());
389
                     topPoint.setTopPointname(point.getPointname());
413
                     topPoint.setTopPointname(point.getPointname());
390
                 }
414
                 }
391
             }else{
415
             }else{
416
+                //知识点的父知识点为空,即上层、顶层知识点都是知识点本身
392
                 upPoint.setTopPointid(point.getPointid());
417
                 upPoint.setTopPointid(point.getPointid());
393
                 upPoint.setTopPointname(point.getPointname());
418
                 upPoint.setTopPointname(point.getPointname());
394
 
419
 
452
     private void pointTopAndUpForOther(List<PointStudentVo> levelStuPoints, List<QuestionPointVo> ques, Map<Integer,String> qnMap, PointParams pointParam,
477
     private void pointTopAndUpForOther(List<PointStudentVo> levelStuPoints, List<QuestionPointVo> ques, Map<Integer,String> qnMap, PointParams pointParam,
453
                                         List<MsClassStudent> classStus, List<MsrSubjectPointSection> pointSections, List<MsrStudent> sturanks,List<MsrStudentPoint> saveStuPoints,
478
                                         List<MsClassStudent> classStus, List<MsrSubjectPointSection> pointSections, List<MsrStudent> sturanks,List<MsrStudentPoint> saveStuPoints,
454
                                         List<MsrSubjectPoint> saveSubjectPoints, List<MsrSubjectPointSection> savePointSections, List<MsrSubjectPointRankgroup> savePointRankgroups){
479
                                         List<MsrSubjectPoint> saveSubjectPoints, List<MsrSubjectPointSection> savePointSections, List<MsrSubjectPointRankgroup> savePointRankgroups){
480
+        List<Integer> mptqids = new ArrayList<>();
481
+        for(QuestionPointVo qpointvo : ques){
482
+            mptqids.addAll(qpointvo.getMptqids());
483
+        }
455
 
484
 
456
-        List<Integer> mptqids = ques.stream().map(QuestionPointVo::getMptqid).distinct().collect(Collectors.toList());
457
-        String qnStr="";
485
+        StringBuilder qnStr= new StringBuilder();
458
         String mptqidStr = mptqids.stream().map(Object::toString).collect(Collectors.joining(","));
486
         String mptqidStr = mptqids.stream().map(Object::toString).collect(Collectors.joining(","));
459
         for(Map.Entry<Integer,String> qnentry : qnMap.entrySet()){
487
         for(Map.Entry<Integer,String> qnentry : qnMap.entrySet()){
460
             if(mptqids.contains(qnentry.getKey())){
488
             if(mptqids.contains(qnentry.getKey())){
461
-                qnStr = qnStr + qnentry.getValue() + ",";
489
+                qnStr.append(qnentry.getValue()).append(",");
462
             }
490
             }
463
         }
491
         }
464
-        if(N_Utils.isNotEmpty(qnStr)){
465
-            qnStr = qnStr.substring(0,qnStr.length()-1);
492
+        if(N_Utils.isNotEmpty(qnStr.toString())){
493
+            qnStr = new StringBuilder(qnStr.substring(0, qnStr.length() - 1));
466
         }
494
         }
467
 
495
 
468
         //知识点多个试题,处理成单个学生试题总分值
496
         //知识点多个试题,处理成单个学生试题总分值
484
         subjectPoint.setExamid(pointParam.getExamid());
512
         subjectPoint.setExamid(pointParam.getExamid());
485
         subjectPoint.setSubjectid(pointParam.getSubjectid());
513
         subjectPoint.setSubjectid(pointParam.getSubjectid());
486
         subjectPoint.setPointid(pointParam.getPointid());
514
         subjectPoint.setPointid(pointParam.getPointid());
515
+        subjectPoint.setPointname(pointParam.getPointname());
487
         subjectPoint.setClassid(0);
516
         subjectPoint.setClassid(0);
488
-        subjectPoint.setPointname(pointParam.getPointid());
489
         subjectPoint.setFullscore(pointParam.getFullscore());
517
         subjectPoint.setFullscore(pointParam.getFullscore());
490
         subjectPoint.setPointlevel(pointParam.getPointlevel());
518
         subjectPoint.setPointlevel(pointParam.getPointlevel());
491
         subjectPoint.setMptqids(mptqidStr);
519
         subjectPoint.setMptqids(mptqidStr);
492
-        subjectPoint.setQns(qnStr);
520
+        subjectPoint.setQns(qnStr.toString());
493
 
521
 
494
         //校知识点分析
522
         //校知识点分析
495
         MsrSubjectPoint schoolPoint = pointLevelClass(pointStuScores, subjectPoint);
523
         MsrSubjectPoint schoolPoint = pointLevelClass(pointStuScores, subjectPoint);
522
         pqvo.setScore(pointParam.getFullscore());
550
         pqvo.setScore(pointParam.getFullscore());
523
 
551
 
524
         //知识点分段分析(知识点与总分的相关性)
552
         //知识点分段分析(知识点与总分的相关性)
525
-        List<MsrSubjectPointSection> pointSecs = pointSection(pointStuScores, pointSections, pqvo, pointParam.getPointlevel());
553
+        List<MsrSubjectPointSection> pointSecs = pointSection(pointStuScores, pointSections, pointParam);
526
         savePointSections.addAll(pointSecs);
554
         savePointSections.addAll(pointSecs);
527
 
555
 
528
         //知识点考生分组分析
556
         //知识点考生分组分析
547
                 stuPoint.setSturate(MarkingUtil.calculateRate(pstuvo.getStuscore(), pqvo.getScore()));
575
                 stuPoint.setSturate(MarkingUtil.calculateRate(pstuvo.getStuscore(), pqvo.getScore()));
548
                 stuPoint.setSchoolavg(schoolAvgScore);
576
                 stuPoint.setSchoolavg(schoolAvgScore);
549
                 stuPoint.setSchoolrate(schoolScoreRate);
577
                 stuPoint.setSchoolrate(schoolScoreRate);
550
-                stuPoint.setQns(qnStr);
578
+                stuPoint.setQns(qnStr.toString());
551
                 stuPoint.setMptqid(mptqidStr);
579
                 stuPoint.setMptqid(mptqidStr);
552
                 saveStuPoints.add(stuPoint);
580
                 saveStuPoints.add(stuPoint);
553
             }
581
             }
673
                 pqvo.setScore(pointscore);
701
                 pqvo.setScore(pointscore);
674
 
702
 
675
                 //知识点结构与总分的相关性(三级知识点)
703
                 //知识点结构与总分的相关性(三级知识点)
676
-                List<MsrSubjectPointSection> pointSecs = pointSection(pointStuScores, pointSections, pqvo, pointlevel);
677
-                savePointSections.addAll(pointSecs);
704
+                // List<MsrSubjectPointSection> pointSecs = pointSection(pointStuScores, pointSections, PointParams);
705
+                // savePointSections.addAll(pointSecs);
678
 
706
 
679
                 //知识点考生分组分析
707
                 //知识点考生分组分析
680
                 List<MsrSubjectPointRankgroup> pointRankg = pointRankGroup(pointStuScores,sturanks, pqvo, examid, subjectid, pointlevel);
708
                 List<MsrSubjectPointRankgroup> pointRankg = pointRankGroup(pointStuScores,sturanks, pqvo, examid, subjectid, pointlevel);

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

31
 import com.xhkjedu.smarking.vo.report.reportsubject.SectionScoreVo;
31
 import com.xhkjedu.smarking.vo.report.reportsubject.SectionScoreVo;
32
 import com.xhkjedu.utils.N_Utils;
32
 import com.xhkjedu.utils.N_Utils;
33
 import org.springframework.stereotype.Service;
33
 import org.springframework.stereotype.Service;
34
+import org.springframework.transaction.annotation.Transactional;
34
 
35
 
35
 import javax.annotation.Resource;
36
 import javax.annotation.Resource;
36
 import java.util.*;
37
 import java.util.*;
70
     @Resource
71
     @Resource
71
     private ReportGeneratePointService reportGeneratePointService;
72
     private ReportGeneratePointService reportGeneratePointService;
72
 
73
 
74
+    @Transactional(rollbackFor = Exception.class)
73
     public void generateQuestion(Integer examid, Integer exammode) {
75
     public void generateQuestion(Integer examid, Integer exammode) {
74
         // 查询所有学生试题
76
         // 查询所有学生试题
75
         List<MsPaperStudentQuestion> stuQuestions = msPaperStudentQuestionMapper.listAllStuQuesByExamid(examid);
77
         List<MsPaperStudentQuestion> stuQuestions = msPaperStudentQuestionMapper.listAllStuQuesByExamid(examid);
79
         // 获取考试参数
81
         // 获取考试参数
80
         List<MsrReportparam> params = msrReportparamMapper.listReportparamByRpbelong(examid, "quesummary", null);
82
         List<MsrReportparam> params = msrReportparamMapper.listReportparamByRpbelong(examid, "quesummary", null);
81
 
83
 
84
+        msrClassQuestionMapper.deleteReportByExamid(examid);//清除数据
85
+
82
         // 根据科目进行区分
86
         // 根据科目进行区分
83
         for (MsPaper subject : subjects) {
87
         for (MsPaper subject : subjects) {
84
             String subjectid = subject.getSubjectid();
88
             String subjectid = subject.getSubjectid();
94
             // 获取学生科目得分及排名
98
             // 获取学生科目得分及排名
95
             List<MsrStudent> subjectStuPapers = stuPapers.stream().filter(p -> p.getSubjectid().equals(subjectid)).collect(Collectors.toList());
99
             List<MsrStudent> subjectStuPapers = stuPapers.stream().filter(p -> p.getSubjectid().equals(subjectid)).collect(Collectors.toList());
96
 
100
 
101
+            // 处理学生客观题、主观题得分
102
+            handleStudentObjSub(subjectStuQuestions, subjectStuPapers, questions);
97
             // 处理小题
103
             // 处理小题
98
             handleQuestion(subjectStuQuestions, subjectClassStudents, questions, subjectParams, subjectStuPapers, examid, subjectid,subject.getPscore());
104
             handleQuestion(subjectStuQuestions, subjectClassStudents, questions, subjectParams, subjectStuPapers, examid, subjectid,subject.getPscore());
99
             //处理题型
105
             //处理题型
101
             //客观题、主观题
107
             //客观题、主观题
102
             handleObjSub(subjectStuQuestions, subjectClassStudents, questions, subjectStuPapers, examid, subjectid,subject.getPscore());
108
             handleObjSub(subjectStuQuestions, subjectClassStudents, questions, subjectStuPapers, examid, subjectid,subject.getPscore());
103
             //知识点相关分析
109
             //知识点相关分析
104
-            reportGeneratePointService.generatePoint(subjectStuQuestions,questions,classStudents,stuPapers,examid,subjectid,subject.getMpid(),subject.getPscore());
110
+            reportGeneratePointService.generatePoint(subjectStuQuestions,questions,classStudents,subjectStuPapers,examid,subjectid,subject.getMpid(),subject.getPscore());
111
+        }
112
+    }
113
+
114
+    //学生客观题、主观题得分
115
+    private void handleStudentObjSub(List<MsPaperStudentQuestion> subjectStuQuestions, List<MsrStudent> stus, List<MsPaperQtypeQuestion> questions){
116
+        //获取试卷中所有主观题、客观题
117
+        List<Integer> objMptqids = questions.stream().filter(q -> q.getQtype()==1).map(MsPaperQtypeQuestion::getMptqid).distinct().collect(Collectors.toList());
118
+        List<Integer> subMptqids = questions.stream().filter(q -> q.getQtype()==2).map(MsPaperQtypeQuestion::getMptqid).distinct().collect(Collectors.toList());
119
+        //学生试题按学生分组
120
+        Map<Integer,List<MsPaperStudentQuestion>> stuQuestionMap = subjectStuQuestions.stream().collect(Collectors.groupingBy(MsPaperStudentQuestion::getStudentid));
121
+
122
+        for(MsrStudent stu:stus){
123
+            Integer studentid = stu.getStudentid();
124
+            if(stuQuestionMap.containsKey(studentid)){
125
+                List<MsPaperStudentQuestion> stuQuestions = stuQuestionMap.get(studentid);
126
+                List<MsPaperStudentQuestion> objStuQues = stuQuestions.stream().filter(q -> objMptqids.contains(q.getMptqid())).collect(Collectors.toList());
127
+                List<MsPaperStudentQuestion> subStuQues = stuQuestions.stream().filter(q -> subMptqids.contains(q.getMptqid())).collect(Collectors.toList());
128
+                //学生客观题得分
129
+                double objScore = objStuQues.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
130
+                //学生主观题得分
131
+                double subScore = subStuQues.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
132
+                stu.setObjscore(N_Utils.formatDouble(objScore,1));
133
+                stu.setSubscore(N_Utils.formatDouble(subScore,1));
134
+            }else{
135
+                stu.setObjscore(0.0);
136
+                stu.setSubscore(0.0);
137
+            }
105
         }
138
         }
139
+        msrStudentMapper.updateBatchObjSubScore(stus);
106
     }
140
     }
107
 
141
 
108
     // 单个试题分析
142
     // 单个试题分析
139
             schoolQ.setSchoolavgscore(avgScore);
173
             schoolQ.setSchoolavgscore(avgScore);
140
             schoolQ.setSchoolavgrate(avgScoreRate);
174
             schoolQ.setSchoolavgrate(avgScoreRate);
141
             schoolQ.setMptqid(question.getMptqid());
175
             schoolQ.setMptqid(question.getMptqid());
176
+            schoolQ.setZqda(question.getQanswer());
142
             schoolQ.setQn(question.getMptqn() + "." + question.getQn());
177
             schoolQ.setQn(question.getMptqn() + "." + question.getQn());
143
             // 全校班级试题情况
178
             // 全校班级试题情况
144
             MsrClassQuestion schoolQue = questionClass(stuQuestions, question, params, schoolQ);
179
             MsrClassQuestion schoolQue = questionClass(stuQuestions, question, params, schoolQ);
238
 
273
 
239
         classQ.setScorerate(stuScoreRate);
274
         classQ.setScorerate(stuScoreRate);
240
         classQ.setScoreratec(MarkingUtil.sub(MarkingUtil.calculateRate(maxScore, qScore), MarkingUtil.calculateRate(minScore, qScore)));// 得分率差=最高得分率-最低得分率
275
         classQ.setScoreratec(MarkingUtil.sub(MarkingUtil.calculateRate(maxScore, qScore), MarkingUtil.calculateRate(minScore, qScore)));// 得分率差=最高得分率-最低得分率
241
-        classQ.setNd(MarkingUtil.div(stuScoreRate, qScore));// 难度
276
+        classQ.setNd(MarkingUtil.div(avgScore, qScore));// 难度
242
         String[] ndStr = questionNdAndQfd(params, 1, classQ.getNd());
277
         String[] ndStr = questionNdAndQfd(params, 1, classQ.getNd());
243
         classQ.setNdms(ndStr[0]);// 难度描述
278
         classQ.setNdms(ndStr[0]);// 难度描述
244
         classQ.setNdfw(ndStr[1]);// 难度范围
279
         classQ.setNdfw(ndStr[1]);// 难度范围
248
         classQ.setQfdfw(qfdStr[1]);// 区分度范围
283
         classQ.setQfdfw(qfdStr[1]);// 区分度范围
249
         classQ.setBzc(MarkingUtil.bzc(stuScores));// 标准差
284
         classQ.setBzc(MarkingUtil.bzc(stuScores));// 标准差
250
         classQ.setCyxs(MarkingUtil.div(classQ.getBzc(), avgScore));// 差异系数
285
         classQ.setCyxs(MarkingUtil.div(classQ.getBzc(), avgScore));// 差异系数
251
-        classQ.setJbzs(MarkingUtil.jbzs(stuScores, stuScoreRate));// 鉴别指数
286
+        classQ.setJbzs(MarkingUtil.jbzs(stuScores, question.getQscore()));// 鉴别指数
287
+        classQ.setZqda(schoolQ.getZqda());
252
         // 获取所有满分学生
288
         // 获取所有满分学生
253
         List<MsPaperStudentQuestion> fullStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(q.getQscore())).collect(Collectors.toList());
289
         List<MsPaperStudentQuestion> fullStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore().equals(q.getQscore())).collect(Collectors.toList());
254
-        String mfids = fullStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 满分学生id
255
-        classQ.setMfnum(fullStuQuestions.size());
256
-        classQ.setMfrate(MarkingUtil.calculateRate(classQ.getMfnum(), stunum));////正确率、满分人数占比
257
-        classQ.setMfids(mfids);
290
+        if(!fullStuQuestions.isEmpty()){
291
+            String mfids = fullStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 满分学生id
292
+            classQ.setMfnum(fullStuQuestions.size());
293
+            classQ.setMfrate(MarkingUtil.calculateRate(classQ.getMfnum(), stunum));////正确率、满分人数占比
294
+            classQ.setMfids(mfids);
295
+        }else{
296
+            classQ.setMfnum(0);
297
+            classQ.setMfrate(0.0);////正确率、满分人数占比
298
+        }
299
+        classQ.setZqrate(classQ.getMfrate());
300
+
258
         // 获取零分学生
301
         // 获取零分学生
259
         List<MsPaperStudentQuestion> lfStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore() == 0).collect(Collectors.toList());
302
         List<MsPaperStudentQuestion> lfStuQuestions = stuQuestions.stream().filter(q -> q.getStuscore() == 0).collect(Collectors.toList());
260
-        String lfids = lfStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 零分学生id
261
-        classQ.setLfnum(lfStuQuestions.size());
262
-        classQ.setLfrate(MarkingUtil.calculateRate(lfStuQuestions.size(), stunum));////零分人数占比
263
-        classQ.setLfids(lfids);
303
+        if (!lfStuQuestions.isEmpty()) {
304
+            String lfids = lfStuQuestions.stream().map(p -> p.getStudentid().toString()).collect(Collectors.joining(","));// 零分学生id
305
+            classQ.setLfnum(lfStuQuestions.size());
306
+            classQ.setLfrate(MarkingUtil.calculateRate(lfStuQuestions.size(), stunum));////零分人数占比
307
+            classQ.setLfids(lfids);
308
+        } else {
309
+            classQ.setLfnum(0);
310
+            classQ.setLfrate(0.0);////零分人数占比
311
+        }
264
         return classQ;
312
         return classQ;
265
     }
313
     }
266
 
314
 
397
                     }else{
445
                     }else{
398
                         sectionStuQuestions = groupStuQuestions.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue() && q.getStuscore() < sectionScore.getMaxvalue()).collect(Collectors.toList());
446
                         sectionStuQuestions = groupStuQuestions.stream().filter(q -> q.getStuscore() >= sectionScore.getMinvalue() && q.getStuscore() < sectionScore.getMaxvalue()).collect(Collectors.toList());
399
                     }
447
                     }
400
-                    double sectionStuSumScore = sectionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
401
-                    double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
402
-                    sqrg.setStunum(sectionStuQuestions.size());
403
-                    sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
404
-                    sqrg.setScorerate(MarkingUtil.calculateRate(sectionStuSumScore, sectionStuQuestions.size() * fullScore));
405
-                    sqrg.setAvgrate(MarkingUtil.calculateRate(sectionStuAvgScore, fullScore));
448
+                    if(!sectionStuQuestions.isEmpty()){
449
+                        double sectionStuSumScore = sectionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
450
+                        double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
451
+                        sqrg.setStunum(sectionStuQuestions.size());
452
+                        sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
453
+                        sqrg.setScorerate(MarkingUtil.calculateRate(sectionStuSumScore, sectionStuQuestions.size() * fullScore));
454
+                        sqrg.setAvgrate(MarkingUtil.calculateRate(sectionStuAvgScore, fullScore));
455
+                    }else{
456
+                        sqrg.setStunum(0);
457
+                        sqrg.setScorerate(0.0);
458
+                        sqrg.setAvgrate(0.0);
459
+                    }
406
                 }else{
460
                 }else{
407
                     sqrg.setStunum(0);
461
                     sqrg.setStunum(0);
408
                     sqrg.setScorerate(0.0);
462
                     sqrg.setScorerate(0.0);
419
                 }
473
                 }
420
                 List<String> newOptions = options.stream().map(s -> s != null && !s.isEmpty() ? s : "未作答").sorted().collect(Collectors.toList());
474
                 List<String> newOptions = options.stream().map(s -> s != null && !s.isEmpty() ? s : "未作答").sorted().collect(Collectors.toList());
421
                 for(String optionStr : newOptions){
475
                 for(String optionStr : newOptions){
422
-
423
                     MsrSubjectQuestionRankgroup optionObj = new MsrSubjectQuestionRankgroup();
476
                     MsrSubjectQuestionRankgroup optionObj = new MsrSubjectQuestionRankgroup();
424
                     optionObj.setExamid(examid);
477
                     optionObj.setExamid(examid);
425
                     optionObj.setSubjectid(subjectid);
478
                     optionObj.setSubjectid(subjectid);
479
+                    optionObj.setMptqid(mptqid);
426
                     optionObj.setQntype(1);
480
                     optionObj.setQntype(1);
427
                     optionObj.setRgroup(rankGroup.getGroupname());
481
                     optionObj.setRgroup(rankGroup.getGroupname());
428
                     optionObj.setRgtype(1);
482
                     optionObj.setRgtype(1);
436
                             optionStuQuestions = groupStuQuestions.stream().filter(q -> optionStr.equals(q.getStuanswer())).collect(Collectors.toList());
490
                             optionStuQuestions = groupStuQuestions.stream().filter(q -> optionStr.equals(q.getStuanswer())).collect(Collectors.toList());
437
                         }
491
                         }
438
 
492
 
439
-                        double optionStuSumScore = optionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
440
-                        double optionStuAvgScore = MarkingUtil.div(optionStuSumScore, optionStuQuestions.size());
493
+                        if(!optionStuQuestions.isEmpty()){
494
+                            double optionStuSumScore = optionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
495
+                            double optionStuAvgScore = MarkingUtil.div(optionStuSumScore, optionStuQuestions.size());
496
+
497
+                            optionObj.setStunum(optionStuQuestions.size());
498
+                            optionObj.setStuids(optionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
499
+                            optionObj.setScorerate(MarkingUtil.calculateRate(optionStuSumScore, optionStuQuestions.size() * fullScore));
500
+                            optionObj.setAvgrate(MarkingUtil.calculateRate(optionStuAvgScore, fullScore));
501
+                        }else{
502
+                            optionObj.setStunum(0);
503
+                            optionObj.setScorerate(0.0);
504
+                            optionObj.setAvgrate(0.0);
505
+                        }
441
 
506
 
442
-                        optionObj.setStunum(optionStuQuestions.size());
443
-                        optionObj.setStuids(optionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
444
-                        optionObj.setScorerate(MarkingUtil.calculateRate(optionStuSumScore, optionStuQuestions.size() * fullScore));
445
-                        optionObj.setAvgrate(MarkingUtil.calculateRate(optionStuAvgScore, fullScore));
446
                     }else{
507
                     }else{
447
                         optionObj.setStunum(0);
508
                         optionObj.setStunum(0);
448
                         optionObj.setScorerate(0.0);
509
                         optionObj.setScorerate(0.0);
491
             String[] userids = section.getFdids().split(",");
552
             String[] userids = section.getFdids().split(",");
492
             List<String> useridList = Arrays.asList(userids);
553
             List<String> useridList = Arrays.asList(userids);
493
             List<MsPaperStudentQuestion> sectionStuQuestions = stuQuestions.stream().filter(q -> useridList.contains(q.getStudentid().toString())).collect(Collectors.toList());
554
             List<MsPaperStudentQuestion> sectionStuQuestions = stuQuestions.stream().filter(q -> useridList.contains(q.getStudentid().toString())).collect(Collectors.toList());
555
+
556
+            MsrSubjectQuestionSection sqs = new MsrSubjectQuestionSection();
557
+            sqs.setExamid(section.getExamid());
558
+            sqs.setSubjectid(section.getSubjectid());
559
+            sqs.setMptqid(mptqid);
560
+            sqs.setFdfw(section.getFdfw());
561
+            sqs.setFdnum(section.getFdnum());
562
+            sqs.setFdids(section.getFdids());
494
             // 获取总分
563
             // 获取总分
495
-            double sumScore = sectionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
496
-            int stuNum = sectionStuQuestions.size();
497
-            // 获取平均分
498
-            double avgScore = MarkingUtil.div(sumScore, stuNum);
499
-            // 获取平均得分率
500
-            double avgScoreRate = MarkingUtil.calculateRate(avgScore, fullScore);
501
-            section.setAvgscore(avgScore);
502
-            section.setAvgrate(avgScoreRate);
564
+            if(!sectionStuQuestions.isEmpty()){
565
+                int stuNum = sectionStuQuestions.size();
566
+                // 获取总分
567
+                double sumScore = sectionStuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();
568
+                // 获取平均分
569
+                double avgScore = MarkingUtil.div(sumScore, stuNum);
570
+                // 获取平均得分率
571
+                double avgScoreRate = MarkingUtil.calculateRate(avgScore, fullScore);
572
+                sqs.setAvgscore(avgScore);
573
+                sqs.setAvgrate(avgScoreRate);
574
+            }else{
575
+                sqs.setAvgscore(0.0);
576
+                sqs.setAvgrate(0.0);
577
+            }
578
+
503
             if(qtype == 1){
579
             if(qtype == 1){
504
-                section.setQntype(qtype);//类型1小题2客观题3主观题
580
+                sqs.setQntype(qtype);//类型1小题2客观题3主观题
505
             }else{
581
             }else{
506
-                section.setQntype(qtype+1);
582
+                sqs.setQntype(qtype+1);
507
             }
583
             }
508
-            section.setMptqid(mptqid);
509
-            rtnList.add(section);
584
+            rtnList.add(sqs);
510
         }
585
         }
511
         return rtnList;
586
         return rtnList;
512
     }
587
     }
592
         classQtype.setAvgscore(avgScore);
667
         classQtype.setAvgscore(avgScore);
593
         classQtype.setBzc(MarkingUtil.bzc(stuScores));
668
         classQtype.setBzc(MarkingUtil.bzc(stuScores));
594
         classQtype.setNd(MarkingUtil.div(avgScore, schoolQtype.getFullscore()));
669
         classQtype.setNd(MarkingUtil.div(avgScore, schoolQtype.getFullscore()));
595
-        classQtype.setNdms(questionNdAndQfd(params, 1, schoolQtype.getNd())[0]);
670
+        classQtype.setNdms(questionNdAndQfd(params, 1, classQtype.getNd())[0]);
596
         classQtype.setQfd(MarkingUtil.qfd(stuScores));
671
         classQtype.setQfd(MarkingUtil.qfd(stuScores));
597
-        classQtype.setQfdms(questionNdAndQfd(params, 2, schoolQtype.getQfd())[0]);
672
+        classQtype.setQfdms(questionNdAndQfd(params, 2, classQtype.getQfd())[0]);
598
         classQtype.setMfnum(mfnum);
673
         classQtype.setMfnum(mfnum);
599
         classQtype.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
674
         classQtype.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
600
         if(mfnum > 0){
675
         if(mfnum > 0){
644
             List<MsrSubjectQuestionSection> sectionQuestions = subjectSectionQuestion(stuQuestions, subjectSectionQuestions,entry.getKey(), fullScore,null);
719
             List<MsrSubjectQuestionSection> sectionQuestions = subjectSectionQuestion(stuQuestions, subjectSectionQuestions,entry.getKey(), fullScore,null);
645
             saveSectionQuestions.addAll(sectionQuestions);
720
             saveSectionQuestions.addAll(sectionQuestions);
646
 
721
 
647
-
648
-            Integer qobjsubtype;//为了区分表中存放值
722
+            int qobjsubtype;//为了区分表中存放值
649
             if(entry.getKey() == 1){
723
             if(entry.getKey() == 1){
650
                 qobjsubtype = 11;
724
                 qobjsubtype = 11;
651
             }else{
725
             }else{
700
 
774
 
701
         Double stuSumScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();// 学生总分
775
         Double stuSumScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).sum();// 学生总分
702
         Double avgScore = MarkingUtil.div(stuSumScore, stuNum);// 平均分
776
         Double avgScore = MarkingUtil.div(stuSumScore, stuNum);// 平均分
703
-        Double stuScoreRate = MarkingUtil.div(stuSumScore, schoolObjsub.getFullscore() * stuNum);// 学生得分率
704
 
777
 
705
         MsrClassQobjsub objSub = new MsrClassQobjsub();
778
         MsrClassQobjsub objSub = new MsrClassQobjsub();
706
         objSub.setExamid(schoolObjsub.getExamid());
779
         objSub.setExamid(schoolObjsub.getExamid());
707
         objSub.setSubjectid(schoolObjsub.getSubjectid());
780
         objSub.setSubjectid(schoolObjsub.getSubjectid());
708
         objSub.setClassid(schoolObjsub.getClassid());
781
         objSub.setClassid(schoolObjsub.getClassid());
782
+        objSub.setStunum(stuNum);
709
         objSub.setQtype(schoolObjsub.getQtype());
783
         objSub.setQtype(schoolObjsub.getQtype());
710
         objSub.setFullscore(schoolObjsub.getFullscore());
784
         objSub.setFullscore(schoolObjsub.getFullscore());
711
         objSub.setMaxscore(stuScores.stream().max(Double::compareTo).orElse(0.0));
785
         objSub.setMaxscore(stuScores.stream().max(Double::compareTo).orElse(0.0));
716
         objSub.setQfd(MarkingUtil.qfd(stuScores));
790
         objSub.setQfd(MarkingUtil.qfd(stuScores));
717
         objSub.setBzc(MarkingUtil.bzc(stuScores));
791
         objSub.setBzc(MarkingUtil.bzc(stuScores));
718
         objSub.setCyxs(MarkingUtil.div(objSub.getBzc(), avgScore));
792
         objSub.setCyxs(MarkingUtil.div(objSub.getBzc(), avgScore));
719
-        objSub.setJbzs(MarkingUtil.jbzs(stuScores, stuScoreRate));
793
+        objSub.setJbzs(MarkingUtil.jbzs(stuScores, schoolObjsub.getFullscore()));
720
         objSub.setMfnum(mfnum);
794
         objSub.setMfnum(mfnum);
721
         objSub.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
795
         objSub.setMfrate(MarkingUtil.calculateRate(mfnum, stuNum));
722
         if(mfnum > 0){
796
         if(mfnum > 0){

+ 18
- 19
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

389
         if (N_Utils.isListEmpty(x)) return 0;
389
         if (N_Utils.isListEmpty(x)) return 0;
390
         int m = x.size();
390
         int m = x.size();
391
         double sum = 0;
391
         double sum = 0;
392
-        for (int i = 0; i < m; i++) {// 求和
393
-            sum += x.get(i);
392
+        for (Double aDouble : x) {// 求和
393
+            sum += aDouble;
394
         }
394
         }
395
         double dAve = sum / m;// 求平均值
395
         double dAve = sum / m;// 求平均值
396
         double dVar = 0;
396
         double dVar = 0;
430
         if (N_Utils.isListEmpty(scores)) return 0;
430
         if (N_Utils.isListEmpty(scores)) return 0;
431
 
431
 
432
         int totalCount = scores.size();
432
         int totalCount = scores.size();
433
+        Collections.sort(scores);//对集合排序
433
         int highCount = (int) Math.ceil(totalCount * 0.27); // 高分组人数
434
         int highCount = (int) Math.ceil(totalCount * 0.27); // 高分组人数
434
         int lowCount = (int) Math.ceil(totalCount * 0.27);  // 低分组人数
435
         int lowCount = (int) Math.ceil(totalCount * 0.27);  // 低分组人数
435
 
436
 
520
 
521
 
521
     // 鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
522
     // 鉴别指数 试题鉴别指数 = 前27%的学生得分率-后27%的学生得分率
522
     // 将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
523
     // 将学生按总分排序(去掉缺考的学生),取前27%、后27%的学生,分别计算在该题上的得分率,两者之差即为鉴别指数
523
-    public static double jbzs(List<Double> list, Double scoreRate) {
524
+    public static double jbzs(List<Double> list, Double qscore) {
524
         List<Double> sortList = list.stream().sorted().collect(Collectors.toList());
525
         List<Double> sortList = list.stream().sorted().collect(Collectors.toList());
525
         int size = sortList.size();
526
         int size = sortList.size();
526
-        int count = (int) (size * 0.27);// 27%学生数量
527
+
528
+        if (qscore == 0) return 0.0;
529
+        int highCount = (int) Math.ceil(size * 0.27); // 高分组人数
530
+        int lowCount = (int) Math.ceil(size * 0.27);  // 低分组人数
527
 
531
 
528
         // 前27%的学生
532
         // 前27%的学生
529
-        List<Double> topGroup = sortList.subList(0, count);
533
+        List<Double> topGroup = new ArrayList<>(sortList.subList(size - highCount, size));
530
         double topScore = topGroup.stream().mapToDouble(Double::doubleValue).sum();
534
         double topScore = topGroup.stream().mapToDouble(Double::doubleValue).sum();
531
-        double topRate = div(topScore, mul(scoreRate, count));
535
+        double topRate = div(topScore, mul(qscore, highCount));
532
 
536
 
533
         // 后27%的学生
537
         // 后27%的学生
534
-        List<Double> bottomGroup = sortList.subList(size - count, size);
538
+        List<Double> bottomGroup = new ArrayList<>(sortList.subList(0, lowCount));
535
         double bottomScore = bottomGroup.stream().mapToDouble(Double::doubleValue).sum();
539
         double bottomScore = bottomGroup.stream().mapToDouble(Double::doubleValue).sum();
536
-        double bottomRate = div(bottomScore, mul(scoreRate, count));
540
+        double bottomRate = div(bottomScore, mul(qscore, lowCount));
537
 
541
 
538
         // 鉴别指数
542
         // 鉴别指数
539
         return sub(topRate, bottomRate);
543
         return sub(topRate, bottomRate);
578
     //分数排名
582
     //分数排名
579
     public static Map<Double,Integer> fspm(List<Double> scores) {
583
     public static Map<Double,Integer> fspm(List<Double> scores) {
580
         //倒序排
584
         //倒序排
581
-        Collections.sort(scores, Collections.reverseOrder());
585
+        scores.sort(Collections.reverseOrder());
582
         // 创建一个地图来存储分数和出现次数
586
         // 创建一个地图来存储分数和出现次数
583
         Map<Double, Integer> scoreCountMap = new HashMap<>();
587
         Map<Double, Integer> scoreCountMap = new HashMap<>();
584
 
588
 
595
     //人数排名
599
     //人数排名
596
     public static Map<Integer,Integer> rspm(List<Integer> nums) {
600
     public static Map<Integer,Integer> rspm(List<Integer> nums) {
597
         //倒序排
601
         //倒序排
598
-        Collections.sort(nums, Collections.reverseOrder());
602
+        nums.sort(Collections.reverseOrder());
599
         // 创建一个地图来存储分数和出现次数
603
         // 创建一个地图来存储分数和出现次数
600
         Map<Integer, Integer> scoreCountMap = new HashMap<>();
604
         Map<Integer, Integer> scoreCountMap = new HashMap<>();
601
 
605
 
668
         return "";
672
         return "";
669
     }
673
     }
670
     public static void main(String[] args) {
674
     public static void main(String[] args) {
671
-        // List<SectionScoreVo> rtnList = fdScoreForOne(0.8);
672
-        // for (SectionScoreVo rg : rtnList) {
673
-        //     System.out.println(rg.getSectionname() + ": " + rg.getMinvalue() + "-" + rg.getMaxvalue());
674
-        // }
675
-
676
-        List<String> list = Arrays.asList("A", "BC", "C", "AB", "","D");
677
-    List<String> rtnList = list.stream().map(s -> s != null &&!s.isEmpty() ? s : "未作答").sorted().collect(Collectors.toList());
678
-        for (String rtn : rtnList) {
679
-            System.out.println(rtn);
675
+        List<String> options = Arrays.asList("A","B","D","F","","C","E");
676
+        List<String> newOptions = options.stream().map(s -> s != null && !s.isEmpty() ? s : "未作答").sorted().collect(Collectors.toList());
677
+        for (String option : newOptions) {
678
+            System.out.println(option);
680
         }
679
         }
681
     }
680
     }
682
 }
681
 }

+ 5
- 4
smarking/src/main/resources/mapper/paper/MsTemplateBlockMapper.xml View File

15
         <result column="mblockid" property="mblockid" />
15
         <result column="mblockid" property="mblockid" />
16
         <result column="blockname" property="blockname" />
16
         <result column="blockname" property="blockname" />
17
         <result column="mttype" property="mttype" />
17
         <result column="mttype" property="mttype" />
18
+        <result column="direct" property="direct" />
18
         <result column="localcoor" property="localcoor" />
19
         <result column="localcoor" property="localcoor" />
19
         <result column="pagenum" property="pagenum" />
20
         <result column="pagenum" property="pagenum" />
20
         <result column="extendcoor" property="extendcoor" />
21
         <result column="extendcoor" property="extendcoor" />
28
             <result column="mtbqorder" property="mtbqorder" />
29
             <result column="mtbqorder" property="mtbqorder" />
29
         </collection>
30
         </collection>
30
     </resultMap>
31
     </resultMap>
31
-    <!--模信息详情-->
32
+    <!--模信息详情-->
32
     <select id="listTemplateBlockQuestions" resultMap="templateBlockResultMap">
33
     <select id="listTemplateBlockQuestions" resultMap="templateBlockResultMap">
33
-        select b.mtbid,b.mblockid,b.blockname,b.mttype,b.localcoor,b.pagenum,b.extendcoor,b.scorecoor,
34
+        select b.mtbid,b.mblockid,b.blockname,b.mttype,b.direct,b.localcoor,b.pagenum,b.extendcoor,b.scorecoor,
34
         b.mtborder,q.mtbqid,q.qn,q.qlocalcoor,q.mtbqorder
35
         b.mtborder,q.mtbqid,q.qn,q.qlocalcoor,q.mtbqorder
35
         from ms_template_block b left join ms_template_block_question q on b.mtbid=q.mtbid
36
         from ms_template_block b left join ms_template_block_question q on b.mtbid=q.mtbid
36
         where b.mtid=#{mtid}
37
         where b.mtid=#{mtid}
40
         order by b.mtborder,q.mtbqorder
41
         order by b.mtborder,q.mtbqorder
41
     </select>
42
     </select>
42
 
43
 
43
-    <!--获取模主观题题块信息-->
44
+    <!--获取模主观题题块信息-->
44
     <select id="listSubjectiveBlockQuestions" resultType="java.util.Map">
45
     <select id="listSubjectiveBlockQuestions" resultType="java.util.Map">
45
-        select b.mtbid,b.mblockid,b.blockname,b.mttype,b.localcoor,b.pagenum,b.extendcoor,b.scorecoor,
46
+        select b.mtbid,b.mblockid,b.blockname,b.mttype,b.direct,b.localcoor,b.pagenum,b.extendcoor,b.scorecoor,
46
         b.mtborder from ms_template_block b where b.mtid=#{mtid} and b.mttype=2 order by b.mtborder
47
         b.mtborder from ms_template_block b where b.mtid=#{mtid} and b.mttype=2 order by b.mtborder
47
     </select>
48
     </select>
48
 </mapper>
49
 </mapper>

+ 14
- 0
smarking/src/main/resources/mapper/report/reportclass/MsrClassQuestionMapper.xml View File

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQuestionMapper">
3
 <mapper namespace="com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQuestionMapper">
4
+
5
+    <!-- 清除单次考试报告 -->
6
+    <delete id="deleteReportByExamid">
7
+        delete from msr_class_qobjsub where examid = #{examid};
8
+        delete from msr_class_qtype where examid = #{examid};
9
+        delete from msr_class_question where examid = #{examid};
10
+        delete from msr_class_question_obj where examid = #{examid};
11
+        delete from msr_student_point where examid = #{examid};
12
+        delete from msr_subject_point where examid = #{examid};
13
+        delete from msr_subject_point_section where examid = #{examid};
14
+        delete from msr_subject_question_rankgroup where examid = #{examid};
15
+        delete from msr_subject_question_section where examid = #{examid};
16
+    </delete>
17
+
4
 </mapper>
18
 </mapper>

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

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper">
3
 <mapper namespace="com.xhkjedu.smarking.mapper.report.reportother.MsrExamMapper">
4
+
5
+    <!-- 清除单次考试报告 -->
6
+    <delete id="deleteReportByExamid">
7
+        delete from msr_class_goodbad where examid = #{examid};
8
+        delete from msr_class_nearline where examid = #{examid};
9
+        delete from msr_class_qobjsub where examid = #{examid};
10
+        delete from msr_class_qtype where examid = #{examid};
11
+        delete from msr_class_question where examid = #{examid};
12
+        delete from msr_class_question_obj where examid = #{examid};
13
+        delete from msr_class_rankgroup where examid = #{examid};
14
+        delete from msr_class_rankrate where examid = #{examid};
15
+        delete from msr_class_section where examid = #{examid};
16
+        delete from msr_class_subject where examid = #{examid};
17
+        delete from msr_class_subject_grade where examid = #{examid};
18
+        delete from msr_class_top where examid = #{examid};
19
+        delete from msr_exam where examid = #{examid};
20
+        delete from msr_student where examid = #{examid};
21
+        delete from msr_student_point where examid = #{examid};
22
+        delete from msr_subject where examid = #{examid};
23
+        delete from msr_subject_class where examid = #{examid};
24
+        delete from msr_subject_point where examid = #{examid};
25
+        delete from msr_subject_point_section where examid = #{examid};
26
+        delete from msr_subject_question_rankgroup where examid = #{examid};
27
+        delete from msr_subject_question_section where examid = #{examid};
28
+    </delete>
4
 </mapper>
29
 </mapper>

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

5
     <select id="listStuScoreAndRankByExamid" resultType="com.xhkjedu.smarking.model.report.reportstu.MsrStudent">
5
     <select id="listStuScoreAndRankByExamid" resultType="com.xhkjedu.smarking.model.report.reportstu.MsrStudent">
6
         select rsid,examid,subjectid,classid,studentid,stuscore,classrank,schoolrank from msr_student where examid = #{examid}
6
         select rsid,examid,subjectid,classid,studentid,stuscore,classrank,schoolrank from msr_student where examid = #{examid}
7
     </select>
7
     </select>
8
+
9
+    <!--批量修改学生主观题、客观题分值-->
10
+    <update id="updateBatchObjSubScore">
11
+        <foreach collection="list" item="item" separator=";">
12
+            update msr_student set objscore = #{item.objscore},subscore = #{item.subscore} where rsid = #{item.rsid}
13
+        </foreach>
14
+    </update>
8
 </mapper>
15
 </mapper>

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

325
 
325
 
326
     <!--获取考试所有参考学生作答情况-->
326
     <!--获取考试所有参考学生作答情况-->
327
     <select id="listAllStuQuesByExamid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
327
     <select id="listAllStuQuesByExamid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">
328
-        select sq.mpsqid,sq.studentid,sq.subjectid,sq.mpid,sq.mpsid,sq.mptid,sq.mptqid,sq.ctype,sq.questionid,sq.qn,sq.qorder,
328
+        select sq.mpsqid,sq.studentid,sq.subjectid,sq.mpid,sq.mpsid,sq.mptqid,sq.ctype,sq.questionid,sq.qn,sq.qorder,
329
         sq.qscore,sq.answered,sq.answertype,sq.stuanswer,sq.stuscore,sq.stumerge,sq.hasgood,sq.hasbad
329
         sq.qscore,sq.answered,sq.answertype,sq.stuanswer,sq.stuscore,sq.stumerge,sq.hasgood,sq.hasbad
330
         from ms_paper_student_question sq
330
         from ms_paper_student_question sq
331
         left join ms_paper_student ps on sq.mpsid=ps.mpsid
331
         left join ms_paper_student ps on sq.mpsid=ps.mpsid

Loading…
Cancel
Save