diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java index b4a9ddf..757ed23 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminAppraiseServiceImpl.java @@ -92,7 +92,7 @@ public class AdminAppraiseServiceImpl implements AdminAppraiseService { slice = appraiseRecordRepository.findAllByAcademicYearId(String.format(PK.PK_APPRAISE_RECORD, schoolId), academicYearId, pageRequest); List content = slice.getContent(); if (ObjectUtils.isEmpty(content)) { - return indexData; + break; } // 分批次计算 diff --git a/src/main/java/cn/teammodel/model/vo/admin/IndexData.java b/src/main/java/cn/teammodel/model/vo/admin/IndexData.java index 7671464..dc167a0 100644 --- a/src/main/java/cn/teammodel/model/vo/admin/IndexData.java +++ b/src/main/java/cn/teammodel/model/vo/admin/IndexData.java @@ -10,10 +10,10 @@ import java.util.Map; */ @Data public class IndexData { - private Integer totalCount; - private Integer praiseCount; - private Integer criticalCount; - private Integer teacherCount; - private Integer studentCount; + private Integer totalCount = 0; + private Integer praiseCount = 0; + private Integer criticalCount = 0; + private Integer teacherCount = 0; + private Integer studentCount = 0; private Map countByWeek; } diff --git a/src/main/java/cn/teammodel/model/vo/appraise/StudentReportVo.java b/src/main/java/cn/teammodel/model/vo/appraise/StudentReportVo.java index 269f155..04ede5f 100644 --- a/src/main/java/cn/teammodel/model/vo/appraise/StudentReportVo.java +++ b/src/main/java/cn/teammodel/model/vo/appraise/StudentReportVo.java @@ -1,6 +1,7 @@ package cn.teammodel.model.vo.appraise; import cn.teammodel.model.entity.appraise.AchievementRule; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Map; @@ -12,9 +13,14 @@ import java.util.Map; */ @Data public class StudentReportVo { + @ApiModelProperty("学生表扬总数") private Integer praiseCount; + @ApiModelProperty("学生总分") private Integer score; + @ApiModelProperty("五育表扬分布图") private Map praiseDistribution; + @ApiModelProperty("五育待改进分布图") private Map criticalDistribution; + @ApiModelProperty("学生当前成就") private AchievementRule curAchievement; } diff --git a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java index 1788200..b0ed0de 100644 --- a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java @@ -1,5 +1,6 @@ package cn.teammodel.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.UUID; import cn.teammodel.common.ErrorCode; import cn.teammodel.common.IdRequest; @@ -431,6 +432,9 @@ public class EvaluationServiceImpl implements EvaluationService { // 查询成就规则 Appraise appraise = RepositoryUtil.findOne(appraiseRepository.findRulesById(schoolId, periodId), "当前成就规则还未创建"); List rules = appraise.getAchievementRules(); + if (CollectionUtil.isEmpty(rules)) { + throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "当前成就规则为空"); + } StudentReportVo reportVo = new StudentReportVo(); // 计算雷达图 Map praiseDistribution = new HashMap<>(); @@ -452,7 +456,7 @@ public class EvaluationServiceImpl implements EvaluationService { // 计算成就项 (排序 rules = rules.stream().sorted(Comparator.comparing(AchievementRule::getLevel).reversed()).collect(Collectors.toList()); Integer praiseCount = appraiseRecord.getPraiseCount(); - AchievementRule curAchievement = rules.get(0); + AchievementRule curAchievement = rules.get(rules.size() - 1); for (AchievementRule rule : rules) { Integer promotionCount = rule.getPromotionCount(); int flag = praiseCount / promotionCount;