Bläddra i källkod

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 2 dagar sedan
förälder
incheckning
70836dcacb

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassGoodbad.java Visa fil

@@ -37,4 +37,10 @@ public class MsrClassGoodbad extends BaseBean {
37 37
     private Double dtgavgscore;
38 38
     //学科短板人数
39 39
     private Integer dbnum;
40
+    //优秀学生id字符串
41
+    private String stuids;
42
+    //待提高学生id字符串
43
+    private String stuids2;
44
+    //学科短板学生id字符串
45
+    private String stuids3;
40 46
 }

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassNearline.java Visa fil

@@ -57,4 +57,8 @@ public class MsrClassNearline extends BaseBean {
57 57
     private String stuids2;
58 58
     //临界生id字符串
59 59
     private String stuids3;
60
+    //累计上线学生id字符串
61
+    private String stuids4;
62
+    //总分上线学科未上线学生id字符串
63
+    private String stuids5;
60 64
 }

+ 21
- 11
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java Visa fil

@@ -406,14 +406,14 @@ public class MsPaperCheckTeacherTaskService {
406 406
                 checked = 3;
407 407
             }
408 408
             if (correcttype.equals(3)) {//按题块批阅
409
-                checkscore = questions.stream().map(MsPaperBlockQuestion::getMergescore).collect(Collectors.joining(";"));
409
+                checkscore = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
410 410
                 //题块批阅信息
411 411
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
412 412
                 block.setMpsbid(mpsbid);
413 413
                 block.setChecked(checked);
414 414
                 block.setFirstcid(handleid);
415 415
                 block.setFirstcime(N_Utils.getSecondTimestamp());
416
-                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergestuscore).collect(Collectors.joining(";"));
416
+                String stuscores = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
417 417
                 block.setFirstccores(stuscores);
418 418
                 block.setFirstccore(arbitratescore);
419 419
                 block.setHasgood(hasgood);
@@ -438,12 +438,13 @@ public class MsPaperCheckTeacherTaskService {
438 438
                         studentQuestions.add(studentQuestion);
439 439
                     } else {
440 440
                         String[] mptqids = question.getMergeqid().split(",");
441
-                        String[] mergestuscore = question.getMergestuscore().split(",");
441
+                        String[] mergescores = question.getMergescore().split(",");
442
+                        double[] scores = setStuScore(mergescores, stuscore);//计算学生小题得分
442 443
                         for (int i = 0; i < mptqids.length; i++) {
443 444
                             MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
444 445
                             studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));
445
-                            studentQuestion.setFirstccore(MarkingUtil.objToDouble(mergestuscore[i]));
446
-                            studentQuestion.setStuscore(MarkingUtil.objToDouble(mergestuscore[i]));
446
+                            studentQuestion.setFirstccore(scores[i]);
447
+                            studentQuestion.setStuscore(scores[i]);
447 448
                             studentQuestions.add(studentQuestion);
448 449
                         }
449 450
                     }
@@ -506,7 +507,7 @@ public class MsPaperCheckTeacherTaskService {
506 507
                 //题块批阅信息
507 508
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
508 509
                 block.setMpsbid(mpsbid);
509
-                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergestuscore).collect(Collectors.joining(";"));
510
+                String stuscores = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
510 511
                 String[] cores = new String[0];
511 512
                 if (type.equals(1)) {
512 513
                     block.setFirstcid(handleid);
@@ -553,11 +554,7 @@ public class MsPaperCheckTeacherTaskService {
553 554
                     } else {
554 555
                         String[] mptqids = question.getMergeqid().split(",");
555 556
                         String[] mergescores = question.getMergescore().split(",");
556
-                        String[] mergestuscore = question.getMergestuscore().split(",");
557
-                        double[] scores = new double[mergestuscore.length];
558
-                        for (int i = 0; i < mergestuscore.length; i++) {
559
-                            scores[i]=MarkingUtil.objToDouble(mergestuscore[i]);
560
-                        }
557
+                        double[] scores = setStuScore(mergescores, stuscore);//计算学生小题得分
561 558
                         String[] cores2 = new String[0];
562 559
                         if (corrected) cores2 = cores[j].split(",");
563 560
                         for (int i = 0; i < mptqids.length; i++) {
@@ -639,6 +636,19 @@ public class MsPaperCheckTeacherTaskService {
639 636
         if (checked == 3) msPaperStudentMapper.updateStudentPaperScoreByMpsId(mpsid);//更新学生总分
640 637
     }
641 638
 
639
+    //计算学生小题得分
640
+    private double[] setStuScore(String[] mergescores, Double stuscore) {
641
+        double totalScore = 0;
642
+        for (String mergescore : mergescores) {
643
+            totalScore = MarkingUtil.add(mergescore, totalScore);
644
+        }
645
+        double[] scores = new double[mergescores.length];
646
+        for (int i = 0; i < mergescores.length; i++) {
647
+            scores[i] = MarkingUtil.mul(stuscore, MarkingUtil.div(mergescores[i], totalScore));
648
+        }
649
+        return scores;
650
+    }
651
+
642 652
     //最终得分计算
643 653
     private Double getUserScore(Integer finalscore, double addScore, Double roundvalue) {
644 654
         double score;

+ 261
- 100
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrExamService.java Visa fil

@@ -69,6 +69,8 @@ public class MsrExamService {
69 69
     private MsrClassSectionMapper msrClassSectionMapper;
70 70
     @Resource
71 71
     private MsrClassNearlineMapper msrClassNearlineMapper;
72
+    @Resource
73
+    private MsrClassGoodbadMapper msrClassGoodbadMapper;
72 74
 
73 75
 
74 76
     /**
@@ -370,10 +372,93 @@ public class MsrExamService {
370 372
         saveClassSection(examid, 1, "bj", msrStudents);//班级报告-分段统计
371 373
         saveClassSection(examid, 1, "jxzl", msrStudents);//教学质量-分段统计
372 374
         saveClassNearLine(examid, msrStudents);//分档上线统计
375
+        saveClassGoodBad(examid, "all", msrStudents);//重点学生-优劣名次统计
373 376
 
374 377
         examMapper.updateExamState(examid, 3);
375 378
     }
376 379
 
380
+    //重点学生-优劣名次统计
381
+    public void saveClassGoodBad(Integer examid, String all, List<MsrStudent> msrStudents) {
382
+        List<MsrReportparam> params = getMsrReportParams(examid, "keystu", all);
383
+        SzJsonVo fd = JSON.parseObject(params.get(0).getSzjson(), SzJsonVo.class);
384
+        List<MsrClassGoodbad> classGoodbads = new ArrayList<>();
385
+        String subjectid;
386
+        Map<String, List<MsrStudent>> collect = getSubjectCollect(msrStudents);
387
+        for (Map.Entry<String, List<MsrStudent>> entry : collect.entrySet()) {
388
+            Integer classid = 0;
389
+            subjectid = entry.getKey();
390
+            studentsDistinct(entry);
391
+            setClassGoodBag(examid, entry, fd, subjectid, classid, classGoodbads);
392
+        }
393
+        Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
394
+        for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
395
+            String key = entry.getKey();
396
+            Integer classid = N_Utils.obj2Int(key.split("_")[0]);
397
+            subjectid = key.split("_")[1];
398
+            setClassGoodBag(examid, entry, fd, subjectid, classid, classGoodbads);
399
+        }
400
+        msrClassGoodbadMapper.insertList(classGoodbads);
401
+    }
402
+
403
+    //学生去重
404
+    private void studentsDistinct(Map.Entry<String, List<MsrStudent>> entry) {
405
+        //list根据学生id去重
406
+        Map<Integer, MsrStudent> map = new HashMap<>();
407
+        for (MsrStudent student : entry.getValue()) {
408
+            map.putIfAbsent(student.getStudentid(), student);
409
+        }
410
+        List<MsrStudent> list = map.values().stream().collect(Collectors.toList());
411
+        entry.setValue(list);
412
+    }
413
+
414
+    //重点学生-优劣名次计算
415
+    private void setClassGoodBag(Integer examid, Map.Entry<String, List<MsrStudent>> entry, SzJsonVo fd, String subjectid, Integer classid, List<MsrClassGoodbad> classGoodbads) {
416
+        int totalnum;
417
+        Integer goodtype = fd.getGoodtype();
418
+        Integer badtype = fd.getBadtype();
419
+        List<MsrStudent> studentList = entry.getValue().stream().sorted(Comparator.comparing(MsrStudent::getSchoolrank)).collect(Collectors.toList());
420
+        Double avgScore = N_Utils.formatDouble(studentList.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage(), 2);
421
+        totalnum = studentList.size();//区间总人数
422
+        Integer goodvalue = fd.getGoodvalue();
423
+        Integer badvalue = fd.getBadvalue();
424
+        List<MsrStudent> yxStudents;//优秀学生列表
425
+        List<MsrStudent> dtgStudents;//待提高学生列表
426
+        List<MsrStudent> dbStudents;//学科短板学生列表
427
+        if (goodtype.equals(1)) {//按名次
428
+            yxStudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(goodvalue) <= 0).collect(Collectors.toList());
429
+        } else {//按比例
430
+            int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, goodvalue));
431
+            if (index > totalnum) index = totalnum;
432
+            yxStudents = studentList.subList(0, index);
433
+        }
434
+        if (badtype.equals(1)) {//按名次
435
+            dtgStudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(badvalue) <= 0).collect(Collectors.toList());
436
+        } else {//按比例
437
+            int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, badvalue));
438
+            if (index > totalnum) index = totalnum;
439
+            //取后index个
440
+            dtgStudents = studentList.subList(totalnum - index, totalnum);
441
+        }
442
+        dbStudents = studentList.stream().filter(s -> s.getStuscore().compareTo(avgScore) <= 0).collect(Collectors.toList());
443
+        int yxnum = yxStudents.size();
444
+        MsrClassGoodbad goodbad = new MsrClassGoodbad();
445
+        goodbad.setExamid(examid);
446
+        goodbad.setSubjectid(subjectid);
447
+        goodbad.setClassid(classid);
448
+        goodbad.setYxnum(yxnum);
449
+        goodbad.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, totalnum));
450
+        goodbad.setYxavgscore(N_Utils.formatDouble(yxStudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage(), 2));
451
+        int dtgnum = dtgStudents.size();
452
+        goodbad.setDtgnum(dtgnum);
453
+        goodbad.setDtgrate(N_Utils.getIntegerDivideAndMulitiply(dtgnum, totalnum));
454
+        goodbad.setDtgavgscore(N_Utils.formatDouble(dtgStudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage(), 2));
455
+        goodbad.setDbnum(dbStudents.size());
456
+        goodbad.setStuids(yxStudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
457
+        goodbad.setStuids2(dtgStudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
458
+        goodbad.setStuids3(dbStudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
459
+        classGoodbads.add(goodbad);
460
+    }
461
+
377 462
     //分档上线分析
378 463
     public void saveClassNearLine(Integer examid, List<MsrStudent> msrStudents) {
379 464
         List<MsrReportparam> params = getMsrReportParams(examid, "gradescore", "all");
@@ -386,113 +471,25 @@ public class MsrExamService {
386 471
         }
387 472
         params = getMsrReportParams(examid, "nearline", "all");
388 473
         List<SzJsonVo> vos = JSON.parseArray(params.get(0).getSzjson(), SzJsonVo.class);
389
-        Map<Integer, List<Integer>> zfSx = new HashMap<>();//学生总分是否上线
474
+        Map<Integer, List<Integer>> zfSx = null;//学生总分是否上线
390 475
         List<MsrClassNearline> classNearlines = new ArrayList<>();
391 476
         String subjectid;
392
-        int totalnum;
477
+        Map<String, List<MsrStudent>> collect0 = getSubjectCollect(msrStudents);
478
+        for (Map.Entry<String, List<MsrStudent>> entry : collect0.entrySet()) {
479
+            Integer classid = 0;
480
+            subjectid = entry.getKey();
481
+            studentsDistinct(entry);
482
+            if (subjectid.equals("zf")) {
483
+                zfSx = setZfsxMap(entry.getValue(), qjMap, tMap);
484
+            }
485
+            setClassNearLine(examid, entry, qjMap, subjectid, tMap, vos, classid, zfSx, classNearlines);
486
+        }
393 487
         Map<String, List<MsrStudent>> scCollect = msrStudents.stream().collect(Collectors.groupingBy(s -> s.getClassid() + "_" + s.getSubjectid()));
394 488
         for (Map.Entry<String, List<MsrStudent>> entry : scCollect.entrySet()) {
395 489
             String key = entry.getKey();
396 490
             Integer classid = N_Utils.obj2Int(key.split("_")[0]);
397 491
             subjectid = key.split("_")[1];
398
-            List<SzJsonVo> list = qjMap.get(subjectid);
399
-            Integer rptype = tMap.get(subjectid);
400
-            List<MsrStudent> studentList = entry.getValue();
401
-            if (rptype.equals(3)) {
402
-                studentList = studentList.stream().sorted(Comparator.comparing(MsrStudent::getStuscore).reversed()).collect(Collectors.toList());
403
-            }
404
-            totalnum = studentList.size();//区间总人数
405
-            Double max = null;
406
-            Integer minRank = null;
407
-            int minIndex = 0;
408
-            for (int i = 0; i < list.size(); i++) {
409
-                SzJsonVo fd = vos.get(i);
410
-                Double fdMaxScore = fd.getMaxvalue();//档位浮动分数
411
-                if (fdMaxScore == null) fdMaxScore = MarkingUtil.objToDouble(fd.getDjvalue());
412
-                Double fdMinScore = fd.getMinvalue();//档位浮动分数
413
-                if (fdMinScore == null) {
414
-                    fdMinScore = fdMaxScore;
415
-                }
416
-                SzJsonVo rg = list.get(i);
417
-                Object djvalue = rg.getDjvalue();
418
-                double dwscore;
419
-                List<MsrStudent> qjstudents;//上线学生列表
420
-                List<MsrStudent> ljstudents;//累计上线学生列表
421
-                if (rptype.equals(1)) {//按名次
422
-                    Integer rank = N_Utils.obj2Int(djvalue);
423
-                    ljstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) <= 0).collect(Collectors.toList());
424
-                    if (minRank == null) {
425
-                        qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) <= 0).collect(Collectors.toList());
426
-                    } else {
427
-                        Integer finalMinRank = minRank;
428
-                        qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(finalMinRank) >= 0 && s.getSchoolrank().compareTo(rank) < 0).collect(Collectors.toList());
429
-                    }
430
-                    minRank = rank;
431
-                    dwscore = N_Utils.handleInfinity(qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
432
-                } else if (rptype.equals(2)) {//按分数
433
-                    Double score = MarkingUtil.objToDouble(djvalue);
434
-                    ljstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
435
-                    if (max == null) {
436
-                        qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
437
-                    } else {
438
-                        Double finalMax = max;
439
-                        qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0 && s.getStuscore().compareTo(finalMax) < 0).collect(Collectors.toList());
440
-                    }
441
-                    dwscore = MarkingUtil.objToDouble(djvalue);
442
-                    max = score;
443
-                    minRank = qjstudents.stream().mapToInt(MsrStudent::getSchoolrank).summaryStatistics().getMin();
444
-                } else {//按比例
445
-                    int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, djvalue));
446
-                    if (index > totalnum) index = totalnum;
447
-                    qjstudents = studentList.subList(minIndex, index);
448
-                    minIndex = index;
449
-                    DoubleSummaryStatistics statistics = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics();
450
-                    dwscore = N_Utils.handleInfinity(statistics.getMin());
451
-                    ljstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(dwscore) >= 0).collect(Collectors.toList());
452
-                }
453
-                int qjnum = qjstudents.size();
454
-                MsrClassNearline nearline = new MsrClassNearline();
455
-                nearline.setExamid(examid);
456
-                nearline.setSubjectid(subjectid);
457
-                nearline.setClassid(classid);
458
-                Integer dworder = i + 1;
459
-                String dwname = N_Utils.NumberToChn(dworder) + "档";
460
-                nearline.setDwname(dwname);
461
-                nearline.setDworder(dworder);
462
-                nearline.setDwscore(dwscore);
463
-                nearline.setSxnum(qjnum);
464
-                nearline.setSxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
465
-                int ljsxnum = ljstudents.size();
466
-                nearline.setLjsxnum(ljsxnum);
467
-                nearline.setLjsxrate(N_Utils.getIntegerDivideAndMulitiply(ljsxnum, totalnum));
468
-                if ("zf".equals(subjectid)) {
469
-                    List<Integer> ids = qjstudents.stream().map(MsrStudent::getStudentid).collect(Collectors.toList());
470
-                    zfSx.put(dworder, ids);
471
-                } else {
472
-                    List<Integer> zfsxIds = zfSx.get(dworder);//总分上线学生id列表
473
-                    int zfsxnum = zfsxIds.size();
474
-                    List<MsrStudent> ssxIds = qjstudents.stream().filter(s -> zfsxIds.contains(s.getStudentid())).collect(Collectors.toList());
475
-                    Integer ssxnum = ssxIds.size();//双上线人数
476
-                    nearline.setSsxnum(ssxnum);
477
-                    nearline.setStuids2(ssxIds.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
478
-                    //总分上线学科未上线人数
479
-                    List<Integer> dksxIds = qjstudents.stream().map(MsrStudent::getStudentid).collect(Collectors.toList());
480
-                    zfsxIds.removeAll(dksxIds);
481
-                    int zfsxxkwsxnum = zfsxIds.size();
482
-                    nearline.setZfsxxkwsxnum(zfsxxkwsxnum);
483
-                    nearline.setGxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, zfsxnum));
484
-                    nearline.setMzxrate(N_Utils.getIntegerDivideAndMulitiply(ssxnum, qjnum));
485
-                }
486
-                nearline.setSxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
487
-                double ljMax = MarkingUtil.add(dwscore, fdMaxScore);
488
-                double ljMin = MarkingUtil.sub(dwscore, fdMinScore);
489
-                List<MsrStudent> ljStudents = studentList.stream().filter(s -> s.getStuscore().compareTo(ljMax) <= 0 && s.getStuscore().compareTo(ljMin) >= 0).collect(Collectors.toList());
490
-                nearline.setLjsnum(ljStudents.size());
491
-                nearline.setStuids3(ljStudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
492
-                String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
493
-                nearline.setStuids(stuids);
494
-                classNearlines.add(nearline);
495
-            }
492
+            setClassNearLine(examid, entry, qjMap, subjectid, tMap, vos, classid, zfSx, classNearlines);
496 493
         }
497 494
         Map<String, List<MsrClassNearline>> collect = classNearlines.stream().collect(Collectors.groupingBy(l -> l.getSubjectid() + "_" + l.getDworder()));
498 495
         for (Map.Entry<String, List<MsrClassNearline>> entry : collect.entrySet()) {
@@ -509,6 +506,170 @@ public class MsrExamService {
509 506
         msrClassNearlineMapper.insertList(classNearlines);
510 507
     }
511 508
 
509
+    //获取科学分组学生
510
+    private Map<String, List<MsrStudent>> getSubjectCollect(List<MsrStudent> msrStudents) {
511
+        return msrStudents.stream().collect(Collectors.groupingBy(s -> s.getSubjectid(), LinkedHashMap::new, Collectors.toList()));
512
+    }
513
+
514
+    //分档上线计算
515
+    private void setClassNearLine(Integer examid, Map.Entry<String, List<MsrStudent>> entry, Map<String, List<SzJsonVo>> qjMap
516
+            , String subjectid, Map<String, Integer> tMap, List<SzJsonVo> vos, Integer classid
517
+            , Map<Integer, List<Integer>> zfSx, List<MsrClassNearline> classNearlines) {
518
+        int totalnum;
519
+        List<SzJsonVo> list = qjMap.get(subjectid);
520
+        Integer rptype = tMap.get(subjectid);
521
+        List<MsrStudent> studentList = entry.getValue();
522
+        if (rptype.equals(3)) {
523
+            studentList = studentList.stream().sorted(Comparator.comparing(MsrStudent::getStuscore).reversed()).collect(Collectors.toList());
524
+        }
525
+        totalnum = studentList.size();//区间总人数
526
+        Double max = null;
527
+        Integer minRank = null;
528
+        int minIndex = 0;
529
+        for (int i = 0; i < list.size(); i++) {
530
+            SzJsonVo fd = vos.get(i);
531
+            Double fdMaxScore = fd.getMaxvalue();//档位浮动分数
532
+            if (fdMaxScore == null) fdMaxScore = MarkingUtil.objToDouble(fd.getDjvalue());
533
+            Double fdMinScore = fd.getMinvalue();//档位浮动分数
534
+            if (fdMinScore == null) {
535
+                fdMinScore = fdMaxScore;
536
+            }
537
+            SzJsonVo rg = list.get(i);
538
+            Object djvalue = rg.getDjvalue();
539
+            double dwscore;
540
+            List<MsrStudent> qjstudents;//上线学生列表
541
+            List<MsrStudent> ljstudents;//累计上线学生列表
542
+            if (rptype.equals(1)) {//按名次
543
+                Integer rank = N_Utils.obj2Int(djvalue);
544
+                ljstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) <= 0).collect(Collectors.toList());
545
+                if (minRank == null) {
546
+                    qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) <= 0).collect(Collectors.toList());
547
+                } else {
548
+                    Integer finalMinRank = minRank;
549
+                    qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(finalMinRank) >= 0 && s.getSchoolrank().compareTo(rank) < 0).collect(Collectors.toList());
550
+                }
551
+                minRank = rank;
552
+                dwscore = N_Utils.handleInfinity(qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getMin());
553
+            } else if (rptype.equals(2)) {//按分数
554
+                Double score = MarkingUtil.objToDouble(djvalue);
555
+                ljstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
556
+                if (max == null) {
557
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
558
+                } else {
559
+                    Double finalMax = max;
560
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0 && s.getStuscore().compareTo(finalMax) < 0).collect(Collectors.toList());
561
+                }
562
+                dwscore = MarkingUtil.objToDouble(djvalue);
563
+                max = score;
564
+                minRank = qjstudents.stream().mapToInt(MsrStudent::getSchoolrank).summaryStatistics().getMin();
565
+            } else {//按比例
566
+                int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, djvalue));
567
+                if (index > totalnum) index = totalnum;
568
+                qjstudents = studentList.subList(minIndex, index);
569
+                minIndex = index;
570
+                DoubleSummaryStatistics statistics = qjstudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics();
571
+                dwscore = N_Utils.handleInfinity(statistics.getMin());
572
+                ljstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(dwscore) >= 0).collect(Collectors.toList());
573
+            }
574
+            int qjnum = qjstudents.size();
575
+            MsrClassNearline nearline = new MsrClassNearline();
576
+            nearline.setExamid(examid);
577
+            nearline.setSubjectid(subjectid);
578
+            nearline.setClassid(classid);
579
+            Integer dworder = i + 1;
580
+            String dwname = N_Utils.NumberToChn(dworder) + "档";
581
+            nearline.setDwname(dwname);
582
+            nearline.setDworder(dworder);
583
+            nearline.setDwscore(dwscore);
584
+            nearline.setSxnum(qjnum);
585
+            nearline.setSxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
586
+            int ljsxnum = ljstudents.size();
587
+            nearline.setLjsxnum(ljsxnum);
588
+            nearline.setLjsxrate(N_Utils.getIntegerDivideAndMulitiply(ljsxnum, totalnum));
589
+            if (!"zf".equals(subjectid)) {
590
+                List<Integer> zfsxIds = zfSx.get(dworder);//总分上线学生id列表
591
+                int zfsxnum = zfsxIds.size();
592
+                List<MsrStudent> ssxIds = qjstudents.stream().filter(s -> zfsxIds.contains(s.getStudentid())).collect(Collectors.toList());
593
+                Integer ssxnum = ssxIds.size();//双上线人数
594
+                nearline.setSsxnum(ssxnum);
595
+                nearline.setStuids2(ssxIds.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
596
+                //总分上线学科未上线人数
597
+                List<Integer> dksxIds = qjstudents.stream().map(MsrStudent::getStudentid).collect(Collectors.toList());
598
+                List<Integer> zfsxxkwsxIds = new ArrayList<>();
599
+                zfsxxkwsxIds.addAll(zfsxIds);
600
+                zfsxxkwsxIds.removeAll(dksxIds);
601
+                int zfsxxkwsxnum = zfsxxkwsxIds.size();
602
+                nearline.setZfsxxkwsxnum(zfsxxkwsxnum);
603
+                nearline.setStuids5(zfsxxkwsxIds.stream().map(s -> s.toString()).collect(Collectors.joining(",")));
604
+                nearline.setGxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, zfsxnum));
605
+                nearline.setMzxrate(N_Utils.getIntegerDivideAndMulitiply(ssxnum, qjnum));
606
+            }
607
+            nearline.setSxrate(N_Utils.getIntegerDivideAndMulitiply(qjnum, totalnum));
608
+            double ljMax = MarkingUtil.add(dwscore, fdMaxScore);
609
+            double ljMin = MarkingUtil.sub(dwscore, fdMinScore);
610
+            List<MsrStudent> ljStudents = studentList.stream().filter(s -> s.getStuscore().compareTo(ljMax) <= 0 && s.getStuscore().compareTo(ljMin) >= 0).collect(Collectors.toList());
611
+            nearline.setLjsnum(ljStudents.size());
612
+            nearline.setLjsavgscore(N_Utils.formatDouble(ljStudents.stream().mapToDouble(MsrStudent::getStuscore).summaryStatistics().getAverage(), 2));
613
+            nearline.setStuids3(ljStudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
614
+            nearline.setStuids4(ljstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(",")));
615
+            String stuids = qjstudents.stream().map(s -> s.getStudentid().toString()).collect(Collectors.joining(","));
616
+            nearline.setStuids(stuids);
617
+            classNearlines.add(nearline);
618
+        }
619
+    }
620
+
621
+    //总分上线分析
622
+    private Map<Integer, List<Integer>> setZfsxMap(List<MsrStudent> studentList, Map<String, List<SzJsonVo>> qjMap
623
+            , Map<String, Integer> tMap) {
624
+        Map<Integer, List<Integer>> zfSx = new HashMap<>();
625
+        String subjectid = "zf";
626
+        int totalnum;
627
+        List<SzJsonVo> list = qjMap.get(subjectid);
628
+        Integer rptype = tMap.get(subjectid);
629
+        if (rptype.equals(3)) {
630
+            studentList = studentList.stream().sorted(Comparator.comparing(MsrStudent::getStuscore).reversed()).collect(Collectors.toList());
631
+        }
632
+        totalnum = studentList.size();//区间总人数
633
+        Double max = null;
634
+        Integer minRank = null;
635
+        int minIndex = 0;
636
+        for (int i = 0; i < list.size(); i++) {
637
+            SzJsonVo rg = list.get(i);
638
+            Object djvalue = rg.getDjvalue();
639
+            List<MsrStudent> qjstudents;//上线学生列表
640
+            if (rptype.equals(1)) {//按名次
641
+                Integer rank = N_Utils.obj2Int(djvalue);
642
+                if (minRank == null) {
643
+                    qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(rank) <= 0).collect(Collectors.toList());
644
+                } else {
645
+                    Integer finalMinRank = minRank;
646
+                    qjstudents = studentList.stream().filter(s -> s.getSchoolrank().compareTo(finalMinRank) >= 0 && s.getSchoolrank().compareTo(rank) < 0).collect(Collectors.toList());
647
+                }
648
+                minRank = rank;
649
+            } else if (rptype.equals(2)) {//按分数
650
+                Double score = MarkingUtil.objToDouble(djvalue);
651
+                if (max == null) {
652
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0).collect(Collectors.toList());
653
+                } else {
654
+                    Double finalMax = max;
655
+                    qjstudents = studentList.stream().filter(s -> s.getStuscore().compareTo(score) >= 0 && s.getStuscore().compareTo(finalMax) < 0).collect(Collectors.toList());
656
+                }
657
+                max = score;
658
+                minRank = qjstudents.stream().mapToInt(MsrStudent::getSchoolrank).summaryStatistics().getMin();
659
+            } else {//按比例
660
+                int index = (int) Math.ceil(MarkingUtil.div(totalnum * 100, djvalue));
661
+                if (index > totalnum) index = totalnum;
662
+                qjstudents = studentList.subList(minIndex, index);
663
+                minIndex = index;
664
+            }
665
+
666
+            Integer dworder = i + 1;
667
+            List<Integer> ids = qjstudents.stream().map(MsrStudent::getStudentid).collect(Collectors.toList());
668
+            zfSx.put(dworder, ids);
669
+        }
670
+        return zfSx;
671
+    }
672
+
512 673
     //分段统计
513 674
     public void saveClassSection(Integer examid, Integer type, String reportcode, List<MsrStudent> msrStudents) {
514 675
         List<MsrReportparam> params = getMsrReportParams(examid, "scoresection", reportcode);

+ 2
- 2
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml Visa fil

@@ -12,8 +12,8 @@
12 12
     <!--考试进度总览-->
13 13
     <select id="examOverview" resultType="java.util.Map">
14 14
         select s.msid,s.subjectid,s.subjectname,s.sdate,s.begintime,s.endtime,s.msstate,s.pstate,s.ptstate,
15
-        s.pbstate,s.checkset,s.checkstate,s.invigilatestate,p.answered,p.ptype,p.cutstate,s.teacherid,
16
-        u.username as teachername,p.mpid,p.yjstate,p.cutstate,e.exammode,e.examstate,e.hashb,e.gradeid,s.leaderid,u2.username as leadername
15
+        s.pbstate,s.checkset,s.checkstate,s.invigilatestate,p.answered,p.ptype,s.teacherid,
16
+        u.username as teachername,p.mpid,p.yjstate,e.exammode,e.examstate,e.hashb,e.gradeid,s.leaderid,u2.username as leadername
17 17
         ,if(ps.batchid is not null,ps.mpsid,null) scannum,count(ps.mpsid) stunum
18 18
         from ms_subject s left join t_user u on s.teacherid=u.userid
19 19
         left join t_user u2 on s.leaderid=u2.userid

Laddar…
Avbryt
Spara