|
|
@ -435,7 +435,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> findVoteRecord(FindVoteRecordDto findVoteRecordDto, HttpServletRequest request) {
|
|
|
|
public List<AppraiseRecordVo> findVoteRecord(FindVoteRecordDto findVoteRecordDto, HttpServletRequest request) {
|
|
|
|
String periodId = findVoteRecordDto.getPeriodId();
|
|
|
|
String periodId = findVoteRecordDto.getPeriodId();
|
|
|
|
String targetId = StringUtils.isBlank(findVoteRecordDto.getTargetId()) ? null : findVoteRecordDto.getTargetId();
|
|
|
|
String targetId = StringUtils.isBlank(findVoteRecordDto.getTargetId()) ? null : findVoteRecordDto.getTargetId();
|
|
|
|
String targetType = StringUtils.isBlank(findVoteRecordDto.getTargetType()) ? null : findVoteRecordDto.getTargetType();
|
|
|
|
String targetType = StringUtils.isBlank(findVoteRecordDto.getTargetType()) ? null : findVoteRecordDto.getTargetType();
|
|
|
@ -445,49 +445,38 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
String teacherId = loginUser.getId();
|
|
|
|
String teacherId = loginUser.getId();
|
|
|
|
String schoolId = loginUser.getSchoolId();
|
|
|
|
String schoolId = loginUser.getSchoolId();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
String academicYearId = SchoolDateUtil.calculateAcademicYearId(semesters, LocalDate.now());
|
|
|
|
String academicYearId = SchoolDateUtil.calculateAcademicYearId(semesters, LocalDate.now());
|
|
|
|
// 分页
|
|
|
|
|
|
|
|
Sort sort = Sort.by("createTime").descending();
|
|
|
|
/* // 2. 分页查询(确保 offset 计算正确)
|
|
|
|
final CosmosPageRequest pageRequest = new CosmosPageRequest(findVoteRecordDto.getCurrent(), findVoteRecordDto.getSize(), null, sort);
|
|
|
|
int page = findVoteRecordDto.getCurrent();
|
|
|
|
Page<AppraiseRecordVo> appraiseRecordItemPage = appraiseRecordRepository.searchNodesByCondition(
|
|
|
|
int size = findVoteRecordDto.getSize();
|
|
|
|
|
|
|
|
//int offset = page * size; // 计算实际偏移量
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CosmosPageRequest pageRequest =new CosmosPageRequest(page, size,null);*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AppraiseRecordVo> content = appraiseRecordRepository.searchNodesByCondition(
|
|
|
|
targetId,
|
|
|
|
targetId,
|
|
|
|
targetType,
|
|
|
|
targetType,
|
|
|
|
classId,
|
|
|
|
classId,
|
|
|
|
teacherId,
|
|
|
|
teacherId,
|
|
|
|
academicYearId,
|
|
|
|
academicYearId,
|
|
|
|
isPraise,
|
|
|
|
isPraise,
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId)
|
|
|
|
pageRequest
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
List<AppraiseRecordVo> content = appraiseRecordItemPage.getContent();
|
|
|
|
/* List<AppraiseRecordVo> content = appraiseRecordItemPage.getContent();
|
|
|
|
long total = appraiseRecordItemPage.getTotalElements(); // 获取总数
|
|
|
|
long total = appraiseRecordItemPage.getTotalElements(); // 获取总数*/
|
|
|
|
//提取学生ID 查询学生个人信息
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 提取学生ID,查询学生个人信息
|
|
|
|
Set<String> studentIds = content.stream().map(AppraiseRecordVo::getTargetId).collect(Collectors.toSet());
|
|
|
|
Set<String> studentIds = content.stream().map(AppraiseRecordVo::getTargetId).collect(Collectors.toSet());
|
|
|
|
if (studentIds.isEmpty()) throw new ServiceException(ErrorCode.PARAM_ERROR.getCode(), "没有对应学生信息");
|
|
|
|
if (studentIds.isEmpty()) throw new ServiceException(ErrorCode.PARAM_ERROR.getCode(), "没有对应学生信息");
|
|
|
|
List<Student> students = studentRepository.findAllByCodeAndIdIn(String.format(PK.STUDENT, schoolId), studentIds);
|
|
|
|
List<Student> students = studentRepository.findAllByCodeAndIdIn(String.format(PK.STUDENT, schoolId), studentIds);
|
|
|
|
Set<String> classIds = students.stream().map(Student::getClassId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
|
Set<String> classIds = students.stream().map(Student::getClassId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
|
List<ClassInfo> classes = classRepository.findAllByCodeAndIdIn(String.format(PK.CLASS, schoolId), classIds);
|
|
|
|
List<ClassInfo> classes = classRepository.findAllByCodeAndIdIn(String.format(PK.CLASS, schoolId), classIds);
|
|
|
|
|
|
|
|
|
|
|
|
//以防万一 其他成员名单
|
|
|
|
// 4. 补充学生和班级信息
|
|
|
|
/*GroupDto groupDto = new GroupDto();
|
|
|
|
for (AppraiseRecordVo appraiseRecordVo : content) {
|
|
|
|
groupDto.setIds(new ArrayList<>(classIds));
|
|
|
|
|
|
|
|
groupDto.setSchoolId(schoolId);
|
|
|
|
|
|
|
|
String url = env.getProperty("ies.server-url-group");
|
|
|
|
|
|
|
|
Map<String, Object> groupId = GroupUtil.getGroupId(groupDto,new GroupUtil(env), request,url);
|
|
|
|
|
|
|
|
List<RGroupList> rGroupList = new ArrayList<>();
|
|
|
|
|
|
|
|
List<RMember> rMembers = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Map.Entry<String, Object> entry : groupId.entrySet()) {
|
|
|
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
|
|
|
Object value = entry.getValue();
|
|
|
|
|
|
|
|
if (key.equals("groups")) {
|
|
|
|
|
|
|
|
String jsonGroups = JSON.toJSONString(value);
|
|
|
|
|
|
|
|
rGroupList = JSON.parseObject(jsonGroups, new TypeReference<List<RGroupList>>() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
for(AppraiseRecordVo appraiseRecordVo : content) {
|
|
|
|
|
|
|
|
students.stream().filter(student -> student.getId().equals(appraiseRecordVo.getTargetId()))
|
|
|
|
students.stream().filter(student -> student.getId().equals(appraiseRecordVo.getTargetId()))
|
|
|
|
.findFirst()
|
|
|
|
.findFirst()
|
|
|
|
.ifPresent(student -> {
|
|
|
|
.ifPresent(student -> {
|
|
|
@ -499,9 +488,10 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
appraiseRecordVo.setClassName(classInfo.getName());
|
|
|
|
appraiseRecordVo.setClassName(classInfo.getName());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
params.put("total", total);
|
|
|
|
|
|
|
|
params.put("content", content);
|
|
|
|
// 5. 返回分页结果
|
|
|
|
return params;
|
|
|
|
|
|
|
|
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|