fix(用例评审): 修复已关联用例统计模块数量错误问题
This commit is contained in:
parent
25efebe991
commit
d30f30151f
|
@ -47,7 +47,7 @@ public class FunctionalCaseTrashController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/module/count")
|
@PostMapping("/module/count")
|
||||||
@Operation(summary = "用例管理-功能用例-回收站-表格分页查询文件")
|
@Operation(summary = "用例管理-功能用例-回收站-模块树统计用例数量")
|
||||||
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ)
|
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ)
|
||||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
public Map<String, Long> moduleCount(@Validated @RequestBody FunctionalCasePageRequest request) {
|
public Map<String, Long> moduleCount(@Validated @RequestBody FunctionalCasePageRequest request) {
|
||||||
|
|
|
@ -31,5 +31,5 @@ public interface ExtFunctionalCaseModuleMapper {
|
||||||
|
|
||||||
List<BaseTreeNode> selectApiScenarioModuleByRequest(@Param("request") AssociateCaseModuleRequest request);
|
List<BaseTreeNode> selectApiScenarioModuleByRequest(@Param("request") AssociateCaseModuleRequest request);
|
||||||
|
|
||||||
List<BaseTreeNode> selectIdAndParentIdByProjectIdAndReviewId(@Param("projectId")String projectId, @Param("reviewId")String reviewId);
|
List<String> selectIdByProjectIdAndReviewId(@Param("projectId")String projectId, @Param("reviewId")String reviewId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@
|
||||||
ORDER BY pos
|
ORDER BY pos
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectIdAndParentIdByProjectIdAndReviewId" resultType="io.metersphere.system.dto.sdk.BaseTreeNode">
|
<select id="selectIdByProjectIdAndReviewId" resultType="java.lang.String">
|
||||||
SELECT fcm.id, fcm.parent_id AS parentId
|
SELECT fcm.id
|
||||||
FROM functional_case_module fcm
|
FROM functional_case_module fcm
|
||||||
WHERE fcm.project_id = #{projectId}
|
WHERE fcm.project_id = #{projectId}
|
||||||
AND fcm.id IN
|
AND fcm.id IN
|
||||||
|
|
|
@ -575,8 +575,9 @@ public class CaseReviewFunctionalCaseService {
|
||||||
|
|
||||||
public List<BaseTreeNode> getTreeOnlyIdsAndResourceCount(String projectId, String reviewId, List<ModuleCountDTO> moduleCountDTOList) {
|
public List<BaseTreeNode> getTreeOnlyIdsAndResourceCount(String projectId, String reviewId, List<ModuleCountDTO> moduleCountDTOList) {
|
||||||
//节点内容只有Id和parentId
|
//节点内容只有Id和parentId
|
||||||
List<BaseTreeNode> fileModuleList = extFunctionalCaseModuleMapper.selectIdAndParentIdByProjectIdAndReviewId(projectId, reviewId);
|
List<String> moduleIds = extFunctionalCaseModuleMapper.selectIdByProjectIdAndReviewId(projectId, reviewId);
|
||||||
return functionalCaseModuleService.buildTreeAndCountResource(fileModuleList, moduleCountDTOList, true, Translator.get("default.module"));
|
List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(moduleIds);
|
||||||
|
return functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, moduleCountDTOList, true, Translator.get("default.module"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OptionDTO> getUserStatus(String reviewId, String caseId) {
|
public List<OptionDTO> getUserStatus(String reviewId, String caseId) {
|
||||||
|
|
|
@ -366,6 +366,24 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
Assertions.assertTrue(CollectionUtils.isEmpty(optionDTOS));
|
Assertions.assertTrue(CollectionUtils.isEmpty(optionDTOS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(12)
|
||||||
|
public void getModuleCount() throws Exception {
|
||||||
|
ReviewFunctionalCasePageRequest request = new ReviewFunctionalCasePageRequest();
|
||||||
|
request.setReviewId("wx_review_id_1");
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(10);
|
||||||
|
request.setViewFlag(false);
|
||||||
|
request.setProjectId("wx_test_project");
|
||||||
|
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_MODULE_COUNT, request);
|
||||||
|
Map<String, Integer> moduleCount = JSON.parseObject(JSON.toJSONString(
|
||||||
|
JSON.parseObject(moduleCountMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
|
Map.class);
|
||||||
|
|
||||||
|
Assertions.assertTrue(moduleCount.containsKey("TEST_MODULE_ID_COUNT_three"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private List<OptionDTO> getOptionDTOS(String reviewId, String caseId) throws Exception {
|
private List<OptionDTO> getOptionDTOS(String reviewId, String caseId) throws Exception {
|
||||||
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS+"/"+reviewId+"/"+caseId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS+"/"+reviewId+"/"+caseId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
|
|
|
@ -11,7 +11,9 @@ INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, r
|
||||||
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);
|
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)
|
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);
|
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),
|
||||||
|
('gyq_case_id_7', 102, 'TEST_MODULE_ID_COUNT_three', 'wx_test_project', '100001', '测试模块', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'gyq_case_id_7', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL),
|
||||||
|
('gyq_case_id_8', 102, 'TEST_MODULE_ID_COUNT_three', 'wx_test_project', '100001', '测试模块2', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'gyq_case_id_8', '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)
|
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);
|
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);
|
||||||
|
@ -47,6 +49,8 @@ VALUES ('wx_test_1', 'wx_review_id_1', 'wx_case_id_1', 'PASS', 1698058347559,'ad
|
||||||
('gyq_test_3', 'wx_review_id_1', 'gyq_review_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_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),
|
('gyq_test_5', 'wx_review_id_1', 'gyq_case_id_5', 'PASS', 1698058347559,'admin',1698058347559, 2000),
|
||||||
|
('gyq_test_7', 'wx_review_id_1', 'gyq_case_id_7', 'PASS', 1698058347559,'admin',1698058347559, 2000),
|
||||||
|
('gyq_test_8', 'wx_review_id_1', 'gyq_case_id_8', 'PASS', 1698058347559,'admin',1698058347559, 2000),
|
||||||
('wx_test_2', 'wx_review_id_2', 'wx_case_id_2', 'PASS', 1698058347559,'admin',1698058347559, 3000),
|
('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_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),
|
('wx_test_4', 'wx_review_id_2', 'wx_case_id_2', 'PASS', 1698058347559,'admin',1698058347559, 3000),
|
||||||
|
@ -76,7 +80,11 @@ VALUES ('wx_case_id_1', 'wx_review_id_1', 'admin'),
|
||||||
|
|
||||||
INSERT INTO case_review_module(id, project_id, name, parent_id, pos, create_time, update_time, create_user, update_user) VALUES ('wx_module_1', 'wx_test_project', '测试所属模块', 'NONE', 0, 1669174143999, 1669174143999, 'admin', 'admin');
|
INSERT INTO case_review_module(id, project_id, name, parent_id, pos, create_time, update_time, create_user, update_user) VALUES ('wx_module_1', 'wx_test_project', '测试所属模块', 'NONE', 0, 1669174143999, 1669174143999, 'admin', 'admin');
|
||||||
|
|
||||||
INSERT INTO functional_case_module(id, project_id, name, parent_id, pos, create_time, update_time, create_user, update_user) VALUES ('TEST_MODULE_ID', 'wx_test_project', '测试所属模块', 'NONE', 0, 1669174143999, 1669174143999, 'admin', 'admin');
|
INSERT INTO functional_case_module(id, project_id, name, parent_id, pos, create_time, update_time, create_user, update_user)
|
||||||
|
VALUES ('TEST_MODULE_ID', 'wx_test_project', '测试所属模块', 'NONE', 1568, 1669174143999, 1669174143999, 'admin', 'admin'),
|
||||||
|
('TEST_MODULE_ID_COUNT_ID', 'wx_test_project', '测试所属模块子集', 'TEST_MODULE_ID', 64, 1669174143999, 1669174143999, 'admin', 'admin'),
|
||||||
|
('TEST_MODULE_ID_COUNT_three', 'wx_test_project', '测试所属模块子集2', 'TEST_MODULE_ID_COUNT_ID', 64, 1669174143999, 1669174143999, 'admin', 'admin');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source,
|
INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source,
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class NotificationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/count")
|
@PostMapping(value = "/count")
|
||||||
|
@Operation(summary = "消息中心-获取消息中心消息具体类型具体状态的数量")
|
||||||
public Integer countNotification(@RequestBody Notification notification) {
|
public Integer countNotification(@RequestBody Notification notification) {
|
||||||
return notificationService.countNotification(notification, SessionUtils.getUserId());
|
return notificationService.countNotification(notification, SessionUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue