|
|
@@ -3,9 +3,13 @@ package com.zhongshu.card.server.core.controller.openAPI;
|
|
|
import com.github.microservice.auth.client.constant.AuthConstant;
|
|
|
import com.github.microservice.auth.security.annotations.ResourceAuth;
|
|
|
import com.github.microservice.auth.security.type.AuthType;
|
|
|
+import com.zhongshu.card.server.core.service.openAPI.OpenApiConfigManagerService;
|
|
|
+import com.zhongshu.card.server.core.service.openAPI.OpenAppManagerService;
|
|
|
import com.zhongshu.opengateway.client.model.OpenApiConfigModel;
|
|
|
+import com.zhongshu.opengateway.client.model.SignModel;
|
|
|
import com.zhongshu.opengateway.client.model.param.AddApiParam;
|
|
|
import com.zhongshu.opengateway.client.model.param.LimitParam;
|
|
|
+import com.zhongshu.opengateway.client.model.param.OpenApiSearchParam;
|
|
|
import com.zhongshu.opengateway.client.model.ret.ResultContent;
|
|
|
import com.zhongshu.opengateway.client.service.OpenApiConfigService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
@@ -26,14 +30,24 @@ import java.util.List;
|
|
|
public class OpenApiConfigManagerController {
|
|
|
|
|
|
@Autowired
|
|
|
- OpenApiConfigService openApiConfigService;
|
|
|
+ OpenApiConfigManagerService openApiConfigManagerService;
|
|
|
+
|
|
|
+// /** 自定义条件分页查询所有openApi列表 */
|
|
|
+// @Operation(summary = "分页查询所有openApi列表", description = "分页查询所有openApi列表")
|
|
|
+//// @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
|
|
|
+//// @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
|
|
|
+// @RequestMapping(value = "page", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
+// public ResultContent pageByMql(String appId,
|
|
|
+// @PageableDefault(sort = "createTime", direction = Sort.Direction.DESC) Pageable pageable){
|
|
|
+// return openApiConfigManagerService.pageAll(appId, pageable);
|
|
|
+// }
|
|
|
|
|
|
@Operation(summary = "添加应用", description = "添加应用")
|
|
|
@ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "quoteOpenApi", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
public ResultContent quoteOpenApi(@RequestBody AddApiParam param){
|
|
|
- return openApiConfigService.quoteOpenApi(param);
|
|
|
+ return openApiConfigManagerService.quoteOpenApi(param);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -41,18 +55,16 @@ public class OpenApiConfigManagerController {
|
|
|
@ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "pageByApp", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
- public ResultContent pageByApp(String appId, @PageableDefault(sort = "createTime", direction = Sort.Direction.DESC) Pageable pageable){
|
|
|
-
|
|
|
- ResultContent<List<OpenApiConfigModel>> listRet = openApiConfigService.listByAppId(appId);
|
|
|
- if (listRet.isFailed()){
|
|
|
- return listRet;
|
|
|
- }
|
|
|
- List<OpenApiConfigModel> openApiConfigModelList = listRet.getContent();
|
|
|
- Object[] openApiPathList = openApiConfigModelList.stream().map(it -> {
|
|
|
- return it.getOpenApiModel().getPath();
|
|
|
- }).toArray();
|
|
|
+ public ResultContent pageByApp(@RequestBody OpenApiSearchParam param){
|
|
|
+ return openApiConfigManagerService.pageByApp(param);
|
|
|
+ }
|
|
|
|
|
|
- return openApiConfigService.pageByMql("{\"isDelete\": false, \"appId \" : \""+appId + "\", \"openApi.path\" : { $in: [\""+ StringUtils.join(openApiPathList, "\",\"") + "\"]}}", pageable);
|
|
|
+ @Operation(summary = "分页查询App添加列表", description = "分页查询App下openApi")
|
|
|
+ @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
|
|
|
+ @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
+ @RequestMapping(value = "pageAddList", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
+ public ResultContent pageAddList(@RequestBody OpenApiSearchParam param){
|
|
|
+ return openApiConfigManagerService.pageAddList(param);
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "禁用/启用", description = "禁用/启用")
|
|
|
@@ -60,7 +72,7 @@ public class OpenApiConfigManagerController {
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "disable", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
public ResultContent disable(String id){
|
|
|
- return openApiConfigService.disable(id);
|
|
|
+ return openApiConfigManagerService.disable(id);
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "删除", description = "删除")
|
|
|
@@ -68,7 +80,7 @@ public class OpenApiConfigManagerController {
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "delete", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
public ResultContent delete(String id){
|
|
|
- return openApiConfigService.delete(id);
|
|
|
+ return openApiConfigManagerService.delete(id);
|
|
|
}
|
|
|
|
|
|
@Operation(summary = " 获取openApi详情", description = " 获取openApi详情")
|
|
|
@@ -76,7 +88,7 @@ public class OpenApiConfigManagerController {
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "get", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
public ResultContent get(String id){
|
|
|
- return openApiConfigService.get(id);
|
|
|
+ return openApiConfigManagerService.get(id);
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "设置限流规则", description = "设置限流规则")
|
|
|
@@ -84,6 +96,6 @@ public class OpenApiConfigManagerController {
|
|
|
@ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
|
|
|
@RequestMapping(value = "setLimit", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
|
|
|
public ResultContent setLimit(@RequestBody LimitParam limitParam){
|
|
|
- return openApiConfigService.setLimit(limitParam);
|
|
|
+ return openApiConfigManagerService.setLimit(limitParam);
|
|
|
}
|
|
|
}
|