|
|
|
@ -14,6 +14,7 @@ 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.vo.appraise.AppraiseRecordVo;
|
|
|
|
|
import cn.teammodel.security.utils.SecurityUtil;
|
|
|
|
|
import cn.teammodel.service.EvaluationService;
|
|
|
|
|
import cn.teammodel.utils.RepositoryUtil;
|
|
|
|
@ -78,7 +79,6 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
|
User loginUser = SecurityUtil.getLoginUser();
|
|
|
|
|
String schoolId = loginUser.getSchoolId();
|
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(schoolId, periodId, PK.PK_APPRAISE);
|
|
|
|
|
|
|
|
|
|
// todo: 是否要对学段进行鉴权
|
|
|
|
|
if (appraise != null) {
|
|
|
|
|
return this.buildTree(appraise);
|
|
|
|
@ -240,16 +240,17 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
|
String periodId;
|
|
|
|
|
String name;
|
|
|
|
|
String avatar = null;
|
|
|
|
|
String gender = null;
|
|
|
|
|
// 分别对班级和学生的关键信息取值
|
|
|
|
|
if (targetType.equals(TARGET_STUDENT)) {
|
|
|
|
|
Student student = studentRepository.findStudentByIdAndCode(targetId, String.format(PK.STUDENT, schoolId));
|
|
|
|
|
if (student == null) {
|
|
|
|
|
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "该学生不存在");
|
|
|
|
|
}
|
|
|
|
|
List<Student> list = studentRepository.findByIdAndCode(targetId, String.format(PK.STUDENT, schoolId));
|
|
|
|
|
Student student = RepositoryUtil.findOne(list, "该学生不存在");
|
|
|
|
|
|
|
|
|
|
classId = student.getClassId();
|
|
|
|
|
periodId = student.getPeriodId();
|
|
|
|
|
name = student.getName();
|
|
|
|
|
avatar = student.getPicture();
|
|
|
|
|
gender = student.getGender();
|
|
|
|
|
} else if (targetType.equals(TARGET_CLASS)){
|
|
|
|
|
ClassInfo classInfo = classRepository.findClassByIdAndCode(targetId, String.format(PK.CLASS, schoolId));
|
|
|
|
|
if (classInfo == null) {
|
|
|
|
@ -300,6 +301,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
|
record.setClassId(classId);
|
|
|
|
|
record.setName(name);
|
|
|
|
|
record.setAvatar(avatar);
|
|
|
|
|
record.setGender(gender);
|
|
|
|
|
record.setAcademicYearId(academicYearId);
|
|
|
|
|
record.setPraiseCount(appraiseTreeNode.isPraise() ? 1 : -1);
|
|
|
|
|
record.setScore(ObjectUtils.isEmpty(appraiseTreeNode.getScore()) ? 0 : appraiseTreeNode.getScore());
|
|
|
|
@ -325,7 +327,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<AppraiseRecordItem> findVoteRecord(FindVoteRecordDto findVoteRecordDto) {
|
|
|
|
|
public List<AppraiseRecordVo> findVoteRecord(FindVoteRecordDto findVoteRecordDto) {
|
|
|
|
|
String periodId = findVoteRecordDto.getPeriodId();
|
|
|
|
|
String targetId = StringUtils.isBlank(findVoteRecordDto.getTargetId()) ? null : findVoteRecordDto.getTargetId();
|
|
|
|
|
String targetType = StringUtils.isBlank(findVoteRecordDto.getTargetType()) ? null : findVoteRecordDto.getTargetType();
|
|
|
|
@ -336,7 +338,7 @@ public class EvaluationServiceImpl implements EvaluationService {
|
|
|
|
|
|
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
|
String academicYearId = SchoolDateUtil.generateAcademicId(semesters, LocalDate.now());
|
|
|
|
|
List<AppraiseRecordItem> appraiseRecordItems = appraiseRecordRepository.searchNodesByCondition(
|
|
|
|
|
List<AppraiseRecordVo> appraiseRecordItems = appraiseRecordRepository.searchNodesByCondition(
|
|
|
|
|
targetId,
|
|
|
|
|
targetType,
|
|
|
|
|
classId,
|
|
|
|
|