Browse Source

报告bug修复

xiaof 4 years ago
parent
commit
99b5109a30

+ 19 - 17
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.report.business.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
+import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
@@ -255,36 +256,37 @@ public class ReportCommonServiceImpl implements ReportCommonService {
                         .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
                         .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
             } else if ("(".equals(minSign) && "]".equals(maxSign)) {
             } else if ("(".equals(minSign) && "]".equals(maxSign)) {
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue >= e.getTotalScore().doubleValue()).count();
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue >= e.getTotalScore().doubleValue()).count();
                 currentCountAfter = (int) currentDistributionResultList.stream()
                 currentCountAfter = (int) currentDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
             } else if ("[".equals(minSign) && ")".equals(maxSign)) {
             } else if ("[".equals(minSign) && ")".equals(maxSign)) {
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
                 currentCountAfter = (int) currentDistributionResultList.stream()
                 currentCountAfter = (int) currentDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
             } else if ("[".equals(minSign) && "]".equals(maxSign)) {
             } else if ("[".equals(minSign) && "]".equals(maxSign)) {
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
                 allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getTotalScore().doubleValue() && maxValue >= e.getTotalScore().doubleValue()).count();
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
                 allCountAfter = (int) surveyTeacherDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
                 currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
-                        .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getTotalScore().doubleValue() && maxValue >= e.getTotalScore().doubleValue()).count();
                 currentCountAfter = (int) currentDistributionResultList.stream()
                 currentCountAfter = (int) currentDistributionResultList.stream()
-                        .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
+                        .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
             }
             }
-            allCountRateBefore = allCountBefore > 0 ? MathUtil.formatDouble2(allTotalCount / allCountBefore) : 0;
-            allCountRateAfter = allCountAfter > 0 ? MathUtil.formatDouble2(allTotalCount / allCountAfter) : 0;
-            currentCountRateBefore = currentCountBefore > 0 ? MathUtil.formatDouble2(currentTotalCount / currentCountBefore) : 0;
-            currentCountRateAfter = currentCountAfter > 0 ? MathUtil.formatDouble2(currentTotalCount / currentCountAfter) : 0;
+            BigDecimal hundredBig = new BigDecimal("100");
+            allCountRateBefore = allTotalCount > 0 ? new BigDecimal(allCountBefore).multiply(hundredBig).divide(new BigDecimal(allTotalCount), SystemConstant.FINAL_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
+            allCountRateAfter = allTotalCount > 0 ? new BigDecimal(allCountAfter).multiply(hundredBig).divide(new BigDecimal(allTotalCount), SystemConstant.FINAL_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
+            currentCountRateBefore = currentTotalCount > 0 ? new BigDecimal(currentCountBefore).multiply(hundredBig).divide(new BigDecimal(currentTotalCount), SystemConstant.FINAL_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
+            currentCountRateAfter = currentTotalCount > 0 ? new BigDecimal(currentCountAfter).multiply(hundredBig).divide(new BigDecimal(currentTotalCount), SystemConstant.FINAL_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
 
 
             surveyTeacherGradeDistributionResultList.add(new SurveyTeacherGradeDistributionResult(allCountBefore, allCountAfter, currentCountBefore, currentCountAfter,
             surveyTeacherGradeDistributionResultList.add(new SurveyTeacherGradeDistributionResult(allCountBefore, allCountAfter, currentCountBefore, currentCountAfter,
                     allCountRateBefore, allCountRateAfter, currentCountRateBefore, currentCountRateAfter, describe));
                     allCountRateBefore, allCountRateAfter, currentCountRateBefore, currentCountRateAfter, describe));
@@ -493,6 +495,6 @@ public class ReportCommonServiceImpl implements ReportCommonService {
         }
         }
         TAExamCourse taExamCourse = taExamCourseService.getOne(taExamCourseQueryWrapper);
         TAExamCourse taExamCourse = taExamCourseService.getOne(taExamCourseQueryWrapper);
         BigDecimal bigDecimal = new BigDecimal(1);
         BigDecimal bigDecimal = new BigDecimal(1);
-        return new SurveyTeacherExamCourseResult(taExamCourse.getAvgScore(), bigDecimal.subtract(taExamCourse.getPassRate()).multiply(new BigDecimal("100")), taExamCourse.getPaperCurrentAvgScore(), bigDecimal.subtract(taExamCourse.getPaperPassRate()).multiply(new BigDecimal("100")));
+        return new SurveyTeacherExamCourseResult(taExamCourse.getAvgScore(), bigDecimal.subtract(taExamCourse.getPassRate()).multiply(new BigDecimal("100")), taExamCourse.getCurrentAvgScore(), bigDecimal.subtract(taExamCourse.getCurrentPassRate()).multiply(new BigDecimal("100")));
     }
     }
 }
 }

+ 1 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -119,7 +119,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
             Map<String, Object> objectMap = new HashMap<>();
             Map<String, Object> objectMap = new HashMap<>();
             objectMap.put("scores", String.join(",", s.getDescribe()));
             objectMap.put("scores", String.join(",", s.getDescribe()));
             objectMap.put("totalRate", s.getAllCountRateAfter());
             objectMap.put("totalRate", s.getAllCountRateAfter());
-            objectMap.put("totalRealityCount", s.getAllCountBefore());
+            objectMap.put("totalRealityCount", s.getAllCountAfter());
             objectMap.put("currentRealityCount", s.getCurrentCountAfter());
             objectMap.put("currentRealityCount", s.getCurrentCountAfter());
             objectMap.put("currentRate", s.getCurrentCountRateAfter());
             objectMap.put("currentRate", s.getCurrentCountRateAfter());
             mapList.add(objectMap);
             mapList.add(objectMap);