wujiefeng il y a 1 an
Parent
commit
bc7e4ee5cc

+ 6 - 0
FullCardClient/pom.xml

@@ -56,6 +56,12 @@
             <version>${project.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.github.microservice.opengateway</groupId>
+            <artifactId>OpenApiClient</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>cn.afterturn</groupId>
             <artifactId>easypoi-base</artifactId>

+ 47 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/openApi/AppModel.java

@@ -0,0 +1,47 @@
+package com.zhongshu.card.client.model.openApi;
+
+import lombok.Data;
+
+@Data
+public class AppModel {
+
+    private String id;
+
+    private Long createTime;
+
+    private Long updateTime;
+
+    /**
+     * 应用名称
+     */
+    private String appName;
+
+    private String appId;
+
+    private String appKey;
+
+    /**
+     * 状态
+     */
+    private String appState;
+
+    /**
+     * 类型:物联网、全卡
+     */
+    private String appType;
+
+    /**
+     * 绑定项目id
+     */
+    private String businessId;
+
+    private String projectName;
+
+    private String description;
+
+
+    /**
+     * 创建用户
+     */
+    private String uid;
+}

+ 19 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/openApi/AppParam.java

@@ -0,0 +1,19 @@
+package com.zhongshu.card.client.model.openApi;
+
+import com.zhongshu.opengateway.client.type.AppState;
+import com.zhongshu.opengateway.client.type.AppType;
+import io.swagger.v3.oas.annotations.Parameter;
+import lombok.Data;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Data
+public class AppParam {
+
+    private String businessId;
+
+    private AppType appType;
+
+    private AppState appState;
+
+    private String appName;
+}

+ 52 - 50
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/openAPI/OpenApiConfigManagerController.java

@@ -13,6 +13,7 @@ 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;
+import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,60 +43,61 @@ public class OpenApiConfigManagerController {
 //        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 openApiConfigManagerService.quoteOpenApi(param);
-    }
+//    @Operation(summary = "添加接口", description = "添加接口")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "quoteOpenApi", method = RequestMethod.POST)
+//    public ResultContent quoteOpenApi(@RequestBody AddApiParam param){
+//        return openApiConfigManagerService.quoteOpenApi(param);
+//    }
 
 
     @Operation(summary = "分页查询App下openApi", description = "分页查询App下openApi")
-    @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(@RequestBody OpenApiSearchParam param){
+//    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+    @RequestMapping(value = "pageByApp", method = RequestMethod.POST)
+    public ResultContent pageByApp(Pageable pageable, OpenApiSearchParam param){
+        param.setPage(param.getPage());
+        param.setSize(param.getSize());
         return openApiConfigManagerService.pageByApp(param);
     }
+//    @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)
+//    public ResultContent pageAddList(@RequestBody OpenApiSearchParam param){
+//        return openApiConfigManagerService.pageAddList(param);
+//    }
 
-    @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 = "禁用/启用")
-    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
-    @RequestMapping(value = "disable", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
-    public ResultContent disable(String id){
-        return openApiConfigManagerService.disable(id);
-    }
-
-    @Operation(summary = "删除", description = "删除")
-    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
-    @RequestMapping(value = "delete", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
-    public ResultContent delete(String id){
-        return openApiConfigManagerService.delete(id);
-    }
-
-    @Operation(summary = " 获取openApi详情", description = " 获取openApi详情")
-    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
-    @RequestMapping(value = "get", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
-    public ResultContent get(String id){
-        return openApiConfigManagerService.get(id);
-    }
-
-    @Operation(summary = "设置限流规则", description = "设置限流规则")
-    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
-    @RequestMapping(value = "setLimit", method = RequestMethod.POST, consumes = {MediaType.ALL_VALUE})
-    public ResultContent setLimit(@RequestBody LimitParam limitParam){
-        return openApiConfigManagerService.setLimit(limitParam);
-    }
+//    @Operation(summary = "禁用/启用", description = "禁用/启用")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "disable", method = RequestMethod.GET)
+//    public ResultContent disable(@Parameter(name = "id", description = "接口id") @RequestParam(value = "id") String id){
+//        return openApiConfigManagerService.disable(id);
+//    }
+//
+//    @Operation(summary = "删除", description = "删除")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "delete", method = RequestMethod.GET)
+//    public ResultContent delete(@Parameter(name = "id", description = "接口id") @RequestParam(name = "id") String id){
+//        return openApiConfigManagerService.delete(id);
+//    }
+//
+//    @Operation(summary = " 获取openApi详情", description = " 获取openApi详情")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "get", method = RequestMethod.GET)
+//    public ResultContent get(@Parameter(name = "id", description = "接口id") @RequestParam(name = "id") String id){
+//        return openApiConfigManagerService.get(id);
+//    }
+//
+//    @Operation(summary = "设置限流规则", description = "设置限流规则")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = "openapi", type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "setLimit", method = RequestMethod.POST)
+//    public ResultContent setLimit(@RequestBody LimitParam limitParam){
+//        return openApiConfigManagerService.setLimit(limitParam);
+//    }
 }

+ 0 - 42
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/openAPI/OpenApiManagerController.java

@@ -1,42 +0,0 @@
-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.opengateway.client.model.OpenApiModel;
-import com.zhongshu.opengateway.client.model.SignModel;
-import com.zhongshu.opengateway.client.model.param.RefreshApiParam;
-import com.zhongshu.opengateway.client.model.ret.ResultContent;
-import com.zhongshu.opengateway.client.service.OpenApiService;
-import com.zhongshu.opengateway.client.service.SignService;
-import com.zhongshu.opengateway.client.type.ApiType;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.web.PageableDefault;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/openApi/api")
-@Tag(name = "OpenApi--接口管理")
-public class OpenApiManagerController {
-
-    @Autowired
-    OpenApiService openApiService;
-
-    @Autowired
-    SignService signService;
-
-
-
-
-
-
-}

+ 67 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/openAPI/OpenApiSuperController.java

@@ -0,0 +1,67 @@
+//package com.zhongshu.card.server.core.controller.openAPI;
+//
+//import com.github.microservice.components.data.base.util.PageEntityUtil;
+//import com.zhongshu.card.server.core.dao.org.OrganizationDao;
+//import com.zhongshu.opengateway.client.model.OpenApiModel;
+//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.OpenApiService;
+//import com.zhongshu.opengateway.client.service.SignService;
+//import io.swagger.v3.oas.annotations.Operation;
+//import io.swagger.v3.oas.annotations.Parameter;
+//import io.swagger.v3.oas.annotations.tags.Tag;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.data.domain.Page;
+//import org.springframework.data.domain.Pageable;
+//import org.springframework.web.bind.annotation.*;
+//
+//@RestController
+//@RequestMapping("/openApi/super/api")
+//@Tag(name = "OpenApi超管--接口管理")
+//public class OpenApiSuperController {
+//
+//    @Autowired
+//    OpenApiService openApiService;
+//
+//    @Autowired
+//    SignService signService;
+//
+//    @Autowired
+//    OrganizationDao organizationDao;
+//
+//    @Operation(summary = "分页查询openApi", description = "分页查询openApi")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//    @RequestMapping(value = "page", method = RequestMethod.POST)
+//    public ResultContent page(@Parameter(hidden = true) Pageable pageable, OpenApiSearchParam param){
+//        param.setPageNumber(pageable.getPageNumber());
+//        param.setPageSize(pageable.getPageSize());
+//        return openApiService.page(param);
+//    }
+//
+//    @Operation(summary = "禁用/启用", description = "禁用/启用")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//    @RequestMapping(value = "disable", method = RequestMethod.GET)
+//    public ResultContent disable(@Parameter(name = "id", description = "接口id") String id){
+//        return openApiService.disable(id);
+//    }
+//
+//    @Operation(summary = "删除", description = "删除")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//    @RequestMapping(value = "delete", method = RequestMethod.GET)
+//    public ResultContent delete(@Parameter(name = "id", description = "接口id") String id){
+//        return openApiService.delete(id);
+//    }
+//
+//
+//    @Operation(summary = "设置规则", description = "设置规则")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//    @RequestMapping(value = "setLimit", method = RequestMethod.POST)
+//    public ResultContent setLimit(@RequestBody LimitParam limitParam){
+//        return openApiService.setLimit(limitParam);
+//    }
+//
+//
+//
+//
+//}

+ 30 - 27
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/openAPI/OpenAppManagerController.java

@@ -3,6 +3,7 @@ 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.client.model.openApi.AppParam;
 import com.zhongshu.card.server.core.service.openAPI.OpenAppManagerService;
 import com.zhongshu.opengateway.client.model.param.SignParam;
 import com.zhongshu.opengateway.client.service.OpenApiConfigService;
@@ -28,30 +29,31 @@ public class OpenAppManagerController {
     @Autowired
     OpenApiConfigService openApiConfigService;
 
-    @Operation(summary = "添加应用", description = "添加应用")
-    @RequestMapping(value = "add", method = {RequestMethod.POST})
-//    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-//    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
-    public Object add(@RequestBody SignParam param){
-        return openAppManagerService.add(param);
-    }
+//    @Operation(summary = "添加应用", description = "添加应用")
+//    @RequestMapping(value = "add", method = {RequestMethod.POST})
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    public Object add(@RequestBody SignParam param){
+//        return openAppManagerService.add(param);
+//    }
+//
+//    @Operation(summary = "删除应用", description = "删除应用")
+//    @RequestMapping(value = "delete", method = {RequestMethod.GET})
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    public Object delete(@Parameter(name = "appId", description = "应用id") @RequestParam(name = "appId") String appId){
+//        return openAppManagerService.delete(appId);
+//    }
 
-    @Operation(summary = "删除应用", description = "删除应用")
-    @RequestMapping(value = "delete", method = {RequestMethod.POST})
-//    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-//    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
-    public Object delete(String appId){
-        return openAppManagerService.delete(appId);
-    }
 
-
-    @Operation(summary = "禁用/启用", description = "禁用/启用")
-//    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
-//    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
-    @RequestMapping(value = "disable", method = {RequestMethod.POST})
-    public Object disable(String appId, AppState appState){
-        return openAppManagerService.disable(appId, appState);
-    }
+//    @Operation(summary = "禁用/启用", description = "禁用/启用")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "disable", method = {RequestMethod.GET})
+//    public Object disable(@Parameter(name = "appId", description = "应用id")@RequestParam(name = "appId")String appId,
+//                          @Parameter(name = "appState", description = "应用状态")@RequestParam(name = "appState")AppState appState){
+//        return openAppManagerService.disable(appId, appState);
+//    }
 
     /**
      * 分页获取该项目下的app列表
@@ -60,11 +62,12 @@ public class OpenAppManagerController {
 //    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
 //    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
     @RequestMapping(value = "page", method = {RequestMethod.POST})
-    public Object page(@Parameter(name = "businessId", description = "项目id") @RequestParam(name = "businessId")String businessId,
-                       @Parameter(name = "appType", description = "应用类型") @RequestParam(name = "appType", required = false)AppType appType,
-                       @Parameter(name = "appState", description = "应用状态") @RequestParam(name = "appState", required = false)AppState appState,
-                       @Parameter(name = "appName", description = "应用名称") @RequestParam(name = "appName", required = false)String appName,
+    public Object page(AppParam appParam,
                        @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable){
-        return openAppManagerService.page(businessId, appType, appState, appName, pageable);
+        return openAppManagerService.page(appParam, pageable);
     }
+
+
+    //**--------------------------------------------超管接口------------------------------------------------------**/
+
 }

+ 66 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/openAPI/OpenAppSuperController.java

@@ -0,0 +1,66 @@
+//package com.zhongshu.card.server.core.controller.openAPI;
+//
+//import com.zhongshu.card.client.model.openApi.AppParam;
+//import com.zhongshu.card.server.core.service.openAPI.OpenAppManagerService;
+//import com.zhongshu.opengateway.client.model.param.SignParam;
+//import com.zhongshu.opengateway.client.service.OpenApiConfigService;
+//import com.zhongshu.opengateway.client.type.AppState;
+//import com.zhongshu.opengateway.client.type.AppType;
+//import io.swagger.v3.oas.annotations.Operation;
+//import io.swagger.v3.oas.annotations.Parameter;
+//import io.swagger.v3.oas.annotations.tags.Tag;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.data.domain.Pageable;
+//import org.springframework.data.web.PageableDefault;
+//import org.springframework.web.bind.annotation.*;
+//
+//@RestController
+//@RequestMapping("/openApi/super/app")
+//@Tag(name = "OpenApi超管--应用管理")
+//public class OpenAppSuperController {
+//
+//    @Autowired
+//    OpenAppManagerService openAppManagerService;
+//
+//    @Autowired
+//    OpenApiConfigService openApiConfigService;
+//
+//    @Operation(summary = "添加应用", description = "添加应用")
+//    @RequestMapping(value = "add", method = {RequestMethod.POST})
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    public Object add(@RequestBody SignParam param){
+//        return openAppManagerService.add(param);
+//    }
+//
+//    @Operation(summary = "删除应用", description = "删除应用")
+//    @RequestMapping(value = "delete", method = {RequestMethod.GET})
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    public Object delete(@Parameter(name = "appId", description = "应用id") @RequestParam(name = "appId") String appId){
+//        return openAppManagerService.delete(appId);
+//    }
+//
+//
+//    @Operation(summary = "禁用/启用", description = "禁用/启用")
+////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+//    @RequestMapping(value = "disable", method = {RequestMethod.GET})
+//    public Object disable(@Parameter(name = "appId", description = "应用id")@RequestParam(name = "appId")String appId,
+//                          @Parameter(name = "appState", description = "应用状态")@RequestParam(name = "appState") AppState appState){
+//        return openAppManagerService.disable(appId, appState);
+//    }
+//
+////    /**
+////     * 分页获取该项目下的app列表
+////     */
+////    @Operation(summary = "分页获取该项目下的app列表", description = "分页获取该项目下的app列表")
+//////    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
+//////    @ResourceAuth(value = AuthConstant.Admin, type = AuthType.Project, remark = "")
+////    @RequestMapping(value = "page", method = {RequestMethod.POST})
+////    public Object page(@Parameter(hidden = true)  Pageable pageable,
+////                       AppParam param){
+////        return openAppManagerService.page(param, pageable);
+////    }
+//
+//}

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/openAPI/OpenApiConfigManagerService.java

@@ -40,7 +40,7 @@ public class OpenApiConfigManagerService {
 
     public ResultContent pageByApp(OpenApiSearchParam param){
 
-        return openApiConfigService.pageByAppId(param);
+        return openApiConfigService.pageByApp(param);
     }
 
     public ResultContent pageAddList(OpenApiSearchParam param){

+ 36 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/openAPI/OpenAppManagerService.java

@@ -1,6 +1,12 @@
 package com.zhongshu.card.server.core.service.openAPI;
 
 import com.github.microservice.auth.security.helper.AuthHelper;
+import com.github.microservice.components.data.base.util.PageEntityUtil;
+import com.zhongshu.card.client.model.openApi.AppModel;
+import com.zhongshu.card.client.model.openApi.AppParam;
+import com.zhongshu.card.server.core.dao.org.OrganizationDao;
+import com.zhongshu.card.server.core.domain.org.Organization;
+import com.zhongshu.opengateway.client.model.OpenApiModel;
 import com.zhongshu.opengateway.client.model.SignModel;
 import com.zhongshu.opengateway.client.model.param.SignParam;
 import com.zhongshu.opengateway.client.model.ret.ResultContent;
@@ -9,7 +15,10 @@ import com.zhongshu.opengateway.client.service.SignService;
 import com.zhongshu.opengateway.client.type.AppState;
 import com.zhongshu.opengateway.client.type.AppType;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
@@ -30,6 +39,9 @@ public class OpenAppManagerService {
     @Autowired
     AuthHelper authHelper;
 
+    @Autowired
+    OrganizationDao organizationDao;
+
     /**
      * 添加应用
      */
@@ -54,7 +66,29 @@ public class OpenAppManagerService {
     /**
      * 分页获取该项目下的app列表
      */
-    public Object page(String businessId, AppType appType, AppState appState, String appName, Pageable pageable) {
-        return signService.pageByBusinessId(businessId, appType, appState, appName, pageable.getPageNumber(), pageable.getPageSize());
+    public Object page(AppParam param, Pageable pageable) {
+
+        ResultContent<Page<SignModel>> ret = signService.pageByBusinessId(param.getBusinessId(), param.getAppType(), param.getAppState(), param.getAppName(), pageable.getPageNumber(), pageable.getPageSize());
+        if (ret.isSuccess()){
+            Page<SignModel> page = ret.getContent();
+            if (!page.getContent().isEmpty()){
+                return ResultContent.buildContent(PageEntityUtil.concurrent2PageModel(page, this::toAppModel));
+            }
+        }
+        return ret;
+    }
+
+    private AppModel toAppModel(SignModel signModel){
+        AppModel appModel = new AppModel();
+        if (signModel!=null){
+            BeanUtils.copyProperties(signModel, appModel, "appType", "appState");
+            Organization organization = organizationDao.findTopByOid(signModel.getBusinessId());
+            if (organization!=null && StringUtils.isNotEmpty(organization.getName())){
+                appModel.setProjectName(organization.getName());
+            }
+            appModel.setAppType(signModel.getAppType().getRemark());
+            appModel.setAppState(signModel.getAppState().getRemark());
+        }
+        return appModel;
     }
 }

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java

@@ -34,6 +34,7 @@ import com.zhongshu.card.server.core.service.user.DepartmentServiceImpl;
 import com.zhongshu.card.server.core.service.user.RoleServiceImpl;
 import com.zhongshu.card.server.core.service.user.UserAccountServiceImpl;
 import com.zhongshu.card.server.core.util.*;
+import com.zhongshu.opengateway.client.service.SignService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -122,6 +123,9 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
     @Autowired
     private ProjectBindOrgServiceImpl projectBindOrgServiceImpl;
 
+    @Autowired
+    SignService signService;
+
 
     /**
      * 保存项目信息
@@ -180,6 +184,8 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
             organization.setCreateUserId(getCurrentUserId());
             organizationDao.save(organization);
         }
+        //todo  同步名称至openApi网关
+        signService.syncBusinessName(organization.getOid(), organization.getName());
         organizationUserServiceImpl.orgBindManager(organization, userAccounts);
         return ResultContent.buildSuccess();
     }