diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index db9e688e93..db1b73d8f6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -44,6 +44,15 @@ public class ApiAutomationController { return PageUtils.setPageInfo(page, apiAutomationService.list(request)); } + @GetMapping("/list/{projectId}") + @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + public List list(@PathVariable String projectId) { + ApiScenarioRequest request = new ApiScenarioRequest(); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + request.setProjectId(projectId); + return apiAutomationService.list(request); + } + @PostMapping(value = "/create") public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "files") List bodyFiles) { return apiAutomationService.create(request, bodyFiles); diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java index 26d20b7aae..01032800e6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java @@ -44,7 +44,7 @@ public class ApiTestCaseController { if(!list.isEmpty()){ return list.get(0); }else { - return null; + return null; } } @@ -55,6 +55,14 @@ public class ApiTestCaseController { return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request)); } + @GetMapping("/list/{projectId}") + public List list(@PathVariable String projectId) { + ApiTestCaseRequest request = new ApiTestCaseRequest(); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + request.setProjectId(projectId); + return apiTestCaseService.listSimple(request); + } + @PostMapping("/get/request") public Map listSimple(@RequestBody ApiTestCaseRequest request) { request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCase.java b/backend/src/main/java/io/metersphere/base/domain/TestCase.java index 4569f6daca..b57a8b7649 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCase.java @@ -42,5 +42,9 @@ public class TestCase implements Serializable { private String tags; + private String demandId; + + private String demandName; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java index 8796a2848b..2d88c502a7 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java @@ -1323,6 +1323,146 @@ public class TestCaseExample { addCriterion("tags not between", value1, value2, "tags"); return (Criteria) this; } + + public Criteria andDemandIdIsNull() { + addCriterion("demand_id is null"); + return (Criteria) this; + } + + public Criteria andDemandIdIsNotNull() { + addCriterion("demand_id is not null"); + return (Criteria) this; + } + + public Criteria andDemandIdEqualTo(String value) { + addCriterion("demand_id =", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotEqualTo(String value) { + addCriterion("demand_id <>", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdGreaterThan(String value) { + addCriterion("demand_id >", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdGreaterThanOrEqualTo(String value) { + addCriterion("demand_id >=", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLessThan(String value) { + addCriterion("demand_id <", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLessThanOrEqualTo(String value) { + addCriterion("demand_id <=", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLike(String value) { + addCriterion("demand_id like", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotLike(String value) { + addCriterion("demand_id not like", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdIn(List values) { + addCriterion("demand_id in", values, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotIn(List values) { + addCriterion("demand_id not in", values, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdBetween(String value1, String value2) { + addCriterion("demand_id between", value1, value2, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotBetween(String value1, String value2) { + addCriterion("demand_id not between", value1, value2, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandNameIsNull() { + addCriterion("demand_name is null"); + return (Criteria) this; + } + + public Criteria andDemandNameIsNotNull() { + addCriterion("demand_name is not null"); + return (Criteria) this; + } + + public Criteria andDemandNameEqualTo(String value) { + addCriterion("demand_name =", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotEqualTo(String value) { + addCriterion("demand_name <>", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameGreaterThan(String value) { + addCriterion("demand_name >", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameGreaterThanOrEqualTo(String value) { + addCriterion("demand_name >=", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLessThan(String value) { + addCriterion("demand_name <", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLessThanOrEqualTo(String value) { + addCriterion("demand_name <=", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLike(String value) { + addCriterion("demand_name like", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotLike(String value) { + addCriterion("demand_name not like", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameIn(List values) { + addCriterion("demand_name in", values, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotIn(List values) { + addCriterion("demand_name not in", values, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameBetween(String value1, String value2) { + addCriterion("demand_name between", value1, value2, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotBetween(String value1, String value2) { + addCriterion("demand_name not between", value1, value2, "demandName"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml index 995cef9832..3f738911f0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml @@ -10,16 +10,18 @@ - - - - - - - - - - + + + + + + + + + + + + @@ -86,7 +88,7 @@ id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`, prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status, - tags + tags, demand_id, demand_name remark, steps @@ -140,20 +142,22 @@ - insert into test_case (id, node_id, node_path, - project_id, `name`, `type`, - maintainer, priority, `method`, - prerequisite, create_time, update_time, - test_id, sort, num, - other_test_name, review_status, tags, - remark, steps) - values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, - #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, - #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, - #{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, - #{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, - #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}) + insert into test_case (id, node_id, node_path, + project_id, `name`, `type`, + maintainer, priority, `method`, + prerequisite, create_time, update_time, + test_id, sort, num, + other_test_name, review_status, tags, + demand_id, demand_name, remark, + steps) + values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, + #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, + #{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, + #{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, + #{demandId,jdbcType=VARCHAR}, #{demandName,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, + #{steps,jdbcType=LONGVARCHAR}) insert into test_case @@ -212,6 +216,12 @@ tags, + + demand_id, + + + demand_name, + remark, @@ -274,6 +284,12 @@ #{tags,jdbcType=VARCHAR}, + + #{demandId,jdbcType=VARCHAR}, + + + #{demandName,jdbcType=VARCHAR}, + #{remark,jdbcType=LONGVARCHAR}, @@ -345,6 +361,12 @@ tags = #{record.tags,jdbcType=VARCHAR}, + + demand_id = #{record.demandId,jdbcType=VARCHAR}, + + + demand_name = #{record.demandName,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, @@ -366,18 +388,20 @@ `type` = #{record.type,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR}, - remark = #{record.remark,jdbcType=LONGVARCHAR}, - steps = #{record.steps,jdbcType=LONGVARCHAR} + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + test_id = #{record.testId,jdbcType=VARCHAR}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, + steps = #{record.steps,jdbcType=LONGVARCHAR} @@ -391,17 +415,19 @@ `name` = #{record.name,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR}, - priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR} + priority = #{record.priority,jdbcType=VARCHAR}, + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + test_id = #{record.testId,jdbcType=VARCHAR}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR} @@ -460,6 +486,12 @@ tags = #{tags,jdbcType=VARCHAR}, + + demand_id = #{demandId,jdbcType=VARCHAR}, + + + demand_name = #{demandName,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, @@ -471,46 +503,50 @@ update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR}, - remark = #{remark,jdbcType=LONGVARCHAR}, - steps = #{steps,jdbcType=LONGVARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + test_id = #{testId,jdbcType=VARCHAR}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, + steps = #{steps,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + test_id = #{testId,jdbcType=VARCHAR}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java new file mode 100644 index 0000000000..93f63e6bc9 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java @@ -0,0 +1,23 @@ +package io.metersphere.track.controller; + +import io.metersphere.track.dto.DemandDTO; +import io.metersphere.track.service.DemandService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +@RequestMapping("demand") +@RestController +public class TestCaseDemandController { + @Resource + private DemandService DemandService; + + @GetMapping("/list/{projectId}") + public List getDemandList(@PathVariable String projectId) { + return DemandService.getDemandList(projectId); + } +} diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java index ac3544d130..6ea0f97fb8 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java @@ -45,8 +45,8 @@ public class TestCaseReviewController { @PostMapping("/save") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) - public void saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) { - testCaseReviewService.saveTestCaseReview(reviewRequest); + public String saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) { + return testCaseReviewService.saveTestCaseReview(reviewRequest); } @PostMapping("/project") diff --git a/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java b/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java new file mode 100644 index 0000000000..546f1a836c --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.track.dto; + +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter +public class DemandDTO { + private String id; + private String name; +} diff --git a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java index 4a5ba53f7a..c754a0e10a 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -41,7 +41,9 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected String getPlatformConfig(String platform) { SessionUser user = SessionUtils.getUser(); String orgId = user.getLastOrganizationId(); - +/* + String orgId = "88aceecf-5764-4094-96a9-f82bd52e77ad"; +*/ IntegrationRequest request = new IntegrationRequest(); if (StringUtils.isBlank(orgId)) { MSException.throwException("organization id is null"); diff --git a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java index 8bb25cc063..8e70ef30a6 100644 --- a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java @@ -1,6 +1,7 @@ package io.metersphere.track.issue; import io.metersphere.base.domain.Issues; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; @@ -10,18 +11,24 @@ public interface IssuesPlatform { /** * 获取平台相关联的缺陷 + * * @return platform issues list */ List getIssue(); + /*获取平台相关需求*/ + List getDemandList(String projectId); + /** * 添加缺陷到缺陷平台 + * * @param issuesRequest issueRequest */ void addIssue(IssuesRequest issuesRequest); /** * 删除缺陷平台缺陷 + * * @param id issue id */ void deleteIssue(String id); diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index 50a4e66c37..a43465c48a 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -7,6 +7,7 @@ import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.EncryptUtils; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; @@ -78,6 +79,11 @@ public class JiraPlatform extends AbstractIssuePlatform { return list; } + @Override + public List getDemandList(String projectId) { + return null; + } + @Override public void addIssue(IssuesRequest issuesRequest) { String config = getPlatformConfig(IssuesManagePlatform.Jira.toString()); diff --git a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java index 7db678e738..a588c95092 100644 --- a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java @@ -5,6 +5,7 @@ import io.metersphere.base.domain.TestCaseIssues; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; @@ -22,6 +23,11 @@ public class LocalPlatform extends AbstractIssuePlatform { return extIssuesMapper.getIssues(testCaseId, IssuesManagePlatform.Local.toString()); } + @Override + public List getDemandList(String projectId) { + return null; + } + @Override public void addIssue(IssuesRequest issuesRequest) { SessionUser user = SessionUtils.getUser(); diff --git a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java index fc7e2f3137..6440c70074 100644 --- a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java @@ -9,6 +9,7 @@ import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.ResultHolder; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; @@ -64,6 +65,23 @@ public class TapdPlatform extends AbstractIssuePlatform { return list; } + @Override + public List getDemandList(String projectId) { + System.out.println(projectId); + List demandList = new ArrayList<>(); + String url = "https://api.tapd.cn/stories?workspace_id=" + projectId; + ResultHolder call = call(url); + String listJson = JSON.toJSONString(call.getData()); + JSONArray jsonArray = JSON.parseArray(listJson); + System.out.println(jsonArray); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject o = jsonArray.getJSONObject(i); + DemandDTO demand = o.getObject("Story", DemandDTO.class); + demandList.add(demand); + } + return demandList; + } + private Issues getTapdIssues(String projectId, String issuesId) { String url = "https://api.tapd.cn/bugs?workspace_id=" + projectId + "&id=" + issuesId; ResultHolder call = call(url); @@ -208,4 +226,5 @@ public class TapdPlatform extends AbstractIssuePlatform { } + } diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java index 749deecfb4..dd2b0caa51 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -7,6 +7,7 @@ import io.metersphere.base.domain.*; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.ZentaoBuild; import io.metersphere.track.request.testcase.IssuesRequest; @@ -85,6 +86,11 @@ public class ZentaoPlatform extends AbstractIssuePlatform { } + @Override + public List getDemandList(String projectId) { + return null; + } + private Issues getZentaoIssues(String bugId) { String session = login(); HttpEntity requestEntity = new HttpEntity<>(new HttpHeaders()); diff --git a/backend/src/main/java/io/metersphere/track/service/DemandService.java b/backend/src/main/java/io/metersphere/track/service/DemandService.java new file mode 100644 index 0000000000..06a89abd43 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/service/DemandService.java @@ -0,0 +1,76 @@ +package io.metersphere.track.service; + +import io.metersphere.base.domain.Issues; +import io.metersphere.base.domain.Project; +import io.metersphere.base.mapper.ProjectMapper; +import io.metersphere.commons.constants.IssuesManagePlatform; +import io.metersphere.commons.user.SessionUser; +import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.service.ProjectService; +import io.metersphere.track.dto.DemandDTO; +import io.metersphere.track.issue.AbstractIssuePlatform; +import io.metersphere.track.issue.IssueFactory; +import io.metersphere.track.request.testcase.IssuesRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class DemandService { + @Resource + private ProjectService projectService; + @Resource + private IssuesService issuesService; + @Resource + private ProjectMapper projectMapper; + + public List getDemandList(String projectId) { + Project project = projectMapper.selectByPrimaryKey(projectId); + SessionUser user = SessionUtils.getUser(); +/* + String orgId = "88aceecf-5764-4094-96a9-f82bd52e77ad"; +*/ + String orgId = user.getLastOrganizationId(); + boolean tapd = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Tapd.toString()); + boolean jira = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Jira.toString()); + boolean zentao = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Zentao.toString()); + List list = new ArrayList<>(); + List platforms = new ArrayList<>(); + IssuesRequest issueRequest = new IssuesRequest(); + if (tapd) { + // 是否关联了项目 + String tapdId = project.getTapdId(); + if (StringUtils.isNotBlank(tapdId)) { + platforms.add(IssuesManagePlatform.Tapd.name()); + } + issueRequest.setProjectId(tapdId); + } + + if (jira) { + String jiraKey = project.getJiraKey(); + if (StringUtils.isNotBlank(jiraKey)) { + platforms.add(IssuesManagePlatform.Jira.name()); + } + issueRequest.setProjectId(jiraKey); + } + + if (zentao) { + String zentaoId = project.getZentaoId(); + if (StringUtils.isNotBlank(zentaoId)) { + platforms.add(IssuesManagePlatform.Zentao.name()); + } + issueRequest.setProjectId(zentaoId); + } + List platformList = IssueFactory.createPlatforms(platforms, issueRequest); + platformList.forEach(platform -> { + List demand = platform.getDemandList(issueRequest.getProjectId()); + list.addAll(demand); + }); + return list; + } +} diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index a5944ec526..2857fecd68 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -78,7 +78,7 @@ public class TestCaseReviewService { @Resource private SystemParameterService systemParameterService; - public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) { + public String saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) { checkCaseReviewExist(reviewRequest); String reviewId = UUID.randomUUID().toString(); List userIds = reviewRequest.getUserIds();//执行人 @@ -109,6 +109,7 @@ public class TestCaseReviewService { .event(NoticeConstants.Event.CREATE) .build(); noticeSendService.send(NoticeConstants.TaskType.REVIEW_TASK, noticeModel); + return reviewRequest.getId(); } //评审内容 diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 32593286fe..5b1c1772b7 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -100,6 +100,8 @@ public class TestCaseService { testCase.setUpdateTime(System.currentTimeMillis()); testCase.setNum(getNextNum(testCase.getProjectId())); testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name()); + testCase.setDemandId(testCase.getDemandId()); + testCase.setDemandName(testCase.getDemandName()); testCaseMapper.insert(testCase); return testCase; } diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index dd2890a6e6..f8d72c5eee 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -16,17 +16,34 @@ ALTER TABLE test_resource_pool ADD gc_algo VARCHAR(200) NULL; -- create tale api_document_share CREATE TABLE IF NOT EXISTS `api_document_share` ( - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Api Document Share Info ID', - `create_time` BIGINT ( 13 ) NOT NULL COMMENT 'Create timestamp', - `create_user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `update_time` BIGINT ( 13 ) NOT NULL COMMENT 'last visit timestamp', - `share_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'single or batch', - `share_api_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'APiDefinition.id (JSONArray format. Order by TreeSet)', - PRIMARY KEY (`id`) USING BTREE, - INDEX `share_type`(`share_type`) USING BTREE, - INDEX `share_api_id`(`share_api_id`(125)) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Api Document Share Info ID', + `create_time` BIGINT ( 13 ) NOT NULL COMMENT 'Create timestamp', + `create_user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `update_time` BIGINT(13) NOT NULL COMMENT 'last visit timestamp', + `share_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'single or batch', + `share_api_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'APiDefinition.id (JSONArray format. Order by TreeSet)', + PRIMARY KEY (`id`) USING BTREE, + INDEX `share_type` (`share_type`) USING BTREE, + INDEX `share_api_id` (`share_api_id`(125)) USING BTREE +) ENGINE = InnoDB + CHARACTER SET = utf8mb4 + COLLATE = utf8mb4_general_ci + ROW_FORMAT = Dynamic; +-- test_case_review add coloumn +ALTER TABLE test_case_review + ADD tags VARCHAR(2000) NULL; + +-- swagger_url_project +alter table swagger_url_project + modify module_id varchar(120) null; + +-- add_test_case +alter table test_case + add demand_id varchar(50) null; + +alter table test_case + add demand_name varchar(999) null; -- test_case_review add column ALTER TABLE test_case_review ADD tags VARCHAR(2000) NULL; diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 8a049afd7a..5798709de6 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,13 +64,14 @@ - + -
+ +
\ No newline at end of file diff --git a/frontend/src/business/components/api/definition/model/JsonData.js b/frontend/src/business/components/api/definition/model/JsonData.js index a5befa8363..6d16657b77 100644 --- a/frontend/src/business/components/api/definition/model/JsonData.js +++ b/frontend/src/business/components/api/definition/model/JsonData.js @@ -61,6 +61,11 @@ export const CASE_PRIORITY = [ {id: 'P3', label: 'P3'} ] +export const REVIEW_STATUS = [ + {id: 'Prepare', label: '未评审'}, + {id: 'Pass', label: '通过'}, + {id: 'UnPass', label: '未通过'} +] export const API_STATUS = [ {id: 'Prepare', label: '未开始'}, {id: 'Underway', label: '进行中'}, diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index b618625b53..52f9002568 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -1,40 +1,72 @@ --> + v-if="item.id == 'priority'" + prop="priority" + :filters="priorityFilters" + column-key="priority" + min-width="100px" + :label="$t('test_track.case.priority')" + show-overflow-tooltip + :key="index"> - + + + v-if="item.id=='status'" + :filters="statusFilters" + column-key="status" + min-width="100px" + :label="$t('test_track.case.status')" + :key="index"> - + icon="el-icon-document-copy" + type="success" @exec="handleCopy(scope.row)"/> + + + + @@ -415,6 +401,7 @@ export default { handleCopy(testCase) { this.$get('test/case/get/' + testCase.id, response => { let testCase = response.data; + testCase.name='copy_'+testCase.name this.$emit('testCaseCopy', testCase); }); }, diff --git a/frontend/src/business/components/track/common/TestCaseNodeTree.vue b/frontend/src/business/components/track/common/TestCaseNodeTree.vue index ca434508e0..e3d268daab 100644 --- a/frontend/src/business/components/track/common/TestCaseNodeTree.vue +++ b/frontend/src/business/components/track/common/TestCaseNodeTree.vue @@ -1,25 +1,57 @@