feat(用例评审): 批量评审增加是否是当前用例评审人的校验
This commit is contained in:
parent
72b6e303f7
commit
1e8d07dd74
|
@ -19,6 +19,7 @@ import io.metersphere.project.mapper.ProjectApplicationMapper;
|
|||
import io.metersphere.provider.BaseCaseProvider;
|
||||
import io.metersphere.sdk.constants.ProjectApplicationType;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
|
@ -290,7 +291,15 @@ public class CaseReviewFunctionalCaseService {
|
|||
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
||||
|
||||
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
||||
//校验当前操作人是否是该用例的评审人,是增加评审历史,不是过滤掉
|
||||
String caseId = caseReviewFunctionalCase.getCaseId();
|
||||
List<CaseReviewFunctionalCaseUser> userList = reviewerMap.get(caseId);
|
||||
|
||||
if(CollectionUtils.isEmpty(userList) || CollectionUtils.isEmpty(userList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getUserId(), userId)).toList())){
|
||||
LogUtils.error(caseId+": no review user, please check");
|
||||
continue;
|
||||
}
|
||||
|
||||
CaseReviewHistory caseReviewHistory = buildCaseReviewHistory(request, userId, caseId);
|
||||
caseReviewHistoryMapper.insert(caseReviewHistory);
|
||||
if (caseHistoryMap.get(caseId) == null) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import io.metersphere.functional.constants.CaseReviewPassRule;
|
|||
import io.metersphere.functional.constants.FunctionalCaseReviewStatus;
|
||||
import io.metersphere.functional.domain.CaseReviewFunctionalCase;
|
||||
import io.metersphere.functional.domain.CaseReviewFunctionalCaseExample;
|
||||
import io.metersphere.functional.domain.CaseReviewFunctionalCaseUser;
|
||||
import io.metersphere.functional.dto.ReviewFunctionalCaseDTO;
|
||||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseUserMapper;
|
||||
|
@ -236,13 +235,13 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(8)
|
||||
public void testBatchReview() throws Exception {
|
||||
List<CaseReviewFunctionalCase> caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
|
||||
/*List<CaseReviewFunctionalCase> caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
|
||||
List<CaseReviewFunctionalCase> list = caseReviewList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getCreateUser(), "admin")).toList();
|
||||
CaseReviewFunctionalCaseUser caseReviewFunctionalCaseUser = new CaseReviewFunctionalCaseUser();
|
||||
caseReviewFunctionalCaseUser.setReviewId("wx_review_id_1");
|
||||
caseReviewFunctionalCaseUser.setCaseId(list.get(0).getCaseId());
|
||||
caseReviewFunctionalCaseUser.setUserId("admin");
|
||||
caseReviewFunctionalCaseUserMapper.insertSelective(caseReviewFunctionalCaseUser);
|
||||
caseReviewFunctionalCaseUserMapper.insertSelective(caseReviewFunctionalCaseUser);*/
|
||||
|
||||
BatchReviewFunctionalCaseRequest request = new BatchReviewFunctionalCaseRequest();
|
||||
request.setReviewId("wx_review_id_1");
|
||||
|
@ -285,6 +284,18 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
request.setNotifier("gyq;admin");
|
||||
request.setContent("测试批量评审通过");
|
||||
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
||||
|
||||
request = new BatchReviewFunctionalCaseRequest();
|
||||
request.setReviewId("wx_review_id_1");
|
||||
request.setReviewPassRule(CaseReviewPassRule.MULTIPLE.toString());
|
||||
request.setStatus(FunctionalCaseReviewStatus.PASS.toString());
|
||||
request.setSelectAll(false);
|
||||
ids = new ArrayList<>();
|
||||
ids.add(" gyq_test_5");
|
||||
request.setSelectIds(ids);
|
||||
request.setContent("测试批量评审通过");
|
||||
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -5,10 +5,13 @@ INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, r
|
|||
VALUES ('wx_case_id_2', 101, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('gyq_case_id_3', 102, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('gyq_review_case_id_3', 102, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('gyq_case_id_4', 102, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'gyq_case_id_4', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('gyq_case_id_4', 106, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('gyq_case_id_5', 102, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'gyq_case_id_4', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('wx_case_id_3', 104, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
@ -19,8 +22,9 @@ VALUES ('wx_case_id_4', 104, 'TEST_MODULE_ID', 'wx_test_project', '100001', '测
|
|||
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('wx_case_id_1', 'STEP', '1111', '', '', 'TEST');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('wx_case_id_2', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('gyq_case_id_3', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('gyq_review_case_id_3', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('gyq_case_id_4', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('gyq_case_id_5', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('wx_case_id_3', 'STEP', '1111', '', '', '1111');
|
||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('wx_case_id_4', 'STEP', '1111', '', '', '1111');
|
||||
|
||||
|
@ -40,8 +44,9 @@ VALUES ('wx_review_id_1',10001,'wx1', 'wx_module_1', 'wx_test_project', 'COMPLET
|
|||
|
||||
INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_time, create_user, update_time, pos)
|
||||
VALUES ('wx_test_1', 'wx_review_id_1', 'wx_case_id_1', 'PASS', 1698058347559,'admin',1698058347559, 1000),
|
||||
('gyq_test_3', 'wx_review_id_1', 'gyq_case_id_3', 'PASS', 1698058347559,'admin',1698058347559, 1500),
|
||||
('gyq_test_3', 'wx_review_id_1', 'gyq_review_case_id_3', 'PASS', 1698058347559,'admin',1698058347559, 1500),
|
||||
('gyq_test_4', 'wx_review_id_1', 'gyq_case_id_4', 'PASS', 1698058347559,'admin',1698058347559, 2000),
|
||||
('gyq_test_5', 'wx_review_id_1', 'gyq_case_id_5', 'PASS', 1698058347559,'admin',1698058347559, 2000),
|
||||
('wx_test_2', 'wx_review_id_2', 'wx_case_id_2', 'PASS', 1698058347559,'admin',1698058347559, 3000),
|
||||
('wx_test_3', 'wx_review_id_2', 'wx_case_id_1', 'PASS', 1698058347559,'admin',1698058347559, 3000),
|
||||
('wx_test_4', 'wx_review_id_2', 'wx_case_id_2', 'PASS', 1698058347559,'admin',1698058347559, 3000),
|
||||
|
@ -56,8 +61,9 @@ INSERT INTO case_review_functional_case_user(case_id, review_id, user_id)
|
|||
VALUES ('wx_case_id_1', 'wx_review_id_1', 'admin'),
|
||||
('wx_case_id_1', 'wx_review_id_1', 'gyq'),
|
||||
('wx_test_1', 'wx_review_id_1', 'admin'),
|
||||
('gyq_case_id_3', 'wx_review_id_1', 'gyq2'),
|
||||
('gyq_case_id_4', 'wx_review_id_1', 'gyq'),
|
||||
('gyq_review_case_id_3', 'wx_review_id_1', 'admin'),
|
||||
('gyq_case_id_4', 'wx_review_id_1', 'admin'),
|
||||
('gyq_case_id_5', 'wx_review_id_1', 'gyq'),
|
||||
('wx_case_id_3', 'wx_review_id_3', 'admin'),
|
||||
('wx_case_id_4', 'wx_review_id_4', 'admin'),
|
||||
('wx_case_id_1', 'wx_review_id_4', '123'),
|
||||
|
|
Loading…
Reference in New Issue