|
@@ -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);
|