feat: 新增评价项 path 路径

11111
winter 1 year ago
parent 7918786641
commit b610194f30

@ -18,6 +18,7 @@ public class InsertNodeDto {
@ApiModelProperty(value = "父亲节点,不传则为根节点", required = true)
@NotBlank(message = "name 不能为空")
String name;
String[] path;
String logo;
Integer order = 0;
Integer score = 0;

@ -14,6 +14,7 @@ public class UpdateNodeDto {
@ApiModelProperty(value = "评价项节点的 id")
String id;
String name;
String[] path;
String logo;
Integer order;
boolean isPraise;

@ -12,6 +12,7 @@ public class AppraiseTreeNode {
String id;
String pid;
String name;
String[] path;
String logo;
String creator;
String creatorId;

@ -176,7 +176,6 @@ public class EvaluationServiceImpl implements EvaluationService {
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "父节点不存在");
}
}
// todo: 可不可以添加默认值 order ?
newNode.setId(UUID.randomUUID().toString());
newNode.setCreatorId(loginUser.getId());
newNode.setCreator(loginUser.getName());
@ -199,6 +198,7 @@ public class EvaluationServiceImpl implements EvaluationService {
.orElseThrow(() -> new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "更新节点不存在"));
// 更新字段,考虑直接 copy properties
updateNode.setName(updateNodeDto.getName());
updateNode.setPath(updateNodeDto.getPath());
updateNode.setLogo(updateNodeDto.getLogo());
updateNode.setOrder(updateNodeDto.getOrder());
updateNode.setPraise(updateNodeDto.isPraise());
@ -386,7 +386,7 @@ public class EvaluationServiceImpl implements EvaluationService {
.filter(item -> nodeId.equals(item.getId()))
.findFirst().orElseThrow(() -> new ServiceException("该记录节点不存在"));
// 鉴权(不是创建老师不能撤回)
if (!userId.equals(record.getCreatorId())) {
if (!userId.equals(record.getCreatorId()) || !loginUser.getRoles().contains("admin")) {
throw new ServiceException(ErrorCode.NO_AUTH_ERROR.getCode(), "您不是创建老师,不能撤回");
}
// 删除评价项并且恢复评分

Loading…
Cancel
Save