fix(项目设置): 状态排序接口调用报错

This commit is contained in:
AgAngle 2023-11-07 21:01:17 +08:00 committed by jianxing
parent 8de0d13870
commit 83c3dd2478
3 changed files with 8 additions and 6 deletions

View File

@ -55,7 +55,9 @@ public class ProjectStatusFlowSettingController {
@Operation(summary = "系统设置-组织-状态流设置-状态项排序")
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_UPDATE)
public void sortStatusItem(@PathVariable
String projectId, @PathVariable String scene,
String projectId,
@PathVariable
String scene,
@RequestBody
@NotEmpty
List<String> statusIds) {

View File

@ -115,7 +115,7 @@ public class ProjectStatusFlowSettingService extends BaseStatusFlowSettingServic
@Override
public List<StatusItem> sortStatusItem(String projectId, String scene, List<String> statusIds) {
OrganizationService.checkResourceExist(projectId);
ProjectService.checkResourceExist(projectId);
projectTemplateService.checkProjectTemplateEnable(projectId, scene);
return super.sortStatusItem(projectId, scene, statusIds);
}

View File

@ -36,7 +36,6 @@ import java.util.stream.Collectors;
import static io.metersphere.project.enums.result.ProjectResultCode.PROJECT_TEMPLATE_PERMISSION;
import static io.metersphere.system.controller.handler.result.CommonResultCode.*;
import static io.metersphere.system.controller.handler.result.MsHttpResultCode.NOT_FOUND;
import static io.metersphere.system.controller.result.SystemResultCode.ORGANIZATION_TEMPLATE_PERMISSION;
/**
* @author jianxing
@ -298,6 +297,7 @@ public class ProjectStatusFlowSettingControllerTest extends BaseTest {
requestGetPermissionTest(PermissionConstants.PROJECT_TEMPLATE_UPDATE, STATUS_DELETE, addStatusItem.getId());
}
@Test
@Order(6)
public void sortStatusItem() throws Exception {
List<StatusItem> statusItems = baseStatusItemService.getByScopeIdAndScene(DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
@ -308,9 +308,9 @@ public class ProjectStatusFlowSettingControllerTest extends BaseTest {
OrganizationStatusFlowSettingControllerTest.assertSortStatusItem(DEFAULT_PROJECT_ID, statusIds);
// @校验是否开启组织模板
changeOrgTemplateEnable(false);
assertErrorCode(this.requestPost(STATUS_SORT, statusIds, DEFAULT_PROJECT_ID, TemplateScene.BUG.name()), ORGANIZATION_TEMPLATE_PERMISSION);
changeOrgTemplateEnable(true);
assertErrorCode(this.requestPost(STATUS_SORT, statusIds, DEFAULT_PROJECT_ID, TemplateScene.BUG.name()), PROJECT_TEMPLATE_PERMISSION);
changeOrgTemplateEnable(false);
// @@状态不存在
assertErrorCode(this.requestPost(STATUS_SORT, List.of("1111"), DEFAULT_PROJECT_ID, TemplateScene.BUG.name()), STATUS_ITEM_NOT_EXIST);
@ -319,7 +319,7 @@ public class ProjectStatusFlowSettingControllerTest extends BaseTest {
assertErrorCode(this.requestPost(STATUS_SORT, statusIds, "111", TemplateScene.BUG.name()), NOT_FOUND);
// @@校验权限
requestPostPermissionTest(PermissionConstants.ORGANIZATION_TEMPLATE_UPDATE, STATUS_SORT, List.of(), DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
requestPostPermissionTest(PermissionConstants.PROJECT_TEMPLATE_UPDATE, STATUS_SORT, List.of(), DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
}
private void changeOrgTemplateEnable(boolean enable) {