fix: 修复首次添加评价时不会记录得分的bug

11111
winter 1 year ago
parent 29d21f0233
commit a2d75a1c3d

@ -197,6 +197,11 @@ public class EvaluationServiceImpl implements EvaluationService {
User loginUser = SecurityUtil.getLoginUser();
String schoolId = loginUser.getSchoolId();
if (!targetType.equals(TARGET_STUDENT) && !targetType.equals(TARGET_CLASS)) {
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "不受支持的评价对象");
}
// 获取评价项节点
List<AppraiseTreeNode> nodes = appraiseRepository.findNodeById(PK.PK_APPRAISE, appraiseId);
AppraiseTreeNode appraiseTreeNode = RepositoryUtil.findOne(nodes);
@ -230,21 +235,21 @@ public class EvaluationServiceImpl implements EvaluationService {
record = new AppraiseRecord();
if (targetType.equals(TARGET_STUDENT)) {
record.setTargetType(TARGET_STUDENT);
} else if (targetType.equals(TARGET_CLASS)){
record.setTargetType(TARGET_CLASS);
} else {
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "不受支持的评价对象");
record.setTargetType(TARGET_CLASS);
}
record.setTargetId(targetId);
record.setAcademicYearId(academicYearId);
record.setPraiseCount(0);
record.setScore(0);
record.setPraiseCount(appraiseTreeNode.isPraise() ? 1 : -1);
record.setScore(ObjectUtils.isEmpty(appraiseTreeNode.getScore()) ? 0 : appraiseTreeNode.getScore());
record.setNodes(items);
record.setCode(String.format(PK.PK_APPRAISE_RECORD, schoolId));
appraiseRecordRepository.save(record);
} else {
// 处理学校与学生的差异
it
if (targetType.equals(TARGET_CLASS)){
item.setSpread(spread);
}
CosmosPatchOperations operations = CosmosPatchOperations.create();
operations.add("/nodes/0", item);
// 表扬

Loading…
Cancel
Save