Browse Source

优化生成报告全班都不参加考试的错误

tags/正式版本
王宁 2 years ago
parent
commit
a9f561d2a2

+ 19
- 6
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

186
         double schoolStatisticsMax = schoolStatistics.getMax();
186
         double schoolStatisticsMax = schoolStatistics.getMax();
187
         double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
187
         double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
188
         double schoolStatisticsMin = schoolStatistics.getMin();
188
         double schoolStatisticsMin = schoolStatistics.getMin();
189
-        if (N_Utils.isListEmpty(students)) {
189
+        if (N_Utils.isListEmpty(students) || N_Utils.isListEmpty(nozeroschoolStudents)) {
190
             schoolStatisticsMax = 0;
190
             schoolStatisticsMax = 0;
191
             schoolStatisticsMin = 0;
191
             schoolStatisticsMin = 0;
192
+            schoolStatisticsAverage = 0;
192
         }
193
         }
193
 
194
 
194
         ERbase rbase = new ERbase();
195
         ERbase rbase = new ERbase();
299
         DoubleSummaryStatistics statistics = nozerolist.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
300
         DoubleSummaryStatistics statistics = nozerolist.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
300
         double maxscore = statistics.getMax();
301
         double maxscore = statistics.getMax();
301
         double minscore = statistics.getMin();
302
         double minscore = statistics.getMin();
302
-        if (N_Utils.isListEmpty(list)) {
303
+        double avgscore = N_Utils.formatDouble(statistics.getAverage(), 2);
304
+        if (N_Utils.isListEmpty(list) || N_Utils.isListEmpty(nozerolist)) {
303
             maxscore = 0;
305
             maxscore = 0;
304
             minscore = 0;
306
             minscore = 0;
307
+            avgscore = 0;
305
         }
308
         }
306
         ERsubject rs = new ERsubject();
309
         ERsubject rs = new ERsubject();
307
         rs.setExamid(examid);
310
         rs.setExamid(examid);
310
         rs.setScore(allscore);
313
         rs.setScore(allscore);
311
         rs.setMaxscore(maxscore);
314
         rs.setMaxscore(maxscore);
312
         rs.setMinscore(minscore);
315
         rs.setMinscore(minscore);
313
-        rs.setAvgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
316
+        rs.setAvgscore(avgscore);
314
         int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
317
         int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
315
                 .collect(Collectors.toList()).size();
318
                 .collect(Collectors.toList()).size();
316
         int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
319
         int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
338
             List<ERstudent> rstudentList = entry.getValue();
341
             List<ERstudent> rstudentList = entry.getValue();
339
             List<ERstudent> nozerorstudentList = rstudentList.stream().filter(s -> s.getScore()>0).collect(Collectors.toList());
342
             List<ERstudent> nozerorstudentList = rstudentList.stream().filter(s -> s.getScore()>0).collect(Collectors.toList());
340
             DoubleSummaryStatistics claStatistics = nozerorstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
343
             DoubleSummaryStatistics claStatistics = nozerorstudentList.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
344
+
345
+            double clamaxscore = claStatistics.getMax();
346
+            double claminscore = claStatistics.getMin();
347
+            double claavgscore = N_Utils.formatDouble(claStatistics.getAverage(), 2);
348
+            if (N_Utils.isListEmpty(list) || N_Utils.isListEmpty(nozerorstudentList)) {
349
+                clamaxscore = 0;
350
+                claminscore = 0;
351
+                claavgscore = 0;
352
+            }
353
+
341
             ERclass rc = new ERclass();
354
             ERclass rc = new ERclass();
342
             rc.setQkbzc(qkbzc);
355
             rc.setQkbzc(qkbzc);
343
             rc.setExamid(examid);
356
             rc.setExamid(examid);
345
             rc.setSubjectid(subjectid);
358
             rc.setSubjectid(subjectid);
346
             rc.setSubjectname(subjectname);
359
             rc.setSubjectname(subjectname);
347
             rc.setAllscore(allscore);
360
             rc.setAllscore(allscore);
348
-            rc.setClassmaxscore(claStatistics.getMax());
349
-            rc.setClassminscore(claStatistics.getMin());
350
-            rc.setClassavgscore(N_Utils.formatDouble(claStatistics.getAverage(), 2));
361
+            rc.setClassmaxscore(clamaxscore);
362
+            rc.setClassminscore(claminscore);
363
+            rc.setClassavgscore(claavgscore);
351
             rc.setSchoolmaxscore(maxscore);
364
             rc.setSchoolmaxscore(maxscore);
352
             rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
365
             rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
353
             sknum = rstudentList.stream().filter(l -> l.getSstate() == 2)
366
             sknum = rstudentList.stream().filter(l -> l.getSstate() == 2)

Loading…
Cancel
Save