|
@@ -215,24 +215,23 @@ public class ReportCommonServiceImpl implements ReportCommonService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Object surveyTeacherDistribution(Long examId, String courseCode, Long collegeId) {
|
|
|
+ public List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId) {
|
|
|
//TODO 待添加
|
|
|
- List<ExamRecordResult> examPaperTikForSchool = taExamCourseRecordService.findExamRecordByExamIdAndCourseCode(examId, courseCode);
|
|
|
- List<ExamRecordResult> examPaperTikForCollege = examPaperTikForSchool
|
|
|
- .stream().filter(e -> collegeId.longValue() == e.getCollegeId().longValue()).collect(Collectors.toList());
|
|
|
-
|
|
|
- double colTotalCount = examPaperTikForCollege.size(); // 学院总参考人数
|
|
|
- double schTotalCount = examPaperTikForSchool.size(); // 全校总参考人数
|
|
|
- if (schTotalCount < 1 || colTotalCount < 1) {
|
|
|
+ List<SurveyTeacherDistributionResult> surveyTeacherDistributionResultList = taExamCourseRecordService.surveyTeacherDistribution(examId, courseCode);
|
|
|
+ if (surveyTeacherDistributionResultList.size() < 1) {
|
|
|
throw ExceptionResultEnum.DATA_ERROR.exception();
|
|
|
}
|
|
|
+ //过滤应届
|
|
|
+ List<SurveyTeacherDistributionResult> currentDistributionResultList = surveyTeacherDistributionResultList.stream().filter(e -> e.getStudentCurrent() == true).collect(Collectors.toList());
|
|
|
+ double allTotalCount = surveyTeacherDistributionResultList.size(); // 总体人数
|
|
|
+ double currentTotalCount = currentDistributionResultList.size(); // 应届人数
|
|
|
|
|
|
// 计算成绩分布图
|
|
|
- List<GradeDistributionResult> gradeDistributionList = new ArrayList<>();
|
|
|
+ List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = new ArrayList<>();
|
|
|
for (GradeScopeEnum value : GradeScopeEnum.values()) {
|
|
|
String describe = value.getDescribe();
|
|
|
- double colCount = 0;
|
|
|
- double schCount = 0;
|
|
|
+ double allCountBefore = 0, allCountAfter = 0, currentCountBefore = 0, currentCountAfter = 0,
|
|
|
+ allCountRateBefore = 0, allCountRateAfter = 0, currentCountRateBefore = 0, currentCountRateAfter = 0;
|
|
|
|
|
|
Map<String, Object> scopeMap = AnalyzeScopeUtil.analyzeScope(value.getScope());
|
|
|
String minSign = String.valueOf(scopeMap.get("minSign"));
|
|
@@ -240,77 +239,51 @@ public class ReportCommonServiceImpl implements ReportCommonService {
|
|
|
double minValue = Double.parseDouble(String.valueOf(scopeMap.get("minValue")));
|
|
|
double maxValue = Double.parseDouble(String.valueOf(scopeMap.get("maxValue")));
|
|
|
if ("(".equals(minSign) && ")".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
+ allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ allCountAfter = (int) surveyTeacherDistributionResultList.stream()
|
|
|
.filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
+ currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ currentCountAfter = (int) currentDistributionResultList.stream()
|
|
|
.filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
-
|
|
|
- } else if ("(".equals(minSign) && "]".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
|
|
|
-
|
|
|
- } else if ("[".equals(minSign) && ")".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
-
|
|
|
- } else if ("[".equals(minSign) && "]".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue <= e.getAssignedScore().doubleValue() && maxValue >= e.getAssignedScore().doubleValue()).count();
|
|
|
- }
|
|
|
-
|
|
|
- gradeDistributionList.add(new GradeDistributionResult(colCount, schCount, describe));
|
|
|
- }
|
|
|
-
|
|
|
- // 计算分数段分布
|
|
|
- List<PiecewiseDistributionResult> piecewiseDistributionList = new ArrayList<>();
|
|
|
- for (PiecewiseScopeEnum value : PiecewiseScopeEnum.values()) {
|
|
|
- String remark = value.getRemark();
|
|
|
- String name = value.getName();
|
|
|
- double colCount = 0;
|
|
|
- double schCount = 0;
|
|
|
-
|
|
|
- Map<String, Object> scopeMap = AnalyzeScopeUtil.analyzeScope(value.getScope());
|
|
|
- String minSign = String.valueOf(scopeMap.get("minSign"));
|
|
|
- String maxSign = String.valueOf(scopeMap.get("maxSign"));
|
|
|
- double minValue = Double.parseDouble(String.valueOf(scopeMap.get("minValue")));
|
|
|
- double maxValue = Double.parseDouble(String.valueOf(scopeMap.get("maxValue")));
|
|
|
- if ("(".equals(minSign) && ")".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue < e.getPercentGrade().doubleValue() && maxValue > e.getPercentGrade().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue < e.getPercentGrade().doubleValue() && maxValue > e.getPercentGrade().doubleValue()).count();
|
|
|
-
|
|
|
} else if ("(".equals(minSign) && "]".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue < e.getPercentGrade().doubleValue() && maxValue >= e.getPercentGrade().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue < e.getPercentGrade().doubleValue() && maxValue >= e.getPercentGrade().doubleValue()).count();
|
|
|
-
|
|
|
+ allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ allCountAfter = (int) surveyTeacherDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
+ currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ currentCountAfter = (int) currentDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
} else if ("[".equals(minSign) && ")".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue <= e.getPercentGrade().doubleValue() && maxValue > e.getPercentGrade().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue <= e.getPercentGrade().doubleValue() && maxValue > e.getPercentGrade().doubleValue()).count();
|
|
|
-
|
|
|
+ allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ allCountAfter = (int) surveyTeacherDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
+ currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ currentCountAfter = (int) currentDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
} else if ("[".equals(minSign) && "]".equals(maxSign)) {
|
|
|
- colCount = (int) examPaperTikForCollege.stream()
|
|
|
- .filter(e -> minValue <= e.getPercentGrade().doubleValue() && maxValue >= e.getPercentGrade().doubleValue()).count();
|
|
|
- schCount = (int) examPaperTikForSchool.stream()
|
|
|
- .filter(e -> minValue <= e.getPercentGrade().doubleValue() && maxValue >= e.getPercentGrade().doubleValue()).count();
|
|
|
+ allCountBefore = (int) surveyTeacherDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ allCountAfter = (int) surveyTeacherDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
+ currentCountBefore = (int) currentDistributionResultList.stream()//赋分前
|
|
|
+ .filter(e -> minValue < e.getTotalScore().doubleValue() && maxValue > e.getTotalScore().doubleValue()).count();
|
|
|
+ currentCountAfter = (int) currentDistributionResultList.stream()
|
|
|
+ .filter(e -> minValue < e.getAssignedScore().doubleValue() && maxValue > e.getAssignedScore().doubleValue()).count();
|
|
|
}
|
|
|
- double colCountRate = MathUtil.formatDouble2(colCount / colTotalCount * 100); //本院比率 保留2位小数
|
|
|
- double schCountRate = MathUtil.formatDouble2(schCount / schTotalCount * 100); //全校比率 保留2位小数
|
|
|
+ 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;
|
|
|
|
|
|
- piecewiseDistributionList.add(new PiecewiseDistributionResult(name, colCount, colCountRate, schCount, schCountRate, remark));
|
|
|
+ surveyTeacherGradeDistributionResultList.add(new SurveyTeacherGradeDistributionResult(allCountBefore, allCountAfter, currentCountBefore, currentCountAfter,
|
|
|
+ allCountRateBefore, allCountRateAfter, currentCountRateBefore, currentCountRateAfter, describe));
|
|
|
}
|
|
|
-
|
|
|
- return null;
|
|
|
+ return surveyTeacherGradeDistributionResultList;
|
|
|
}
|
|
|
|
|
|
/**
|