fix(测试跟踪): 用例关联需求只展示当前项目关联的平台
--bug=1010457 --user=陈建星 【测试跟踪】-【功能测试】-用例列表-操作-编辑-关联需求获取失败 https://www.tapd.cn/55049933/s/1107024
This commit is contained in:
parent
bbd220b8fd
commit
ed9b75b334
|
@ -14,6 +14,7 @@ import io.metersphere.commons.utils.Pager;
|
|||
import io.metersphere.dto.IssueTemplateDao;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.jira.JiraIssueType;
|
||||
import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
|
||||
|
@ -161,4 +162,9 @@ public class IssuesController {
|
|||
public List<JiraIssueType> getJiraIssueType(@RequestBody JiraIssueTypeRequest request) {
|
||||
return issuesService.getIssueTypes(request);
|
||||
}
|
||||
|
||||
@GetMapping("/demand/list/{projectId}")
|
||||
public List<DemandDTO> getDemandList(@PathVariable String projectId) {
|
||||
return issuesService.getDemandList(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
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<DemandDTO> getDemandList(@PathVariable String projectId) {
|
||||
return demandService.getDemandList(projectId);
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
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 IssuesService issuesService;
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
public List<DemandDTO> getDemandList(String projectId) {
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
|
||||
String workspaceId = project.getWorkspaceId();
|
||||
boolean tapd = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Tapd.toString());
|
||||
boolean jira = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Jira.toString());
|
||||
boolean zentao = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Zentao.toString());
|
||||
boolean azureDevops = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.AzureDevops.toString());
|
||||
List<DemandDTO> list = new ArrayList<>();
|
||||
List<String> platforms = new ArrayList<>();
|
||||
IssuesRequest issueRequest = new IssuesRequest();
|
||||
if (tapd) {
|
||||
// 是否关联了项目
|
||||
String tapdId = project.getTapdId();
|
||||
if (StringUtils.isNotBlank(tapdId)) {
|
||||
platforms.add(IssuesManagePlatform.Tapd.name());
|
||||
}
|
||||
}
|
||||
|
||||
if (jira) {
|
||||
String jiraKey = project.getJiraKey();
|
||||
if (StringUtils.isNotBlank(jiraKey)) {
|
||||
platforms.add(IssuesManagePlatform.Jira.name());
|
||||
}
|
||||
}
|
||||
|
||||
if (zentao) {
|
||||
String zentaoId = project.getZentaoId();
|
||||
if (StringUtils.isNotBlank(zentaoId)) {
|
||||
platforms.add(IssuesManagePlatform.Zentao.name());
|
||||
}
|
||||
}
|
||||
|
||||
if (azureDevops) {
|
||||
String azureDevopsId = project.getAzureDevopsId();
|
||||
if (StringUtils.isNotBlank(azureDevopsId)) {
|
||||
platforms.add(IssuesManagePlatform.AzureDevops.name());
|
||||
}
|
||||
}
|
||||
|
||||
issueRequest.setWorkspaceId(workspaceId);
|
||||
issueRequest.setProjectId(projectId);
|
||||
List<AbstractIssuePlatform> platformList = IssueFactory.createPlatforms(platforms, issueRequest);
|
||||
platformList.forEach(platform -> {
|
||||
List<DemandDTO> demand = new ArrayList<>();
|
||||
try {
|
||||
demand = platform.getDemandList(projectId);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
list.addAll(demand);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -24,10 +24,7 @@ import io.metersphere.service.CustomFieldTemplateService;
|
|||
import io.metersphere.service.IntegrationService;
|
||||
import io.metersphere.service.IssueTemplateService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.track.dto.PlanReportIssueDTO;
|
||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||
import io.metersphere.track.dto.TestPlanFunctionResultReportDTO;
|
||||
import io.metersphere.track.dto.TestPlanSimpleReportDTO;
|
||||
import io.metersphere.track.dto.*;
|
||||
import io.metersphere.track.issue.*;
|
||||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.issue.domain.jira.JiraIssueType;
|
||||
|
@ -684,4 +681,14 @@ public class IssuesService {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public List<DemandDTO> getDemandList(String projectId) {
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
String workspaceId = project.getWorkspaceId();
|
||||
IssuesRequest issueRequest = new IssuesRequest();
|
||||
issueRequest.setWorkspaceId(workspaceId);
|
||||
issueRequest.setProjectId(projectId);
|
||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(project.getPlatform(), issueRequest);
|
||||
return platform.getDemandList(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ export default {
|
|||
getDemandOptions() {
|
||||
if (this.demandOptions.length === 0) {
|
||||
this.result = {loading: true};
|
||||
this.$get("demand/list/" + this.projectId).then(response => {
|
||||
this.$get("/issues/demand/list/" + this.projectId).then(response => {
|
||||
this.demandOptions = [];
|
||||
if (response.data.data && response.data.data.length > 0) {
|
||||
this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []);
|
||||
|
|
Loading…
Reference in New Issue