feat: 测试计划测试用例列表显示缺陷数
This commit is contained in:
parent
c8c53a9030
commit
46d52334bf
|
@ -23,7 +23,8 @@ public class RestTemplateUtils {
|
|||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, requestEntity, String.class);
|
||||
return responseEntity.getBody();
|
||||
} catch (Exception e) {
|
||||
MSException.throwException("接口调用失败:" + e.getMessage());
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("Tapd接口调用失败:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +37,8 @@ public class RestTemplateUtils {
|
|||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||
return responseEntity.getBody();
|
||||
} catch (Exception e) {
|
||||
MSException.throwException("接口调用失败:" + e.getMessage());
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("Tapd接口调用失败:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -63,7 +64,6 @@ public class IssuesService {
|
|||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.exchange("https://api.tapd.cn/quickstart/testauth", HttpMethod.GET, requestEntity, String.class);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("验证失败!");
|
||||
}
|
||||
|
@ -275,7 +275,14 @@ public class IssuesService {
|
|||
HttpEntity<String> requestEntity = new HttpEntity<>(json, requestHeaders);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
//post
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url + "/rest/api/2/issue", HttpMethod.POST, requestEntity, String.class);
|
||||
ResponseEntity<String> responseEntity = null;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url + "/rest/api/2/issue", HttpMethod.POST, requestEntity, String.class);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("调用Jira接口创建缺陷失败");
|
||||
}
|
||||
|
||||
return responseEntity.getBody();
|
||||
}
|
||||
|
||||
|
@ -336,8 +343,15 @@ public class IssuesService {
|
|||
issues.setDescription(description);
|
||||
issues.setStatus(status);
|
||||
issues.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||
} catch (Exception e) {
|
||||
} catch (HttpClientErrorException.NotFound e) {
|
||||
LogUtil.error(e.getStackTrace(), e);
|
||||
return new Issues();
|
||||
} catch (HttpClientErrorException.Unauthorized e) {
|
||||
LogUtil.error(e.getStackTrace(), e);
|
||||
MSException.throwException("获取Jira缺陷失败,检查Jira配置信息");
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException("调用Jira接口获取缺陷失败");
|
||||
}
|
||||
|
||||
return issues;
|
||||
|
@ -445,7 +459,11 @@ public class IssuesService {
|
|||
}
|
||||
|
||||
public List<Issues> getLocalIssues(String caseId) {
|
||||
return extIssuesMapper.getIssues(caseId, IssuesManagePlatform.Local.toString());
|
||||
List<Issues> list = extIssuesMapper.getIssues(caseId, IssuesManagePlatform.Local.toString());
|
||||
List<Issues> issues = list.stream()
|
||||
.filter(l -> !StringUtils.equals(l.getStatus(), "closed"))
|
||||
.collect(Collectors.toList());
|
||||
return issues;
|
||||
}
|
||||
|
||||
public String getTapdProjectId(String testCaseId) {
|
||||
|
@ -471,4 +489,11 @@ public class IssuesService {
|
|||
return StringUtils.isNotBlank(integration.getId());
|
||||
}
|
||||
|
||||
public void closeLocalIssue(String issueId) {
|
||||
Issues issues = new Issues();
|
||||
issues.setId(issueId);
|
||||
issues.setStatus("closed");
|
||||
issuesMapper.updateByPrimaryKeySelective(issues);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class TestCaseIssuesController {
|
|||
issuesService.testAuth(platform);
|
||||
}
|
||||
|
||||
@GetMapping("/close/{id}")
|
||||
public void closeLocalIssue(@PathVariable String id) {
|
||||
issuesService.closeLocalIssue(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,11 +207,22 @@
|
|||
<el-row>
|
||||
<el-col :span="20" :offset="1" class="issues-edit">
|
||||
<el-table border class="adjust-table" :data="issues" style="width: 100%">
|
||||
<el-table-column prop="id" label="缺陷ID"/>
|
||||
<el-table-column prop="id" label="缺陷ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="title" label="缺陷标题"/>
|
||||
<el-table-column prop="status" label="缺陷状态"/>
|
||||
<el-table-column prop="description" label="缺陷描述" show-overflow-tooltip/>
|
||||
<el-table-column prop="status" label="缺陷状态"/>
|
||||
<el-table-column prop="platform" label="平台"/>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot:default="scope">
|
||||
<el-tooltip content="关闭缺陷"
|
||||
placement="right">
|
||||
<el-button type="danger" icon="el-icon-circle-close" size="mini"
|
||||
circle v-if="scope.row.platform === 'Local'"
|
||||
@click="closeIssue(scope.row)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -475,11 +486,16 @@
|
|||
})
|
||||
},
|
||||
getIssues(caseId) {
|
||||
this.result = this.$get("/issues/get/"+caseId,response => {
|
||||
this.result = this.$get("/issues/get/" + caseId, response => {
|
||||
let data = response.data;
|
||||
this.issues = data;
|
||||
console.log(data);
|
||||
})
|
||||
},
|
||||
closeIssue(row) {
|
||||
this.result = this.$get("/issues/close/" + row.id, () => {
|
||||
this.getIssues(this.testCase.caseId);
|
||||
this.$success("关闭成功");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,28 @@
|
|||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="nodePath"
|
||||
label="缺陷"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="400"
|
||||
trigger="hover">
|
||||
<el-table border class="adjust-table" :data="scope.row.issuesContent" style="width: 100%">
|
||||
<!-- <el-table-column prop="id" label="缺陷ID" show-overflow-tooltip/>-->
|
||||
<el-table-column prop="title" label="缺陷标题"/>
|
||||
<el-table-column prop="description" label="缺陷描述" show-overflow-tooltip/>
|
||||
<!-- <el-table-column prop="status" label="缺陷状态"/>-->
|
||||
<el-table-column prop="platform" label="平台"/>
|
||||
</el-table>
|
||||
<el-button slot="reference" type="text">{{scope.row.issuesSize}}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
prop="executorName"
|
||||
:label="$t('test_track.plan_view.executor')">
|
||||
|
@ -317,6 +339,14 @@
|
|||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
this.$set(this.tableData[i], "issuesSize", 0);
|
||||
this.$get("/issues/get/" + this.tableData[i].caseId, response => {
|
||||
let issues = response.data;
|
||||
this.$set(this.tableData[i], "issuesSize", issues.length);
|
||||
this.$set(this.tableData[i], "issuesContent", issues);
|
||||
})
|
||||
}
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue