ソースを参照

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式版本
王宁 2年前
コミット
a9af3f2673

+ 352
- 215
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java ファイルの表示

@@ -27,7 +27,6 @@ import com.xhkjedu.sexam.vo.report.ERPointStuScoreVo;
27 27
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
28 28
 import com.xhkjedu.sexam.vo.system.UserVo;
29 29
 import com.xhkjedu.utils.N_Utils;
30
-import org.springframework.beans.BeanUtils;
31 30
 import org.springframework.stereotype.Service;
32 31
 import org.springframework.transaction.annotation.Transactional;
33 32
 
@@ -123,8 +122,10 @@ public class EReportGenerateService {
123 122
         for (Map.Entry<Integer, List<ERstudent>> entry : schoolCollect.entrySet()) {
124 123
             Integer studentid = entry.getKey();
125 124
             ERstudent cs = new ERstudent();
125
+            List<ERstudent> list = entry.getValue();
126
+            cs.setClassid(list.get(0).getClassid());
126 127
             cs.setStudentid(studentid);
127
-            cs.setScore(entry.getValue().stream().mapToDouble(s -> s.getScore()).sum());
128
+            cs.setScore(list.stream().mapToDouble(s -> s.getScore()).sum());
128 129
             schoolStudents.add(cs);
129 130
         }
130 131
         Map<Integer, List<ERstudent>> cCollect = students.stream().collect(Collectors.groupingBy(s -> s.getClassid()));
@@ -169,7 +170,7 @@ public class EReportGenerateService {
169 170
         rbase.setClassnum(classnum);
170 171
         rbase.setStunum(stunum);
171 172
         rbase.setMissnum(students.stream().filter(l -> l.getSstate() == 3)
172
-                                 .map(l -> l.getStudentid()).distinct().collect(Collectors.toList()).size());
173
+                .map(l -> l.getStudentid()).distinct().collect(Collectors.toList()).size());
173 174
         rbase.setSubjectnum(subjectnum);
174 175
         rbase.setMaxscore(schoolStatisticsMax);
175 176
         rbase.setAvgscore(schoolStatisticsAverage);
@@ -179,6 +180,8 @@ public class EReportGenerateService {
179 180
         Map<String, List<ERstudent>> subCollect = students.stream().collect(Collectors.groupingBy(s -> s.getSubjectid()));
180 181
         List<ERsubject> subjectList = new ArrayList<>();//考试报告科目情况
181 182
         List<ERclass> classList = new ArrayList<>();//考试报告班级情况
183
+        setSubject(examid, stunum, "zf", "总分", subjectList, classList, schoolStudents
184
+                , papers.stream().mapToDouble(p -> p.getPscore()).sum());
182 185
         for (Map.Entry<String, List<ERstudent>> ssEntry : subCollect.entrySet()) {
183 186
             subjectid = ssEntry.getKey();
184 187
             subjectname = subjectMap.get(subjectid);
@@ -195,74 +198,7 @@ public class EReportGenerateService {
195 198
             }
196 199
             ERPaperVo rp = paperMap.get(subjectid);
197 200
             Double allscore = rp.getPscore();//满分
198
-            double yxscore = ExamUtil.mul(allscore, 0.85);//优秀分
199
-            double lhscore = ExamUtil.mul(allscore, 0.7);//良好分
200
-            double jgscore = ExamUtil.mul(allscore, 0.6);//及格分
201
-            double dfscore = ExamUtil.mul(allscore, 0.4);//低分
202
-
203
-            DoubleSummaryStatistics statistics = list.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
204
-            ERsubject rs = new ERsubject();
205
-            rs.setExamid(examid);
206
-            rs.setSubjectid(subjectid);
207
-            rs.setSubjectname(subjectname);
208
-            rs.setScore(allscore);
209
-            rs.setMaxscore(statistics.getMax());
210
-            rs.setMinscore(statistics.getMin());
211
-            rs.setAvgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
212
-            int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
213
-                            .collect(Collectors.toList()).size();
214
-            int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
215
-                            .collect(Collectors.toList()).size();
216
-            int jgnum = list.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
217
-                            .collect(Collectors.toList()).size();
218
-            int dfnum = list.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
219
-                            .collect(Collectors.toList()).size();
220
-            List<Double> scores = list.stream().map(l -> l.getScore()).collect(Collectors.toList());
221
-            rs.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
222
-            rs.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
223
-            rs.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
224
-            rs.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
225
-            rs.setBzc(ExamUtil.standardDiviation(scores));
226
-            int sknum = list.size();
227
-            rs.setStunum(sknum);//实考人数
228
-            rs.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
229
-            subjectList.add(rs);
230
-
231
-            Map<Integer, List<ERstudent>> claCollect = list.stream().collect(Collectors.groupingBy(s -> s.getClassid()));
232
-            for (Map.Entry<Integer, List<ERstudent>> entry : claCollect.entrySet()) {
233
-                Integer classid = entry.getKey();
234
-                List<ERstudent> rstudentList = entry.getValue();
235
-                DoubleSummaryStatistics claStatistics = rstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
236
-                ERclass rc = new ERclass();
237
-                rc.setExamid(examid);
238
-                rc.setClassid(classid);
239
-                rc.setSubjectid(subjectid);
240
-                rc.setSubjectname(subjectname);
241
-                rc.setAllscore(allscore);
242
-                rc.setClassmaxscore(claStatistics.getMax());
243
-                rc.setClassminscore(claStatistics.getMin());
244
-                rc.setClassavgscore(N_Utils.formatDouble(claStatistics.getAverage(), 2));
245
-                rc.setSchoolmaxscore(statistics.getMax());
246
-                rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
247
-                sknum = rstudentList.size();
248
-                rc.setStunum(sknum);//实考人数
249
-                rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
250
-                yxnum = rstudentList.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
251
-                                    .collect(Collectors.toList()).size();
252
-                lhnum = rstudentList.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
253
-                                    .collect(Collectors.toList()).size();
254
-                jgnum = rstudentList.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
255
-                                    .collect(Collectors.toList()).size();
256
-                dfnum = rstudentList.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
257
-                                    .collect(Collectors.toList()).size();
258
-                scores = rstudentList.stream().map(l -> l.getScore()).collect(Collectors.toList());
259
-                rc.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
260
-                rc.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
261
-                rc.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
262
-                rc.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
263
-                rc.setBzc(ExamUtil.standardDiviation(scores));
264
-                classList.add(rc);
265
-            }
201
+            setSubject(examid, stunum, subjectid, subjectname, subjectList, classList, list, allscore);
266 202
         }
267 203
 
268 204
         setClassAvgRank(classList);//班级科目平均分排名
@@ -312,14 +248,87 @@ public class EReportGenerateService {
312 248
         setAction(examid, subjectMap, userMap);//行为分析
313 249
     }
314 250
 
251
+    //科目统计
252
+    private void setSubject(Integer examid, int stunum, String subjectid, String subjectname, List<ERsubject> subjectList,
253
+                            List<ERclass> classList, List<ERstudent> list, Double allscore) {
254
+        double yxscore = ExamUtil.mul(allscore, 0.85);//优秀分
255
+        double lhscore = ExamUtil.mul(allscore, 0.7);//良好分
256
+        double jgscore = ExamUtil.mul(allscore, 0.6);//及格分
257
+        double dfscore = ExamUtil.mul(allscore, 0.4);//低分
258
+
259
+        DoubleSummaryStatistics statistics = list.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
260
+        ERsubject rs = new ERsubject();
261
+        rs.setExamid(examid);
262
+        rs.setSubjectid(subjectid);
263
+        rs.setSubjectname(subjectname);
264
+        rs.setScore(allscore);
265
+        rs.setMaxscore(statistics.getMax());
266
+        rs.setMinscore(statistics.getMin());
267
+        rs.setAvgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
268
+        int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
269
+                .collect(Collectors.toList()).size();
270
+        int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
271
+                .collect(Collectors.toList()).size();
272
+        int jgnum = list.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
273
+                .collect(Collectors.toList()).size();
274
+        int dfnum = list.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
275
+                .collect(Collectors.toList()).size();
276
+        List<Double> scores = list.stream().map(l -> l.getScore()).collect(Collectors.toList());
277
+        rs.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
278
+        rs.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
279
+        rs.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
280
+        rs.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
281
+        rs.setBzc(ExamUtil.standardDiviation(scores));
282
+        int sknum = list.size();
283
+        rs.setStunum(sknum);//实考人数
284
+        rs.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
285
+        subjectList.add(rs);
286
+
287
+        Map<Integer, List<ERstudent>> claCollect = list.stream().collect(Collectors.groupingBy(s -> s.getClassid()));
288
+        for (Map.Entry<Integer, List<ERstudent>> entry : claCollect.entrySet()) {
289
+            Integer classid = entry.getKey();
290
+            List<ERstudent> rstudentList = entry.getValue();
291
+            DoubleSummaryStatistics claStatistics = rstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
292
+            ERclass rc = new ERclass();
293
+            rc.setExamid(examid);
294
+            rc.setClassid(classid);
295
+            rc.setSubjectid(subjectid);
296
+            rc.setSubjectname(subjectname);
297
+            rc.setAllscore(allscore);
298
+            rc.setClassmaxscore(claStatistics.getMax());
299
+            rc.setClassminscore(claStatistics.getMin());
300
+            rc.setClassavgscore(N_Utils.formatDouble(claStatistics.getAverage(), 2));
301
+            rc.setSchoolmaxscore(statistics.getMax());
302
+            rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
303
+            sknum = rstudentList.size();
304
+            rc.setStunum(sknum);//实考人数
305
+            rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
306
+            yxnum = rstudentList.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
307
+                    .collect(Collectors.toList()).size();
308
+            lhnum = rstudentList.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
309
+                    .collect(Collectors.toList()).size();
310
+            jgnum = rstudentList.stream().filter(l -> l.getScore().compareTo(jgscore) != -1)
311
+                    .collect(Collectors.toList()).size();
312
+            dfnum = rstudentList.stream().filter(l -> l.getScore().compareTo(dfscore) != 1)
313
+                    .collect(Collectors.toList()).size();
314
+            scores = rstudentList.stream().map(l -> l.getScore()).collect(Collectors.toList());
315
+            rc.setYxrate(N_Utils.getIntegerDivideAndMulitiply(yxnum, stunum));
316
+            rc.setLhrate(N_Utils.getIntegerDivideAndMulitiply(lhnum, stunum));
317
+            rc.setJgrate(N_Utils.getIntegerDivideAndMulitiply(jgnum, stunum));
318
+            rc.setDfrate(N_Utils.getIntegerDivideAndMulitiply(dfnum, stunum));
319
+            rc.setBzc(ExamUtil.standardDiviation(scores));
320
+            classList.add(rc);
321
+        }
322
+    }
323
+
315 324
     //班级科目平均分排名
316 325
     private void setClassAvgRank(List<ERclass> classList) {
317 326
         Map<String, Integer> classSubRank = new HashMap<>();
318 327
         Map<String, List<ERclass>> collect = classList.stream().collect(Collectors.groupingBy(c -> c.getSubjectid()));
319 328
         for (Map.Entry<String, List<ERclass>> centry : collect.entrySet()) {
320 329
             List<Map.Entry<Double, List<ERclass>>> gslist2 = centry.getValue().stream()
321
-                                                                   .collect(Collectors.groupingBy(ERclass::getClassavgscore)).entrySet()
322
-                                                                   .stream().sorted((s1, s2) -> -Double.compare(s1.getKey(), s2.getKey())).collect(Collectors.toList());
330
+                    .collect(Collectors.groupingBy(ERclass::getClassavgscore)).entrySet()
331
+                    .stream().sorted((s1, s2) -> -Double.compare(s1.getKey(), s2.getKey())).collect(Collectors.toList());
323 332
             Integer index = 1;
324 333
             for (Map.Entry<Double, List<ERclass>> entry : gslist2) {
325 334
                 for (ERclass rc : entry.getValue()) {
@@ -499,7 +508,14 @@ public class EReportGenerateService {
499 508
             , List<ERrank> rranks, Integer createid, Map<Integer, String> userMap) {
500 509
         Map<String, Double> scoreMap = papers.stream().collect(Collectors.toMap(p -> p.getSubjectid(), p -> p.getPscore()));//考试总分
501 510
         Double pscore;//试卷总分
502
-
511
+        Double zfscore = papers.stream().mapToDouble(p -> p.getPscore()).sum();//考试总分
512
+        List<ERstudent> cstudents = new ArrayList<>();//班级学生
513
+        Map<String, List<ERstudent>> cscollect = students.stream().collect(
514
+                Collectors.groupingBy(s -> s.getClassid() + "_" + s.getStudentid()));
515
+        setStuScore(cscollect, cstudents);
516
+        //总分统计
517
+        Map<Integer, List<ERstudent>> zfcollect = cstudents.stream().collect(
518
+                Collectors.groupingBy(s -> s.getClassid()));
503 519
         List<ERstudent> sstudents = new ArrayList<>();//科目学生
504 520
         Map<String, List<ERstudent>> sscollect = students.stream().collect(
505 521
                 Collectors.groupingBy(s -> s.getSubjectid() + "_" + s.getStudentid()));
@@ -513,24 +529,50 @@ public class EReportGenerateService {
513 529
         ERrank eRrank = rranks.get(0);
514 530
         Integer ranktype = eRrank.getRanktype();
515 531
         if (ranktype == 1) {//等级(A[85%~100%],B[70%~85%),C[60%~70%),D[40%~60%),E[0%~40%))
516
-            for (ERrank rrank : rranks) {
517
-                Double maxrate = rrank.getMaxscore();
518
-                Double minrate = rrank.getMinscore();
532
+            for (ERrank rank : rranks) {
533
+                Double maxrate = rank.getMaxscore();
534
+                Double minrate = rank.getMinscore();
535
+                //总分统计
536
+                double zfmaxscore = ExamUtil.mul(maxrate, zfscore);
537
+                double zfminscore = ExamUtil.mul(minrate, zfscore);
538
+                ERrank rr = new ERrank();
539
+                String rankname = rank.getRankname();
540
+                rr.setRanktype(ranktype);
541
+                rr.setRankname(rankname);
542
+                rr.setMaxscore(zfmaxscore);
543
+                rr.setMinscore(zfminscore);
544
+                rr.setSubjectid("zf");
545
+                String zfrankrange = "[" + zfminscore + "," + zfmaxscore;
546
+                if (rr.getRankname().equals("A")) {
547
+                    zfrankrange = zfrankrange + "]";
548
+                } else {
549
+                    zfrankrange = zfrankrange + ")";
550
+                }
551
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
552
+                    Integer classid = entry.getKey();
553
+                    String subjectid = "zf";
554
+                    List<ERstudent> list = entry.getValue();
555
+                    setDjTj(examid, userMap, rclassRankList, rr, zfrankrange, subjectid, classid, list);
556
+                }
557
+                IntSummaryStatistics zfstatistics = cstudents.stream().mapToInt(s -> s.getSchoolrank()).summaryStatistics();
558
+                rr.setLinescore(zfstatistics.getMax());
559
+                rr.setFloatscore(zfstatistics.getMin());
560
+                rrankList.add(rr);
519 561
 
520 562
                 //分科统计
521 563
                 for (ERPaperVo paper : papers) {
522 564
                     String subjectid = paper.getSubjectid();
565
+                    ERrank rrank = new ERrank();
566
+                    rrank.setRanktype(ranktype);
567
+                    rrank.setRankname(rankname);
523 568
                     rrank.setSubjectid(subjectid);
524 569
                     pscore = scoreMap.get(subjectid);
525 570
                     double maxscore = ExamUtil.mul(maxrate, pscore);
526 571
                     double minscore = ExamUtil.mul(minrate, pscore);
527 572
                     rrank.setMaxscore(maxscore);
528 573
                     rrank.setMinscore(minscore);
529
-                    ERrank rrank1 = new ERrank();
530
-                    BeanUtils.copyProperties(rrank, rrank1);
531
-
532 574
                     String rankrange = "[" + minscore + "," + maxscore;
533
-                    if (rrank.getRankname().equals("A")) {
575
+                    if (rankname.equals("A")) {
534 576
                         rankrange = rankrange + "]";
535 577
                     } else {
536 578
                         rankrange = rankrange + ")";
@@ -541,13 +583,13 @@ public class EReportGenerateService {
541 583
                     List<ERstudent> list = qbbjcollect.get(subjectid);
542 584
                     setDjTj(examid, userMap, rclassRankList, rrank, rankrange, subjectid, classid, list);
543 585
                     IntSummaryStatistics statistics = list.stream().mapToInt(s -> s.getSchoolrank()).summaryStatistics();
544
-                    rrank1.setLinescore(statistics.getMax());
545
-                    rrank1.setFloatscore(statistics.getMin());
546
-                    rrankList.add(rrank1);
586
+                    rrank.setLinescore(statistics.getMax());
587
+                    rrank.setFloatscore(statistics.getMin());
588
+                    rrankList.add(rrank);
547 589
 
548 590
                     //班级科目统计
549 591
                     Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
550
-                                                                     .collect(Collectors.groupingBy(s -> s.getClassid()));
592
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
551 593
                     for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
552 594
                         classid = entry.getKey();
553 595
                         list = entry.getValue();
@@ -557,6 +599,35 @@ public class EReportGenerateService {
557 599
             }
558 600
         } else if (ranktype == 2) {//分数段(10分/段)
559 601
             Integer linescore = eRrank.getLinescore();
602
+            //总分统计
603
+            Integer gnum = ExamUtil.divUp(zfscore, linescore);
604
+            for (Integer i = 1; i <= gnum; i++) {
605
+                ERrank rrank = new ERrank();
606
+                rrank.setRanktype(ranktype);
607
+                double maxscore = ExamUtil.mul(i, linescore);
608
+                double minscore = ExamUtil.mul(i - 1, linescore);
609
+                if (maxscore > zfscore) {
610
+                    maxscore = zfscore;
611
+                }
612
+                rrank.setMaxscore(maxscore);
613
+                rrank.setMinscore(minscore);
614
+                String rankrange = "[" + minscore + "," + maxscore;
615
+                if (i == gnum) {
616
+                    rankrange = rankrange + "]";
617
+                } else {
618
+                    rankrange = rankrange + ")";
619
+                }
620
+                rrank.setRankname(rankrange);
621
+                rrank.setSubjectid("zf");
622
+                rrankList.add(rrank);
623
+
624
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
625
+                    Integer classid = entry.getKey();
626
+                    String subjectid = "zf";
627
+                    List<ERstudent> list = entry.getValue();
628
+                    setFdTj(examid, userMap, rclassRankList, gnum, i, rrank, rankrange, classid, list);
629
+                }
630
+            }
560 631
 
561 632
             //分科统计
562 633
             for (ERPaperVo paper : papers) {
@@ -582,9 +653,7 @@ public class EReportGenerateService {
582 653
                         rankrange = rankrange + ")";
583 654
                     }
584 655
                     rrank.setRankname(rankrange);
585
-                    ERrank rrank1 = new ERrank();
586
-                    BeanUtils.copyProperties(rrank, rrank1);
587
-                    rrankList.add(rrank1);
656
+                    rrankList.add(rrank);
588 657
 
589 658
                     //全部班级统计
590 659
                     Integer classid = 0;
@@ -593,7 +662,7 @@ public class EReportGenerateService {
593 662
 
594 663
                     //班级科目统计
595 664
                     Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
596
-                                                                     .collect(Collectors.groupingBy(s -> s.getClassid()));
665
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
597 666
                     for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
598 667
                         classid = entry.getKey();
599 668
                         list = entry.getValue();
@@ -601,144 +670,212 @@ public class EReportGenerateService {
601 670
                     }
602 671
                 }
603 672
             }
604
-        } else if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
605
-            Integer linescore = eRrank.getLinescore();
606
-            Integer floatscore = eRrank.getFloatscore();
607
-            ERrank rrank = new ERrank();
608
-            rrank.setRanktype(ranktype);
673
+        } else {
674
+            Integer lscore = eRrank.getLinescore();
675
+            if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
676
+                Integer linescore = lscore;
677
+                Integer floatscore = eRrank.getFloatscore();
678
+                ERrank rr = new ERrank();
679
+                rr.setRanktype(ranktype);
680
+                //总分统计
681
+                if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(zfscore, 0.8));
682
+                double zfmaxscore = ExamUtil.add(linescore, floatscore);
683
+                double zfminscore = ExamUtil.sub(linescore, floatscore);
684
+                if (zfmaxscore > zfscore) zfmaxscore = zfscore;
685
+                if (zfminscore < 0) zfminscore = 0;
686
+                rr.setMaxscore(zfmaxscore);
687
+                rr.setMinscore(zfminscore);
688
+                rr.setLinescore(linescore);
689
+                rr.setFloatscore(floatscore);
690
+                String zfrankrange = "[" + zfminscore + "," + zfmaxscore + "]";
691
+                rr.setRankname(zfrankrange);
692
+                rr.setSubjectid("zf");
693
+                rrankList.add(rr);
694
+
695
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
696
+                    Integer classid = entry.getKey();
697
+                    String subjectid = "zf";
698
+                    List<ERstudent> list = entry.getValue();
699
+                    setLjfTj(examid, userMap, rclassRankList, rr, zfrankrange, classid, subjectid, list);
700
+                }
609 701
 
610
-            //分科统计
611
-            for (ERPaperVo paper : papers) {
612
-                String subjectid = paper.getSubjectid();
613
-                rrank.setSubjectid(subjectid);
614
-                pscore = scoreMap.get(subjectid);
615
-                if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(pscore, 0.8));
616
-                double maxscore = ExamUtil.add(linescore, floatscore);
617
-                double minscore = ExamUtil.sub(linescore, floatscore);
618
-                if (maxscore > pscore) maxscore = pscore;
619
-                if (minscore < 0) minscore = 0;
620
-                rrank.setMaxscore(maxscore);
621
-                rrank.setMinscore(minscore);
622
-                rrank.setLinescore(linescore);
623
-                rrank.setFloatscore(floatscore);
624
-                String rankrange = "[" + minscore + "," + maxscore + "]";
625
-                rrank.setRankname(rankrange);
626
-                ERrank rrank1 = new ERrank();
627
-                BeanUtils.copyProperties(rrank, rrank1);
628
-                rrankList.add(rrank1);
629
-
630
-                //全部班级统计
631
-                Integer classid = 0;
632
-                List<ERstudent> list = qbbjcollect.get(subjectid);
633
-                setLjfTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
634
-
635
-                //班级科目统计
636
-                Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
637
-                                                                 .collect(Collectors.groupingBy(s -> s.getClassid()));
638
-                for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
639
-                    classid = entry.getKey();
640
-                    list = entry.getValue();
702
+                //分科统计
703
+                for (ERPaperVo paper : papers) {
704
+                    String subjectid = paper.getSubjectid();
705
+                    ERrank rrank = new ERrank();
706
+                    rrank.setRanktype(ranktype);
707
+                    rrank.setSubjectid(subjectid);
708
+                    pscore = scoreMap.get(subjectid);
709
+                    linescore = lscore;
710
+                    if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(pscore, 0.8));
711
+                    double maxscore = ExamUtil.add(linescore, floatscore);
712
+                    double minscore = ExamUtil.sub(linescore, floatscore);
713
+                    if (maxscore > pscore) maxscore = pscore;
714
+                    if (minscore < 0) minscore = 0;
715
+                    rrank.setMaxscore(maxscore);
716
+                    rrank.setMinscore(minscore);
717
+                    rrank.setLinescore(linescore);
718
+                    rrank.setFloatscore(floatscore);
719
+                    String rankrange = "[" + minscore + "," + maxscore + "]";
720
+                    rrank.setRankname(rankrange);
721
+                    rrankList.add(rrank);
722
+
723
+                    //全部班级统计
724
+                    Integer classid = 0;
725
+                    List<ERstudent> list = qbbjcollect.get(subjectid);
641 726
                     setLjfTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
727
+
728
+                    //班级科目统计
729
+                    Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
730
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
731
+                    for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
732
+                        classid = entry.getKey();
733
+                        list = entry.getValue();
734
+                        setLjfTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
735
+                    }
736
+                }
737
+            } else if (ranktype == 4) {//临界名次(临界名次10,浮动名次5)
738
+                Integer linescore = lscore;
739
+                Integer floatscore = eRrank.getFloatscore();
740
+                ERrank rr = new ERrank();
741
+                rr.setRanktype(ranktype);
742
+                //总分统计
743
+                double zfmaxscore = ExamUtil.sub(linescore, floatscore);//最高名次
744
+                double zfminscore = ExamUtil.add(linescore, floatscore);//最低名次
745
+                if (zfmaxscore < 1) zfmaxscore = 1;//最高名次为1
746
+                int zfstunum = (int) students.stream().map(s -> s.getStudentid()).distinct().count();//学生数量
747
+                if (zfminscore > zfstunum) zfminscore = zfstunum;//最低名次=学生数量
748
+                rr.setMaxscore(zfmaxscore);
749
+                rr.setMinscore(zfminscore);
750
+                rr.setLinescore(linescore);
751
+                rr.setFloatscore(floatscore);
752
+                String zfrankrange = "[" + zfminscore + "," + zfmaxscore + "]";
753
+                rr.setRankname(zfrankrange);
754
+                rr.setSubjectid("zf");
755
+                rrankList.add(rr);
756
+
757
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
758
+                    Integer classid = entry.getKey();
759
+                    String subjectid = "zf";
760
+                    List<ERstudent> list = entry.getValue();
761
+                    setLjmcTj(examid, userMap, rclassRankList, rr, zfrankrange, classid, subjectid, list);
642 762
                 }
643
-            }
644
-        } else if (ranktype == 4) {//临界名次(临界名次10,浮动名次5)
645
-            Integer linescore = eRrank.getLinescore();
646
-            Integer floatscore = eRrank.getFloatscore();
647
-            ERrank rrank = new ERrank();
648
-            rrank.setRanktype(ranktype);
649 763
 
650
-            //分科统计
651
-            for (ERPaperVo paper : papers) {
652
-                String subjectid = paper.getSubjectid();
653
-                rrank.setSubjectid(subjectid);
654
-                double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
655
-                double minscore = ExamUtil.add(linescore, floatscore);//最低名次
656
-                if (maxscore < 1) maxscore = 1;//最高名次为1
657
-                Integer stunum = students.size();//学生数量
658
-                if (minscore > stunum) minscore = stunum;//最低名次=学生数量
659
-                rrank.setMaxscore(maxscore);
660
-                rrank.setMinscore(minscore);
661
-                rrank.setLinescore(linescore);
662
-                rrank.setFloatscore(floatscore);
663
-                String rankrange = "[" + minscore + "," + maxscore + "]";
664
-                rrank.setRankname(rankrange);
665
-                ERrank rrank1 = new ERrank();
666
-                BeanUtils.copyProperties(rrank, rrank1);
667
-                rrankList.add(rrank1);
668
-
669
-                //全部班级统计
670
-                Integer classid = 0;
671
-                List<ERstudent> list = qbbjcollect.get(subjectid);
672
-                setLjmcTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
673
-
674
-                //班级科目统计
675
-                Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
676
-                                                                 .collect(Collectors.groupingBy(s -> s.getClassid()));
677
-                for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
678
-                    classid = entry.getKey();
679
-                    list = entry.getValue();
764
+                //分科统计
765
+                for (ERPaperVo paper : papers) {
766
+                    String subjectid = paper.getSubjectid();
767
+                    double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
768
+                    double minscore = ExamUtil.add(linescore, floatscore);//最低名次
769
+                    if (maxscore < 1) maxscore = 1;//最高名次为1
770
+                    Integer stunum = students.size();//学生数量
771
+                    if (minscore > stunum) minscore = stunum;//最低名次=学生数量
772
+                    ERrank rrank = new ERrank();
773
+                    rrank.setRanktype(ranktype);
774
+                    rrank.setSubjectid(subjectid);
775
+                    rrank.setMaxscore(maxscore);
776
+                    rrank.setMinscore(minscore);
777
+                    rrank.setLinescore(linescore);
778
+                    rrank.setFloatscore(floatscore);
779
+                    String rankrange = "[" + minscore + "," + maxscore + "]";
780
+                    rrank.setRankname(rankrange);
781
+                    rrankList.add(rrank);
782
+
783
+                    //全部班级统计
784
+                    Integer classid = 0;
785
+                    List<ERstudent> list = qbbjcollect.get(subjectid);
680 786
                     setLjmcTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
787
+
788
+                    //班级科目统计
789
+                    Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
790
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
791
+                    for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
792
+                        classid = entry.getKey();
793
+                        list = entry.getValue();
794
+                        setLjmcTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
795
+                    }
796
+                }
797
+            } else if (ranktype == 5) {//优秀年级前(10名)
798
+                Integer linescore = lscore;
799
+                ERrank rr = new ERrank();
800
+                rr.setRanktype(ranktype);
801
+                rr.setLinescore(linescore);
802
+                String rankrange = "年级前" + linescore + "名";
803
+                rr.setRankname(rankrange);
804
+                //总分统计
805
+                rr.setSubjectid("zf");
806
+                rrankList.add(rr);
807
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
808
+                    Integer classid = entry.getKey();
809
+                    String subjectid = "zf";
810
+                    List<ERstudent> list = entry.getValue();
811
+                    setNjqTj(examid, userMap, rclassRankList, rr, rankrange, classid, subjectid, list);
681 812
                 }
682
-            }
683
-        } else if (ranktype == 5) {//优秀年级前(10名)
684
-            Integer linescore = eRrank.getLinescore();
685
-            ERrank rrank = new ERrank();
686
-            rrank.setRanktype(ranktype);
687
-            rrank.setLinescore(linescore);
688
-            String rankrange = "年级前" + linescore + "名";
689
-            rrank.setRankname(rankrange);
690 813
 
691
-            //分科统计
692
-            for (ERPaperVo paper : papers) {
693
-                String subjectid = paper.getSubjectid();
694
-                rrank.setSubjectid(subjectid);
695
-                ERrank rrank1 = new ERrank();
696
-                BeanUtils.copyProperties(rrank, rrank1);
697
-                rrankList.add(rrank1);
698
-                //全部班级统计
699
-                Integer classid = 0;
700
-                List<ERstudent> list = qbbjcollect.get(subjectid);
701
-                setNjqTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
702
-
703
-                //班级科目统计
704
-                Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
705
-                                                                 .collect(Collectors.groupingBy(s -> s.getClassid()));
706
-                for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
707
-                    classid = entry.getKey();
708
-                    list = entry.getValue();
814
+                //分科统计
815
+                for (ERPaperVo paper : papers) {
816
+                    String subjectid = paper.getSubjectid();
817
+                    ERrank rrank = new ERrank();
818
+                    rrank.setRanktype(ranktype);
819
+                    rrank.setRankname(rankrange);
820
+                    rrank.setLinescore(linescore);
821
+                    rrank.setSubjectid(subjectid);
822
+                    rrankList.add(rrank);
823
+                    //全部班级统计
824
+                    Integer classid = 0;
825
+                    List<ERstudent> list = qbbjcollect.get(subjectid);
709 826
                     setNjqTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
827
+
828
+                    //班级科目统计
829
+                    Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
830
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
831
+                    for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
832
+                        classid = entry.getKey();
833
+                        list = entry.getValue();
834
+                        setNjqTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
835
+                    }
836
+                }
837
+            } else if (ranktype == 6) {//学困年级后(10名)
838
+                Integer linescore = lscore;
839
+                ERrank rr = new ERrank();
840
+                rr.setRanktype(ranktype);
841
+                rr.setLinescore(linescore);
842
+                String rankrange = "年级后" + linescore + "名";
843
+                rr.setRankname(rankrange);
844
+                //总分统计
845
+                rr.setSubjectid("zf");
846
+                rrankList.add(rr);
847
+                for (Map.Entry<Integer, List<ERstudent>> entry : zfcollect.entrySet()) {
848
+                    Integer classid = entry.getKey();
849
+                    String subjectid = "zf";
850
+                    List<ERstudent> list = entry.getValue();
851
+                    setNjqTj(examid, userMap, rclassRankList, rr, rankrange, classid, subjectid, list);
710 852
                 }
711
-            }
712
-        } else if (ranktype == 6) {//学困年级后(10名)
713
-            Integer linescore = eRrank.getLinescore();
714
-            ERrank rrank = new ERrank();
715
-            rrank.setRanktype(ranktype);
716
-            rrank.setLinescore(linescore);
717
-            String rankrange = "年级后" + linescore + "名";
718
-            rrank.setRankname(rankrange);
719 853
 
720
-            //分科统计
721
-            for (ERPaperVo paper : papers) {
722
-                String subjectid = paper.getSubjectid();
723
-                rrank.setSubjectid(subjectid);
724
-                ERrank rrank1 = new ERrank();
725
-                BeanUtils.copyProperties(rrank, rrank1);
726
-                rrank1.setMaxscore(null);
727
-                rrankList.add(rrank1);
728
-                //全部班级统计
729
-                Integer classid = 0;
730
-                List<ERstudent> list = qbbjcollect.get(subjectid);
731
-                rrank.setMaxscore(getMaxScore(list, linescore));
732
-                setNjhTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
733
-
734
-                //班级科目统计
735
-                Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
736
-                                                                 .collect(Collectors.groupingBy(s -> s.getClassid()));
737
-                for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
738
-                    classid = entry.getKey();
739
-                    list = entry.getValue();
854
+                //分科统计
855
+                for (ERPaperVo paper : papers) {
856
+                    String subjectid = paper.getSubjectid();
857
+                    ERrank rrank = new ERrank();
858
+                    rrank.setRanktype(ranktype);
859
+                    rrank.setRankname(rankrange);
860
+                    rrank.setLinescore(linescore);
861
+                    rrank.setSubjectid(subjectid);
862
+                    rrankList.add(rrank);
863
+                    //全部班级统计
864
+                    Integer classid = 0;
865
+                    List<ERstudent> list = qbbjcollect.get(subjectid);
740 866
                     rrank.setMaxscore(getMaxScore(list, linescore));
741 867
                     setNjhTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
868
+
869
+                    //班级科目统计
870
+                    Map<Integer, List<ERstudent>> ccollect = students.stream().filter(s -> s.getSubjectid().equals(subjectid))
871
+                            .collect(Collectors.groupingBy(s -> s.getClassid()));
872
+                    for (Map.Entry<Integer, List<ERstudent>> entry : ccollect.entrySet()) {
873
+                        classid = entry.getKey();
874
+                        list = entry.getValue();
875
+                        rrank.setMaxscore(getMaxScore(list, linescore));
876
+                        setNjhTj(examid, userMap, rclassRankList, rrank, rankrange, classid, subjectid, list);
877
+                    }
878
+                    rrank.setMaxscore(null);
742 879
                 }
743 880
             }
744 881
         }

+ 2
- 1
sexam/src/main/resources/mapper/report/ERclassMapper.xml ファイルの表示

@@ -17,7 +17,8 @@
17 17
         select er.allscore,er.classmaxscore,er.classminscore,er.classavgscore,er.schoolmaxscore,er.schoolavgscore
18 18
         ,er.stunum,er.missnum,er.yxrate,er.lhrate,er.jgrate,er.dfrate,er.bzc
19 19
         ,er.classid,(case when er.classid=0 then '全部班级' else ec.classname end)classname
20
-        ,(select s.subjectname from t_subject s where er.subjectid=s.subjectid)subjectname
20
+        ,(case when er.subjectid='zf' then '总分' else (select s.subjectname from t_subject s where
21
+                er.subjectid=s.subjectid) end)subjectname
21 22
         from e_rclass er left join e_class ec on er.examid = ec.examid and er.classid = ec.classid
22 23
         where er.examid=#{examid} and er.classid=#{classid}
23 24
     </select>

+ 3
- 1
sexam/src/main/resources/mapper/report/ERclassRankMapper.xml ファイルの表示

@@ -18,8 +18,10 @@
18 18
     <select id="listByExamAndClassId" resultType="java.util.Map">
19 19
         select err.ranktype,err.rankname,err.rankrange,err.stunum,err.stujson,err.sturate
20 20
         ,err.classid,(case when err.classid=0 then '全部班级' else ec.classname end)classname
21
+        ,(case when err.subjectid='zf' then '总分' else (select s.subjectname from t_subject s where
22
+        err.subjectid=s.subjectid) end)subjectname
21 23
         from e_rclass_rank err left join e_class ec on err.examid = ec.examid and err.classid = ec.classid
22
-        where err.examid=#{rank.examid} and and err.classid=#{rank.classid}
24
+        where err.examid=#{rank.examid} and err.classid=#{rank.classid}
23 25
         <if test="rank.ranktype!=null and rank.ranktype!=0">
24 26
             and err.ranktype=#{rank.ranktype}
25 27
         </if>

+ 2
- 0
sexam/src/main/resources/mapper/report/EReportGenerateMapper.xml ファイルの表示

@@ -14,6 +14,7 @@
14 14
     <delete id="deleteExamReport">
15 15
         delete from e_rbase where examid=#{examid};
16 16
         delete from e_rclass where examid=#{examid};
17
+        delete from e_rclass_action where examid=#{examid};
17 18
         delete from e_rclass_complexity where examid=#{examid};
18 19
         delete from e_rclass_point where examid=#{examid};
19 20
         delete from e_rclass_qtype where examid=#{examid};
@@ -21,6 +22,7 @@
21 22
         delete from e_rclass_rank where examid=#{examid};
22 23
         delete from e_rrank where examid=#{examid};
23 24
         delete from e_rstudent where examid=#{examid};
25
+        delete from e_rstudent_action where examid=#{examid};
24 26
         delete from e_rstudent_complexity where examid=#{examid};
25 27
         delete from e_rstudent_point where examid=#{examid};
26 28
         delete from e_rstudent_qtype where examid=#{examid};

読み込み中…
キャンセル
保存