Merge remote-tracking branch 'origin/v1.7' into v1.7

This commit is contained in:
song.tianyang 2021-02-02 18:56:25 +08:00
commit cc390326ab
9 changed files with 115 additions and 25 deletions

View File

@ -39,8 +39,14 @@ public class TestReviewTestCaseController {
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteTestCaseBath(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.deleteTestCaseBath(request);
public void deleteTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.deleteTestCaseBatch(request);
}
@PostMapping("/batch/edit/status")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.editTestCaseBatchStatus(request);
}
@PostMapping("/list/all")

View File

@ -18,6 +18,7 @@ import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -97,7 +98,7 @@ public class TestReviewTestCaseService {
}
}
public void deleteTestCaseBath(TestReviewCaseBatchRequest request) {
public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) {
checkReviewer(request.getReviewId());
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
example.createCriteria().andIdIn(request.getIds());
@ -105,15 +106,7 @@ public class TestReviewTestCaseService {
}
public void editTestCase(TestCaseReviewTestCase testCaseReviewTestCase) {
String currentUserId = SessionUtils.getUser().getId();
String reviewId = testCaseReviewTestCase.getReviewId();
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId);
List<TestCaseReviewUsers> testCaseReviewUsers = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample);
List<String> reviewIds = testCaseReviewUsers.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
if (!reviewIds.contains(currentUserId)) {
MSException.throwException("非此用例的评审人员!");
}
checkReviewCase(testCaseReviewTestCase.getReviewId());
// 记录测试用例评审状态变更
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
@ -137,4 +130,37 @@ public class TestReviewTestCaseService {
public TestReviewCaseDTO get(String reviewId) {
return extTestReviewCaseMapper.get(reviewId);
}
public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) {
List<String> ids = request.getIds();
if (CollectionUtils.isEmpty(ids)) {
return;
}
if (StringUtils.isBlank(request.getReviewId())) {
return;
} else {
checkReviewCase(request.getReviewId());
}
// 更新状态
if (StringUtils.isNotBlank(request.getStatus())) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(ids);
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
testCase.setReviewStatus(request.getStatus());
testCaseMapper.updateByExampleSelective(testCase, example);
}
}
private void checkReviewCase(String reviewId) {
String currentUserId = SessionUtils.getUser().getId();
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId);
List<TestCaseReviewUsers> testCaseReviewUsers = testCaseReviewUsersMapper.selectByExample(testCaseReviewUsersExample);
List<String> reviewIds = testCaseReviewUsers.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
if (!reviewIds.contains(currentUserId)) {
MSException.throwException("非此用例的评审人员!");
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
title="选则模块"
:title="$t('commons.module.select_module')"
:visible.sync="oneClickOperationVisible"
width="600px"
left
@ -11,7 +11,7 @@
<ms-node-tree
v-loading="result.loading"
:tree-nodes="data"
allLabel="默认模块"
:allLabel="$t('commons.module.default_module')"
@add="add"
:type="'edit'"
@edit="edit"

View File

@ -60,9 +60,23 @@
name: "ApiFailureCasesList",
components: {MsTag, PriorityTableItem, TypeTableItem, MethodTableItem, StatusTableItem},
props: ['apiTestCases'],
watch: {
apiTestCases() {
this.parseTags();
}
},
methods: {
goFailureTestCase(row) {
this.$emit("openFailureTestCase", row);
},
parseTags() {
if (this.apiTestCases) {
this.apiTestCases.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
}
}
}
}
@ -70,4 +84,4 @@
<style scoped>
</style>
</style>k

View File

@ -64,9 +64,21 @@
name: "ScenarioFailureCasesList",
components: {MsTag, PriorityTableItem, TypeTableItem, MethodTableItem, StatusTableItem},
props: ['scenarioTestCases'],
watch: {
scenarioTestCases() {
this.parseTags();
}
},
methods: {
goFailureTestCase(row) {
this.$emit("openFailureTestCase", row);
},
parseTags() {
this.scenarioTestCases.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
}
}
}

View File

@ -146,6 +146,9 @@
@refreshTable="search"/>
</el-card>
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
:type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
</div>
</template>
@ -214,21 +217,21 @@ export default {
],
showMore: false,
buttons: [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleEditBatch
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
}
],
typeArr: [
{id: 'status', name: this.$t('test_track.plan_view.execute_result')},
{id: 'executor', name: this.$t('test_track.plan_view.executor')},
{id: 'status', name: this.$t('test_track.review_view.execute_result')},
],
valueArr: {
executor: [],
status: [
{name: this.$t('test_track.plan_view.pass'), id: 'Pass'},
{name: this.$t('test_track.plan_view.failure'), id: 'Failure'},
{name: this.$t('test_track.plan_view.blocking'), id: 'Blocking'},
{name: this.$t('test_track.plan_view.skip'), id: 'Skip'}
{name: this.$t('test_track.case.status_prepare'), id: 'Prepare'},
{name: this.$t('test_track.case.status_pass'), id: 'Pass'},
{name: this.$t('test_track.case.status_un_pass'), id: 'UnPass'},
]
},
}
@ -339,6 +342,23 @@ export default {
this.$success(this.$t('test_track.cancel_relevance_success'));
});
},
handleEditBatch() {
this.$refs.batchEdit.open(this.selectRows.size);
},
batchEdit(form) {
let reviewId = this.reviewId;
let param = {};
param[form.type] = form.value;
param.ids = Array.from(this.selectRows).map(row => row.caseId);
param.reviewId = reviewId;
this.$post('/test/review/case/batch/edit/status', param, () => {
this.selectRows.clear();
this.status = '';
this.$post('/test/case/review/edit/status/' + reviewId);
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
});
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {

View File

@ -187,7 +187,11 @@ export default {
review: "all"
},
image: 'Image',
tag: 'Tag'
tag: 'Tag',
module: {
select_module: "Select module",
default_module: "Default module",
}
},
license: {
title: 'Authorization management',

View File

@ -188,7 +188,11 @@ export default {
review: "全部评审"
},
image: '镜像',
tag: '标签'
tag: '标签',
module: {
select_module: "选择模块",
default_module: "默认模块",
}
},
license: {
title: '授权管理',

View File

@ -188,7 +188,11 @@ export default {
review: "全部評審"
},
image: '鏡像',
tag: '標簽'
tag: '標簽',
module: {
select_module: "選擇模塊",
default_module: "默認模塊",
}
},
license: {
title: '授權管理',