feat(用例评审): 批量修改评审结果
This commit is contained in:
parent
f70995e175
commit
f8d5ad2363
|
@ -39,8 +39,14 @@ public class TestReviewTestCaseController {
|
||||||
|
|
||||||
@PostMapping("/batch/delete")
|
@PostMapping("/batch/delete")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
public void deleteTestCaseBath(@RequestBody TestReviewCaseBatchRequest request) {
|
public void deleteTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
|
||||||
testReviewTestCaseService.deleteTestCaseBath(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")
|
@PostMapping("/list/all")
|
||||||
|
|
|
@ -18,6 +18,7 @@ import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -97,7 +98,7 @@ public class TestReviewTestCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteTestCaseBath(TestReviewCaseBatchRequest request) {
|
public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) {
|
||||||
checkReviewer(request.getReviewId());
|
checkReviewer(request.getReviewId());
|
||||||
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
|
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
|
||||||
example.createCriteria().andIdIn(request.getIds());
|
example.createCriteria().andIdIn(request.getIds());
|
||||||
|
@ -105,15 +106,7 @@ public class TestReviewTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editTestCase(TestCaseReviewTestCase testCaseReviewTestCase) {
|
public void editTestCase(TestCaseReviewTestCase testCaseReviewTestCase) {
|
||||||
String currentUserId = SessionUtils.getUser().getId();
|
checkReviewCase(testCaseReviewTestCase.getReviewId());
|
||||||
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("非此用例的评审人员!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 记录测试用例评审状态变更
|
// 记录测试用例评审状态变更
|
||||||
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
|
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
|
||||||
|
@ -137,4 +130,37 @@ public class TestReviewTestCaseService {
|
||||||
public TestReviewCaseDTO get(String reviewId) {
|
public TestReviewCaseDTO get(String reviewId) {
|
||||||
return extTestReviewCaseMapper.get(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("非此用例的评审人员!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,9 @@
|
||||||
@refreshTable="search"/>
|
@refreshTable="search"/>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
|
||||||
|
:type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -214,21 +217,21 @@ export default {
|
||||||
],
|
],
|
||||||
showMore: false,
|
showMore: false,
|
||||||
buttons: [
|
buttons: [
|
||||||
|
{
|
||||||
|
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleEditBatch
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
|
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
typeArr: [
|
typeArr: [
|
||||||
{id: 'status', name: this.$t('test_track.plan_view.execute_result')},
|
{id: 'status', name: this.$t('test_track.review_view.execute_result')},
|
||||||
{id: 'executor', name: this.$t('test_track.plan_view.executor')},
|
|
||||||
],
|
],
|
||||||
valueArr: {
|
valueArr: {
|
||||||
executor: [],
|
|
||||||
status: [
|
status: [
|
||||||
{name: this.$t('test_track.plan_view.pass'), id: 'Pass'},
|
{name: this.$t('test_track.case.status_prepare'), id: 'Prepare'},
|
||||||
{name: this.$t('test_track.plan_view.failure'), id: 'Failure'},
|
{name: this.$t('test_track.case.status_pass'), id: 'Pass'},
|
||||||
{name: this.$t('test_track.plan_view.blocking'), id: 'Blocking'},
|
{name: this.$t('test_track.case.status_un_pass'), id: 'UnPass'},
|
||||||
{name: this.$t('test_track.plan_view.skip'), id: 'Skip'}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -339,6 +342,23 @@ export default {
|
||||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
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) {
|
handleSelectAll(selection) {
|
||||||
if (selection.length > 0) {
|
if (selection.length > 0) {
|
||||||
this.tableData.forEach(item => {
|
this.tableData.forEach(item => {
|
||||||
|
|
Loading…
Reference in New Issue