|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
package cn.teammodel;
|
|
|
|
|
|
|
|
|
|
import cn.teammodel.dao.EvaluationTreeRepository;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import cn.teammodel.dao.EvaluationRepository;
|
|
|
|
|
import cn.teammodel.dao.StudentRepository;
|
|
|
|
|
import cn.teammodel.manager.DingAlertNotifier;
|
|
|
|
|
import cn.teammodel.model.entity.EvaluationTree;
|
|
|
|
|
import cn.teammodel.model.entity.Evaluation;
|
|
|
|
|
import cn.teammodel.model.entity.EvaluationTreeNode;
|
|
|
|
|
import cn.teammodel.model.entity.Student;
|
|
|
|
|
import cn.teammodel.service.EvaluationService;
|
|
|
|
|
import cn.teammodel.service.impl.EvaluationServiceImpl;
|
|
|
|
|
import com.azure.cosmos.models.PartitionKey;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -13,7 +15,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
|
|
@ -25,7 +26,7 @@ class TeamModelExtensionApplicationTests {
|
|
|
|
|
@Autowired
|
|
|
|
|
StudentRepository studentRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EvaluationTreeRepository evaluationTreeRepository;
|
|
|
|
|
private EvaluationRepository evaluationRepository;
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void contextLoads() {
|
|
|
|
@ -34,9 +35,9 @@ class TeamModelExtensionApplicationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testCrud() {
|
|
|
|
|
EvaluationTree evaluationTree = new EvaluationTree();
|
|
|
|
|
evaluationTree.setCode("evaluation");
|
|
|
|
|
evaluationTree.setCampusId("default");
|
|
|
|
|
Evaluation evaluation = new Evaluation();
|
|
|
|
|
evaluation.setCode("evaluation");
|
|
|
|
|
evaluation.setPeriodId("default");
|
|
|
|
|
List<EvaluationTreeNode> nodes = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// 1
|
|
|
|
@ -62,16 +63,25 @@ class TeamModelExtensionApplicationTests {
|
|
|
|
|
nodes.add(node);
|
|
|
|
|
nodes.add(node1);
|
|
|
|
|
nodes.add(node2);
|
|
|
|
|
evaluationTree.setNodes(nodes);
|
|
|
|
|
evaluation.setNodes(nodes);
|
|
|
|
|
|
|
|
|
|
EvaluationTree saved = evaluationTreeRepository.save(evaluationTree);
|
|
|
|
|
Evaluation saved = evaluationRepository.save(evaluation);
|
|
|
|
|
System.out.println(saved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testSelect() {
|
|
|
|
|
Optional<Student> s = studentRepository.findById("24913", new PartitionKey("Base-hbcn"));
|
|
|
|
|
System.out.println(s.orElse(null));
|
|
|
|
|
Evaluation 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"));
|
|
|
|
|
EvaluationService service = new EvaluationServiceImpl();
|
|
|
|
|
System.out.println(JSONUtil.parse(service.buildTree(saved.getNodes())).toStringPretty());
|
|
|
|
|
evaluationRepository.save(saved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|