瀏覽代碼

题库题型,难易度

tags/正式3.13.5
王宁 11 月之前
父節點
當前提交
725bfddabf

+ 188
- 119
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateQuestionService.java 查看文件

@@ -60,7 +60,7 @@ public class EReportGenerateQuestionService {
60 60
     private ERStudentComplexityMapper erStudentComplexityMapper;
61 61
 
62 62
     public void setClassQuestion(Integer examid, List<Map> subjects, List<Map> classes, EBase base){
63
-        Integer stuzero  = base.getStuzero();//0分学生是否参与统计0不统计1统计(默认)
63
+        Integer stuzero = base.getStuzero();//0分学生是否参与统计0不统计1统计(默认)
64 64
         // 考试所有学生提交试卷作答情况 2023-12-27添加0分学生是否参与统计
65 65
         List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid);
66 66
         if (N_Utils.isListNotEmpty(stulist)) {
@@ -91,15 +91,15 @@ public class EReportGenerateQuestionService {
91 91
                         // 处理题型下试题:题库显示题号时为母题的题号即order(qn是英语为顺延题号其他学科为母题号和子题排序拼接)
92 92
                         String qtypejson = panalyze.get("qnumjson").toString();// 原试卷题型分析
93 93
                         List<Map> qtypelist = JSON.parseArray(qtypejson, Map.class);
94
-                        setPaperQuestionTkQtypes(qtypelist, paperstulist, rtypelist, rqueslist, stutypelist, examPaperClassVo);
94
+                        setPaperQuestionTkQtypes(qtypelist, paperstulist, rtypelist, rqueslist, stutypelist, examPaperClassVo, stuzero);
95 95
 
96 96
                         // 处理知识点
97
-                        setEPaperQuestionPoints(panalyze, paperstulist, rpointlist, stupointlist, examPaperClassVo);
97
+                        setEPaperQuestionPoints(panalyze, paperstulist, rpointlist, stupointlist, examPaperClassVo, stuzero);
98 98
 
99 99
                         // 处理难易度
100 100
                         String complexityjson = panalyze.get("complexityjson").toString();
101 101
                         List<Map> complexitylist = JSON.parseArray(complexityjson, Map.class);
102
-                        setEPaperQuestionComplexitys(complexitylist, paperstulist, complist, stucomplist, examPaperClassVo);
102
+                        setEPaperQuestionComplexitys(complexitylist, paperstulist, complist, stucomplist, examPaperClassVo, stuzero);
103 103
 
104 104
                     } else {
105 105
                         // 处理题型及题型下试题:附件显示题号为qn(order)作为排序使用
@@ -397,7 +397,7 @@ public class EReportGenerateQuestionService {
397 397
                     } else {
398 398
                         ercq.setErroroption("");
399 399
                     }
400
-                    
400
+
401 401
                     rqueslist.add(ercq);// 单个试题统计
402 402
 
403 403
                     if (tclassmap.containsKey(classid)) {
@@ -428,11 +428,12 @@ public class EReportGenerateQuestionService {
428 428
             }
429 429
 
430 430
             Double tgavgscore = 0D;
431
+            Double tgsrate = 0D;
431 432
             if(gstunum >0){
432 433
                 tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, gstunum);// 题型下年级平均分
434
+                tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
433 435
             }
434 436
 
435
-            Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
436 437
             // 题型--班级得分
437 438
             for (Map.Entry<Integer, ERClassScoreVo> entry : tclassmap.entrySet()) {
438 439
                 ERClassScoreVo erClassScoreVo = entry.getValue();
@@ -481,7 +482,7 @@ public class EReportGenerateQuestionService {
481 482
 
482 483
     // 题型、试题、知识点、难易度--题库题型
483 484
     private void setPaperQuestionTkQtypes(List<Map> qtypelist, List<EPaperStudentQuestion> paperstulist, List<ERclassQtype> rtypelist, List<ERclassQuestion> rqueslist,
484
-                                          List<ERStudentQtype> stutypelist, ExamPaperClassVo examPaperClassVo) {
485
+                                          List<ERStudentQtype> stutypelist, ExamPaperClassVo examPaperClassVo,Integer stuzero) {
485 486
         List<Map> classes = examPaperClassVo.getClasses();
486 487
         for (int k = 0; k < qtypelist.size(); k++) {
487 488
             Map qtypemap = qtypelist.get(k);
@@ -512,15 +513,15 @@ public class EReportGenerateQuestionService {
512 513
                 qns = qns + order + ",";
513 514
 
514 515
                 // 获取集合中对应子题集合的数据
515
-                List<EPaperStudentQuestion> qgstulist = null;
516
+                List<EPaperStudentQuestion> qgstulistZero = null;
516 517
                 Integer eptqid = null;
517 518
                 if (qlevel == 1) {
518 519
                     // 单题时直接为试题id
519 520
                     eptqid = eptqids.get(0);
520 521
                     Integer teptqid = eptqid;
521
-                    qgstulist = paperstulist.stream().filter(s -> teptqid.equals(s.getEptqid())).collect(Collectors.toList());
522
+                    qgstulistZero = paperstulist.stream().filter(s -> teptqid.equals(s.getEptqid())).collect(Collectors.toList());
522 523
                 } else {
523
-                    qgstulist = new ArrayList<>();
524
+                    qgstulistZero = new ArrayList<>();
524 525
                     List<EPaperStudentQuestion> stuqlist = paperstulist.stream().filter(s -> eptqids.contains(s.getEptqid())).collect(Collectors.toList());
525 526
                     // 母子题情况,计算所有子题的和即为母题。把试题按照学生分组,分组为一组的即为
526 527
                     Map<Integer, List<EPaperStudentQuestion>> stuQuesMap = stuqlist.stream().collect(Collectors.groupingBy(EPaperStudentQuestion::getStudentid));
@@ -528,6 +529,7 @@ public class EReportGenerateQuestionService {
528 529
                         List<EPaperStudentQuestion> stuqueslist = entry.getValue();
529 530
                         EPaperStudentQuestion pfist = stuqueslist.get(0);
530 531
                         EPaperStudentQuestion pstq = new EPaperStudentQuestion();
532
+                        pstq.setStupaperscore(pfist.getStupaperscore());
531 533
                         pstq.setClassid(pfist.getClassid());
532 534
                         pstq.setStudentid(entry.getKey());
533 535
 
@@ -554,101 +556,137 @@ public class EReportGenerateQuestionService {
554 556
                         if (good > 0) {
555 557
                             pstq.setGood(1);
556 558
                         }
557
-                        qgstulist.add(pstq);
559
+                        qgstulistZero.add(pstq);
558 560
                     }
559 561
                 }
560 562
 
563
+                EPaperStudentQuestion ePaperStudentQuestion = qgstulistZero.get(0);
564
+                List<EPaperStudentQuestion> qgstulist = new ArrayList<>();
565
+                if(stuzero == 0){//如果为0:0分学生不参与统计
566
+                    qgstulist = qgstulistZero.stream().filter(s -> s.getStupaperscore() > 0).collect(Collectors.toList());
567
+                }else{
568
+                    //1:0分学生参与统计
569
+                    qgstulist.addAll(qgstulistZero);
570
+                }
571
+
561 572
                 gstunum = qgstulist.size();
562
-                Double qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
563
-                qgscore = N_Utils.formatDouble(qgscore, 1);
564
-                Double qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
565
-                qgstuscore = N_Utils.formatDouble(qgstuscore, 1);
566
-                EPaperStudentQuestion qgmaxscore = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
567
-                tgscore = ExamUtil.add(tgscore, qgscore);
568
-                tgstuscore = ExamUtil.add(tgstuscore, qgstuscore);
573
+                Double qgscore = 0D;
574
+                Double qgstuscore = 0D;
575
+                EPaperStudentQuestion qgmaxscore = null;
576
+                Double qgavgscore = 0D;
577
+                Double qgsrate = 0D;
578
+                if(gstunum > 0){
579
+                    qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
580
+                    qgscore = N_Utils.formatDouble(qgscore, 1);
581
+                    qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
582
+                    qgstuscore = N_Utils.formatDouble(qgstuscore, 1);
583
+                    qgmaxscore = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
584
+                    tgscore = ExamUtil.add(tgscore, qgscore);
585
+                    tgstuscore = ExamUtil.add(tgstuscore, qgstuscore);
586
+                    qgavgscore= N_Utils.getDoubleDivideForAvg(qgstuscore, gstunum);
587
+                    qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgstuscore, qgscore);
588
+                }
569 589
 
570 590
                 for (Map classm : classes) {
571 591
                     Integer classid = Integer.parseInt(classm.get("classid").toString());
572 592
                     List<EPaperStudentQuestion> qcstulist = qgstulist.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
573
-                    if (N_Utils.isListNotEmpty(qcstulist)) {
574
-                        int cstunum = qcstulist.size();// 班级下试题作答学生数量
575
-                        Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
593
+                    List<EPaperStudentQuestion> qcstulistZero = qgstulistZero.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
594
+
595
+                    int cstunum = qcstulist.size();// 班级下试题作答学生数量
596
+                    Double qcscore = 0D;
597
+                    Double qcstuscore = 0D;
598
+                    Double qcavgscore = 0D;
599
+                    EPaperStudentQuestion maxscore = null;
600
+                    Double qcsrate = 0D;
601
+                    if(cstunum > 0){
602
+                        qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
576 603
                         qcscore = N_Utils.formatDouble(qcscore, 1);
577
-                        Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
604
+                        qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
578 605
                         qcstuscore = N_Utils.formatDouble(qcstuscore, 1);
579
-                        Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, cstunum);
580
-                        EPaperStudentQuestion maxscore = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
606
+                        qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, cstunum);
607
+                        maxscore = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
608
+                        qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
609
+                    }
581 610
 
582
-                        if (tclassmap.containsKey(classid)) {
583
-                            ERClassScoreVo erClassScoreVo = tclassmap.get(classid);
584
-                            erClassScoreVo.setStuscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcstuscore));
585
-                            erClassScoreVo.setCscore(ExamUtil.add(erClassScoreVo.getCscore(), qcscore));
611
+                    if (tclassmap.containsKey(classid)) {
612
+                        ERClassScoreVo erClassScoreVo = tclassmap.get(classid);
613
+                        erClassScoreVo.setStuscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcstuscore));
614
+                        erClassScoreVo.setCscore(ExamUtil.add(erClassScoreVo.getCscore(), qcscore));
615
+                    } else {
616
+                        ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
617
+                        erClassScoreVo.setStunum(cstunum);
618
+                        erClassScoreVo.setStuscore(qcstuscore);
619
+                        erClassScoreVo.setCscore(qcscore);
620
+                        tclassmap.put(classid, erClassScoreVo);
621
+                    }
622
+                    for (EPaperStudentQuestion psq : qcstulistZero) {
623
+                        if (tstumap.containsKey(psq.getStudentid())) {
624
+                            ERStudentQtype sq = tstumap.get(psq.getStudentid());
625
+                            sq.setStuscore(ExamUtil.add(sq.getStuscore(), psq.getStuscore()));
586 626
                         } else {
587
-                            ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
588
-                            erClassScoreVo.setStunum(cstunum);
589
-                            erClassScoreVo.setStuscore(qcstuscore);
590
-                            erClassScoreVo.setCscore(qcscore);
591
-                            tclassmap.put(classid, erClassScoreVo);
592
-                        }
593
-                        for (EPaperStudentQuestion psq : qcstulist) {
594
-                            if (tstumap.containsKey(psq.getStudentid())) {
595
-                                ERStudentQtype sq = tstumap.get(psq.getStudentid());
596
-                                sq.setStuscore(ExamUtil.add(sq.getStuscore(), psq.getStuscore()));
597
-                            } else {
598
-                                ERStudentQtype sq = new ERStudentQtype();
599
-                                sq.setClassid(psq.getClassid());
600
-                                sq.setStudentid(psq.getStudentid());
601
-                                sq.setStuscore(psq.getStuscore());
602
-                                tstumap.put(psq.getStudentid(), sq);
603
-                            }
627
+                            ERStudentQtype sq = new ERStudentQtype();
628
+                            sq.setClassid(psq.getClassid());
629
+                            sq.setStudentid(psq.getStudentid());
630
+                            sq.setStuscore(psq.getStuscore());
631
+                            tstumap.put(psq.getStudentid(), sq);
604 632
                         }
633
+                    }
605 634
 
606
-                        // 班级单题情况
607
-                        ERclassQuestion ercq = new ERclassQuestion();
608
-                        ercq.setCtype(qcstulist.get(0).getCtype());
609
-                        ercq.setExamid(examPaperClassVo.getExamid());
610
-                        ercq.setClassid(classid);
611
-                        ercq.setSubjectid(examPaperClassVo.getSubjectid());
612
-                        ercq.setEpid(examPaperClassVo.getEpid());
613
-                        ercq.setEptqid(eptqid);
614
-                        ercq.setQuestionid(questionid);
615
-                        ercq.setQtypename(quesname);
616
-                        ercq.setComplexity(complexity);
617
-                        ercq.setScore(quesscore);
618
-                        ercq.setQn(String.join(",", qnslist));
619
-                        ercq.setQorder(Integer.parseInt(order));
620
-                        ercq.setClassscore(qcstuscore);
635
+                    // 班级单题情况
636
+                    ERclassQuestion ercq = new ERclassQuestion();
637
+                    ercq.setCtype(ePaperStudentQuestion.getCtype());
638
+                    ercq.setExamid(examPaperClassVo.getExamid());
639
+                    ercq.setClassid(classid);
640
+                    ercq.setSubjectid(examPaperClassVo.getSubjectid());
641
+                    ercq.setEpid(examPaperClassVo.getEpid());
642
+                    ercq.setEptqid(eptqid);
643
+                    ercq.setQuestionid(questionid);
644
+                    ercq.setQtypename(quesname);
645
+                    ercq.setComplexity(complexity);
646
+                    ercq.setScore(quesscore);
647
+                    ercq.setQn(String.join(",", qnslist));
648
+                    ercq.setQorder(Integer.parseInt(order));
649
+                    ercq.setClassscore(qcstuscore);
650
+                    if(maxscore == null){
651
+                        ercq.setClassmaxscore(0D);
652
+                    }else {
621 653
                         ercq.setClassmaxscore(maxscore.getStuscore());
622
-                        ercq.setClassavgscore(qcavgscore);
623
-                        Double qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
624
-                        ercq.setClasssrate(qcsrate);
625
-                        ercq.setClassratetype(ExamUtil.getScoreRateType(qcsrate));
654
+                    }
655
+                    ercq.setClassavgscore(qcavgscore);
656
+                    ercq.setClasssrate(qcsrate);
657
+                    ercq.setClassratetype(ExamUtil.getScoreRateType(qcsrate));
658
+                    if(qgmaxscore == null){
659
+                        ercq.setGrademaxscore(0D);
660
+                    }else {
626 661
                         ercq.setGrademaxscore(qgmaxscore.getStuscore());
627
-                        ercq.setGradescore(qgstuscore);
628
-                        ercq.setGradeavgscore(N_Utils.getDoubleDivideForAvg(qgstuscore, gstunum));
629
-                        ercq.setGradesrate(N_Utils.getDoubleDivideAndMulitiply(qgstuscore, qgscore));
630
-                        // 处理单选题选项情况
631
-                        Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
632
-                        ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
633
-                        ercq.setAnswerjson(stuansmap.get("answerlist").toString());
634
-                        if (N_Utils.isNotEmpty(stuansmap.get("goodlist"))) {
635
-                            ercq.setGoodstujson(stuansmap.get("goodlist").toString());
636
-                        }
637
-                        if (N_Utils.isNotEmpty(stuansmap.get("badlist"))) {
638
-                            ercq.setBadstujson(stuansmap.get("badlist").toString());
639
-                        }
640
-                        if (N_Utils.isNotEmpty(stuansmap.get("erroroption"))) {
641
-                            ercq.setErroroption(stuansmap.get("erroroption").toString());
642
-                        } else {
643
-                            ercq.setErroroption("");
644
-                        }
645
-                        rqueslist.add(ercq);// 单个试题统计
646 662
                     }
663
+                    ercq.setGradescore(qgstuscore);
664
+                    ercq.setGradeavgscore(qgavgscore);
665
+                    ercq.setGradesrate(qgsrate);
666
+                    // 处理单选题选项情况
667
+                    Map stuansmap = setPaperQuestionsForStuAnswer(qcstulistZero);
668
+                    ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
669
+                    ercq.setAnswerjson(stuansmap.get("answerlist").toString());
670
+                    if (N_Utils.isNotEmpty(stuansmap.get("goodlist"))) {
671
+                        ercq.setGoodstujson(stuansmap.get("goodlist").toString());
672
+                    }
673
+                    if (N_Utils.isNotEmpty(stuansmap.get("badlist"))) {
674
+                        ercq.setBadstujson(stuansmap.get("badlist").toString());
675
+                    }
676
+                    if (N_Utils.isNotEmpty(stuansmap.get("erroroption"))) {
677
+                        ercq.setErroroption(stuansmap.get("erroroption").toString());
678
+                    } else {
679
+                        ercq.setErroroption("");
680
+                    }
681
+                    rqueslist.add(ercq);// 单个试题统计
647 682
                 }
648 683
             }
649
-
650
-            Double tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, gstunum);// 题型下年级平均分
651
-            Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
684
+            Double tgavgscore = 0D;
685
+            Double tgsrate = 0D;
686
+            if(gstunum > 0){
687
+                tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, gstunum);// 题型下年级平均分
688
+                tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
689
+            }
652 690
 
653 691
             // 题型--班级得分
654 692
             for (Map.Entry<Integer, ERClassScoreVo> entry : tclassmap.entrySet()) {
@@ -667,8 +705,17 @@ public class EReportGenerateQuestionService {
667 705
                 eRclassQtype.setGradeavgscore(tgavgscore);
668 706
                 eRclassQtype.setGradesrate(tgsrate);
669 707
                 eRclassQtype.setClassscore(erClassScoreVo.getStuscore());
670
-                eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideForAvg(erClassScoreVo.getStuscore(), erClassScoreVo.getStunum()));
671
-                eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(), erClassScoreVo.getCscore()));
708
+                if(erClassScoreVo.getStunum() == 0){
709
+                    eRclassQtype.setClassavgscore(0D);
710
+                }else{
711
+                    eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideForAvg(erClassScoreVo.getStuscore(), erClassScoreVo.getStunum()));
712
+                }
713
+                if(erClassScoreVo.getCscore() == 0){
714
+                    eRclassQtype.setClasssrate(0D);
715
+                }else{
716
+                    eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(), erClassScoreVo.getCscore()));
717
+                }
718
+
672 719
                 eRclassQtype.setQns(qns.substring(0, qns.lastIndexOf(",")));
673 720
                 rtypelist.add(eRclassQtype);
674 721
             }
@@ -689,7 +736,7 @@ public class EReportGenerateQuestionService {
689 736
 
690 737
     // 题型、试题、知识点、难易度--知识点
691 738
     private void setEPaperQuestionPoints(Map panalyze, List<EPaperStudentQuestion> paperstulist, List<ERclassPoint> cpointlist, List<ERstudentPoint> stupointlist,
692
-                                         ExamPaperClassVo examPaperClassVo) {
739
+                                         ExamPaperClassVo examPaperClassVo,Integer stuzero) {
693 740
         // 原试卷知识点分析
694 741
         String pointjson = panalyze.get("pointjson").toString();
695 742
         List<Map> pointlist = JSON.parseArray(pointjson, Map.class);
@@ -815,6 +862,7 @@ public class EReportGenerateQuestionService {
815 862
             Map pointmap = points.get(0);
816 863
             // 说明该试题仅有一个知识点得分直接为改知识点分值
817 864
             ERPointStuScoreVo pscvo = new ERPointStuScoreVo();
865
+            pscvo.setStupaperscore(sq.getStupaperscore());
818 866
             pscvo.setClassid(sq.getClassid());
819 867
             pscvo.setStudentid(sq.getStudentid());
820 868
             pscvo.setStuscore(sq.getStuscore());
@@ -828,6 +876,7 @@ public class EReportGenerateQuestionService {
828 876
             for (int j = 0; j < points.size(); j++) {
829 877
                 Map pointmap = points.get(j);
830 878
                 ERPointStuScoreVo pscvo = new ERPointStuScoreVo();
879
+                pscvo.setStupaperscore(sq.getStupaperscore());
831 880
                 pscvo.setClassid(sq.getClassid());
832 881
                 pscvo.setStudentid(sq.getStudentid());
833 882
                 String pointid = pointmap.get("pointid").toString();
@@ -846,7 +895,7 @@ public class EReportGenerateQuestionService {
846 895
 
847 896
     // 题型、试题、知识点、难易度--难易度
848 897
     private void setEPaperQuestionComplexitys(List<Map> complexitylist, List<EPaperStudentQuestion> paperstulist, List<ERclassComplexity> complist,
849
-                                              List<ERStudentComplexity> stucomplist, ExamPaperClassVo examPaperClassVo) {
898
+                                              List<ERStudentComplexity> stucomplist, ExamPaperClassVo examPaperClassVo,Integer stuzero) {
850 899
         List<Map> classes = examPaperClassVo.getClasses();
851 900
         for (Map compmap : complexitylist) {
852 901
             Integer complexity = Integer.parseInt(compmap.get("level").toString());
@@ -869,12 +918,14 @@ public class EReportGenerateQuestionService {
869 918
                 levelstuquelist.addAll(petqqueslit);
870 919
             }
871 920
 
872
-            List<EPaperStudentQuestion> qgstulist = new ArrayList<>();// 每个学生难易度下得分
921
+            List<EPaperStudentQuestion> qgstulistZero = new ArrayList<>();// 每个学生难易度下得分
873 922
             Map<Integer, List<EPaperStudentQuestion>> stuQuesMap = levelstuquelist.stream().collect(Collectors.groupingBy(EPaperStudentQuestion::getStudentid));
874 923
             for (Map.Entry<Integer, List<EPaperStudentQuestion>> entry : stuQuesMap.entrySet()) {
875 924
                 List<EPaperStudentQuestion> stuqueslist = entry.getValue();
925
+                log.error("key:" + entry.getKey());
876 926
                 EPaperStudentQuestion pfirst = stuqueslist.get(0);
877 927
                 EPaperStudentQuestion pstq = new EPaperStudentQuestion();
928
+                pstq.setStupaperscore(pfirst.getStupaperscore());
878 929
                 pstq.setStudentid(entry.getKey());
879 930
                 pstq.setClassid(pfirst.getClassid());
880 931
                 Double qstuscore = stuqueslist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
@@ -883,7 +934,7 @@ public class EReportGenerateQuestionService {
883 934
                 qscore = N_Utils.formatDouble(qscore, 1);
884 935
                 pstq.setQscore(qscore);
885 936
                 pstq.setStuscore(qstuscore);
886
-                qgstulist.add(pstq);
937
+                qgstulistZero.add(pstq);
887 938
 
888 939
                 ERStudentComplexity stucomp = new ERStudentComplexity();
889 940
                 stucomp.setStudentid(entry.getKey());
@@ -897,41 +948,59 @@ public class EReportGenerateQuestionService {
897 948
                 stucomplist.add(stucomp);
898 949
             }
899 950
 
900
-            Double tgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();// 难易度下学生得分
901
-            tgstuscore = N_Utils.formatDouble(tgstuscore, 1);
902
-            Double tgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();// 难易度下试题总分
903
-            tgscore = N_Utils.formatDouble(tgscore, 1);
904
-            Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
905
-            Double tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, qgstulist.size());
951
+            List<EPaperStudentQuestion> qgstulist = new ArrayList<>();
952
+            if(stuzero == 0){
953
+                //如果为0:0分学生不参与统计
954
+                qgstulist = qgstulistZero.stream().filter(s -> s.getStupaperscore() > 0).collect(Collectors.toList());
955
+            }else{
956
+                qgstulist.addAll(qgstulistZero);
957
+            }
906 958
 
959
+            Double tgstuscore = 0D;
960
+            Double tgscore = 0D;
961
+            Double tgsrate = 0D;
962
+            Double tgavgscore = 0D;
963
+            if(qgstulist.size() > 0){
964
+                tgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();// 难易度下学生得分
965
+                tgstuscore = N_Utils.formatDouble(tgstuscore, 1);
966
+                tgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();// 难易度下试题总分
967
+                tgscore = N_Utils.formatDouble(tgscore, 1);
968
+                tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
969
+                tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, qgstulist.size());
970
+            }
907 971
 
908 972
             for (Map classm : classes) {
909 973
                 Integer classid = Integer.parseInt(classm.get("classid").toString());
910 974
                 List<EPaperStudentQuestion> qcstulist = qgstulist.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
911
-                if (N_Utils.isListNotEmpty(qcstulist)) {
912
-                    Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
975
+                // List<EPaperStudentQuestion> qcstulistZero = qgstulistZero.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
976
+                Double qcscore = 0D;
977
+                Double qcstuscore = 0D;
978
+                Double qcavgscore = 0D;
979
+                Double qcrate = 0D;
980
+                if (N_Utils.isListNotEmpty(qcstulist) && qcstulist.size() > 0) {
981
+                    qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
913 982
                     qcscore = N_Utils.formatDouble(qcscore, 1);
914
-                    Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
983
+                    qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
915 984
                     qcstuscore = N_Utils.formatDouble(qcstuscore, 1);
916
-                    Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, qcstulist.size());
917
-
918
-                    ERclassComplexity erc = new ERclassComplexity();
919
-                    erc.setExamid(examPaperClassVo.getExamid());
920
-                    erc.setSubjectid(examPaperClassVo.getSubjectid());
921
-                    erc.setEpid(examPaperClassVo.getEpid());
922
-                    erc.setClassid(classid);
923
-                    erc.setComplexity(complexity);
924
-                    erc.setScore(score);
925
-                    erc.setSrate(srate);
926
-                    erc.setGradescore(tgstuscore);
927
-                    erc.setGradeavgscore(tgavgscore);
928
-                    erc.setGradesrate(tgsrate);
929
-                    erc.setClassscore(qcstuscore);
930
-                    erc.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore));
931
-                    erc.setClassavgscore(qcavgscore);
932
-                    erc.setQns(qns.substring(0, qns.lastIndexOf(",")));
933
-                    complist.add(erc);
985
+                    qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, qcstulist.size());
986
+                    qcrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
934 987
                 }
988
+                ERclassComplexity erc = new ERclassComplexity();
989
+                erc.setExamid(examPaperClassVo.getExamid());
990
+                erc.setSubjectid(examPaperClassVo.getSubjectid());
991
+                erc.setEpid(examPaperClassVo.getEpid());
992
+                erc.setClassid(classid);
993
+                erc.setComplexity(complexity);
994
+                erc.setScore(score);
995
+                erc.setSrate(srate);
996
+                erc.setGradescore(tgstuscore);
997
+                erc.setGradeavgscore(tgavgscore);
998
+                erc.setGradesrate(tgsrate);
999
+                erc.setClassscore(qcstuscore);
1000
+                erc.setClasssrate(qcrate);
1001
+                erc.setClassavgscore(qcavgscore);
1002
+                erc.setQns(qns.substring(0, qns.lastIndexOf(",")));
1003
+                complist.add(erc);
935 1004
             }
936 1005
         }
937 1006
     }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/report/ERPointStuScoreVo.java 查看文件

@@ -21,4 +21,6 @@ public class ERPointStuScoreVo {
21 21
     private Double stuscore;//学生得分
22 22
 
23 23
     private String eptqids;//试题id
24
+
25
+    private Double stupaperscore;//学生试卷得分
24 26
 }

Loading…
取消
儲存