fix(测试跟踪):用例评审状态显示错误,用例评审状态显示和测试用例评审结果不一致
This commit is contained in:
parent
00f7bebc2e
commit
ebe086fc0d
|
@ -26,4 +26,6 @@ public interface ExtTestCaseReviewMapper {
|
|||
* @return Review ID
|
||||
*/
|
||||
int checkIsHave(@Param("reviewId") String reviewId, @Param("projectIds") Set<String> projectIds);
|
||||
|
||||
String selectStatusById(@Param("id") String id);
|
||||
}
|
||||
|
|
|
@ -192,4 +192,13 @@
|
|||
</foreach>
|
||||
</if>) as temp
|
||||
</select>
|
||||
|
||||
<select id="selectStatusById" resultType="java.lang.String">
|
||||
SELECT
|
||||
`status`
|
||||
FROM
|
||||
test_case_review
|
||||
WHERE
|
||||
id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -329,9 +329,12 @@
|
|||
</select>
|
||||
|
||||
<select id="getStatusByReviewId" resultType="java.lang.String">
|
||||
select review_status
|
||||
from test_case
|
||||
where id in (select case_id from test_case_review_test_case where review_id = #{reviewId});
|
||||
SELECT
|
||||
status
|
||||
FROM
|
||||
test_case_review_test_case
|
||||
WHERE
|
||||
review_id = #{reviewId} and is_del = 0;
|
||||
</select>
|
||||
|
||||
<select id="findRelateTestReviewId" resultType="java.lang.String">
|
||||
|
|
|
@ -104,4 +104,9 @@ public class TestReviewTestCaseController {
|
|||
testReviewTestCaseService.updateOrder(request);
|
||||
}
|
||||
|
||||
@GetMapping("/auto-check/{caseId}")
|
||||
public void autoCheck(@PathVariable String caseId) {
|
||||
testReviewTestCaseService.checkStatus(caseId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -549,14 +549,16 @@ public class TestCaseReviewService {
|
|||
}
|
||||
|
||||
public void editTestReviewStatus(String reviewId) {
|
||||
String status = extTestCaseReviewMapper.selectStatusById(reviewId);
|
||||
if (StringUtils.equalsAnyIgnoreCase(status, TestCaseReviewStatus.Completed.name(), TestCaseReviewStatus.Finished.name())){
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> statusList = extTestReviewCaseMapper.getStatusByReviewId(reviewId);
|
||||
TestCaseReview testCaseReview = new TestCaseReview();
|
||||
testCaseReview.setId(reviewId);
|
||||
|
||||
if (statusList.contains(TestReviewCaseStatus.Prepare.name()) || statusList.contains(TestReviewCaseStatus.Again.name()) ||
|
||||
statusList.contains(TestReviewCaseStatus.Underway.name()) || statusList.contains(TestReviewCaseStatus.Rereview.name())) {
|
||||
testCaseReview.setStatus(TestCaseReviewStatus.Underway.name());
|
||||
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
||||
if (statusList.contains(TestReviewCaseStatus.Underway.name()) || statusList.contains(TestReviewCaseStatus.Again.name()) ) {
|
||||
return;
|
||||
}
|
||||
if (statusList.contains(TestReviewCaseStatus.UnPass.name())) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.ExtTestCaseReviewTestCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
|
||||
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
||||
import io.metersphere.commons.constants.TestPlanStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
|
@ -747,4 +748,19 @@ public class TestReviewTestCaseService {
|
|||
public List<TestCaseReviewTestCase> selectForReviewerChange(String reviewId) {
|
||||
return extTestCaseReviewTestCaseMapper.selectForReviewerChange(reviewId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查执行结果,自动更新计划状态
|
||||
* @param caseId
|
||||
*/
|
||||
public void checkStatus(String caseId) {
|
||||
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(caseId);
|
||||
if (testCaseReview.getEndTime() != null && testCaseReview.getEndTime() < System.currentTimeMillis()) {
|
||||
TestCaseReviewExample example = new TestCaseReviewExample();
|
||||
example.createCriteria().andIdEqualTo(caseId);
|
||||
TestCaseReview review = new TestCaseReview();
|
||||
review.setStatus(TestPlanStatus.Finished.name());
|
||||
testCaseReviewMapper.updateByExampleSelective(review,example);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,3 +272,7 @@ export function saveCaseRelevanceLoad(caseId, param) {
|
|||
export function checkProjectPermission(projectId) {
|
||||
return get(BASE_URL + "check/permission/" + projectId);
|
||||
}
|
||||
|
||||
export function testCaseAutoCheck(caseId) {
|
||||
return get(`/test/review/case/auto-check/${caseId}`);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
|||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||
import MsTableHeaderSelectPopover from "metersphere-frontend/src/components/table/MsTableHeaderSelectPopover";
|
||||
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
|
||||
import {editTestReviewTestCaseOrder, getTestReviewTestCase} from "@/api/testCase";
|
||||
import {editTestReviewTestCaseOrder, getTestReviewTestCase,testCaseAutoCheck} from "@/api/testCase";
|
||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||
import TestCaseReviewStatusTableItem from "@/business/common/tableItems/TestCaseReviewStatusTableItem";
|
||||
|
@ -404,6 +404,7 @@ export default {
|
|||
this.$refs.headerCustom.open(list);
|
||||
},
|
||||
initTableData(callback) {
|
||||
this.autoCheckStatus();
|
||||
initCondition(this.condition, this.condition.selectAll);
|
||||
if (this.reviewId) {
|
||||
this.condition.reviewId = this.reviewId;
|
||||
|
@ -435,6 +436,13 @@ export default {
|
|||
this.getNexPageData();
|
||||
}
|
||||
},
|
||||
autoCheckStatus() {
|
||||
// 检查执行结果,自动更新计划状态
|
||||
if (!this.reviewId) {
|
||||
return;
|
||||
}
|
||||
testCaseAutoCheck(this.reviewId);
|
||||
},
|
||||
getNexPageData() {
|
||||
getTestReviewTestCase(this.currentPage * this.pageSize + 1, 1, this.condition)
|
||||
.then((response) => {
|
||||
|
|
Loading…
Reference in New Issue