refactor(项目管理): 菜单管理优化入参
This commit is contained in:
parent
f9084d5624
commit
7011958e7b
|
@ -46,8 +46,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "测试计划-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_TEST_PLAN_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateTestPlanLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateTestPlan(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateTestPlan(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/test-plan")
|
||||
|
@ -67,8 +67,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "UI测试-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_UI_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateUiLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateUI(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateUI(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/ui")
|
||||
|
@ -95,8 +95,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "性能测试-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_PERFORMANCE_TEST_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updatePerformanceLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updatePerformanceTest(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updatePerformanceTest(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/performance-test")
|
||||
|
@ -123,8 +123,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "接口测试-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_API_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateApiLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateApi(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateApi(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/api")
|
||||
|
@ -162,8 +162,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "用例管理-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_CASE_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateCaseLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateCase(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateCase(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,8 +217,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "工作台-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_WORKSTATION_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateWorkstationLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateWorkstation(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateWorkstation(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/workstation")
|
||||
|
@ -238,8 +238,8 @@ public class ProjectApplicationController {
|
|||
@Operation(summary = "缺陷管理-配置")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_BUG_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateWorkstationLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateBug(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
public void updateBug(@Validated({Updated.class}) @RequestBody ProjectApplication application) {
|
||||
projectApplicationService.update(application, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/bug")
|
||||
|
|
|
@ -78,16 +78,13 @@ public class ProjectApplicationService {
|
|||
/**
|
||||
* 更新配置信息
|
||||
*
|
||||
* @param applications
|
||||
* @param application
|
||||
* @return
|
||||
*/
|
||||
public void update(List<ProjectApplication> applications, String currentUser) {
|
||||
applications.forEach(application -> {
|
||||
//定时任务配置,检查是否存在定时任务配置,存在则更新,不存在则新增
|
||||
this.doBeforeUpdate(application, currentUser);
|
||||
//配置信息入库
|
||||
this.createOrUpdateConfig(application);
|
||||
});
|
||||
public void update(ProjectApplication application, String currentUser) {
|
||||
this.doBeforeUpdate(application, currentUser);
|
||||
//配置信息入库
|
||||
this.createOrUpdateConfig(application);
|
||||
}
|
||||
|
||||
private void createOrUpdateConfig(ProjectApplication application) {
|
||||
|
@ -106,7 +103,6 @@ public class ProjectApplicationService {
|
|||
|
||||
private void doBeforeUpdate(ProjectApplication application, String currentUser) {
|
||||
String type = application.getType();
|
||||
//TODO 自定义id配置 &其他配置
|
||||
if (StringUtils.equals(type, ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name())
|
||||
|| StringUtils.equals(type, ProjectApplicationType.UI.UI_CLEAN_REPORT.name())
|
||||
|| StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_CLEAN_REPORT.name())
|
||||
|
|
|
@ -63,11 +63,11 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
public void testTestPlanClean() throws Exception {
|
||||
this.testGetTestPlan();
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), TIME_TYPE_VALUE);
|
||||
|
||||
this.requestPost(TEST_PLAN_UPDATE_URL, request);
|
||||
//更新
|
||||
request.get(0).setTypeValue("4M");
|
||||
request.setTypeValue("4M");
|
||||
this.requestPost(TEST_PLAN_UPDATE_URL, request);
|
||||
// @@异常参数校验
|
||||
updatedGroupParamValidateTest(ProjectApplicationDefinition.class, TEST_PLAN_UPDATE_URL);
|
||||
|
@ -79,10 +79,10 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(2)
|
||||
public void testTestPlanShare() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.TEST_PLAN.TEST_PLAN_SHARE_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.TEST_PLAN.TEST_PLAN_SHARE_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(TEST_PLAN_UPDATE_URL, request);
|
||||
//更新
|
||||
request.get(0).setTypeValue("5M");
|
||||
request.setTypeValue("5M");
|
||||
this.requestPost(TEST_PLAN_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(4)
|
||||
public void testUiClean() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.UI.UI_CLEAN_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.UI.UI_CLEAN_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(UI_UPDATE_URL, request);
|
||||
// @@异常参数校验
|
||||
updatedGroupParamValidateTest(ProjectApplicationDefinition.class, UI_UPDATE_URL);
|
||||
|
@ -125,10 +125,10 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(5)
|
||||
public void testUiShare() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.UI.UI_SHARE_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.UI.UI_SHARE_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(UI_UPDATE_URL, request);
|
||||
//更新
|
||||
request.get(0).setTypeValue("5M");
|
||||
request.setTypeValue("5M");
|
||||
this.requestPost(UI_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(5)
|
||||
public void testUiResourcePool() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.UI.UI_RESOURCE_POOL_ID.name()), "local");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.UI.UI_RESOURCE_POOL_ID.name(), "local");
|
||||
this.requestPost(UI_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -174,10 +174,10 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(7)
|
||||
public void testPerformanceClean() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_CLEAN_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_CLEAN_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(PERFORMANCE_UPDATE_URL, request);
|
||||
//更新
|
||||
request.get(0).setTypeValue("4M");
|
||||
request.setTypeValue("4M");
|
||||
this.requestPost(PERFORMANCE_UPDATE_URL, request);
|
||||
// @@异常参数校验
|
||||
updatedGroupParamValidateTest(ProjectApplicationDefinition.class, PERFORMANCE_UPDATE_URL);
|
||||
|
@ -189,10 +189,10 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(8)
|
||||
public void testPerformanceShare() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_SHARE_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_SHARE_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(PERFORMANCE_UPDATE_URL, request);
|
||||
//更新
|
||||
request.get(0).setTypeValue("5M");
|
||||
request.setTypeValue("5M");
|
||||
this.requestPost(PERFORMANCE_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Order(9)
|
||||
public void testPerformanceReviewer() throws Exception {
|
||||
//新增
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_SCRIPT_REVIEWER_ENABLE.name()), "admin");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_SCRIPT_REVIEWER_ENABLE.name(), "admin");
|
||||
this.requestPost(PERFORMANCE_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(12)
|
||||
public void testUrlRepeatable() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_URL_REPEATABLE.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_URL_REPEATABLE.name(), "true");
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(13)
|
||||
public void testApiClean() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_CLEAN_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_CLEAN_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(14)
|
||||
public void testApiShare() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_SHARE_REPORT.name()), TIME_TYPE_VALUE);
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_SHARE_REPORT.name(), TIME_TYPE_VALUE);
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(15)
|
||||
public void testApiResourcePool() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_RESOURCE_POOL_ID.name()), "local");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_RESOURCE_POOL_ID.name(), "local");
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(16)
|
||||
public void testApiReviewer() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_SCRIPT_REVIEWER_ENABLE.name()), "admin");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_SCRIPT_REVIEWER_ENABLE.name(), "admin");
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(17)
|
||||
public void testApiErrorReportRule() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_ERROR_REPORT_RULE.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_ERROR_REPORT_RULE.name(), "true");
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(18)
|
||||
public void testApiSyncCase() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.API.API_SYNC_CASE.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.API.API_SYNC_CASE.name(), "true");
|
||||
this.requestPost(API_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(22)
|
||||
public void testCasePublic() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.CASE.CASE_PUBLIC.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.CASE.CASE_PUBLIC.name(), "true");
|
||||
this.requestPost(CASE_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(23)
|
||||
public void testReview() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.CASE.CASE_RE_REVIEW.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.CASE.CASE_RE_REVIEW.name(), "true");
|
||||
this.requestPost(CASE_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(27)
|
||||
public void testWorkstation() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.WORKSTATION.WORKSTATION_SYNC_RULE.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.WORKSTATION.WORKSTATION_SYNC_RULE.name(), "true");
|
||||
this.requestPost(WORKSTATION_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(29)
|
||||
public void testBug() throws Exception {
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList(ProjectApplicationType.BUG.BUG_SYNC.name()), "true");
|
||||
ProjectApplication request = creatRequest(ProjectApplicationType.BUG.BUG_SYNC.name(), "true");
|
||||
this.requestPost(BUG_UPDATE_URL, request);
|
||||
}
|
||||
|
||||
|
@ -487,16 +487,13 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
return request;
|
||||
}
|
||||
|
||||
private List<ProjectApplication> creatRequest(List<String> type, String typeValue) {
|
||||
List<ProjectApplication> list = new ArrayList<>();
|
||||
type.forEach(t -> {
|
||||
ProjectApplication projectApplication = new ProjectApplication();
|
||||
projectApplication.setProjectId(PROJECT_ID);
|
||||
projectApplication.setType(t);
|
||||
projectApplication.setTypeValue(typeValue);
|
||||
list.add(projectApplication);
|
||||
});
|
||||
return list;
|
||||
private ProjectApplication creatRequest(String type, String typeValue) {
|
||||
ProjectApplication projectApplication = new ProjectApplication();
|
||||
projectApplication.setProjectId(PROJECT_ID);
|
||||
projectApplication.setType(type);
|
||||
projectApplication.setTypeValue(typeValue);
|
||||
return projectApplication;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -562,8 +559,8 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
Assertions.assertNotNull(resultHolder);
|
||||
|
||||
//更新
|
||||
List<ProjectApplication> request = creatRequest(Arrays.asList("bugManagement"), "false");
|
||||
request.get(0).setProjectId("100001100001");
|
||||
ProjectApplication request = creatRequest("bugManagement", "false");
|
||||
request.setProjectId("100001100001");
|
||||
this.requestPost(BUG_UPDATE_URL, request);
|
||||
MvcResult updateMvcResult = this.requestGetWithOkAndReturn(GET_MODULE_SETTING_URL + "/100001100001");
|
||||
// 获取返回值
|
||||
|
@ -628,6 +625,7 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
|||
private String mockServerHost;
|
||||
@Value("${embedded.mockserver.port}")
|
||||
private int mockServerHostPort;
|
||||
|
||||
@Test
|
||||
@Order(39)
|
||||
public void testCheckProjectKey() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue