소스 검색

题块批阅

名次和比例分析
ywx
雍文秀 3 주 전
부모
커밋
18a4547a88

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassRankrate.java 파일 보기

@@ -37,4 +37,6 @@ public class MsrClassRankrate extends BaseBean {
37 37
     private Integer rnum;
38 38
     //占比
39 39
     private Double rrate;
40
+    //学生id字符串
41
+    private String stuids;
40 42
 }

+ 7
- 12
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java 파일 보기

@@ -506,20 +506,20 @@ public class MsPaperCheckTeacherTaskService {
506 506
                 //题块批阅信息
507 507
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
508 508
                 block.setMpsbid(mpsbid);
509
-                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergescore).collect(Collectors.joining(";"));
510
-                String[] cores;
509
+                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergestuscore).collect(Collectors.joining(";"));
510
+                String[] cores = new String[0];
511 511
                 if (type.equals(1)) {
512 512
                     block.setFirstcid(handleid);
513 513
                     block.setFirstcime(N_Utils.getSecondTimestamp());
514 514
                     block.setFirstccore(arbitratescore);
515 515
                     block.setFirstccores(stuscores);
516
-                    cores = param.getSecondcscores().split(";");
516
+                    if (corrected) cores = result.getSecondcscores().split(";");
517 517
                 } else {
518 518
                     block.setSecondcid(handleid);
519 519
                     block.setSecondctime(N_Utils.getSecondTimestamp());
520 520
                     block.setSecondcscore(arbitratescore);
521 521
                     block.setSecondcscores(stuscores);
522
-                    cores = param.getFirstccores().split(";");
522
+                    if (corrected) cores = result.getFirstccores().split(";");
523 523
                 }
524 524
                 List<MsPaperStudentQuestion> studentQuestions = new ArrayList<>();
525 525
                 for (int j = 0; j < questions.size(); j++) {
@@ -555,16 +555,11 @@ public class MsPaperCheckTeacherTaskService {
555 555
                         String[] mergescores = question.getMergescore().split(",");
556 556
                         String[] mergestuscore = question.getMergestuscore().split(",");
557 557
                         double[] scores = new double[mergestuscore.length];
558
-                        int last = mergestuscore.length - 1;
559
-                        double score = 0;
560 558
                         for (int i = 0; i < mergestuscore.length; i++) {
561
-                            scores[i] = MarkingUtil.mul(MarkingUtil.div(mergestuscore[i], qscore), stuscore);
562
-                            score = MarkingUtil.add(score, scores[i]);
563
-                            if (i == last) {
564
-                                scores[i] = MarkingUtil.sub(stuscore, score);
565
-                            }
559
+                            scores[i]=MarkingUtil.objToDouble(mergestuscore[i]);
566 560
                         }
567
-                        String[] cores2 = cores[j].split(",");
561
+                        String[] cores2 = new String[0];
562
+                        if (corrected) cores2 = cores[j].split(",");
568 563
                         for (int i = 0; i < mptqids.length; i++) {
569 564
                             MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
570 565
                             studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));

+ 156
- 17
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrExamService.java 파일 보기

@@ -60,6 +60,10 @@ public class MsrExamService {
60 60
     private MsrClassTopMapper msrClassTopMapper;
61 61
     @Resource
62 62
     private MsrClassSubjectGradeMapper msrClassSubjectGradeMapper;
63
+    @Resource
64
+    private MsrClassRankgroupMapper msrClassRankgroupMapper;
65
+    @Resource
66
+    private MsrClassRankrateMapper msrClassRankrateMapper;
63 67
 
64 68
 
65 69
     /**
@@ -345,15 +349,141 @@ public class MsrExamService {
345 349
         msrClassSubjectMapper.insertList(msrClassSubjects);
346 350
         msrClassTopMapper.insertList(msrClassTops);
347 351
 
348
-        saveClassSubjectGrade(examid, "scorerate", "zh", msrStudents);//综合报告-班级学科四率等级分析
349
-        saveClassSubjectGrade(examid, "scorerate", "xj", msrStudents);//校级报告-班级学科四率等级分析
352
+        saveClassSubjectGrade(examid, "zh", msrStudents);//综合报告-班级学科四率等级分析
353
+        saveClassSubjectGrade(examid, "xj", msrStudents);//校级报告-班级学科四率等级分析
354
+        saveClassRankGroup(examid, msrStudents);//学科报告-班级学科名次分组分析
355
+        saveClassRankRate(examid, msrStudents);//综合报表-名次和比例分析
350 356
 
351 357
         examMapper.updateExamState(examid, 3);
352 358
     }
353 359
 
360
+    //学科报告-班级学科名次分组分析
361
+    private void saveClassRankGroup(Integer examid, List<MsrStudent> msrStudents) {
362
+        List<MsrClassRankgroup> classRankGroups = new ArrayList<>();
363
+        int groupNum = 10;
364
+        String subjectid;
365
+        Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
366
+        for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
367
+            String key = entry.getKey();
368
+            Integer classid = N_Utils.obj2Int(key.split("_")[0]);
369
+            subjectid = key.split("_")[1];
370
+            List<MsrStudent> studentList = entry.getValue();
371
+            int maxRank = studentList.stream().mapToInt(MsrStudent::getSchoolrank).summaryStatistics().getMax();
372
+            List<RankGroupVo> groups = MarkingUtil.rankGroup(maxRank, groupNum);
373
+            for (RankGroupVo group : groups) {
374
+                int maxvalue = group.getMaxvalue();
375
+                int minvalue = group.getMinvalue();
376
+                List<MsrStudent> qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(minvalue) >= 0 && s.getSchoolrank().compareTo(maxvalue) <= 0).collect(Collectors.toList());
377
+                MsrClassRankgroup cg = new MsrClassRankgroup();
378
+                cg.setExamid(examid);
379
+                cg.setClassid(classid);
380
+                cg.setSubjectid(subjectid);
381
+                cg.setRname(group.getGroupname());
382
+                cg.setRnum(qjstudents.size());
383
+                String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
384
+                cg.setStuids(stuids);
385
+                classRankGroups.add(cg);
386
+            }
387
+        }
388
+        msrClassRankgroupMapper.insertList(classRankGroups);
389
+    }
390
+
391
+    //综合报表-名次和比例分析
392
+    private void saveClassRankRate(Integer examid, List<MsrStudent> msrStudents) {
393
+        List<MsrReportparam> params = getMsrReportParams(examid, "rankrate", "zh");
394
+        Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
395
+        Map<String, Integer> tMap = new HashMap<>();
396
+        for (MsrReportparam param : params) {
397
+            String subjectid = param.getSubjectid();
398
+            qjMap.put(subjectid, JSON.parseArray(param.getSzjson(), SzJsonVo.class));
399
+            tMap.put(subjectid, param.getRptype());
400
+        }
401
+        List<MsrClassRankrate> classRankrates = new ArrayList<>();
402
+        String subjectid;
403
+        int totalnum;
404
+        Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
405
+        for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
406
+            String key = entry.getKey();
407
+            Integer classid = N_Utils.obj2Int(key.split("_")[0]);
408
+            subjectid = key.split("_")[1];
409
+            List<SzJsonVo> list = qjMap.get(subjectid);
410
+            Integer rptype = tMap.get(subjectid);
411
+            List<MsrStudent> studentList = entry.getValue();
412
+            if (rptype.equals(3)) {
413
+                studentList = studentList.stream().sorted(Comparator.comparing(MsrStudent::getStuscore).reversed()).collect(Collectors.toList());
414
+            }
415
+            totalnum = studentList.size();//区间总人数
416
+            Double max = null;
417
+            Integer minRank = null;
418
+            int minIndex = 0;
419
+            Object minRate = null;
420
+            for (SzJsonVo rg : list) {
421
+                Object djvalue = rg.getDjvalue();
422
+                List<MsrStudent> qjstudents;
423
+                String ztname;
424
+                String ctname;
425
+                if (rptype.equals(1)) {//按名次
426
+                    ztname = "前" + djvalue + "名";
427
+                    Integer rank = N_Utils.obj2Int(djvalue);
428
+                    if (minRank == null) {
429
+                        qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) >= 0).collect(Collectors.toList());
430
+                    } else {
431
+                        Integer finalMinRank = minRank;
432
+                        qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(finalMinRank) >= 0 && s.getSchoolrank().compareTo(rank) < 0).collect(Collectors.toList());
433
+                    }
434
+                    minRank = rank;
435
+                    double minScore = N_Utils.handleInfinity(qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
436
+                    ctname = ">=" + minScore + "分";
437
+                } else if (rptype.equals(2)) {//按分数
438
+                    ztname = ">=" + djvalue + "分";
439
+                    Double score = MarkingUtil.objToDouble(djvalue);
440
+                    if (max == null) {
441
+                        qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
442
+                    } else {
443
+                        Double finalMax = max;
444
+                        qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0 && s.getStuscore().compareTo(finalMax) < 0).collect(Collectors.toList());
445
+                    }
446
+                    max = score;
447
+                    minRank = qjstudents.stream().mapToInt(MsrStudent::getSchoolrank).summaryStatistics().getMin();
448
+                    ctname = "前" + minRank + "名";
449
+                } else {//按比例
450
+                    if (minIndex == 0) {
451
+                        ztname = "前" + djvalue + "%";
452
+                    } else {
453
+                        ztname = "前" + minRate + "%-" + djvalue + "%";
454
+                    }
455
+                    int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, djvalue));
456
+                    if (index > totalnum) index = totalnum;
457
+                    qjstudents = studentList.subList(minIndex, index);
458
+                    minIndex = index;
459
+                    minRate = djvalue;
460
+                    DoubleSummaryStatistics statistics = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics();
461
+                    double minScore = N_Utils.handleInfinity(statistics.getMin());
462
+                    double maxScore = N_Utils.handleInfinity(statistics.getMax());
463
+                    ctname = "[" + minScore + "-" + maxScore + "]";
464
+                }
465
+                int qjnum = qjstudents.size();
466
+                MsrClassRankrate rankrate = new MsrClassRankrate();
467
+                rankrate.setExamid(examid);
468
+                rankrate.setSubjectid(subjectid);
469
+                rankrate.setClassid(classid);
470
+                rankrate.setStunum(totalnum);
471
+                rankrate.setRtype(rptype);
472
+                rankrate.setZtname(ztname);
473
+                rankrate.setCtname(ctname);
474
+                rankrate.setRnum(qjnum);
475
+                rankrate.setRrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
476
+                String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
477
+                rankrate.setStuids(stuids);
478
+                classRankrates.add(rankrate);
479
+            }
480
+        }
481
+        msrClassRankrateMapper.insertList(classRankrates);
482
+    }
483
+
354 484
     //班级学科四率等级分析
355
-    private void saveClassSubjectGrade(Integer examid, String rpbelong, String reportcode, List<MsrStudent> msrStudents) {
356
-        Map<String, List<SzJsonVo>> qjMap = getReportParams(examid, rpbelong, reportcode);
485
+    private void saveClassSubjectGrade(Integer examid, String reportcode, List<MsrStudent> msrStudents) {
486
+        Map<String, List<SzJsonVo>> qjMap = getReportParams(examid, "scorerate", reportcode);
357 487
         List<MsrClassSubjectGrade> msrClassSubjectGrades = new ArrayList<>();//班级学科分析
358 488
         String subjectid;
359 489
         int totalnum;
@@ -367,13 +497,10 @@ public class MsrExamService {
367 497
             List<MsrStudent> studentList = entry.getValue();
368 498
             totalnum = studentList.size();//区间总人数
369 499
             Double fullscore1 = studentList.get(0).getFullscore();
370
-            List<RankGroupVo> fdScore = MarkingUtil.fdScore(fullscore1, N_Utils.obj2Int(list.get(0).getDjvalue()));
371
-            for (RankGroupVo rg : fdScore) {
372
-                int minscore = rg.getMinvalue();
373
-                int maxscore = rg.getMaxvalue();
374
-                String qjname = rg.getGroupname();
375
-                double min = MarkingUtil.objToDouble(minscore);
376
-                double max = MarkingUtil.objToDouble(maxscore);
500
+            for (SzJsonVo rg : list) {
501
+                String qjname = rg.getDjkey();
502
+                double min = MarkingUtil.mul(rg.getMinvalue(), fullscore1);
503
+                double max = MarkingUtil.mul(rg.getMaxvalue(), fullscore1);
377 504
                 List<MsrStudent> qjstudents;
378 505
                 if (fullscore1.compareTo(max) == 0) {
379 506
                     qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(min) >= 0).collect(Collectors.toList());
@@ -389,8 +516,9 @@ public class MsrExamService {
389 516
                 classSubjectGrade.setRange(qjname);
390 517
                 classSubjectGrade.setRangenum(qjnum);
391 518
                 classSubjectGrade.setRangerate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
392
-                //double qjavg = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
393
-                //classSubjectGrade.setQjavgrate(N_Utils.getDoubleDivideAndMulitiply(qjavg, fullscore1));
519
+                double qjavg = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage();
520
+                classSubjectGrade.setDjscore(qjavg);
521
+                classSubjectGrade.setDjrate(N_Utils.getDoubleDivideAndMulitiply(qjavg, fullscore1));
394 522
                 String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
395 523
                 classSubjectGrade.setStuids(stuids);
396 524
                 msrClassSubjectGrades.add(classSubjectGrade);
@@ -408,10 +536,12 @@ public class MsrExamService {
408 536
 
409 537
     //获取报告参数
410 538
     private Map<String, List<SzJsonVo>> getReportParams(Integer examid, String rpbelong, String reportcode) {
411
-        List<MsrReportparam> list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, reportcode);
412
-        if (N_Utils.isListEmpty(list)) {
413
-            list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, "all");
414
-        }
539
+        List<MsrReportparam> list = getMsrReportParams(examid, rpbelong, reportcode);
540
+        return formatSzJson(list);
541
+    }
542
+
543
+    //格式化报告参数
544
+    private Map<String, List<SzJsonVo>> formatSzJson(List<MsrReportparam> list) {
415 545
         Map<String, List<SzJsonVo>> qjMap = new HashMap<>();
416 546
         for (MsrReportparam param : list) {
417 547
             qjMap.put(param.getSubjectid(), JSON.parseArray(param.getSzjson(), SzJsonVo.class));
@@ -419,6 +549,15 @@ public class MsrExamService {
419 549
         return qjMap;
420 550
     }
421 551
 
552
+    //获取报告参数
553
+    private List<MsrReportparam> getMsrReportParams(Integer examid, String rpbelong, String reportcode) {
554
+        List<MsrReportparam> list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, reportcode);
555
+        if (N_Utils.isListEmpty(list)) {
556
+            list = msrReportparamMapper.listReportparamByRpbelong(examid, rpbelong, "all");
557
+        }
558
+        return list;
559
+    }
560
+
422 561
     //设置科目分析计算参数
423 562
     private void setSubject(MsrSubject msrSubject, List<MsrStudent> schoolStudents2) {
424 563
         Double avgscore = msrSubject.getAvgscore();

+ 2
- 1
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java 파일 보기

@@ -542,6 +542,7 @@ public class MarkingUtil {
542 542
     //排名分组计算 参数[总名次,分组数] 如:第一组(第1-10名)
543 543
     public static List<RankGroupVo> rankGroup(Integer total,Integer groupNum) {
544 544
         List<RankGroupVo> rtnList = new ArrayList<>();
545
+        if (groupNum > total) groupNum = total;
545 546
 
546 547
         int average = total / groupNum;
547 548
         int remainder = total % groupNum;
@@ -558,7 +559,7 @@ public class MarkingUtil {
558 559
             }
559 560
 
560 561
             RankGroupVo rgvo = new RankGroupVo();
561
-            rgvo.setGroupname("第" + (i + 1) + "组(" + min + "~" + max + ")");
562
+            rgvo.setGroupname("第" + N_Utils.NumberToChn(i + 1) + "组(" + min + "~" + max + ")");
562 563
             rgvo.setMinvalue(min);
563 564
             rgvo.setMaxvalue(max);
564 565
             rtnList.add(rgvo);

+ 1
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml 파일 보기

@@ -743,6 +743,7 @@
743 743
         select psq.firstcid,psq.firstcime,psq.firstccore,psq.secondcid,psq.secondctime,psq.secondcscore
744 744
         ,psq.mpsid
745 745
         <if test="param.correcttype==3">
746
+            ,psq.firstccores,psq.secondcscores
746 747
             from ms_paper_student_block psq
747 748
             where psq.mpsbid=#{param.mpsbid}
748 749
         </if>

Loading…
취소
저장