|
|
@ -10,14 +10,12 @@ import cn.teammodel.model.dto.admin.UpdateAchievementRuleDto;
|
|
|
|
import cn.teammodel.model.entity.User;
|
|
|
|
import cn.teammodel.model.entity.User;
|
|
|
|
import cn.teammodel.model.entity.appraise.AchievementRule;
|
|
|
|
import cn.teammodel.model.entity.appraise.AchievementRule;
|
|
|
|
import cn.teammodel.model.entity.appraise.Appraise;
|
|
|
|
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.ClassInfo;
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
import cn.teammodel.model.entity.school.Student;
|
|
|
|
import cn.teammodel.model.entity.school.Student;
|
|
|
|
import cn.teammodel.model.entity.school.Teacher;
|
|
|
|
import cn.teammodel.model.entity.school.Teacher;
|
|
|
|
import cn.teammodel.model.vo.admin.IndexData;
|
|
|
|
import cn.teammodel.model.vo.admin.*;
|
|
|
|
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.appraise.RecordVo;
|
|
|
|
import cn.teammodel.model.vo.appraise.RecordVo;
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
@ -237,25 +235,43 @@ public class AdminAppraiseServiceImpl implements AdminAppraiseService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<RankPo> appraiseNodeRank(TimeRangeDto timeRangeDto) {
|
|
|
|
public List<AppraiseNodeRankVo> appraiseNodeRank(TimeRangeDto timeRangeDto) {
|
|
|
|
Long startTime = timeRangeDto.getStartTime();
|
|
|
|
Long startTime = timeRangeDto.getStartTime();
|
|
|
|
Long endTime = timeRangeDto.getEndTime();
|
|
|
|
Long endTime = timeRangeDto.getEndTime();
|
|
|
|
String academicYearId = timeRangeDto.getAcademicYearId();
|
|
|
|
String academicYearId = timeRangeDto.getAcademicYearId();
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
|
|
|
|
|
|
|
|
List<RankPo> rankPoList = appraiseRecordRepository.appraiseNodeRank(
|
|
|
|
List<AppraiseNodeRankVo> rankVoList = appraiseRecordRepository.appraiseNodeRank(
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
academicYearId,
|
|
|
|
academicYearId,
|
|
|
|
startTime,
|
|
|
|
startTime,
|
|
|
|
endTime
|
|
|
|
endTime
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (rankPoList == null) return null;
|
|
|
|
if (rankVoList == null) return null;
|
|
|
|
rankPoList = rankPoList.stream()
|
|
|
|
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())
|
|
|
|
.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());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
return rankVoList;
|
|
|
|
return rankPoList;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|