|
@@ -24,6 +24,7 @@ import com.xhkjedu.smarking.vo.report.reportsubject.PointLevelVo;
|
24
|
24
|
import com.xhkjedu.smarking.vo.report.reportsubject.PointParams;
|
25
|
25
|
import com.xhkjedu.smarking.vo.report.reportsubject.PointVo;
|
26
|
26
|
import com.xhkjedu.utils.N_Utils;
|
|
27
|
+import org.apache.commons.beanutils.BeanUtils;
|
27
|
28
|
import org.springframework.stereotype.Service;
|
28
|
29
|
|
29
|
30
|
import javax.annotation.Resource;
|
|
@@ -51,7 +52,7 @@ public class ReportGeneratePointService {
|
51
|
52
|
|
52
|
53
|
//知识点分析,题库知识点按母题分析
|
53
|
54
|
public void generatePoint(List<MsPaperStudentQuestion> stuSubjectQuestions, List<MsPaperQtypeQuestion> qtypeQuestions,List<MsClassStudent> classStus,
|
54
|
|
- List<MsrStudent> sturanks, Integer examid, String subjectid, Integer mpid, Double pscore) {
|
|
55
|
+ List<MsrStudent> sturanks, Integer examid, String subjectid, Integer mpid, Double pscore) throws Exception {
|
55
|
56
|
//获取试卷分析
|
56
|
57
|
MsPaperAnalyze paperAnalyze = msPaperAnalyzeMapper.getObjByMpId(mpid);
|
57
|
58
|
if(paperAnalyze == null || N_Utils.isEmpty(paperAnalyze.getPointjson())) return;
|
|
@@ -444,33 +445,42 @@ public class ReportGeneratePointService {
|
444
|
445
|
//层级知识点分析--顶层和上层知识点是知识点本身
|
445
|
446
|
private void pointTopAndUpForSelf(PointLevelVo firstPoint,Integer pointlevel,Map<String, List<MsrSubjectPoint>> subjectPointMap,
|
446
|
447
|
Map<String, List<MsrSubjectPointSection>> pointSectionMap,Map<String, List<MsrSubjectPointRankgroup>> pointRankgroupMap,
|
447
|
|
- List<MsrSubjectPoint> saveSubjectPoints,List<MsrSubjectPointSection> savePointSections, List<MsrSubjectPointRankgroup> savePointRankgroups){
|
|
448
|
+ List<MsrSubjectPoint> saveSubjectPoints,List<MsrSubjectPointSection> savePointSections, List<MsrSubjectPointRankgroup> savePointRankgroups) throws Exception {
|
448
|
449
|
|
449
|
450
|
//知识点分析
|
450
|
451
|
List<MsrSubjectPoint> subpoints = subjectPointMap.get(firstPoint.getPointid());
|
451
|
452
|
for(MsrSubjectPoint subpoint : subpoints){
|
452
|
|
- subpoint.setPointid(firstPoint.getTopPointid());
|
453
|
|
- subpoint.setPointname(firstPoint.getPointname());
|
454
|
|
- subpoint.setPointlevel(pointlevel);
|
455
|
|
- saveSubjectPoints.add(subpoint);
|
|
453
|
+
|
|
454
|
+ MsrSubjectPoint subpointvo = new MsrSubjectPoint();
|
|
455
|
+ BeanUtils.copyProperties(subpointvo, subpoint);
|
|
456
|
+ subpointvo.setPointid(firstPoint.getTopPointid());
|
|
457
|
+ subpointvo.setPointname(firstPoint.getPointname());
|
|
458
|
+ subpointvo.setPointlevel(pointlevel);
|
|
459
|
+ subpointvo.setFullscore(subpoint.getFullscore());
|
|
460
|
+
|
|
461
|
+ saveSubjectPoints.add(subpointvo);
|
456
|
462
|
}
|
457
|
463
|
|
458
|
464
|
//分数分段
|
459
|
465
|
List<MsrSubjectPointSection> sepoints = pointSectionMap.get(firstPoint.getPointid());
|
460
|
466
|
for(MsrSubjectPointSection sepoint : sepoints) {
|
461
|
|
- sepoint.setPointid(firstPoint.getTopPointid());
|
462
|
|
- sepoint.setPointname(firstPoint.getPointname());
|
463
|
|
- sepoint.setPointlevel(pointlevel);
|
464
|
|
- savePointSections.add(sepoint);
|
|
467
|
+ MsrSubjectPointSection sepointvo = new MsrSubjectPointSection();
|
|
468
|
+ BeanUtils.copyProperties(sepointvo, sepoint);
|
|
469
|
+ sepointvo.setPointid(firstPoint.getTopPointid());
|
|
470
|
+ sepointvo.setPointname(firstPoint.getPointname());
|
|
471
|
+ sepointvo.setPointlevel(pointlevel);
|
|
472
|
+ savePointSections.add(sepointvo);
|
465
|
473
|
}
|
466
|
474
|
|
467
|
475
|
//分组分析
|
468
|
476
|
List<MsrSubjectPointRankgroup> rgpoints = pointRankgroupMap.get(firstPoint.getPointid());
|
469
|
477
|
for(MsrSubjectPointRankgroup rgpoint : rgpoints) {
|
470
|
|
- rgpoint.setPointid(firstPoint.getTopPointid());
|
471
|
|
- rgpoint.setPointname(firstPoint.getPointname());
|
472
|
|
- rgpoint.setPointlevel(pointlevel);
|
473
|
|
- savePointRankgroups.add(rgpoint);
|
|
478
|
+ MsrSubjectPointRankgroup rgpointvo = new MsrSubjectPointRankgroup();
|
|
479
|
+ BeanUtils.copyProperties(rgpointvo, rgpoint);
|
|
480
|
+ rgpointvo.setPointid(firstPoint.getTopPointid());
|
|
481
|
+ rgpointvo.setPointname(firstPoint.getPointname());
|
|
482
|
+ rgpointvo.setPointlevel(pointlevel);
|
|
483
|
+ savePointRankgroups.add(rgpointvo);
|
474
|
484
|
}
|
475
|
485
|
}
|
476
|
486
|
//层级知识点分析--顶层和上层知识点下多知识点分析
|
|
@@ -580,134 +590,5 @@ public class ReportGeneratePointService {
|
580
|
590
|
saveStuPoints.add(stuPoint);
|
581
|
591
|
}
|
582
|
592
|
}
|
583
|
|
-
|
584
|
|
- }
|
585
|
|
- //处理顶级、上级知识点---已不用
|
586
|
|
- private void handlePointLevel(Map<String,List<PointLevelVo>> pointMap,List<PointQuestionVo> pointques,List<PointStudentVo> schoolStuPoints,Integer pointlevel,List<MsrSubjectPointSection> pointSections,
|
587
|
|
- List<MsPaperQtypeQuestion> qtypeQuestions,List<MsClassStudent> classStus,Integer examid,String subjectid,List<MsrStudent> sturanks,
|
588
|
|
- List<MsrSubjectPoint> saveSubjectPoints,List<MsrSubjectPointSection> savePointSections,List<MsrSubjectPointRankgroup> savePointRankgroups){
|
589
|
|
-
|
590
|
|
- //科目班级知识点情况
|
591
|
|
- Map<String, List<MsrSubjectPoint>> subjectPointMap = saveSubjectPoints.stream().filter(p -> p.getPointlevel()==3).collect(Collectors.groupingBy(MsrSubjectPoint::getPointid));
|
592
|
|
- //知识点学科总分区间
|
593
|
|
- Map<String, List<MsrSubjectPointSection>> pointSectionMap = savePointSections.stream().filter(p -> p.getPointlevel()==3).collect(Collectors.groupingBy(MsrSubjectPointSection::getPointid));
|
594
|
|
- //知识点分组
|
595
|
|
- Map<String, List<MsrSubjectPointRankgroup>> pointRankgroupMap = savePointRankgroups.stream().filter(p -> p.getPointlevel()==3).collect(Collectors.groupingBy(MsrSubjectPointRankgroup::getPointid));
|
596
|
|
-
|
597
|
|
- //处理上层知识点
|
598
|
|
- for(Map.Entry<String,List<PointLevelVo>> entry : pointMap.entrySet()){
|
599
|
|
- List<PointLevelVo> pointLevels = entry.getValue();
|
600
|
|
- PointLevelVo firstPoint = pointLevels.get(0);
|
601
|
|
- if(pointLevels.size() ==1){
|
602
|
|
- //说明知识的上层知识点是知识点本身或者仅有一个知识点,则上层知识点分析和他本身的分析一致
|
603
|
|
- //科目知识点
|
604
|
|
- List<MsrSubjectPoint> subpoints = subjectPointMap.get(firstPoint.getPointid());
|
605
|
|
- for(MsrSubjectPoint subpoint : subpoints){
|
606
|
|
- subpoint.setPointid(firstPoint.getTopPointid());
|
607
|
|
- subpoint.setPointname(firstPoint.getPointname());
|
608
|
|
- subpoint.setPointlevel(pointlevel);
|
609
|
|
- saveSubjectPoints.add(subpoint);
|
610
|
|
- }
|
611
|
|
-
|
612
|
|
- //分数分段
|
613
|
|
- List<MsrSubjectPointSection> sepoints = pointSectionMap.get(firstPoint.getPointid());
|
614
|
|
- for(MsrSubjectPointSection sepoint : sepoints) {
|
615
|
|
- sepoint.setPointid(firstPoint.getTopPointid());
|
616
|
|
- sepoint.setPointname(firstPoint.getPointname());
|
617
|
|
- sepoint.setPointlevel(pointlevel);
|
618
|
|
- savePointSections.add(sepoint);
|
619
|
|
- }
|
620
|
|
-
|
621
|
|
- //分组分析
|
622
|
|
- List<MsrSubjectPointRankgroup> rgpoints = pointRankgroupMap.get(firstPoint.getPointid());
|
623
|
|
- for(MsrSubjectPointRankgroup rgpoint : rgpoints) {
|
624
|
|
- rgpoint.setPointid(firstPoint.getTopPointid());
|
625
|
|
- rgpoint.setPointname(firstPoint.getPointname());
|
626
|
|
- rgpoint.setPointlevel(pointlevel);
|
627
|
|
- savePointRankgroups.add(rgpoint);
|
628
|
|
- }
|
629
|
|
- }else{
|
630
|
|
- //上层知识点所包含的知识点id集合
|
631
|
|
- List<String> pointids = pointLevels.stream().map(PointLevelVo::getPointid).collect(Collectors.toList());
|
632
|
|
- //知识点下试题,以及学生得分
|
633
|
|
- List<PointQuestionVo> levelPointQues = pointques.stream().filter(q -> pointids.contains(q.getPointid())).collect(Collectors.toList());
|
634
|
|
- List<PointStudentVo> levelStuPoints = schoolStuPoints.stream().filter(q -> pointids.contains(q.getPointid())).collect(Collectors.toList());
|
635
|
|
- List<QuestionPointVo> ques = new ArrayList<>();//知识点下所有试题
|
636
|
|
- for(PointQuestionVo point : levelPointQues) {
|
637
|
|
- ques.addAll(point.getQues());
|
638
|
|
- }
|
639
|
|
-
|
640
|
|
- List<Integer> mptqids = ques.stream().map(QuestionPointVo::getMptqid).distinct().collect(Collectors.toList());
|
641
|
|
- //获取试题对应的qn
|
642
|
|
- List<MsPaperQtypeQuestion> qtypeQues = qtypeQuestions.stream().filter(q -> mptqids.contains(q.getMptqid())).collect(Collectors.toList());
|
643
|
|
- String qnStr = qtypeQues.stream().map(q -> q.getMptqn() + "." + q.getQn()).collect(Collectors.joining(","));
|
644
|
|
- String mptqidStr = mptqids.stream().map(Object::toString).collect(Collectors.joining(","));
|
645
|
|
- double pointscore = levelPointQues.stream().mapToDouble(PointQuestionVo::getScore).sum();
|
646
|
|
- pointscore = N_Utils.formatDouble(pointscore, 1);
|
647
|
|
- //知识点多个试题,处理成单个学生试题总分值
|
648
|
|
- List<PointStudentVo> pointStuScores = new ArrayList<>();//处理成学生知识点形式,后续计算使用
|
649
|
|
- Map<Integer, List<PointStudentVo>> pointStuMap = levelStuPoints.stream().collect(Collectors.groupingBy(PointStudentVo::getStudentid));
|
650
|
|
- for (Map.Entry<Integer, List<PointStudentVo>> psentry : pointStuMap.entrySet()){
|
651
|
|
- List<PointStudentVo> pstuScores = psentry.getValue();
|
652
|
|
- double stuScore = pstuScores.stream().mapToDouble(PointStudentVo::getStuscore).sum();
|
653
|
|
- stuScore = N_Utils.formatDouble(stuScore, 1);
|
654
|
|
- PointStudentVo pstuvo = new PointStudentVo();
|
655
|
|
- pstuvo.setStudentid(psentry.getKey());
|
656
|
|
- pstuvo.setPointid(entry.getKey());
|
657
|
|
- pstuvo.setStuscore(stuScore);
|
658
|
|
- pstuvo.setScore(pointscore);
|
659
|
|
- pointStuScores.add(pstuvo);
|
660
|
|
- }
|
661
|
|
-
|
662
|
|
- MsrSubjectPoint subjectPoint = new MsrSubjectPoint();
|
663
|
|
- subjectPoint.setExamid(examid);
|
664
|
|
- subjectPoint.setSubjectid(subjectid);
|
665
|
|
- subjectPoint.setPointid(firstPoint.getTopPointid());
|
666
|
|
- subjectPoint.setClassid(0);
|
667
|
|
- subjectPoint.setPointname(firstPoint.getTopPointid());
|
668
|
|
- subjectPoint.setFullscore(pointscore);
|
669
|
|
- subjectPoint.setPointlevel(pointlevel);
|
670
|
|
- subjectPoint.setMptqids(mptqidStr);
|
671
|
|
- subjectPoint.setQns(qnStr);
|
672
|
|
-
|
673
|
|
- //校知识点分析
|
674
|
|
- MsrSubjectPoint schoolPoint = pointLevelClass(pointStuScores, subjectPoint);
|
675
|
|
- saveSubjectPoints.add(schoolPoint);
|
676
|
|
-
|
677
|
|
- //班级知识点分析
|
678
|
|
- List<Integer> classIds = classStus.stream().map(MsClassStudent::getClassid).distinct().collect(Collectors.toList());
|
679
|
|
- List<MsrSubjectPoint> classPoints = new ArrayList<>();
|
680
|
|
- for (Integer classid : classIds) {
|
681
|
|
- // 获取班级下学生id
|
682
|
|
- List<Integer> classStuIds = classStus.stream().filter(c -> c.getClassid().equals(classid)).map(MsClassStudent::getStudentid).collect(Collectors.toList());
|
683
|
|
- // 获取班级下学生试题
|
684
|
|
- List<PointStudentVo> classStuPoints = pointStuScores.stream().filter(q -> classStuIds.contains(q.getStudentid())).collect(Collectors.toList());
|
685
|
|
- subjectPoint.setClassid(classid);
|
686
|
|
- MsrSubjectPoint classPoint = pointLevelClass(classStuPoints, subjectPoint);
|
687
|
|
- classPoints.add(classPoint);
|
688
|
|
- }
|
689
|
|
-
|
690
|
|
- // 班级知识点保存后,要对平均分排序
|
691
|
|
- List<Double> avgScores = classPoints.stream().map(MsrSubjectPoint::getAvgscore).collect(Collectors.toList());
|
692
|
|
- Map<Double,Integer> avgScoreRankMap = MarkingUtil.fspm(avgScores);
|
693
|
|
- for(MsrSubjectPoint sp : classPoints){
|
694
|
|
- sp.setAvgrank(avgScoreRankMap.get(sp.getAvgscore()));
|
695
|
|
- }
|
696
|
|
- saveSubjectPoints.addAll(classPoints);
|
697
|
|
-
|
698
|
|
- PointQuestionVo pqvo = new PointQuestionVo();
|
699
|
|
- pqvo.setPointid(firstPoint.getTopPointid());
|
700
|
|
- pqvo.setPointname(firstPoint.getPointname());
|
701
|
|
- pqvo.setScore(pointscore);
|
702
|
|
-
|
703
|
|
- //知识点结构与总分的相关性(三级知识点)
|
704
|
|
- // List<MsrSubjectPointSection> pointSecs = pointSection(pointStuScores, pointSections, PointParams);
|
705
|
|
- // savePointSections.addAll(pointSecs);
|
706
|
|
-
|
707
|
|
- //知识点考生分组分析
|
708
|
|
- List<MsrSubjectPointRankgroup> pointRankg = pointRankGroup(pointStuScores,sturanks, pqvo, examid, subjectid, pointlevel);
|
709
|
|
- savePointRankgroups.addAll(pointRankg);
|
710
|
|
- }
|
711
|
|
- }
|
712
|
593
|
}
|
713
|
594
|
}
|