|
@@ -1,7 +1,6 @@
|
1
|
1
|
package com.xhkjedu.sexam.service.report;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
|
-import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
5
|
4
|
import com.xhkjedu.sexam.mapper.exam.EClassMapper;
|
6
|
5
|
import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
|
7
|
6
|
import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
|
|
@@ -45,6 +44,7 @@ import com.xhkjedu.sexam.vo.report.ERPointStuScoreVo;
|
45
|
44
|
import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
|
46
|
45
|
import com.xhkjedu.sexam.vo.system.UserVo;
|
47
|
46
|
import com.xhkjedu.utils.N_Utils;
|
|
47
|
+import org.springframework.beans.BeanUtils;
|
48
|
48
|
import org.springframework.stereotype.Service;
|
49
|
49
|
import org.springframework.transaction.annotation.Transactional;
|
50
|
50
|
|
|
@@ -178,7 +178,7 @@ public class EReportGenerateService {
|
178
|
178
|
DoubleSummaryStatistics classStatistics = classStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
179
|
179
|
DoubleSummaryStatistics cSStatistics = classSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
180
|
180
|
double schoolStatisticsMax = schoolStatistics.getMax();
|
181
|
|
- double schoolStatisticsAverage = schoolStatistics.getAverage();
|
|
181
|
+ double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
|
182
|
182
|
double schoolStatisticsMin = schoolStatistics.getMin();
|
183
|
183
|
|
184
|
184
|
ERbase rbase = new ERbase();
|
|
@@ -212,10 +212,10 @@ public class EReportGenerateService {
|
212
|
212
|
}
|
213
|
213
|
ERPaperVo rp = paperMap.get(subjectid);
|
214
|
214
|
Double allscore = rp.getPscore();//满分
|
215
|
|
- double yxscore = allscore * 0.85;//优秀分
|
216
|
|
- double lhscore = allscore * 0.7;//良好分
|
217
|
|
- double jgscore = allscore * 0.6;//及格分
|
218
|
|
- double dfscore = allscore * 0.4;//低分
|
|
215
|
+ double yxscore = ExamUtil.mul(allscore, 0.85);//优秀分
|
|
216
|
+ double lhscore = ExamUtil.mul(allscore, 0.7);//良好分
|
|
217
|
+ double jgscore = ExamUtil.mul(allscore, 0.6);//及格分
|
|
218
|
+ double dfscore = ExamUtil.mul(allscore, 0.4);//低分
|
219
|
219
|
|
220
|
220
|
DoubleSummaryStatistics statistics = list.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
|
221
|
221
|
ERsubject rs = new ERsubject();
|
|
@@ -225,7 +225,7 @@ public class EReportGenerateService {
|
225
|
225
|
rs.setScore(allscore);
|
226
|
226
|
rs.setMaxscore(statistics.getMax());
|
227
|
227
|
rs.setMinscore(statistics.getMin());
|
228
|
|
- rs.setAvgscore(statistics.getAverage());
|
|
228
|
+ rs.setAvgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
|
229
|
229
|
int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
|
230
|
230
|
.collect(Collectors.toList()).size();
|
231
|
231
|
int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
|
|
@@ -258,9 +258,9 @@ public class EReportGenerateService {
|
258
|
258
|
rc.setAllscore(allscore);
|
259
|
259
|
rc.setClassmaxscore(claStatistics.getMax());
|
260
|
260
|
rc.setClassminscore(claStatistics.getMin());
|
261
|
|
- rc.setClassavgscore(claStatistics.getAverage());
|
|
261
|
+ rc.setClassavgscore(N_Utils.formatDouble(claStatistics.getAverage(), 2));
|
262
|
262
|
rc.setSchoolmaxscore(statistics.getMax());
|
263
|
|
- rc.setSchoolavgscore(statistics.getAverage());
|
|
263
|
+ rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
|
264
|
264
|
sknum = rstudentList.size();
|
265
|
265
|
rc.setStunum(sknum);//实考人数
|
266
|
266
|
rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
|
|
@@ -294,8 +294,8 @@ public class EReportGenerateService {
|
294
|
294
|
Integer studentid = cs.getStudentid();
|
295
|
295
|
cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
|
296
|
296
|
cs.setClassmaxscore(classStatistics.getMax());
|
297
|
|
- cs.setClassavgscore(classStatistics.getAverage());
|
298
|
|
- Integer schoolrank = schoolStuRank.get(studentid);
|
|
297
|
+ cs.setClassavgscore(N_Utils.formatDouble(classStatistics.getAverage(), 2));
|
|
298
|
+ Integer schoolrank = schoolStuRank.get(studentid.toString());
|
299
|
299
|
cs.setSchoolrank(schoolrank);
|
300
|
300
|
cs.setSchoolmaxscore(schoolStatisticsMax);
|
301
|
301
|
cs.setSchoolavgscore(schoolStatisticsAverage);
|
|
@@ -310,12 +310,12 @@ public class EReportGenerateService {
|
310
|
310
|
subjectid = cs.getSubjectid();
|
311
|
311
|
cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
|
312
|
312
|
cs.setClassmaxscore(cSStatistics.getMax());
|
313
|
|
- cs.setClassavgscore(cSStatistics.getAverage());
|
|
313
|
+ cs.setClassavgscore(N_Utils.formatDouble(cSStatistics.getAverage(), 2));
|
314
|
314
|
Integer schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
|
315
|
315
|
cs.setSchoolrank(schoolrank);
|
316
|
|
- cs.setZfSchoolRank(schoolStuRank.get(studentid));
|
|
316
|
+ cs.setZfSchoolRank(schoolStuRank.get(studentid.toString()));
|
317
|
317
|
cs.setSchoolmaxscore(sSStatistics.getMax());
|
318
|
|
- cs.setSchoolavgscore(sSStatistics.getAverage());
|
|
318
|
+ cs.setSchoolavgscore(N_Utils.formatDouble(sSStatistics.getAverage(), 2));
|
319
|
319
|
setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
|
320
|
320
|
}
|
321
|
321
|
eRstudentMapper.insertList(classSubjectStudents);
|
|
@@ -434,9 +434,11 @@ public class EReportGenerateService {
|
434
|
434
|
Integer ranktype = eRrank.getRanktype();
|
435
|
435
|
if (ranktype == 1) {//等级(A[85%~100%],B[70%~85%),C[60%~70%),D[40%~60%),E[0%~40%))
|
436
|
436
|
for (ERrank rrank : rranks) {
|
|
437
|
+ Double maxrate = rrank.getMaxscore();
|
|
438
|
+ Double minrate = rrank.getMinscore();
|
437
|
439
|
//总分统计
|
438
|
|
- double maxscore = rrank.getMaxscore() * zfscore;
|
439
|
|
- double minscore = rrank.getMinscore() * zfscore;
|
|
440
|
+ double maxscore = ExamUtil.mul(maxrate, zfscore);
|
|
441
|
+ double minscore = ExamUtil.mul(minrate, zfscore);
|
440
|
442
|
rrank.setMaxscore(maxscore);
|
441
|
443
|
rrank.setMinscore(minscore);
|
442
|
444
|
rrankList.add(rrank);
|
|
@@ -458,11 +460,13 @@ public class EReportGenerateService {
|
458
|
460
|
for (ERPaperVo paper : papers) {
|
459
|
461
|
String subjectid = paper.getSubjectid();
|
460
|
462
|
pscore = scoreMap.get(subjectid);
|
461
|
|
- maxscore = rrank.getMaxscore() * pscore;
|
462
|
|
- minscore = rrank.getMinscore() * pscore;
|
|
463
|
+ maxscore = ExamUtil.mul(maxrate, pscore);
|
|
464
|
+ minscore = ExamUtil.mul(minrate, pscore);
|
463
|
465
|
rrank.setMaxscore(maxscore);
|
464
|
466
|
rrank.setMinscore(minscore);
|
465
|
|
- rrankList.add(rrank);
|
|
467
|
+ ERrank rrank1 = new ERrank();
|
|
468
|
+ BeanUtils.copyProperties(rrank, rrank1);
|
|
469
|
+ rrankList.add(rrank1);
|
466
|
470
|
rankrange = "[" + minscore + "," + maxscore;
|
467
|
471
|
if (rankname.equals("A")) {
|
468
|
472
|
rankrange = rankrange + "]";
|
|
@@ -494,8 +498,8 @@ public class EReportGenerateService {
|
494
|
498
|
for (Integer i = 1; i <= gnum; i++) {
|
495
|
499
|
ERrank rrank = new ERrank();
|
496
|
500
|
rrank.setRanktype(ranktype);
|
497
|
|
- double maxscore = i * linescore;
|
498
|
|
- double minscore = (i - 1) * linescore;
|
|
501
|
+ double maxscore = ExamUtil.mul(i, linescore);
|
|
502
|
+ double minscore = ExamUtil.mul(i - 1, linescore);
|
499
|
503
|
if (maxscore > zfscore) {
|
500
|
504
|
maxscore = zfscore;
|
501
|
505
|
}
|
|
@@ -526,13 +530,11 @@ public class EReportGenerateService {
|
526
|
530
|
for (Integer i = 1; i <= cnum; i++) {
|
527
|
531
|
ERrank rrank = new ERrank();
|
528
|
532
|
rrank.setRanktype(ranktype);
|
529
|
|
- double maxscore = i * linescore;
|
530
|
|
- double minscore = (i - 1) * linescore;
|
|
533
|
+ double maxscore = ExamUtil.mul(i, linescore);
|
|
534
|
+ double minscore = ExamUtil.mul(i - 1, linescore);
|
531
|
535
|
if (maxscore > zfscore) {
|
532
|
536
|
maxscore = zfscore;
|
533
|
537
|
}
|
534
|
|
- maxscore = rrank.getMaxscore() * pscore;
|
535
|
|
- minscore = rrank.getMinscore() * pscore;
|
536
|
538
|
rrank.setMaxscore(maxscore);
|
537
|
539
|
rrank.setMinscore(minscore);
|
538
|
540
|
String rankrange = "[" + minscore + "," + maxscore;
|
|
@@ -542,7 +544,9 @@ public class EReportGenerateService {
|
542
|
544
|
rankrange = rankrange + ")";
|
543
|
545
|
}
|
544
|
546
|
rrank.setRankname(rankrange);
|
545
|
|
- rrankList.add(rrank);
|
|
547
|
+ ERrank rrank1 = new ERrank();
|
|
548
|
+ BeanUtils.copyProperties(rrank, rrank1);
|
|
549
|
+ rrankList.add(rrank1);
|
546
|
550
|
|
547
|
551
|
//全部班级统计
|
548
|
552
|
for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
|
|
@@ -562,14 +566,15 @@ public class EReportGenerateService {
|
562
|
566
|
}
|
563
|
567
|
}
|
564
|
568
|
} else if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
|
565
|
|
- Integer linescore = eRrank.getLinescore();
|
|
569
|
+ Integer linescore1 = eRrank.getLinescore();
|
|
570
|
+ Integer linescore = linescore1;
|
566
|
571
|
Integer floatscore = eRrank.getFloatscore();
|
567
|
|
- if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (zfscore * 0.8);
|
|
572
|
+ if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(zfscore, 0.8));
|
568
|
573
|
//总分统计
|
569
|
574
|
ERrank rrank = new ERrank();
|
570
|
575
|
rrank.setRanktype(ranktype);
|
571
|
|
- double maxscore = linescore + floatscore;
|
572
|
|
- double minscore = linescore - floatscore;
|
|
576
|
+ double maxscore = ExamUtil.add(linescore, floatscore);
|
|
577
|
+ double minscore = ExamUtil.sub(linescore, floatscore);
|
573
|
578
|
if (maxscore > zfscore) maxscore = zfscore;
|
574
|
579
|
if (minscore < 0) minscore = 0;
|
575
|
580
|
rrank.setMaxscore(maxscore);
|
|
@@ -591,9 +596,10 @@ public class EReportGenerateService {
|
591
|
596
|
for (ERPaperVo paper : papers) {
|
592
|
597
|
String subjectid = paper.getSubjectid();
|
593
|
598
|
pscore = scoreMap.get(subjectid);
|
594
|
|
- if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (pscore * 0.8);
|
595
|
|
- maxscore = linescore + floatscore;
|
596
|
|
- minscore = linescore - floatscore;
|
|
599
|
+ linescore = linescore1;
|
|
600
|
+ if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(pscore, 0.8));
|
|
601
|
+ maxscore = ExamUtil.add(linescore, floatscore);
|
|
602
|
+ minscore = ExamUtil.sub(linescore, floatscore);
|
597
|
603
|
if (maxscore > pscore) maxscore = pscore;
|
598
|
604
|
if (minscore < 0) minscore = 0;
|
599
|
605
|
rrank.setMaxscore(maxscore);
|
|
@@ -602,7 +608,9 @@ public class EReportGenerateService {
|
602
|
608
|
rrank.setFloatscore(floatscore);
|
603
|
609
|
rankrange = "[" + minscore + "," + maxscore + "]";
|
604
|
610
|
rrank.setRankname(rankrange);
|
605
|
|
- rrankList.add(rrank);
|
|
611
|
+ ERrank rrank1 = new ERrank();
|
|
612
|
+ BeanUtils.copyProperties(rrank, rrank1);
|
|
613
|
+ rrankList.add(rrank1);
|
606
|
614
|
|
607
|
615
|
//全部班级统计
|
608
|
616
|
for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
|
|
@@ -626,8 +634,8 @@ public class EReportGenerateService {
|
626
|
634
|
//总分统计
|
627
|
635
|
ERrank rrank = new ERrank();
|
628
|
636
|
rrank.setRanktype(ranktype);
|
629
|
|
- double maxscore = linescore - floatscore;//最高名次
|
630
|
|
- double minscore = linescore + floatscore;//最低名次
|
|
637
|
+ double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
|
|
638
|
+ double minscore = ExamUtil.add(linescore, floatscore);//最低名次
|
631
|
639
|
if (maxscore < 1) maxscore = 1;//最高名次为1
|
632
|
640
|
int stunum = (int) students.stream().map(s -> s.getStudentid()).distinct().count();//学生数量
|
633
|
641
|
if (minscore > stunum) minscore = stunum;//最低名次=学生数量
|
|
@@ -649,8 +657,8 @@ public class EReportGenerateService {
|
649
|
657
|
//分科统计
|
650
|
658
|
for (ERPaperVo paper : papers) {
|
651
|
659
|
String subjectid = paper.getSubjectid();
|
652
|
|
- maxscore = linescore - floatscore;//最高名次
|
653
|
|
- minscore = linescore + floatscore;//最低名次
|
|
660
|
+ maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
|
|
661
|
+ minscore = ExamUtil.add(linescore, floatscore);//最低名次
|
654
|
662
|
if (maxscore < 1) maxscore = 1;//最高名次为1
|
655
|
663
|
stunum = students.size();//学生数量
|
656
|
664
|
if (minscore > stunum) minscore = stunum;//最低名次=学生数量
|
|
@@ -660,7 +668,9 @@ public class EReportGenerateService {
|
660
|
668
|
rrank.setFloatscore(floatscore);
|
661
|
669
|
rankrange = "[" + minscore + "," + maxscore + "]";
|
662
|
670
|
rrank.setRankname(rankrange);
|
663
|
|
- rrankList.add(rrank);
|
|
671
|
+ ERrank rrank1 = new ERrank();
|
|
672
|
+ BeanUtils.copyProperties(rrank, rrank1);
|
|
673
|
+ rrankList.add(rrank1);
|
664
|
674
|
|
665
|
675
|
//全部班级统计
|
666
|
676
|
for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
|