From 610c6d4e81fe6a532e4c85be5081fd1d82dc949c Mon Sep 17 00:00:00 2001 From: winter <2436197699@qq.com> Date: Mon, 27 Nov 2023 10:35:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=20evaluation=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E6=88=90=20appraise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++- src/main/java/cn/teammodel/common/PK.java | 5 +- .../controller/EvaluationController.java | 26 +++--- .../teammodel/dao/EvaluationRepository.java | 8 +- .../entity/{Evaluation.java => Appraise.java} | 4 +- ...ionTreeNode.java => AppraiseTreeNode.java} | 4 +- .../teammodel/service/EvaluationService.java | 16 ++-- .../service/impl/EvaluationServiceImpl.java | 86 +++++++++---------- .../TeamModelExtensionApplicationTests.java | 26 +++--- .../java/cn/teammodel/TestWithoutSpring.java | 22 ++--- 10 files changed, 111 insertions(+), 98 deletions(-) rename src/main/java/cn/teammodel/model/entity/{Evaluation.java => Appraise.java} (91%) rename src/main/java/cn/teammodel/model/entity/{EvaluationTreeNode.java => AppraiseTreeNode.java} (90%) diff --git a/README.md b/README.md index 315f9c9..4c9118f 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,14 @@ - Azure OIDC(SSO) 迁移 - id-token(jwt) 验证迁移 (出现语言框架之间的签名算法规范问题,解决见: [输出复盘](https://juejin.cn/post/7300036605099163702)) - 钉钉告警: 异常通知 -- 异常文件记录 \ No newline at end of file +- 异常文件记录 + + +## 数据表规则: +### 教育评价树 +分区键: `Appraise` , 表内 `schoolId` 区分学校, `periodId` 区分学区 + +### 教育评价项 +> 学生每学期所有的评价项都在一个项中,按学校进行分区 + +分区键: `AppraiseItem-{学校id}` \ No newline at end of file diff --git a/src/main/java/cn/teammodel/common/PK.java b/src/main/java/cn/teammodel/common/PK.java index be88a68..ce92243 100644 --- a/src/main/java/cn/teammodel/common/PK.java +++ b/src/main/java/cn/teammodel/common/PK.java @@ -8,6 +8,9 @@ import com.azure.cosmos.models.PartitionKey; * @create 2023-11-22 15:31 */ public interface PK { - PartitionKey PK_EVALUATION = new PartitionKey("Evaluation"); + /** + * 评价树 + */ + PartitionKey PK_EVALUATION = new PartitionKey("Appraise"); } diff --git a/src/main/java/cn/teammodel/controller/EvaluationController.java b/src/main/java/cn/teammodel/controller/EvaluationController.java index 0b23be7..2652c98 100644 --- a/src/main/java/cn/teammodel/controller/EvaluationController.java +++ b/src/main/java/cn/teammodel/controller/EvaluationController.java @@ -5,7 +5,7 @@ import cn.teammodel.model.dto.DeleteNodeDto; import cn.teammodel.model.dto.GetEvaluateTreeDto; import cn.teammodel.model.dto.InsertNodeDto; import cn.teammodel.model.dto.UpdateNodeDto; -import cn.teammodel.model.entity.Evaluation; +import cn.teammodel.model.entity.Appraise; import cn.teammodel.service.EvaluationService; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.PostMapping; @@ -27,28 +27,28 @@ public class EvaluationController { @PostMapping("getTrees") @ApiOperation(value = "获取评价树", notes = "获取评价树") - public R getEvaluateTree(@RequestBody GetEvaluateTreeDto getEvaluateTreeDto) { - Evaluation evaluation = evaluationService.getTree(getEvaluateTreeDto); - return R.success(evaluation); + public R getEvaluateTree(@RequestBody GetEvaluateTreeDto getEvaluateTreeDto) { + Appraise appraise = evaluationService.getTree(getEvaluateTreeDto); + return R.success(appraise); } @PostMapping("insertNode") @ApiOperation(value = "新增评价树的节点") - public R insertNode(@RequestBody InsertNodeDto insertNodeDto) { - Evaluation evaluation = evaluationService.insertNode(insertNodeDto); - return R.success(evaluation); + public R insertNode(@RequestBody InsertNodeDto insertNodeDto) { + Appraise appraise = evaluationService.insertNode(insertNodeDto); + return R.success(appraise); } @PostMapping("updateNode") @ApiOperation(value = "更新评价树的节点", notes = "传递更新后的节点,而不是局部更新的值") - public R updateTree(@RequestBody UpdateNodeDto updateNodeDto) { - Evaluation evaluation = evaluationService.updateNode(updateNodeDto); - return R.success(evaluation); + public R updateTree(@RequestBody UpdateNodeDto updateNodeDto) { + Appraise appraise = evaluationService.updateNode(updateNodeDto); + return R.success(appraise); } @PostMapping("deleteNode") @ApiOperation(value = "删除评价树的节点") - public R deleteNode(@RequestBody DeleteNodeDto deleteNodeDto) { + public R deleteNode(@RequestBody DeleteNodeDto deleteNodeDto) { // todo: 注意删除子节点 - Evaluation evaluation = evaluationService.deleteNode(deleteNodeDto); - return R.success(evaluation); + Appraise appraise = evaluationService.deleteNode(deleteNodeDto); + return R.success(appraise); } } diff --git a/src/main/java/cn/teammodel/dao/EvaluationRepository.java b/src/main/java/cn/teammodel/dao/EvaluationRepository.java index fd50dfe..d6c22a1 100644 --- a/src/main/java/cn/teammodel/dao/EvaluationRepository.java +++ b/src/main/java/cn/teammodel/dao/EvaluationRepository.java @@ -1,6 +1,6 @@ package cn.teammodel.dao; -import cn.teammodel.model.entity.Evaluation; +import cn.teammodel.model.entity.Appraise; import com.azure.cosmos.models.PartitionKey; import com.azure.spring.data.cosmos.repository.CosmosRepository; import org.springframework.stereotype.Repository; @@ -16,9 +16,9 @@ import org.springframework.stereotype.Repository; * List findByLastname(String lastname, Pageable pageable);
*/ @Repository -public interface EvaluationRepository extends CosmosRepository { - Evaluation findBySchoolId(String schoolId, PartitionKey partitionKey); - Evaluation findBySchoolIdAndPeriodId(String schoolId,String periodId, PartitionKey partitionKey); +public interface EvaluationRepository extends CosmosRepository { + Appraise findBySchoolId(String schoolId, PartitionKey partitionKey); + Appraise findBySchoolIdAndPeriodId(String schoolId, String periodId, PartitionKey partitionKey); } diff --git a/src/main/java/cn/teammodel/model/entity/Evaluation.java b/src/main/java/cn/teammodel/model/entity/Appraise.java similarity index 91% rename from src/main/java/cn/teammodel/model/entity/Evaluation.java rename to src/main/java/cn/teammodel/model/entity/Appraise.java index fc6bcaf..9cb977c 100644 --- a/src/main/java/cn/teammodel/model/entity/Evaluation.java +++ b/src/main/java/cn/teammodel/model/entity/Appraise.java @@ -17,7 +17,7 @@ import java.util.List; @Container(containerName = "School") @Data @JsonInclude(JsonInclude.Include.NON_NULL) -public class Evaluation { +public class Appraise { @Id @GeneratedValue private String id; @@ -35,6 +35,6 @@ public class Evaluation { */ private String periodId; - private List nodes; + private List nodes; } diff --git a/src/main/java/cn/teammodel/model/entity/EvaluationTreeNode.java b/src/main/java/cn/teammodel/model/entity/AppraiseTreeNode.java similarity index 90% rename from src/main/java/cn/teammodel/model/entity/EvaluationTreeNode.java rename to src/main/java/cn/teammodel/model/entity/AppraiseTreeNode.java index 4d2f0bb..b5e92e5 100644 --- a/src/main/java/cn/teammodel/model/entity/EvaluationTreeNode.java +++ b/src/main/java/cn/teammodel/model/entity/AppraiseTreeNode.java @@ -10,7 +10,7 @@ import java.util.List; @Data @JsonInclude(JsonInclude.Include.NON_NULL) -public class EvaluationTreeNode { +public class AppraiseTreeNode { String id; String pid; String name; @@ -33,5 +33,5 @@ public class EvaluationTreeNode { @JsonProperty("isPraise") boolean isPraise; - List children; + List children; } diff --git a/src/main/java/cn/teammodel/service/EvaluationService.java b/src/main/java/cn/teammodel/service/EvaluationService.java index 4fb1bcd..092ddb8 100644 --- a/src/main/java/cn/teammodel/service/EvaluationService.java +++ b/src/main/java/cn/teammodel/service/EvaluationService.java @@ -4,8 +4,8 @@ import cn.teammodel.model.dto.DeleteNodeDto; import cn.teammodel.model.dto.GetEvaluateTreeDto; import cn.teammodel.model.dto.InsertNodeDto; import cn.teammodel.model.dto.UpdateNodeDto; -import cn.teammodel.model.entity.Evaluation; -import cn.teammodel.model.entity.EvaluationTreeNode; +import cn.teammodel.model.entity.Appraise; +import cn.teammodel.model.entity.AppraiseTreeNode; import java.util.List; @@ -14,12 +14,12 @@ import java.util.List; * @create 2023-11-20 17:46 */ public interface EvaluationService { - Evaluation getTree(GetEvaluateTreeDto getEvaluateTreeDto); + Appraise getTree(GetEvaluateTreeDto getEvaluateTreeDto); /** * 递归构建树 */ - Evaluation buildTree(Evaluation evaluation); + Appraise buildTree(Appraise appraise); /** * 递归扁平化树 @@ -30,20 +30,20 @@ public interface EvaluationService { * @date: 2023/11/21 16:40 * @description: */ - void flattenTree(List trees, List nodes); + void flattenTree(List trees, List nodes); /** * 新增评价树节点 */ - Evaluation insertNode(InsertNodeDto insertNodeDto); + Appraise insertNode(InsertNodeDto insertNodeDto); /** * 更新评价树节点 */ - Evaluation updateNode(UpdateNodeDto updateNodeDto); + Appraise updateNode(UpdateNodeDto updateNodeDto); /** * 删除评价树节点,同时删除其子节点 */ - Evaluation deleteNode(DeleteNodeDto deleteNodeDto); + Appraise deleteNode(DeleteNodeDto deleteNodeDto); } diff --git a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java index c2015b0..e0d02a3 100644 --- a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java @@ -9,8 +9,8 @@ import cn.teammodel.model.dto.DeleteNodeDto; import cn.teammodel.model.dto.GetEvaluateTreeDto; import cn.teammodel.model.dto.InsertNodeDto; import cn.teammodel.model.dto.UpdateNodeDto; -import cn.teammodel.model.entity.Evaluation; -import cn.teammodel.model.entity.EvaluationTreeNode; +import cn.teammodel.model.entity.Appraise; +import cn.teammodel.model.entity.AppraiseTreeNode; import cn.teammodel.model.entity.User; import cn.teammodel.security.utils.SecurityUtils; import cn.teammodel.service.EvaluationService; @@ -40,56 +40,56 @@ public class EvaluationServiceImpl implements EvaluationService { * 通用的获取 evaluation 的方法: 判断参数,判断数据是否为空
* 从 token 中获取 schoolId */ - private Evaluation findEvaluation(String periodId) { + private Appraise findEvaluation(String periodId) { periodId = StringUtils.isEmpty(periodId) ? "default" : periodId; User loginUser = SecurityUtils.getLoginUser(); String schoolId = loginUser.getSchoolId(); // 拿到要新增节点的原始数据 - Evaluation evaluation = evaluationRepository.findBySchoolIdAndPeriodId(schoolId, periodId, PK.PK_EVALUATION); - if (evaluation == null) { + Appraise appraise = evaluationRepository.findBySchoolIdAndPeriodId(schoolId, periodId, PK.PK_EVALUATION); + if (appraise == null) { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "学校评价数据不存在"); } - return evaluation; + return appraise; } @Override - public Evaluation getTree(GetEvaluateTreeDto getEvaluateTreeDto) { - Evaluation evaluation = findEvaluation(getEvaluateTreeDto.getPeriodId()); + public Appraise getTree(GetEvaluateTreeDto getEvaluateTreeDto) { + Appraise appraise = findEvaluation(getEvaluateTreeDto.getPeriodId()); - return this.buildTree(evaluation); + return this.buildTree(appraise); } @Override - public Evaluation buildTree(Evaluation evaluation) { - if (evaluation == null) { + public Appraise buildTree(Appraise appraise) { + if (appraise == null) { return null; } - List nodes = evaluation.getNodes(); - List parents = new ArrayList<>(); + List nodes = appraise.getNodes(); + List parents = new ArrayList<>(); // pid 为 null 或者 "" 则为 parents - for (EvaluationTreeNode node : nodes) { + for (AppraiseTreeNode node : nodes) { if (StringUtils.isBlank(node.getPid())) { parents.add(node); } } // 迭代构建孩子节点 - for (EvaluationTreeNode parent : parents) { + for (AppraiseTreeNode parent : parents) { buildChildren(parent, nodes); } - evaluation.setNodes(parents); - return evaluation; + appraise.setNodes(parents); + return appraise; } @Override - public void flattenTree(List trees, List nodes) { + public void flattenTree(List trees, List nodes) { // 递归结束条件 if (ObjectUtils.isEmpty(trees)) return; // 这里的每个 tree 都是组装好的树,区别于单个节点 - for (EvaluationTreeNode tree : trees) { + for (AppraiseTreeNode tree : trees) { // 递归 flattenTree(tree.getChildren(), nodes); // 回溯时删除 children,添加进列表 @@ -99,13 +99,13 @@ public class EvaluationServiceImpl implements EvaluationService { } @Override - public Evaluation insertNode(InsertNodeDto insertNodeDto) { - Evaluation evaluation = findEvaluation(insertNodeDto.getPeriodId()); + public Appraise insertNode(InsertNodeDto insertNodeDto) { + Appraise appraise = findEvaluation(insertNodeDto.getPeriodId()); User loginUser = SecurityUtils.getLoginUser(); - List originNodes = evaluation.getNodes(); + List originNodes = appraise.getNodes(); // 拷贝数据到新节点 - EvaluationTreeNode newNode = new EvaluationTreeNode(); + AppraiseTreeNode newNode = new AppraiseTreeNode(); BeanUtils.copyProperties(insertNodeDto, newNode); String newNodePid = newNode.getPid(); @@ -123,17 +123,17 @@ public class EvaluationServiceImpl implements EvaluationService { newNode.setCreateTime(LocalDateTime.now()); originNodes.add(newNode); - return buildTree(evaluationRepository.save(evaluation)); + return buildTree(evaluationRepository.save(appraise)); } @Override - public Evaluation updateNode(UpdateNodeDto updateNodeDto) { + public Appraise updateNode(UpdateNodeDto updateNodeDto) { String updateNodeId = updateNodeDto.getId(); - Evaluation evaluation = findEvaluation(updateNodeDto.getPeriodId()); - List originNodes = evaluation.getNodes(); + Appraise appraise = findEvaluation(updateNodeDto.getPeriodId()); + List originNodes = appraise.getNodes(); // 每个节点都有 id, 直接校验是否合法 - EvaluationTreeNode updateNode = originNodes.stream() + AppraiseTreeNode updateNode = originNodes.stream() .filter(item -> updateNodeId.equals(item.getId())) .findFirst() .orElseThrow(() -> new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "更新节点不存在")); @@ -144,18 +144,18 @@ public class EvaluationServiceImpl implements EvaluationService { updateNode.setPraise(updateNodeDto.isPraise()); // todo: 为新节点赋值必须参数 (id, creator), 可不可以添加默认值 order ? - return buildTree(evaluationRepository.save(evaluation)); + return buildTree(evaluationRepository.save(appraise)); } @Override - public Evaluation deleteNode(DeleteNodeDto deleteNodeDto) { + public Appraise deleteNode(DeleteNodeDto deleteNodeDto) { // 删除指定节点,可能是(一级,二级,三级),设计一个通用的 - Evaluation evaluation = findEvaluation(deleteNodeDto.getPeriodId()); - List nodes = evaluation.getNodes(); - List nodesToDelete = new ArrayList<>(); + Appraise appraise = findEvaluation(deleteNodeDto.getPeriodId()); + List nodes = appraise.getNodes(); + List nodesToDelete = new ArrayList<>(); // 迭代器安全删除 - for (EvaluationTreeNode node : nodes) { + for (AppraiseTreeNode node : nodes) { if (node.getId().equals(deleteNodeDto.getId())) { // 删除当前节点 nodesToDelete.add(node); @@ -165,14 +165,14 @@ public class EvaluationServiceImpl implements EvaluationService { } nodes.removeAll(nodesToDelete); - return buildTree(evaluationRepository.save(evaluation)); + return buildTree(evaluationRepository.save(appraise)); } /** * 递归收集 id 的节点及 id 节点的孩子节点 (迭代器删除居然也报错) */ - private void collectNodesToDelete(String id, List nodes, List nodesToDelete) { - for (EvaluationTreeNode node : nodes) { + private void collectNodesToDelete(String id, List nodes, List nodesToDelete) { + for (AppraiseTreeNode node : nodes) { if (id.equals(node.getPid())) { // 收集 nodesToDelete.add(node); @@ -186,12 +186,12 @@ public class EvaluationServiceImpl implements EvaluationService { /** * 递归的构建父亲节点的孩子,以及孩子的孩子 (理论支持无极树,但应该考虑是否增加递归深度) */ - private void buildChildren(EvaluationTreeNode parent, List nodes) { - List children = getChildren(parent, nodes); + private void buildChildren(AppraiseTreeNode parent, List nodes) { + List children = getChildren(parent, nodes); if (children.size() == 0) return; parent.setChildren(children); - for (EvaluationTreeNode child : children) { + for (AppraiseTreeNode child : children) { // 如果子节点还有孩子的话,就继续递归构建 if (getChildren(child, nodes).size() > 0) { buildChildren(child, nodes); @@ -204,9 +204,9 @@ public class EvaluationServiceImpl implements EvaluationService { /** * 获取节点的孩子节点列表 */ - private List getChildren(EvaluationTreeNode parent, List nodes) { - List children = new ArrayList<>(); - for (EvaluationTreeNode node : nodes) { + private List getChildren(AppraiseTreeNode parent, List nodes) { + List children = new ArrayList<>(); + for (AppraiseTreeNode node : nodes) { if (StringUtils.isNotBlank(node.getPid()) && node.getPid().equals(parent.getId())) { children.add(node); } diff --git a/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java b/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java index 5d6a2d9..6165015 100644 --- a/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java +++ b/src/test/java/cn/teammodel/TeamModelExtensionApplicationTests.java @@ -3,8 +3,8 @@ package cn.teammodel; import cn.teammodel.dao.EvaluationRepository; import cn.teammodel.dao.StudentRepository; import cn.teammodel.manager.DingAlertNotifier; -import cn.teammodel.model.entity.Evaluation; -import cn.teammodel.model.entity.EvaluationTreeNode; +import cn.teammodel.model.entity.Appraise; +import cn.teammodel.model.entity.AppraiseTreeNode; import cn.teammodel.service.EvaluationService; import cn.teammodel.service.impl.EvaluationServiceImpl; import com.azure.cosmos.models.PartitionKey; @@ -38,27 +38,27 @@ class TeamModelExtensionApplicationTests { @Test public void testCrud() { - Evaluation evaluation = new Evaluation(); - evaluation.setCode("evaluation"); - evaluation.setPeriodId("default"); - List nodes = new ArrayList<>(); + Appraise appraise = new Appraise(); + appraise.setCode("evaluation"); + appraise.setPeriodId("default"); + List nodes = new ArrayList<>(); // 1 String rootId = UUID.randomUUID().toString(); - EvaluationTreeNode node = new EvaluationTreeNode(); + AppraiseTreeNode node = new AppraiseTreeNode(); node.setId(rootId); node.setPid(null); node.setName("root"); node.setScore(0); // 2 - EvaluationTreeNode node1 = new EvaluationTreeNode(); + AppraiseTreeNode node1 = new AppraiseTreeNode(); String subId = UUID.randomUUID().toString(); node1.setId(subId); node1.setPid(rootId); node1.setName("child-1"); node1.setScore(0); // 3 - EvaluationTreeNode node2 = new EvaluationTreeNode(); + AppraiseTreeNode node2 = new AppraiseTreeNode(); node2.setId(UUID.randomUUID().toString()); node2.setPid(subId); node2.setName("child-2"); @@ -66,22 +66,22 @@ class TeamModelExtensionApplicationTests { nodes.add(node); nodes.add(node1); nodes.add(node2); - evaluation.setNodes(nodes); + appraise.setNodes(nodes); - Evaluation saved = cosmosTemplate.insert(evaluation, null); + Appraise saved = cosmosTemplate.insert(appraise, null); System.out.println(saved); } @Test public void testSelect() { - Evaluation saved = evaluationRepository.findBySchoolId("hbcn", new PartitionKey("evaluation")); + Appraise saved = evaluationRepository.findBySchoolId("hbcn", new PartitionKey("evaluation")); EvaluationService service = new EvaluationServiceImpl(); //System.out.println(JSONUtil.parse(service.buildTree(saved.getNodes())).toStringPretty()); } @Test public void testUpdate() { //EvaluationTree saved = evaluationTreeRepository.findBySchoolId("hbcn", new PartitionKey("evaluation")); - Evaluation saved = evaluationRepository.findBySchoolId("hbcn", new PartitionKey("evaluation")); + Appraise saved = evaluationRepository.findBySchoolId("hbcn", new PartitionKey("evaluation")); EvaluationService service = new EvaluationServiceImpl(); //System.out.println(JSONUtil.parse(service.buildTree(saved.getNodes())).toStringPretty()); evaluationRepository.save(saved); diff --git a/src/test/java/cn/teammodel/TestWithoutSpring.java b/src/test/java/cn/teammodel/TestWithoutSpring.java index 3c6c258..83b270b 100644 --- a/src/test/java/cn/teammodel/TestWithoutSpring.java +++ b/src/test/java/cn/teammodel/TestWithoutSpring.java @@ -1,7 +1,7 @@ package cn.teammodel; -import cn.teammodel.model.entity.Evaluation; -import cn.teammodel.model.entity.EvaluationTreeNode; +import cn.teammodel.model.entity.Appraise; +import cn.teammodel.model.entity.AppraiseTreeNode; import cn.teammodel.service.impl.EvaluationServiceImpl; import com.dingtalk.api.DefaultDingTalkClient; import com.dingtalk.api.DingTalkClient; @@ -88,20 +88,20 @@ public class TestWithoutSpring { @Test public void testResult() { EvaluationServiceImpl service = new EvaluationServiceImpl(); - Evaluation evaluation = new Evaluation(); - evaluation.setCode("evaluation"); - evaluation.setPeriodId("default"); - List nodes = new ArrayList<>(); + Appraise appraise = new Appraise(); + appraise.setCode("evaluation"); + appraise.setPeriodId("default"); + List nodes = new ArrayList<>(); String root2Id = UUID.randomUUID().toString(); - EvaluationTreeNode root1 = new EvaluationTreeNode(); + AppraiseTreeNode root1 = new AppraiseTreeNode(); root1.setId(root2Id); root1.setPid(null); root1.setName("root1"); root1.setScore(0); // 1 String rootId = UUID.randomUUID().toString(); - EvaluationTreeNode node = new EvaluationTreeNode(); + AppraiseTreeNode node = new AppraiseTreeNode(); node.setId(rootId); node.setPid(null); node.setName("root"); @@ -109,14 +109,14 @@ public class TestWithoutSpring { // 2 - EvaluationTreeNode node1 = new EvaluationTreeNode(); + AppraiseTreeNode node1 = new AppraiseTreeNode(); String subId = UUID.randomUUID().toString(); node1.setId(subId); node1.setPid(rootId); node1.setName("child-1"); node1.setScore(0); // 3 - EvaluationTreeNode node2 = new EvaluationTreeNode(); + AppraiseTreeNode node2 = new AppraiseTreeNode(); node2.setId(UUID.randomUUID().toString()); node2.setPid(subId); node2.setName("child-2"); @@ -125,7 +125,7 @@ public class TestWithoutSpring { nodes.add(root1); nodes.add(node1); nodes.add(node2); - evaluation.setNodes(nodes); + appraise.setNodes(nodes); //List tree = service.buildTree(nodes); //System.out.println(JSONUtil.parse(service.buildTree(tree)).toStringPretty());