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