Skip to content

Commit

Permalink
refactor(缺陷管理): 优化关联用例swagger文档
Browse files Browse the repository at this point in the history
  • Loading branch information
song-cc-rock authored and fit2-zhao committed Apr 28, 2024
1 parent 1598b5f commit ecb26d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Expand Up @@ -58,7 +58,7 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement
@Schema(description = "版本来源")
private String refId;

@Schema(description = "关联关系表里主ID eg:功能用例关联接口用例时为功能用例id")
@Schema(description = "关联关系表里主ID eg:功能用例关联接口用例时为功能用例id, 缺陷关联用例时为缺陷ID")
@NotBlank(message = "{relate_source_id_not_blank}")
@Size(min = 1, max = 50, message = "{relate_source_id_length_range}")
private String sourceId;
Expand Down
Expand Up @@ -22,6 +22,9 @@
import io.metersphere.system.utils.Pager;
import io.metersphere.system.utils.SessionUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
Expand Down Expand Up @@ -84,13 +87,18 @@ public Pager<List<BugRelateCaseDTO>> page(@Validated @RequestBody BugRelatedCase
@GetMapping("/un-relate/{id}")
@Operation(description = "缺陷管理-关联用例-取消关联用例")
@RequiresPermissions(PermissionConstants.PROJECT_BUG_UPDATE)
@Parameter(name = "id", description = "ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
@Log(type = OperationLogType.DISASSOCIATE, expression = "#msClass.getRelateLog(#id)", msClass = BugRelateCaseLogService.class)
public void unRelate(@PathVariable String id) {
bugRelateCaseCommonService.unRelate(id);
}

@GetMapping("/check-permission/{projectId}/{caseType}")
@Operation(description = "缺陷管理-关联用例-查看用例权限校验")
@Parameters({
@Parameter(name = "projectId", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)),
@Parameter(name = "caseType", description = "关联用例类型(FUNCTIONAL, API, SCENARIO)", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
})
public BugCaseCheckResult checkPermission(@PathVariable String projectId, @PathVariable String caseType) {
return bugRelateCaseCommonService.checkPermission(projectId, SessionUtils.getUserId(), caseType);
}
Expand Down
Expand Up @@ -106,12 +106,8 @@ private List<BugProviderDTO> buildAssociateBugs(List<BugProviderDTO> associateBu
List<SelectOption> headerHandlerOption = bugCommonService.getHeaderHandlerOption(projectId);
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
associateBugs.forEach(item -> {
headerHandlerOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getHandleUser())).findFirst().ifPresent(option -> {
item.setHandleUserName(option.getText());
});
statusOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getStatus())).findFirst().ifPresent(option -> {
item.setStatusName(option.getText());
});
headerHandlerOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getHandleUser())).findFirst().ifPresent(option -> item.setHandleUserName(option.getText()));
statusOption.stream().filter(option -> StringUtils.equals(option.getValue(), item.getStatus())).findFirst().ifPresent(option -> item.setStatusName(option.getText()));
});
return associateBugs;
}
Expand Down

0 comments on commit ecb26d7

Please sign in to comment.