提交 91242aa3 authored 作者: mry's avatar mry

feat(web): 测试用例集的基本操作

上级 8e396d71
...@@ -3,9 +3,6 @@ package org.matrix.service; ...@@ -3,9 +3,6 @@ package org.matrix.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.matrix.entity.Case; import org.matrix.entity.Case;
import org.matrix.vo.InterfaceGroupVo; import org.matrix.vo.InterfaceGroupVo;
import org.matrix.vo.RecursionInterface;
import java.util.List;
/** /**
* @author mruny * @author mruny
......
...@@ -49,10 +49,12 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -49,10 +49,12 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
public void getRecursiveGrouping(Map<Long, List<InterfaceDocVo>> interfaceDocVosMap, public void getRecursiveGrouping(Map<Long, List<InterfaceDocVo>> interfaceDocVosMap,
Map<Long, List<InterfaceGroupVo>> interfaceGroupingVosMap, Map<Long, List<InterfaceGroupVo>> interfaceGroupingVosMap,
Map<Long, List<TestCaseVo>> testCaseVosMap, Map<Long, List<TestCaseVo>> testCaseVosMap,
List<InterfaceGroupVo> interfaceGroupVos) { List<InterfaceGroupVo> interfaceGroupVos,
Long i) {
if (!CollectionUtils.isEmpty(interfaceGroupVos)) { if (!CollectionUtils.isEmpty(interfaceGroupVos)) {
//根据父分组,查出所有的子分组 //根据父分组,查出所有的子分组
for (InterfaceGroupVo interfaceGroupVo : interfaceGroupVos) { for (InterfaceGroupVo interfaceGroupVo : interfaceGroupVos) {
interfaceGroupVo.setSole(i++);
interfaceGroupVo.setSort("group"); interfaceGroupVo.setSort("group");
//父分组id //父分组id
Long groupId = interfaceGroupVo.getId(); Long groupId = interfaceGroupVo.getId();
...@@ -70,11 +72,13 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -70,11 +72,13 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
for (InterfaceDocVo interfaceDocVo : interfaceDocVoList) { for (InterfaceDocVo interfaceDocVo : interfaceDocVoList) {
if (interfaceDocVo.getId() != null) { if (interfaceDocVo.getId() != null) {
interfaceDocVo.setSort("doc"); interfaceDocVo.setSort("doc");
interfaceDocVo.setSole(i++);
Long docId = interfaceDocVo.getId(); Long docId = interfaceDocVo.getId();
List<TestCaseVo> testCaseVos = testCaseVosMap.get(docId); List<TestCaseVo> testCaseVos = testCaseVosMap.get(docId);
if (!CollectionUtils.isEmpty(testCaseVos)) { if (!CollectionUtils.isEmpty(testCaseVos)) {
for (TestCaseVo testCaseVo : testCaseVos) { for (TestCaseVo testCaseVo : testCaseVos) {
testCaseVo.setSort("testCase"); testCaseVo.setSort("testCase");
testCaseVo.setSole(i++);
} }
} }
interfaceDocVo.setChildren(testCaseVos); interfaceDocVo.setChildren(testCaseVos);
...@@ -84,7 +88,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -84,7 +88,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
interfaceGroupVo.setInterfaceGroupVos(interfaceGroupVoList); interfaceGroupVo.setInterfaceGroupVos(interfaceGroupVoList);
interfaceGroupVo.setChildren(interfaceDocVoList); interfaceGroupVo.setChildren(interfaceDocVoList);
if (!CollectionUtils.isEmpty(interfaceGroupVoList)) { if (!CollectionUtils.isEmpty(interfaceGroupVoList)) {
getRecursiveGrouping(interfaceDocVosMap, interfaceGroupingVosMap, testCaseVosMap, interfaceGroupVoList); getRecursiveGrouping(interfaceDocVosMap, interfaceGroupingVosMap, testCaseVosMap, interfaceGroupVoList, i);
} }
} }
} }
...@@ -92,6 +96,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -92,6 +96,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
@Override @Override
public InterfaceGroupVo getAll(Long projectId) { public InterfaceGroupVo getAll(Long projectId) {
Long i = 0L;
InterfaceGroupVo groupVo = new InterfaceGroupVo(); InterfaceGroupVo groupVo = new InterfaceGroupVo();
//分组 //分组
List<InterfaceGroupVo> interfaceGroupVos = new ArrayList<>(); List<InterfaceGroupVo> interfaceGroupVos = new ArrayList<>();
...@@ -101,6 +106,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -101,6 +106,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
InterfaceGroupVo interfaceGroupVo = interfaceGrouping.toInterfaceGroupVo(); InterfaceGroupVo interfaceGroupVo = interfaceGrouping.toInterfaceGroupVo();
interfaceGroupVo.setLabel(interfaceGrouping.getTag()); interfaceGroupVo.setLabel(interfaceGrouping.getTag());
interfaceGroupVo.setSort("group"); interfaceGroupVo.setSort("group");
interfaceGroupVo.setSole(i++);
interfaceGroupVos.add(interfaceGroupVo); interfaceGroupVos.add(interfaceGroupVo);
} }
//key: 父分组id value : 分组集合 //key: 父分组id value : 分组集合
...@@ -122,6 +128,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -122,6 +128,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
for (InterfaceDoc interfaceDoc : interfaceDocs) { for (InterfaceDoc interfaceDoc : interfaceDocs) {
InterfaceDocVo interfaceDocVo = interfaceDoc.toInterfaceDocVo(); InterfaceDocVo interfaceDocVo = interfaceDoc.toInterfaceDocVo();
interfaceDocVo.setSort("doc"); interfaceDocVo.setSort("doc");
interfaceDocVo.setSole(i++);
interfaceDocVo.setLabel(interfaceDoc.getSummary()); interfaceDocVo.setLabel(interfaceDoc.getSummary());
interfaceDocVos.add(interfaceDocVo); interfaceDocVos.add(interfaceDocVo);
} }
...@@ -143,6 +150,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -143,6 +150,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
for (Case aCase : cases) { for (Case aCase : cases) {
TestCaseVo testCaseVo = aCase.toTestCaseVo(); TestCaseVo testCaseVo = aCase.toTestCaseVo();
testCaseVo.setSort("testCase"); testCaseVo.setSort("testCase");
testCaseVo.setSole(i++);
testCaseVo.setLabel(aCase.getName()); testCaseVo.setLabel(aCase.getName());
testCaseVos.add(testCaseVo); testCaseVos.add(testCaseVo);
} }
...@@ -161,7 +169,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC ...@@ -161,7 +169,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, Case> implements IC
firstInterfaceDocVo.setChildren(testCaseVoList); firstInterfaceDocVo.setChildren(testCaseVoList);
} }
} }
getRecursiveGrouping(interfaceDocVosMap, interfaceGroupingVosMap, testCaseVosMap, firstInterfaceVoGroupings); getRecursiveGrouping(interfaceDocVosMap, interfaceGroupingVosMap, testCaseVosMap, firstInterfaceVoGroupings, i);
return groupVo; return groupVo;
} }
......
...@@ -118,4 +118,9 @@ public class InterfaceDocVo { ...@@ -118,4 +118,9 @@ public class InterfaceDocVo {
* 用来区分分组,接口,用例 * 用来区分分组,接口,用例
*/ */
public String sort; public String sort;
/**
* 传给前端的唯一值
*/
private Long sole;
} }
...@@ -81,5 +81,11 @@ public class InterfaceGroupVo { ...@@ -81,5 +81,11 @@ public class InterfaceGroupVo {
/** /**
* 用来区分分组,接口,用例 * 用来区分分组,接口,用例
*/ */
public String sort; private String sort;
/**
* 传给前端的唯一值
*/
private Long sole;
} }
...@@ -78,4 +78,9 @@ public class TestCaseVo { ...@@ -78,4 +78,9 @@ public class TestCaseVo {
*/ */
public String sort; public String sort;
/**
* 传给前端的唯一值
*/
private Long sole;
} }
package org.matrix.autotest.controller; package org.matrix.autotest.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.ArrayStack;
import org.matrix.entity.Case; import org.matrix.entity.Case;
import org.matrix.entity.MouldDoc;
import org.matrix.exception.GlobalException; import org.matrix.exception.GlobalException;
import org.matrix.service.ICaseService; import org.matrix.service.ICaseService;
import org.matrix.vo.InterfaceGroupVo; import org.matrix.vo.InterfaceGroupVo;
...@@ -14,8 +11,6 @@ import org.springframework.http.HttpStatus; ...@@ -14,8 +11,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论