|
|
|
@ -10,14 +10,12 @@ import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto;
|
|
|
|
|
import cn.teammodel.model.entity.User;
|
|
|
|
|
import cn.teammodel.model.entity.appraise.AchievementRule;
|
|
|
|
|
import cn.teammodel.model.entity.appraise.Appraise;
|
|
|
|
|
import cn.teammodel.model.entity.appraise.AppraiseTreeNode;
|
|
|
|
|
import cn.teammodel.model.entity.school.ClassInfo;
|
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
|
import cn.teammodel.model.entity.school.Student;
|
|
|
|
|
import cn.teammodel.model.entity.school.Teacher;
|
|
|
|
|
import cn.teammodel.model.vo.admin.IndexData;
|
|
|
|
|
import cn.teammodel.model.vo.admin.RankPo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.RankVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.StudentRankVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.*;
|
|
|
|
|
import cn.teammodel.model.vo.appraise.RecordVo;
|
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
|
@ -237,25 +235,43 @@ public class AdminAppraiseServiceImpl implements AdminAppraiseService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<RankPo> appraiseNodeRank(TimeRangeDto timeRangeDto) {
|
|
|
|
|
public List<AppraiseNodeRankVo> appraiseNodeRank(TimeRangeDto timeRangeDto) {
|
|
|
|
|
Long startTime = timeRangeDto.getStartTime();
|
|
|
|
|
Long endTime = timeRangeDto.getEndTime();
|
|
|
|
|
String academicYearId = timeRangeDto.getAcademicYearId();
|
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
|
|
|
|
|
|
List<RankPo> rankPoList = appraiseRecordRepository.appraiseNodeRank(
|
|
|
|
|
List<AppraiseNodeRankVo> rankVoList = appraiseRecordRepository.appraiseNodeRank(
|
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
|
academicYearId,
|
|
|
|
|
startTime,
|
|
|
|
|
endTime
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (rankPoList == null) return null;
|
|
|
|
|
rankPoList = rankPoList.stream()
|
|
|
|
|
if (rankVoList == null) return null;
|
|
|
|
|
List<String> names = rankVoList.stream().map(AppraiseNodeRankVo::getName).collect(Collectors.toList());
|
|
|
|
|
// 去重后的 nodes
|
|
|
|
|
List<AppraiseTreeNode> nodesByName = appraiseRecordRepository.findAppraiseRecordInNames(String.format(PK.PK_APPRAISE_RECORD, schoolId), academicYearId, names);
|
|
|
|
|
// 正常情况下 name 一一对应
|
|
|
|
|
Map<String, AppraiseTreeNode> nameNodeMap = nodesByName.stream().collect(Collectors.toMap(AppraiseTreeNode::getName, item -> item, (existing, replacement) -> {
|
|
|
|
|
if (replacement.getPath() != null) {
|
|
|
|
|
return replacement;
|
|
|
|
|
}
|
|
|
|
|
return existing;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
rankVoList = rankVoList.stream()
|
|
|
|
|
.sorted(Comparator.comparing(RankPo::getCount).reversed())
|
|
|
|
|
// 流中对元素操作但不改变流
|
|
|
|
|
.peek(s -> {
|
|
|
|
|
AppraiseTreeNode node = nameNodeMap.get(s.getName());
|
|
|
|
|
if (node != null) {
|
|
|
|
|
s.setPath(node.getPath());
|
|
|
|
|
s.setIsPraise(node.isPraise());
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
return rankPoList;
|
|
|
|
|
return rankVoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|