5 Commits 5a21ccde05 ... d8e0203d29

Autore SHA1 Messaggio Data
  GITZYY d8e0203d29 update check 1 settimana fa
  GITZYY a88fae7b77 update check 1 settimana fa
  GITZYY 979a5458fd Merge branch 'feature_20240905' into release-checkinto-241113 1 settimana fa
  GITZYY 9065c6b357 update eg 1 settimana fa
  bianlz b8660459a5 add all 新增API服务。 1 settimana fa
100 ha cambiato i file con 1914 aggiunte e 938 eliminazioni
  1. 0 11
      egress-gateway-service-adapter/src/main/java/adapter/api/Test.java
  2. 0 34
      egress-gateway-service-adapter/src/main/java/adapter/api/controller/ApiController.java
  3. 33 0
      egress-gateway-service-adapter/src/main/java/com/hrsk/cloud/eg/adapter/controller/ApiController.java
  4. 0 51
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/api/ApiGatewayService.java
  5. 25 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/api/executor/ApiInvokeCmdExe.java
  6. 0 48
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/ApiCustomizeBizHandler.java
  7. 0 142
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/ApiCustomizeRouteService.java
  8. 0 35
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/CodeStrategyCmd.java
  9. 0 2
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/ApiInvokeCmdExe.java
  10. 24 26
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/GenerateCheckIntoHttpApiConfigCmdExe.java
  11. 5 7
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/GenerateCheckIntoHttpApiConfigV2CmdExe.java
  12. 0 19
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/checkInto/CheckCmdExe.java
  13. 0 38
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/common/CommonCmdExe.java
  14. 0 17
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/route/EndpointRouteService.java
  15. 0 50
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/route/impl/CheckIntoCmd.java
  16. 18 0
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/api/ApiService.java
  17. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/BusinessPrefixEnum.java
  18. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/GlobalDataStatusEnum.java
  19. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/ResultCodeEnum.java
  20. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/EgLoanApiConfigInfoDto.java
  21. 28 0
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/ApiInvokeCmd.java
  22. 16 0
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/ApiQryCmd.java
  23. 17 0
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/RouteCmd.java
  24. 1 0
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/package-info.java
  25. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/plan/command/EgLoanApiConfigInfoCmd.java
  26. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/plan/command/PlanCmd.java
  27. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetCarInfoCmd.java
  28. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetHouseInfoCmd.java
  29. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetInsuranceInfoCmd.java
  30. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserBaseInfoCmd.java
  31. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionBusinessOwnerCmd.java
  32. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionEcommerceOwnersCmd.java
  33. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionOfficeWorkersCmd.java
  34. 1 1
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionSelfEmployedCmd.java
  35. 0 18
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/CustomerDTO.java
  36. 0 6
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/ErrorCode.java
  37. 0 29
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/command/ApiInvokeParamCmd.java
  38. 0 31
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/command/LoanParamCmd.java
  39. 0 18
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/common/LocalEnumDTO.java
  40. 0 21
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/event/CustomerCreatedEvent.java
  41. 0 11
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/event/DomainEventConstant.java
  42. 0 117
      egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/vo/DataVo.java
  43. 19 29
      egress-gateway-service-domain/pom.xml
  44. 49 6
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/Api.java
  45. 100 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiChannel.java
  46. 19 43
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiFactory.java
  47. 8 10
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiGateway.java
  48. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/KeyValueObject.java
  49. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ValueObject.java
  50. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/customized/common/JoinMethodEnums.java
  51. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/customized/common/ServerCodeEnums.java
  52. 32 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ContentTypeEnum.java
  53. 32 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiEndpointIntegrationModeEnum.java
  54. 47 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiErrorCodeEnum.java
  55. 34 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiStatusEnum.java
  56. 21 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/KeyValueObject.java
  57. 95 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ValueObject.java
  58. 34 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ValueObjectTypeEnum.java
  59. 46 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/EncryptionFunction.java
  60. 45 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/FunctionObject.java
  61. 25 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/FunctionParam.java
  62. 66 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/ValueObjectFunctionManager.java
  63. 120 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiRequest.java
  64. 46 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiRequestConfig.java
  65. 50 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiResponse.java
  66. 1 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/package-info.java
  67. 1 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/package-info.java
  68. 103 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiJsonPayloadResolver.java
  69. 18 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiPayloadResolver.java
  70. 58 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiPayloadResolverManage.java
  71. 26 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/BasicTypeValueObjectResolver.java
  72. 17 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/JsonPathValueObjectResolver.java
  73. 37 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/SpelValueObjectResolver.java
  74. 22 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/ValueObjectResolver.java
  75. 66 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/ValueObjectResolverManager.java
  76. 0 2
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/EncryptionFunction.java
  77. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/ValueObjectFunctionManager.java
  78. 2 2
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/resolver/payload/ApiJsonPayloadResolver.java
  79. 0 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/resolver/result/ApiJsonResultResolver.java
  80. 56 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/ApiRoute.java
  81. 35 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/strategy/ChannelCodeBasedRouteStrategy.java
  82. 21 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/strategy/RouteStrategy.java
  83. 73 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/BeetlHelper.java
  84. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/BizPreconditions.java
  85. 32 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/Constants.java
  86. 70 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/GsonUtils.java
  87. 63 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/HessianUtils.java
  88. 44 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/SysErrorCodeEnum.java
  89. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgApiTypeEnum.java
  90. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgressApiEndpointIntegrationModeEnum.java
  91. 1 1
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgressApiStatusEnum.java
  92. 0 44
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/egress/EgRouteTypeEnum.java
  93. 0 24
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/utils/GsonUtils.java
  94. 1 0
      egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/package-info.java
  95. 18 21
      egress-gateway-service-infrastructure/pom.xml
  96. 40 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/HttpClient.java
  97. 1 1
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/RetryRequestConfig.java
  98. 1 1
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/RetryRestTemplate.java
  99. 1 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/package-info.java
  100. 29 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/common/InfrastructureException.java

+ 0 - 11
egress-gateway-service-adapter/src/main/java/adapter/api/Test.java

@@ -1,11 +0,0 @@
-package adapter.api;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: Test
- * @date 2024/9/18 15:11
- */
-public class Test {
-
-}

+ 0 - 34
egress-gateway-service-adapter/src/main/java/adapter/api/controller/ApiController.java

@@ -1,34 +0,0 @@
-package adapter.api.controller;
-
-import com.hrsk.cloud.eg.app.api.ApiGatewayService;
-import com.hrsk.cloud.eg.clinet.dto.data.command.ApiInvokeParamCmd;
-import com.hrsk.pangu.dto.SingleResponse;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: ApiController
- * @date 2024/11/6 13:47
- */
-@RestController
-@RequestMapping("/api/eg")
-public class ApiController {
-
-    @Resource
-     private ApiGatewayService apiGatewayService;
-    /**
-     * @description:  接口
-     * @param:
-     * @return:
-     * @author zhangyy
-     * @date: 2024/8/30 14:34
-     */
-    @RequestMapping("/loans/v1")
-    public SingleResponse loans(ApiInvokeParamCmd apiInvokeParamCmd) {
-        return SingleResponse.of(apiGatewayService.invoke(apiInvokeParamCmd));
-    }
-}

+ 33 - 0
egress-gateway-service-adapter/src/main/java/com/hrsk/cloud/eg/adapter/controller/ApiController.java

@@ -0,0 +1,33 @@
+package com.hrsk.cloud.eg.adapter.controller;
+
+import com.hrsk.cloud.eg.client.api.ApiService;
+import com.hrsk.cloud.eg.client.dto.cmd.ApiInvokeCmd;
+import com.hrsk.pangu.dto.SingleResponse;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-09 10:33
+ * @description: API Controller
+ **/
+@RestController
+@RequestMapping("/api")
+public class ApiController {
+    @Resource
+    private ApiService apiService;
+
+    /**
+     * 请求
+     * @param apiInvokeCmd api请求CMD
+     * @return 响应数据
+     */
+    @PostMapping("/invoke")
+    public SingleResponse<String> invoke(@RequestBody ApiInvokeCmd apiInvokeCmd){
+        return apiService.invoke(apiInvokeCmd);
+    }
+}

+ 0 - 51
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/api/ApiGatewayService.java

@@ -1,51 +0,0 @@
-package com.hrsk.cloud.eg.app.api;
-
-
-import com.hrsk.cloud.eg.app.route.EndpointRouteService;
-import com.hrsk.cloud.eg.clinet.dto.data.command.ApiInvokeParamCmd;
-import com.hrsk.cloud.eg.domain.common.constant.BusinessServiceEnums;
-import com.hrsk.cloud.eg.domain.common.constant.egress.EgRouteTypeEnum;
-import com.hrsk.pangu.dto.SingleResponse;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: ApiService
- * @date 2024/11/6 14:07
- */
-@Slf4j
-@Service
-public class ApiGatewayService {
-
-    @Resource
-    private List<EndpointRouteService> endpointRouteServices;
-
-
-
-    /**
-     * @description:  网管寻找对应的服务
-     * @param:
-     * @return:
-     * @author zhangyy
-     * @date: 2024/11/6 16:19
-     */
-  public   SingleResponse invoke(ApiInvokeParamCmd apiInvokeParamCmd){
-    try {
-       if (EgRouteTypeEnum.CHECK_INTO.getCode().equals(apiInvokeParamCmd.getRoute())){
-           Map<String, EndpointRouteService> collect = endpointRouteServices.stream().collect(Collectors.toMap(EndpointRouteService::getRoute, EndpointRouteService -> EndpointRouteService));
-         return   collect.get(apiInvokeParamCmd.getRoute()).apiEndPoint(apiInvokeParamCmd);
-       }
-    }catch (Exception e){
-      log.error("网关错误",e.getMessage());
-    }
-    return SingleResponse.buildFailure(BusinessServiceEnums.FAIL.getCode(), BusinessServiceEnums.FAIL.getMessage());
-  }
-
-}

+ 25 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/api/executor/ApiInvokeCmdExe.java

@@ -0,0 +1,25 @@
+package com.hrsk.cloud.eg.app.api.executor;
+
+import com.hrsk.cloud.eg.client.dto.cmd.ApiInvokeCmd;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-09 10:57
+ * @description: API调用CMD EXE
+ **/
+@Component
+public class ApiInvokeCmdExe {
+    @Resource
+    private ApiGateway apiGateway;
+    /**
+     * 执行
+     * @param apiInvokeCmd CMD
+     * @return 处理结果JSON
+     */
+    public String execute(ApiInvokeCmd apiInvokeCmd){
+        return apiGateway.invoke(apiInvokeCmd);
+    }
+}

+ 0 - 48
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/ApiCustomizeBizHandler.java

@@ -1,48 +0,0 @@
-package com.hrsk.cloud.eg.app.loan.customize;
-
-import com.hrsk.cloud.eg.domain.common.constant.ServerCodeEnums;
-import com.hrsk.cloud.eg.infrastructure.loanMannager.threedocking.LoanDockingApi;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: ApiBizHandler
- * @date 2024/9/13 09:34
- */
-@Component
-public class ApiCustomizeBizHandler implements ApplicationContextAware {
-
-    private final Map<ServerCodeEnums, LoanDockingApi> bizHandlerMap = new HashMap<>();
-
-
-    public void putBizHandler(ServerCodeEnums  type, LoanDockingApi handler) {
-        bizHandlerMap.put(type, handler);
-    }
-
-    public LoanDockingApi getBizHandler(ServerCodeEnums type) {
-        LoanDockingApi bizHandler = this.bizHandlerMap.get(type);
-        if (bizHandler == null) {
-            throw new RuntimeException("not.found.BizHandler");
-        }
-        return bizHandler;
-    }
-
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        Map<String, LoanDockingApi> beansOfType = applicationContext.getBeansOfType(LoanDockingApi.class);
-        Collection<LoanDockingApi> services = beansOfType.values();
-        for (LoanDockingApi service : services) {
-            ServerCodeEnums type = service.getType();
-            bizHandlerMap.put(type, service);
-        }
-    }
-
-}

+ 0 - 142
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/ApiCustomizeRouteService.java

@@ -1,142 +0,0 @@
-package com.hrsk.cloud.eg.app.loan.customize;
-
-import com.hrsk.cloud.eg.clinet.dto.data.command.LoanParamCmd;
-import com.hrsk.cloud.eg.clinet.dto.data.plan.command.PlanCmd;
-import com.hrsk.cloud.eg.clinet.vo.DataVo;
-import com.hrsk.cloud.eg.domain.common.constant.JoinMethodEnums;
-import com.hrsk.cloud.eg.domain.common.constant.ServerCodeEnums;
-import com.hrsk.cloud.eg.infrastructure.loanMannager.threedocking.LoanDockingApi;
-import com.hrsk.cloud.eg.infrastructure.loanMannager.threedocking.impl.*;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgLoanApiConfigInfoDo;
-import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import java.util.Objects;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: ApiRouteService
- * @date 2024/9/13 09:29
- */
-@Slf4j
-@Service
-public class ApiCustomizeRouteService {
-
-    @Resource
-    private EgApiService egApiService;
-
-    @Resource
-    private ApiCustomizeBizHandler apiCustomizeBizHandler;
-
-    @Resource
-    private QingyuCreditService qingyuCreditService;
-
-    @Resource
-    private XinluCreditService xinluCreditService;
-
-    @Resource
-    private OpenApiCreditService openApiCreditService;
-
-    @Resource
-    private QingyuV2CreditService qingyuV2CreditService;
-
-    @Resource
-    private XiangKeDaCreditService xiangKeDaCreditService;
-
-    @Resource
-    private RxkCreditService rxkCreditService;
-
-    @Resource
-    private OpenApiAesCreditService openApiAesCreditService;
-
-    @Resource
-    private HuirongCrmCreditService huirongCrmCreditService;
-
-    @Resource
-    private JinDieV2CreditService jinDieV2CreditService;
-
-    @Resource
-    private JinDieV3CreditService jinDieV3CreditService;
-
-    @Resource
-    private QingyuV3CreditService qingyuV3CreditService;
-
-    @Resource
-    private PubNoCheckCreditService pubNoCheckCreditService;
-
-
-    /**
-     * API 路由
-     *
-     * @param xdProduct
-     * @return
-     */
-    public LoanDockingApi apiRouter(PlanCmd xdProduct) {
-        if (null == xdProduct.getApiId()) return null;
-        EgLoanApiConfigInfoDo apiInfo = egApiService.getApiInfoByRedis(xdProduct.getApiId());
-        LoanDockingApi apiService = null;
-        if (Objects.isNull(apiInfo)&&apiInfo.getNeedCheck()==0){
-             apiService=pubNoCheckCreditService;
-             return apiService;
-        }
-        JoinMethodEnums method = JoinMethodEnums.getByCode(apiInfo.getApiCode());
-        if (null == method) return null;
-        switch (method) {
-            case CRM_QY:
-                apiService = qingyuCreditService;
-                break;
-            case CRM_XL:
-                apiService = xinluCreditService;
-                break;
-            case OPEN_API:
-                apiService = openApiCreditService;
-                break;
-            case CRM_QY_V2:
-                apiService = qingyuV2CreditService;
-                break;
-            case CRM_XKD:
-                apiService = xiangKeDaCreditService;
-                break;
-            case CRM_RXK:
-                apiService = rxkCreditService;
-                break;
-            case HUIRONG_CRM:
-                apiService = huirongCrmCreditService;
-                break;
-            case CRM_EC:
-                break;
-            case CRM_JD:
-                apiService = jinDieV2CreditService;
-                break;
-            case CRM_JDV3:
-                apiService = jinDieV3CreditService;
-                break;
-            case BUSI_API:
-                apiService = apiCustomizeBizHandler.getBizHandler(ServerCodeEnums.map.get(apiInfo.getApiCode()));
-                break;
-            case CRM_QY_V3:
-                apiService = qingyuV3CreditService;
-                break;
-            case OPEN_API_AES:
-                apiService = openApiAesCreditService;
-                break;
-            default:
-                log.error("不支持的对接方式:productId={}", xdProduct.getPlanId());
-        }
-        return apiService;
-    }
-
-    /**
-     * @description:  助贷撞库api
-     * @param:
-     * @return:
-     * @author zhangyy
-     * @date: 2024/9/13 09:59
-     */
-    public DataVo loanCheckInto(LoanParamCmd checkIntoParamCmd){
-        LoanDockingApi loanDockingApi = apiRouter(checkIntoParamCmd.getPlan());
-      return   loanDockingApi.qualityCheck(checkIntoParamCmd.getUser(), checkIntoParamCmd.getPlan(),checkIntoParamCmd.getApiConfigInfo());
-    }
-}

+ 0 - 35
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/customize/CodeStrategyCmd.java

@@ -1,35 +0,0 @@
-package com.hrsk.cloud.eg.app.loan.customize;
-
-import com.hrsk.cloud.eg.app.loan.executor.checkInto.CheckCmdExe;
-import com.hrsk.cloud.eg.clinet.dto.data.command.LoanParamCmd;
-import com.hrsk.cloud.eg.clinet.vo.DataVo;
-import com.hrsk.cloud.eg.domain.common.constant.egress.EgressApiEndpointIntegrationModeEnum;
-import com.hrsk.pangu.dto.SingleResponse;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: CodeStrategyCmd
- * @date 2024/11/6 16:14
- */
-@Service
-public class CodeStrategyCmd implements CheckCmdExe {
-
-    @Resource
-    private ApiCustomizeRouteService apiCustomizeRouteService;
-
-    @Override
-    public SingleResponse route(LoanParamCmd checkIntoParamCmd) {
-        DataVo dataVo = apiCustomizeRouteService.loanCheckInto(checkIntoParamCmd);
-        return SingleResponse.of(dataVo);
-    }
-
-    @Override
-    public String getMode() {
-        return EgressApiEndpointIntegrationModeEnum.CUSTOMIZE.getCode();
-    }
-}

+ 0 - 2
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/ApiInvokeCmdExe.java

@@ -1,7 +1,5 @@
 package com.hrsk.cloud.eg.app.loan.executor;
 
-import com.hrsk.cloud.eg.app.api.ApiGatewayService;
-import com.hrsk.cloud.eg.clinet.dto.data.command.ApiInvokeParamCmd;
 import com.hrsk.pangu.dto.SingleResponse;
 import org.springframework.stereotype.Component;
 

+ 24 - 26
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/GenerateCheckIntoHttpApiConfigCmdExe.java

@@ -1,17 +1,15 @@
 package com.hrsk.cloud.eg.app.loan.executor;
 
-import com.alibaba.fastjson2.JSONObject;
-import com.google.common.collect.Lists;
-import com.hrsk.cloud.eg.clinet.constant.BusinessPrefixEnum;
+import com.hrsk.cloud.eg.client.constant.BusinessPrefixEnum;
 import com.hrsk.cloud.eg.domain.api.*;
 import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
 import com.hrsk.cloud.eg.domain.api.common.ValueObjectTypeEnum;
 import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiDo;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiEndpointDo;
-import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgressApiDo;
+import com.hrsk.cloud.eg.infrastructure.service.EgApiChannelService;
 import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
 import lombok.extern.slf4j.Slf4j;
+import net.minidev.json.JSONObject;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -32,7 +30,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
     private EgApiService egApiService;
 
     @Resource
-    private EgApiEndpointService egApiEndpointService;
+    private EgApiChannelService egApiChannelService;
 
     /**
      * @description:  原始惠融对接api转化
@@ -42,14 +40,14 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
      * @date: 2024/8/29 17:58
      */
     public void  generateHuiRonHuiRonApiConfig(String huiRonApiConfig){
-        EgApiDo egApiDo=new EgApiDo();
+        EgressApiDo egApiDo=new EgressApiDo();
         egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":HUIRONG_CRM:9");
         egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
         egApiService.save(egApiDo);
         JSONObject jsonObject = JSONObject.parseObject(huiRonApiConfig);
         EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
         egApiEndpointDo.setApiId(egApiDo.getId());
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -70,7 +68,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createOpenApiRsaCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -91,7 +89,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createOpenApiAesCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /** 
@@ -112,7 +110,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createQinYuCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -129,7 +127,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
         EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
         egApiEndpointDo.setApiId(egApiDo.getId());
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -150,7 +148,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createXkdApiCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -171,7 +169,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createJinDieCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createJinDieCheckIntoBean(String openApiConfig) {
@@ -230,7 +228,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createJinDieCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createJinDieV3CheckIntoBean(String openApiConfig) {
@@ -290,7 +288,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createRxkCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createRxkCheckIntoBean(String openApiConfig) {
@@ -647,7 +645,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHuiZhongCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -713,7 +711,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYinHuaCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createYinHuaCheckIntoBean(String openApiConfig) {
@@ -775,7 +773,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHuixinCheckIntoBean(threeSystemConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createHuixinCheckIntoBean(String threeSystemConfig) {
@@ -844,7 +842,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHuiZhongCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     /**
@@ -911,7 +909,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYuKuaiHuaCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createYuKuaiHuaCheckIntoBean(String openApiConfig) {
@@ -970,7 +968,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYinJieCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createYinJieCheckIntoBean(String openApiConfig) {
@@ -1033,7 +1031,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYouRonCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createYouRonCheckIntoBean(String openApiConfig) {
@@ -1093,7 +1091,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHamiguaCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createHamiguaCheckIntoBean(String openApiConfig) {
@@ -1159,7 +1157,7 @@ public class GenerateCheckIntoHttpApiConfigCmdExe {
         egApiEndpointDo.setApiId(egApiDo.getId());
        
         egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHaohanwuyinCheckIntoBean(openApiConfig)));
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createHaohanwuyinCheckIntoBean(String openApiConfig) {

+ 5 - 7
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/GenerateCheckIntoHttpApiConfigV2CmdExe.java

@@ -2,14 +2,12 @@ package com.hrsk.cloud.eg.app.loan.executor;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.google.common.collect.Lists;
-import com.hrsk.cloud.eg.clinet.constant.BusinessPrefixEnum;
+import com.hrsk.cloud.eg.client.constant.BusinessPrefixEnum;
 import com.hrsk.cloud.eg.domain.api.HttpApiConfig;
 import com.hrsk.cloud.eg.domain.api.KeyValueObject;
 import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
 import com.hrsk.cloud.eg.domain.api.common.ValueObjectTypeEnum;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiDo;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiEndpointDo;
-import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
+import com.hrsk.cloud.eg.infrastructure.service.EgApiChannelService;
 import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -30,7 +28,7 @@ public class GenerateCheckIntoHttpApiConfigV2CmdExe {
     private EgApiService egApiService;
 
     @Resource
-    private EgApiEndpointService egApiEndpointService;
+    private EgApiChannelService egApiChannelService;
     /**
      * @description:  灏瀚无崟
      * @author zhangyy
@@ -45,7 +43,7 @@ public class GenerateCheckIntoHttpApiConfigV2CmdExe {
         JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
         EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
         egApiEndpointDo.setApiId(egApiDo.getId());
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createGexinjinfuCheckIntoBean(String openApiConfig) {
@@ -111,7 +109,7 @@ public class GenerateCheckIntoHttpApiConfigV2CmdExe {
         JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
         EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
         egApiEndpointDo.setApiId(egApiDo.getId());
-        egApiEndpointService.save(egApiEndpointDo);
+        egApiChannelService.save(egApiEndpointDo);
     }
 
     private HttpApiConfig createKuaiyidaiCheckIntoBean(String openApiConfig) {

+ 0 - 19
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/checkInto/CheckCmdExe.java

@@ -1,19 +0,0 @@
-package com.hrsk.cloud.eg.app.loan.executor.checkInto;
-
-import com.hrsk.cloud.eg.clinet.dto.data.command.LoanParamCmd;
-import com.hrsk.pangu.dto.SingleResponse;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: CheckCmdExe 撞库
- * @date 2024/11/6 15:28
- */
-public interface CheckCmdExe {
-
-
-    SingleResponse route(LoanParamCmd apiInvokeParamCmd);
-
-    String getMode();
-
-}

+ 0 - 38
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/loan/executor/common/CommonCmdExe.java

@@ -1,38 +0,0 @@
-package com.hrsk.cloud.eg.app.loan.executor.common;
-
-import com.hrsk.cloud.eg.domain.common.constant.egress.EgApiTypeEnum;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.hrsk.cloud.eg.clinet.dto.data.common.LocalEnumDTO;
-/**
- * @author zhangyy
- * @version 1.0
- * @description: CommonService 公共信息操作类
- * @date 2024/9/24 11:48
- */
-@Component
-public class CommonCmdExe {
-
-    /**
-     * @description:  获取本地枚举返回给前端
-     * @author zhangyy
-     * @date 2024/9/24 11:56
-     * @version 1.0
-     */
-    public List<LocalEnumDTO> getLocalEnumList() {
-        List<LocalEnumDTO> localEnumDtoList = new ArrayList<>();
-        EgApiTypeEnum[] values = EgApiTypeEnum.values();
-        LocalEnumDTO localEnumDto=null;
-        for (int i = 0; i < values.length; i++) {
-            localEnumDto = new LocalEnumDTO();
-            localEnumDto.setCode(values[i].getCode());
-            localEnumDto.setMsg(values[i].getMsg());
-            localEnumDtoList.add(localEnumDto);
-        }
-        return localEnumDtoList;
-    }
-}

+ 0 - 17
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/route/EndpointRouteService.java

@@ -1,17 +0,0 @@
-package com.hrsk.cloud.eg.app.route;
-
-import com.hrsk.cloud.eg.clinet.dto.data.command.ApiInvokeParamCmd;
-import com.hrsk.pangu.dto.SingleResponse;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: EndpointService
- * @date 2024/11/6 16:26
- */
-public interface EndpointRouteService {
-
-    SingleResponse apiEndPoint(ApiInvokeParamCmd apiInvokeParamCmd);
-
-    String getRoute();
-}

+ 0 - 50
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/route/impl/CheckIntoCmd.java

@@ -1,50 +0,0 @@
-package com.hrsk.cloud.eg.app.route.impl;
-
-import com.alibaba.fastjson2.JSONObject;
-import com.hrsk.cloud.eg.app.loan.executor.checkInto.CheckCmdExe;
-import com.hrsk.cloud.eg.app.route.EndpointRouteService;
-import com.hrsk.cloud.eg.clinet.dto.data.command.ApiInvokeParamCmd;
-import com.hrsk.cloud.eg.clinet.dto.data.command.LoanParamCmd;
-import com.hrsk.cloud.eg.clinet.dto.data.plan.command.EgLoanApiConfigInfoCmd;
-import com.hrsk.cloud.eg.domain.common.constant.egress.EgRouteTypeEnum;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgLoanApiConfigInfoDo;
-import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
-import com.hrsk.cloud.eg.infrastructure.utils.BeanCopyUtils;
-import com.hrsk.pangu.dto.SingleResponse;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: CheckIntoCmd
- * @date 2024/11/6 16:29
- */
-@Service
-public class CheckIntoCmd implements EndpointRouteService {
-
-    @Resource
-    private EgApiService egApiService;
-
-    @Resource
-    private List<CheckCmdExe> checkCmdExeList;
-
-    @Override
-    public SingleResponse apiEndPoint(ApiInvokeParamCmd apiInvokeParamCmd) {
-        LoanParamCmd checkIntoParamCmd = JSONObject.parseObject(apiInvokeParamCmd.getParam().toString(), LoanParamCmd.class);
-        EgLoanApiConfigInfoDo loanApiConfigInfo = egApiService.getLoanApiConfigInfo(checkIntoParamCmd.getPlan().getApiId());
-        EgLoanApiConfigInfoCmd configCmd = BeanCopyUtils.copy(loanApiConfigInfo, EgLoanApiConfigInfoCmd.class);
-        Map<String, CheckCmdExe> collect = checkCmdExeList.stream().collect(Collectors.toMap(CheckCmdExe::getMode, CheckCmdExe -> CheckCmdExe));
-
-        return   collect.get(loanApiConfigInfo.getIntegrationMode()).route(checkIntoParamCmd);
-    }
-
-    @Override
-    public String getRoute() {
-        return EgRouteTypeEnum.CHECK_INTO.getCode();
-    }
-}

+ 18 - 0
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/api/ApiService.java

@@ -0,0 +1,18 @@
+package com.hrsk.cloud.eg.client.api;
+
+import com.hrsk.cloud.eg.client.dto.cmd.ApiInvokeCmd;
+import com.hrsk.pangu.dto.SingleResponse;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-09 10:34
+ * @description: API服务
+ **/
+public interface ApiService {
+    /**
+     * 调用
+     * @param apiInvokeCmd API调用CMD
+     * @return 响应数据
+     */
+    SingleResponse<String> invoke(ApiInvokeCmd apiInvokeCmd);
+}

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/constant/BusinessPrefixEnum.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/BusinessPrefixEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.constant;
+package com.hrsk.cloud.eg.client.constant;
 
 /**
  * @description: BusinessPrefixEnum 

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/constant/GlobalDataStatusEnum.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/GlobalDataStatusEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.constant;
+package com.hrsk.cloud.eg.client.constant;
 
 /**
  * @author zhangyy

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/constant/ResultCodeEnum.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/constant/ResultCodeEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.constant;
+package com.hrsk.cloud.eg.client.constant;
 
 public enum ResultCodeEnum {
     // 全局

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/EgLoanApiConfigInfoDto.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/EgLoanApiConfigInfoDto.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data;
+package com.hrsk.cloud.eg.client.dto;
 
 import lombok.Data;
 

+ 28 - 0
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/ApiInvokeCmd.java

@@ -0,0 +1,28 @@
+package com.hrsk.cloud.eg.client.dto.cmd;
+
+import com.hrsk.pangu.dto.Command;
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-09 10:44
+ * @description: API调用CMD
+ **/
+@Data
+public class ApiInvokeCmd extends Command {
+    /**
+     * API编码
+     */
+    private String apiCode;
+    /**
+     * 路由
+     */
+    private RouteCmd route;
+    /**
+     * 数据
+     */
+    private Map<String,Object> data;
+
+}

+ 16 - 0
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/ApiQryCmd.java

@@ -0,0 +1,16 @@
+package com.hrsk.cloud.eg.client.dto.cmd;
+
+import lombok.Data;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 11:26
+ * @description:API查询CMD
+ **/
+@Data
+public class ApiQryCmd {
+    /**
+     * API编码
+     */
+    private String apiCode;
+}

+ 17 - 0
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/cmd/RouteCmd.java

@@ -0,0 +1,17 @@
+package com.hrsk.cloud.eg.client.dto.cmd;
+
+import com.hrsk.pangu.dto.Command;
+import lombok.Data;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 18:01
+ * @description: 路由CMD
+ **/
+@Data
+public class RouteCmd extends Command {
+    /**
+     * 路由编码
+     */
+    private String code;
+}

+ 1 - 0
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/package-info.java

@@ -0,0 +1 @@
+package com.hrsk.cloud.eg.client.dto;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/plan/command/EgLoanApiConfigInfoCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/plan/command/EgLoanApiConfigInfoCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.plan.command;
+package com.hrsk.cloud.eg.client.dto.plan.command;
 
 import lombok.Data;
 

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/plan/command/PlanCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/plan/command/PlanCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.plan.command;
+package com.hrsk.cloud.eg.client.dto.plan.command;
 
 import lombok.Data;
 import java.io.Serializable;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserAssetCarInfoCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetCarInfoCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserAssetHouseInfoCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetHouseInfoCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserAssetInsuranceInfoCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserAssetInsuranceInfoCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserBaseInfoCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserBaseInfoCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserProfessionBusinessOwnerCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionBusinessOwnerCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserProfessionEcommerceOwnersCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionEcommerceOwnersCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserProfessionOfficeWorkersCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionOfficeWorkersCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 1 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/user/command/UserProfessionSelfEmployedCmd.java → egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/client/dto/user/command/UserProfessionSelfEmployedCmd.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.clinet.dto.data.user.command;
+package com.hrsk.cloud.eg.client.dto.user.command;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 0 - 18
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/CustomerDTO.java

@@ -1,18 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.data;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotEmpty;
-
-
-@Data
-public class CustomerDTO{
-    private String customerId;
-    private String memberId;
-    private String customerName;
-    private String customerType;
-    @NotEmpty
-    private String companyName;
-    @NotEmpty
-    private String source;
-}

+ 0 - 6
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/ErrorCode.java

@@ -1,6 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.data;
-
-
-public class ErrorCode {
-    public static final String B_CUSTOMER_companyNameConflict = "B_CUSTOMER_companyNameConflict";
-}

+ 0 - 29
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/command/ApiInvokeParamCmd.java

@@ -1,29 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.data.command;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: ApiParamCmd
- * @date 2024/11/6 13:56
- */
-@Data
-public class ApiInvokeParamCmd  implements Serializable {
-
-    /** 
-     * 定义的路由类型
-     */ 
-    private String route;
-
-
-    /**
-     * 参数
-     */
-    private Object param;
-
-
-}

+ 0 - 31
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/command/LoanParamCmd.java

@@ -1,31 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.data.command;
-
-import com.hrsk.cloud.eg.clinet.dto.data.plan.command.EgLoanApiConfigInfoCmd;
-import com.hrsk.cloud.eg.clinet.dto.data.plan.command.PlanCmd;
-import com.hrsk.cloud.eg.clinet.dto.data.user.command.UserBaseInfoCmd;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: CheckIntoParamDto
- * @date 2024/8/30 09:52
- */
-@Data
-public class LoanParamCmd implements Serializable {
-    /**
-     * 用户信息
-     * */
-    private UserBaseInfoCmd user;
-    /**
-     * 推广计划信息
-     * */
-    private PlanCmd plan;
-
-    /**
-     * api信息配置
-     */
-    private EgLoanApiConfigInfoCmd apiConfigInfo;
-}

+ 0 - 18
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/data/common/LocalEnumDTO.java

@@ -1,18 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.data.common;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: LocalEnumDto
- * @date 2024/9/24 11:53
- */
-@Data
-public class LocalEnumDTO implements Serializable {
-
-    private String code;
-    private String msg;
-}

+ 0 - 21
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/event/CustomerCreatedEvent.java

@@ -1,21 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.event;
-
-/**
- * CustomerCreatedEvent
- *
- * @author Frank Zhang
- * @date 2019-01-04 10:32 AM
- */
-public class CustomerCreatedEvent{
-
-    private String customerId;
-
-    public String getCustomerId() {
-        return customerId;
-    }
-
-    public void setCustomerId(String customerId) {
-        this.customerId = customerId;
-    }
-
-}

+ 0 - 11
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/dto/event/DomainEventConstant.java

@@ -1,11 +0,0 @@
-package com.hrsk.cloud.eg.clinet.dto.event;
-
-/**
- * @author niexiaolong
- * @date 2019/4/16
- */
-public class DomainEventConstant {
-
-	public static final String CUSTOMER_CREATED_TOPIC = "CRM_CUSTOMER_CREATED_DOMAIN_EVENT_TOPIC";
-
-}

+ 0 - 117
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/clinet/vo/DataVo.java

@@ -1,117 +0,0 @@
-package com.hrsk.cloud.eg.clinet.vo;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-public class DataVo<T> implements Serializable {
-    private Integer status;
-    private String msg;
-    private T data;
-
-    public DataVo(Integer status, String msg) {
-        this.status = status;
-        this.msg = msg;
-    }
-
-    public DataVo() {
-    }
-
-    public DataVo(Integer status, String msg, T data) {
-        this.status = status;
-        this.msg = msg;
-        this.data = data;
-    }
-
-    public static <T> DataVo<T> dataVo(Integer status, String msg, T data) {
-        return createDefaulDataVo(status, msg, data);
-    }
-
-    public static <T> DataVo<T> success(String msg, T data) {
-        return createDefaulDataVo(0, msg, data);
-    }
-
-    public static <T> DataVo<T> success(Integer status, String msg, T data) {
-        return createDefaulDataVo(status, msg, data);
-    }
-
-    public static <T> DataVo<T> fail(String msg, T data) {
-        return createDefaulDataVo(1, msg, data);
-    }
-
-    public static <T> DataVo<T> fail(Integer status, String msg, T data) {
-        return createDefaulDataVo(status, msg, data);
-    }
-
-    public static <T> DataVo<T> createDefaulDataVo(Integer code, String message, T data) {
-        DataVo<T> responseVo = new DataVo();
-        if (code != null) {
-            responseVo.setStatus(code);
-        }
-
-        if (!Objects.isNull(message)) {
-            responseVo.setMsg(message);
-        }
-
-        if (data != null) {
-            responseVo.setData(data);
-        }
-
-        return responseVo;
-    }
-
-    public static DataVo timeout(String msg) {
-        return new DataVo(2, msg);
-    }
-
-    public static <T> DataVo<T> timeout(T data, String msg) {
-        return new DataVo(2, msg, data);
-    }
-
-    public static DataVo success() {
-        return new DataVo(0, "撞库成功");
-    }
-
-    public static DataVo success(String msg) {
-        return new DataVo(0, msg);
-    }
-
-    public static DataVo success(Integer status, String msg) {
-        return new DataVo(status, msg);
-    }
-
-    public static DataVo success(Integer status) {
-        return new DataVo(status, "成功");
-    }
-
-    public static DataVo fail() {
-        return new DataVo(1, "撞库失败");
-    }
-
-    public static DataVo fail(String msg) {
-        return new DataVo(1, msg + "撞库失败");
-    }
-
-    public Integer getStatus() {
-        return this.status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public String getMsg() {
-        return this.msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-    public T getData() {
-        return this.data;
-    }
-
-    public void setData(T data) {
-        this.data = data;
-    }
-}

+ 19 - 29
egress-gateway-service-domain/pom.xml

@@ -17,63 +17,53 @@
     </properties>
 
     <dependencies>
-
         <dependency>
-            <groupId>com.hrsk.cloud</groupId>
-            <artifactId>egress-gateway-service-client</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-component-domain-starter</artifactId>
         </dependency>
         <dependency>
             <groupId>com.hrsk.pangu</groupId>
             <artifactId>pangu-component-tool</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>com.hrsk.cloud</groupId>
+            <artifactId>egress-gateway-service-client</artifactId>
         </dependency>
         <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.alibaba.cola</groupId>
-            <artifactId>cola-component-domain-starter</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba.cola</groupId>
-            <artifactId>cola-component-exception</artifactId>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-expression</artifactId>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
+            <artifactId>spring-beans</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
+            <groupId>com.jayway.jsonpath</groupId>
+            <artifactId>json-path</artifactId>
         </dependency>
-<!--        <dependency>-->
-<!--            <groupId>org.apache.commons</groupId>-->
-<!--            <artifactId>commons-pool2</artifactId>-->
-<!--        </dependency>-->
         <dependency>
-            <groupId>com.alibaba.fastjson2</groupId>
-            <artifactId>fastjson2</artifactId>
+            <groupId>com.ibeetl</groupId>
+            <artifactId>beetl</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.google.code.gson</groupId>
-            <artifactId>gson</artifactId>
+            <groupId>com.caucho</groupId>
+            <artifactId>hessian</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-expression</artifactId>
         </dependency>
     </dependencies>
 </project>

+ 49 - 6
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/Api.java

@@ -1,14 +1,57 @@
 package com.hrsk.cloud.eg.domain.api;
 
+import com.google.common.base.Function;
+import com.hrsk.cloud.eg.client.dto.cmd.RouteCmd;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.EgressApiErrorCodeEnum;
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiRequest;
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiResponse;
+import com.hrsk.cloud.eg.domain.api.route.ApiRoute;
+import com.hrsk.pangu.tool.exception.BizException;
+
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author: bianlanzhou
- * @create: 2024-07-26 17:58
- * @description: API基类
+ * @create: 2024-11-10 16:18
+ * @description: API实体
  **/
-public interface Api {
+public class Api {
+    /**
+     * API通道列表
+     */
+    private List<ApiChannel> apiChannels;
+    /**
+     * 最终目标通道
+     */
+    private ApiChannel target;
+
+    /**
+     * 构造函数
+     * @param apiChannels
+     */
+    public Api(List<ApiChannel> apiChannels) {
+        this.apiChannels = apiChannels;
+    }
+
+    /**
+     * 调用
+     * @param input 入参
+     */
+    public String invoke(Map<String,Object> input, Function<HttpApiRequest, HttpApiResponse> httpClientFunc){
+        if(target == null){
+            throw new BizException(EgressApiErrorCodeEnum.AVAILABLE_API_CHANNEL_NOT_EXIST.getCode(),EgressApiErrorCodeEnum.API_CHANNEL_NOT_EXIST.getMessage());
+        }
+        return target.invoke(input,httpClientFunc);
+    }
+
     /**
-     * 获取类型
-     * @return 类型
+     * 路由
+     * @param route 路由
+     * @return 路由后的API
      */
-    String getType();
+    public Api route(RouteCmd route){
+        target = ApiRoute.getInstance().route(apiChannels,route);
+        return this;
+    }
 }

+ 100 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiChannel.java

@@ -0,0 +1,100 @@
+package com.hrsk.cloud.eg.domain.api;
+
+import com.google.common.base.Function;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.EgressApiEndpointIntegrationModeEnum;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.EgressApiErrorCodeEnum;
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiRequest;
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiRequestConfig;
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiResponse;
+import com.hrsk.cloud.eg.domain.common.BeetlHelper;
+import com.hrsk.cloud.eg.domain.common.GsonUtils;
+import com.hrsk.pangu.tool.exception.BizException;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+
+import java.util.Map;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 16:28
+ * @description: API通道
+ **/
+@Data
+public class ApiChannel {
+    /**
+     * 通道编码
+     */
+    private String channelCode;
+    /**
+     * 集成方式
+     */
+    private String integrationMode;
+    /**
+     * 权重
+     */
+    private Integer weight;
+    /**
+     * 请求/响应数据JSON配置
+     */
+    private Pair<String,String> configStrPair;
+    /**
+     * Http Api 请求配置
+     */
+    private HttpApiRequestConfig httpApiRequestConfig;
+    /**
+     * Http Api 响应配置
+     */
+    private String httpApiResponseConfig;
+
+    /**
+     * 评分,用于路由排序
+     */
+    private Integer score;
+
+    /**
+     * 构造函数
+     * @param channelCode 渠道编码
+     * @param integrationMode 集成方式
+     * @param requestJsonConfig 请求配置
+     * @param responseJsonConfig 响应配置
+     */
+    public ApiChannel(String channelCode,String integrationMode ,String requestJsonConfig, String responseJsonConfig) {
+        this.channelCode = channelCode;
+        this.integrationMode = integrationMode;
+        configStrPair = Pair.of(requestJsonConfig,responseJsonConfig);
+    }
+
+
+
+    /**
+     * 使配置生效
+     */
+    public void config(){
+        if(StringUtils.equals(integrationMode,EgressApiEndpointIntegrationModeEnum.GUIDE.getCode())){
+            httpApiRequestConfig = GsonUtils.fromJson(configStrPair.getLeft(),HttpApiRequestConfig.class);
+            httpApiResponseConfig = configStrPair.getRight();
+        }
+    }
+
+    /**
+     * 调用
+     * @param input 入参
+     * @param httpClientFunc httpclient
+     * @return 处理结果
+     */
+    public String invoke(Map<String,Object> input,Function<HttpApiRequest, HttpApiResponse> httpClientFunc){
+        HttpApiResponse response = null;
+        if(StringUtils.equals(integrationMode, EgressApiEndpointIntegrationModeEnum.GUIDE.getCode())){
+            config();
+            response = httpClientFunc.apply(new HttpApiRequest(httpApiRequestConfig).request(input));
+            return BeetlHelper.render(httpApiResponseConfig,response);
+        }else if(StringUtils.equals(integrationMode, EgressApiEndpointIntegrationModeEnum.CUSTOMIZE.getCode())){
+            //todo 代码模式
+
+            return null;
+        }else{
+            throw new BizException(EgressApiErrorCodeEnum.ILLEGAL_INTEGRATION_MODE.getCode(),EgressApiErrorCodeEnum.ILLEGAL_INTEGRATION_MODE.getMessage());
+        }
+    }
+}

+ 19 - 43
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiFactory.java

@@ -1,59 +1,35 @@
 package com.hrsk.cloud.eg.domain.api;
 
-import com.hrsk.cloud.eg.domain.api.common.ApiTypeEnums;
-import com.hrsk.cloud.eg.domain.common.utils.BizPreconditions;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import com.alibaba.cola.domain.DomainFactory;
-import org.springframework.stereotype.Component;
+import java.util.List;
 
 /**
  * @author: bianlanzhou
- * @create: 2024-07-26 17:57
- * @description: API领域对象工厂
+ * @create: 2024-11-10 21:01
+ * @description: API工厂
  **/
-@Component
-@Slf4j
 public class ApiFactory {
     /**
-     * 创建API对象
-     * @param apiConfig api配置
-     * @param input 入参
-     * @return API
+     * 创建API通道
+     * @param apiCode
      */
-    public Api createApi(ApiConfig apiConfig,Object input){
-        BizPreconditions.checkArgument(apiConfig!=null,"API配置不能为空!");
-        BizPreconditions.checkArgument(StringUtils.isNotBlank(apiConfig.getType()),"API配置类型不能为空!");
-        if(StringUtils.equals(ApiTypeEnums.HTTP.getType(),apiConfig.getType())
-          ||StringUtils.equals(ApiTypeEnums.HTTPS.getType(), apiConfig.getType())
-         ){
-            return createHttpApi((HttpApiConfig)apiConfig,input);
-        }else {
-            log.error("不支持的API类型:{}!",apiConfig.getType());
-        }
-        return null;
-    }
-
-
     /**
-     * @description: 构建统一返回值
-     * @param:
-     * @return:
-     * @author zhangyy
-     * @date: 2024/9/2 16:33
+     * 创建API通道
+     * @param apiCode API编码
+     * @param integrationMode 集成方式
+     * @param requestConfigStr 请求配置
+     * @param responseConfigStr 响应配置
+     * @return
      */
-    public Object createResult(ApiConfig apiConfig,Object output){
-        HttpApi httpApi = DomainFactory.create(HttpApi.class);
-        return httpApi.loadResult((HttpApiConfig) apiConfig,output);
+    public static ApiChannel createApiChannel(String apiCode,String integrationMode,String requestConfigStr,String responseConfigStr){
+        return new ApiChannel(apiCode,integrationMode,requestConfigStr,responseConfigStr);
     }
+
     /**
-     * 创建HTTP API
-     * @param httpApiConfig http api config
-     * @return  HTTP API
+     * 创建API
+     * @param apiChannels api通道
+     * @return API
      */
-    private Api createHttpApi(HttpApiConfig httpApiConfig,Object input){
-        HttpApi httpApi = DomainFactory.create(HttpApi.class);
-        httpApi.load(httpApiConfig,input);
-        return httpApi;
+    public static Api createApi(List<ApiChannel> apiChannels){
+        return new Api(apiChannels);
     }
 }

+ 8 - 10
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ApiGateway.java

@@ -1,21 +1,19 @@
 package com.hrsk.cloud.eg.domain.api;
 
-import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
-import com.hrsk.cloud.eg.vo.response.DataVo;
-import com.hrsk.cloud.eg.vo.response.DefaultResponseVo;
+
+import com.hrsk.cloud.eg.client.dto.cmd.ApiInvokeCmd;
 
 /**
  * @author: bianlanzhou
- * @create: 2024-08-01 18:14
- * @description: API防腐层
+ * @create: 2024-11-11 06:18
+ * @description: API网关
  **/
 public interface ApiGateway {
 
     /**
-     * @description:  撞库请求
-     * @author zhangyy
-     * @date 2024/8/30 14:11
-     * @version 1.0
+     * 通过api code调用
+     * @param apiInvokeCmd cmd
+     * @return 调用结果
      */
-    DefaultResponseVo<DataVo> checkIntoRequest (CheckIntoParamDto param);
+    String invoke(ApiInvokeCmd apiInvokeCmd);
 }

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/KeyValueObject.java

@@ -1,6 +1,6 @@
 package com.hrsk.cloud.eg.domain.api;
 
-import com.hrsk.cloud.eg.domain.common.utils.BizPreconditions;
+import com.hrsk.cloud.eg.domain.common.BizPreconditions;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.ToString;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/ValueObject.java

@@ -1,7 +1,7 @@
 package com.hrsk.cloud.eg.domain.api;
 
 import com.hrsk.cloud.eg.domain.api.resolver.vo.ValueObjectResolverManager;
-import com.hrsk.cloud.eg.domain.common.utils.BizPreconditions;
+import com.hrsk.cloud.eg.domain.common.BizPreconditions;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/JoinMethodEnums.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/customized/common/JoinMethodEnums.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.constant;
+package com.hrsk.cloud.eg.domain.api.channel.customized.common;
 
 import lombok.AllArgsConstructor;
 import lombok.Getter;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/ServerCodeEnums.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/customized/common/ServerCodeEnums.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.constant;
+package com.hrsk.cloud.eg.domain.api.channel.customized.common;
 
 import java.util.HashMap;
 import java.util.Map;

+ 32 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ContentTypeEnum.java

@@ -0,0 +1,32 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import lombok.Getter;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-11 15:05
+ * @description: 内容类型枚举
+ **/
+@Getter
+public enum ContentTypeEnum {
+    APPLICATION_JSON("application/json"),
+    JSON("json");
+
+    /**
+     * 编码
+     * -- GETTER --
+     *  获取编码
+     *
+     * @return 编码
+
+     */
+    private final String code;
+
+    /**
+     * 构造函数
+     * @param code 编码
+     */
+    ContentTypeEnum(String code) {
+        this.code = code;
+    }
+}

+ 32 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiEndpointIntegrationModeEnum.java

@@ -0,0 +1,32 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import lombok.Getter;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-04 10:43
+ * @description: 通道接出方式
+ **/
+@Getter
+public enum EgressApiEndpointIntegrationModeEnum {
+    CUSTOMIZE("customize","自定义代码模式"),
+    GUIDE("guide","向导模式");
+    /**
+     * 编码
+     */
+    private String code;
+    /**
+     * 描述
+     */
+    private String desc;
+
+    /**
+     * 构造函数
+     * @param code
+     * @param desc
+     */
+    EgressApiEndpointIntegrationModeEnum(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+}

+ 47 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiErrorCodeEnum.java

@@ -0,0 +1,47 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-11 11:02
+ * @description: 接出API错误码枚举
+ **/
+public enum EgressApiErrorCodeEnum {
+
+    ILLEGAL_INTEGRATION_MODE("100004","不合法的集成方式!"),
+    AVAILABLE_API_CHANNEL_NOT_EXIST("100003","没有可用的API通道!"),
+    API_CHANNEL_NOT_EXIST("100002","API通道不存在!"),
+    API_NOT_EXIST("100001","API不存在!");
+    private String code;
+
+    private String message;
+    /**
+     * 前缀
+     */
+    private static final String PREFIX = "egress-";
+
+    /**
+     * 构造函数
+     * @param code
+     * @param message
+     */
+    EgressApiErrorCodeEnum(String code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    /**
+     * 获取编码
+     * @return 编码
+     */
+    public String getCode() {
+        return PREFIX + code;
+    }
+
+    /**
+     * 获取消息
+     * @return 返回消息
+     */
+    public String getMessage() {
+        return message;
+    }
+}

+ 34 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/EgressApiStatusEnum.java

@@ -0,0 +1,34 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import lombok.Getter;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-22 10:49
+ * @description: 接出API状态枚举
+ **/
+@Getter
+public enum EgressApiStatusEnum {
+    DRAFT("draft","草稿"),
+    OK("ok","启用"),
+    DEACTIVATE("deactivate","停用"),
+    DELETE("delete","删除");
+    /**
+     * 编码
+     */
+    private String code;
+    /**
+     * 描述
+     */
+    private String desc;
+
+    /**
+     * 构造函数
+     * @param code 编码
+     * @param desc 描述
+     */
+    EgressApiStatusEnum(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+}

+ 21 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/KeyValueObject.java

@@ -0,0 +1,21 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-09-05 14:34
+ * @description: kv对象
+ **/
+@ToString
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class KeyValueObject extends ValueObject {
+    /**
+     * key
+     */
+    private String key;
+
+}

+ 95 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ValueObject.java

@@ -0,0 +1,95 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.func.FunctionObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo.ValueObjectResolverManager;
+import com.hrsk.cloud.eg.domain.common.GsonUtils;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-27 10:21
+ * @description: 值对象
+ **/
+
+@ToString
+public class ValueObject implements Serializable {
+    /**
+     * 值类型
+     */
+    private String type;
+    /**
+     * 值
+     */
+    @Getter
+    private String value;
+    /**
+     * 真实值
+     */
+    @Getter
+    private Object realValue;
+    /**
+     * 函数链
+     */
+    @Setter
+    private List<FunctionObject> functions = new ArrayList<>();
+
+    /**
+     * 构造函数
+     */
+    public ValueObject() {
+    }
+
+    /**
+     * 构造函数
+     * @param value 值
+     */
+    public ValueObject(String value) {
+        this.value = value;
+    }
+
+    /**
+     * 解析
+     * @param apiContext
+     * @return
+     */
+    public ValueObject compile(ApiContext apiContext){
+        this.realValue = ValueObjectResolverManager.getInstance().resolve(this,apiContext);
+        if(CollectionUtils.isEmpty(functions)){
+            return this;
+        }
+        for(FunctionObject function : functions){
+            this.realValue = function.apply(realValue,apiContext);
+        }
+        return this;
+    }
+
+    /**
+     * 类型
+     * @return 类型
+     */
+    public String getType(){
+        return StringUtils.isEmpty(type) ? typeInference():type;
+    }
+
+    /**
+     * 类型推测
+     * @return 类型
+     */
+    private String typeInference(){
+        if(GsonUtils.isJson(value)){
+            return ValueObjectTypeEnum.JSON_PATH.getType();
+        }else{
+            return ValueObjectTypeEnum.BASIC.getType();
+        }
+    }
+
+}

+ 34 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/common/ValueObjectTypeEnum.java

@@ -0,0 +1,34 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.common;
+
+import lombok.Getter;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-31 15:06
+ * @description: 值对象类型枚举
+ **/
+public enum ValueObjectTypeEnum {
+    JSON_PATH("json_path","json path类型"),
+    SPEL("spel","spel类型"),
+    BASIC("basic","");
+    /**
+     * 类型
+     */
+    @Getter
+    private final String type;
+    /**
+     * 描述
+     */
+    @Getter
+    private final String memo;
+
+    /**
+     * 构造函数
+     * @param type 类型
+     * @param memo 描述
+     */
+    ValueObjectTypeEnum(String type, String memo) {
+        this.type = type;
+        this.memo = memo;
+    }
+}

+ 46 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/EncryptionFunction.java

@@ -0,0 +1,46 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.func;
+
+import java.security.MessageDigest;
+import java.util.Objects;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-31 15:58
+ * @description: 加解密函数
+ **/
+public class EncryptionFunction {
+    /**
+     * MD5函数
+     * @param functionParam 入参
+     * @return MD字符串
+     */
+    public static String md5(FunctionParam functionParam){
+        String input = Objects.toString(functionParam.getInput(),null);
+        //用于加密的字符
+        char[] md5String = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+                'A', 'B', 'C', 'D', 'E', 'F' };
+        try {
+            //使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中
+            byte[] btInput = input.getBytes();
+            //信息摘要是安全的单向哈希函数,它接收任意大小的数据,并输出固定长度的哈希值。
+            MessageDigest mdInst = MessageDigest.getInstance("MD5");
+            //MessageDigest对象通过使用 update方法处理数据, 使用指定的byte数组更新摘要
+            mdInst.update(btInput);
+            // 摘要更新之后,通过调用digest()执行哈希计算,获得密文
+            byte[] md = mdInst.digest();
+            // 把密文转换成十六进制的字符串形式
+            int j = md.length;
+            char[] str = new char[j * 2];
+            int k = 0;
+            for (int i = 0; i < j; i++) {   //  i = 0
+                byte byte0 = md[i];  //95
+                str[k++] = md5String[byte0 >>> 4 & 0xf];    //    5
+                str[k++] = md5String[byte0 & 0xf];   //   F
+            }
+            //返回经过加密后的字符串
+            return new String(str);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+}

+ 45 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/FunctionObject.java

@@ -0,0 +1,45 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.func;
+
+import com.google.common.collect.Lists;
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo.ValueObjectResolverManager;
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-27 11:05
+ * @description: 函数对象,值对象
+ **/
+@ToString
+@Data
+public class FunctionObject implements Serializable {
+    /**
+     * 编码
+     */
+    private String code;
+    /**
+     * 参数
+     */
+    private List<ValueObject> args = Lists.newArrayList();
+
+    /**
+     * 执行
+     * @param value 值对象
+     * @param apiContext 上下文
+     * @return 结果
+     */
+    public Object apply(Object value, ApiContext apiContext){
+        FunctionParam functionParam = new FunctionParam().setInput(value);
+        for(ValueObject arg : args){
+            functionParam.getExtArg().add(ValueObjectResolverManager.getInstance().resolve(arg,apiContext));
+        }
+        return ValueObjectFunctionManager.getInstance().apply(code,functionParam);
+    }
+
+
+}

+ 25 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/FunctionParam.java

@@ -0,0 +1,25 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.func;
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-30 11:40
+ * @description: 函数参数
+ **/
+@Data
+@Accessors(chain = true)
+public class FunctionParam {
+    /**
+     * 入参
+     */
+    private Object input;
+    /**
+     * 额外参数
+     */
+    private List<Object> extArg = Lists.newArrayList();
+}

+ 66 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/func/ValueObjectFunctionManager.java

@@ -0,0 +1,66 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.func;
+
+import com.hrsk.pangu.tool.exception.BizException;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 09:48
+ * @description: 值对象函数管理器
+ **/
+@Slf4j
+public class ValueObjectFunctionManager {
+    /**
+     * 函数
+     */
+    private static final Map<String, Function<FunctionParam, Object>> FUNCTIONS = new HashMap<>();
+    /**
+     * 实例
+     */
+    private static final ValueObjectFunctionManager INSTANCE = new ValueObjectFunctionManager();
+
+    static {
+        regist();
+    }
+
+    /**
+     * 构造函数
+     */
+    private ValueObjectFunctionManager(){}
+
+    /**
+     * 获取实例
+     * @return 实例
+     */
+    public static ValueObjectFunctionManager getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * 注册函数
+     */
+    private static void regist(){
+        log.info("开始注册值对象函数!");
+        FUNCTIONS.put("MD5", EncryptionFunction::md5);
+//        FUNCTIONS.put("md5Sign", EncryptionFunction::md5Sign);
+        log.info("md5函数已注册!");
+    }
+
+    /**
+     * 执行函数
+     * @param code 函数编码
+     * @param functionParam 函数参数
+     * @return 函数执行结果
+     */
+    public Object apply(String code, FunctionParam functionParam){
+        Function<FunctionParam,Object> function = FUNCTIONS.get(code);
+        if(function == null){
+            throw new BizException("不支持的函数编码!");
+        }
+        return function.apply(functionParam);
+    }
+}

+ 120 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiRequest.java

@@ -0,0 +1,120 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.http;
+
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ContentTypeEnum;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.KeyValueObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.resolver.payload.ApiPayloadResolverManage;
+import com.hrsk.pangu.tool.exception.BizException;
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static com.hrsk.cloud.eg.domain.common.Constants.URL_SEARCH;
+import static com.hrsk.cloud.eg.domain.common.Constants.URL_SEARCH_SEPARATOR;
+import static com.hrsk.cloud.eg.domain.common.Constants.URL_SEPARATOR;
+import static com.hrsk.cloud.eg.domain.common.Constants._EQUAL;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-11 14:53
+ * @description: http api request
+ **/
+public class HttpApiRequest {
+    /**
+     * http api请求配置
+     */
+    private HttpApiRequestConfig httpApiRequestConfig;
+    /**
+     * 请求方法
+     */
+    @Getter
+    private String method;
+    /**
+     * url地址
+     */
+    @Getter
+    private String url;
+    /**
+     * header数据
+     */
+    @Getter
+    private final Map<String, Object> header = new HashMap<>();
+    /**
+     * 请求payload数据
+     */
+    @Getter
+    private Object payload;
+
+    /**
+     * 构造函数
+     * @param httpApiRequestConfig 请求配置
+     */
+    public HttpApiRequest(HttpApiRequestConfig httpApiRequestConfig) {
+        this.httpApiRequestConfig = httpApiRequestConfig;
+    }
+
+    /**
+     * 请求
+     * @param input 入参
+     * @return this
+     */
+    public HttpApiRequest request(Map<String,Object> input){
+        ApiContext context = new ApiContext(input);
+        url(context);
+        header(context);
+        body(context);
+        return this;
+    }
+
+    /**
+     * 创建URL
+     * @param context 上下文
+     */
+    private void url(ApiContext context){
+        StringBuilder urlSb = new StringBuilder(httpApiRequestConfig.getUrl());
+        for(ValueObject valueObject : httpApiRequestConfig.getPath()){
+            urlSb.append(URL_SEPARATOR).append(valueObject.compile(context).getRealValue());
+        }
+        if(!CollectionUtils.isEmpty(httpApiRequestConfig.getSearch())){
+            StringBuilder searchSb = new StringBuilder();
+            for(KeyValueObject keyValueObject : httpApiRequestConfig.getSearch()){
+                searchSb.append(URL_SEARCH_SEPARATOR).append(keyValueObject.getKey()).append(_EQUAL).append(keyValueObject.compile(context).getRealValue());
+            }
+            urlSb.append(URL_SEARCH).append(searchSb.toString().replaceFirst(URL_SEARCH_SEPARATOR,""));
+        }
+        method = httpApiRequestConfig.getMethod();
+        url = urlSb.toString();
+    }
+
+    /**
+     * 创建header
+     * @param context 上下文
+     */
+    private void header(ApiContext context){
+        for(KeyValueObject keyValueObject : httpApiRequestConfig.getHeader()){
+            this.header.put(keyValueObject.getKey(),  keyValueObject.compile(context).getRealValue().toString());
+        }
+    }
+
+    /**
+     * 加载请求体
+     * @param context 上下文
+     */
+    private void body(ApiContext context){
+        if(StringUtils.isEmpty(httpApiRequestConfig.getBody())){
+            return ;
+        }
+        if(StringUtils.equals(httpApiRequestConfig.getContentType(), ContentTypeEnum.APPLICATION_JSON.getCode())){
+            payload = Objects.toString(
+                    ApiPayloadResolverManage.getInstance().resolve(httpApiRequestConfig.getContentType(),
+                            httpApiRequestConfig.getBody(),context),"{}");
+        }else{
+            throw new BizException("不支持的请求体类型!");
+        }
+    }
+}

+ 46 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiRequestConfig.java

@@ -0,0 +1,46 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.http;
+
+import com.google.common.collect.Lists;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ContentTypeEnum;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.KeyValueObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 21:26
+ * @description: HTTP API 请求配置
+ **/
+@Data
+public class HttpApiRequestConfig {
+    /**
+     * 请求方法
+     */
+    private String method;
+    /**
+     * url地址
+     */
+    private String url;
+    /**
+     * header
+     */
+    private List<KeyValueObject> header = Lists.newArrayList();
+    /**
+     * path  a/b/b
+     */
+    private List<ValueObject> path = Lists.newArrayList();
+    /**
+     * search
+     */
+    private List<KeyValueObject> search = Lists.newArrayList();
+    /**
+     * 内容类型
+     */
+    private String contentType = ContentTypeEnum.APPLICATION_JSON.getCode();
+    /**
+     * body
+     */
+    private String body;
+}

+ 50 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/HttpApiResponse.java

@@ -0,0 +1,50 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.http;
+
+import lombok.Data;
+
+import java.util.HashMap;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-12 18:20
+ * @description: http api响应
+ **/
+@Data
+public class HttpApiResponse extends HashMap<String,Object> {
+    /**
+     * http响应编码
+     */
+    private Integer httpCode;
+    /**
+     * 数据body
+     */
+    private Object data;
+
+    /**
+     * 构造函数
+     * @param httpCode HTTP编码
+     * @param data 数据
+     */
+    public HttpApiResponse( Integer httpCode, Object data) {
+        super();
+        setHttpCode(httpCode);
+        setData(data);
+    }
+
+    public Integer getHttpCode() {
+        return (Integer)get("httpCode");
+    }
+
+    public Object getData() {
+        return get("data");
+    }
+
+
+    public void setHttpCode(Integer httpCode) {
+        put("httpCode",httpCode);
+    }
+
+    public void setData(Object data) {
+        put("data",data);
+    }
+}

+ 1 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/http/package-info.java

@@ -0,0 +1 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.http;

+ 1 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/package-info.java

@@ -0,0 +1 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide;

+ 103 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiJsonPayloadResolver.java

@@ -0,0 +1,103 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.payload;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import com.hrsk.cloud.eg.domain.common.GsonUtils;
+import com.hrsk.pangu.tool.exception.BizException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 15:38
+ * @description: json类型payload
+ **/
+@Slf4j
+public class ApiJsonPayloadResolver implements ApiPayloadResolver {
+    /**
+     * JSON配置最大深度
+     */
+    private static final Integer MAX_DEEP = 10;
+    /**
+     * 配置前缀标记
+     */
+    private static final String CV_PREFIX_SIGN = "<cv>";
+
+    /**
+     * 配置后缀标记
+     */
+    private static final String CV_END_SIGN = "</cv>";
+
+    @Override
+    public JsonObject resolve(String jsonTemplate, ApiContext context) {
+        JsonElement jsonElement = GsonUtils.fromJson(jsonTemplate, JsonElement.class);
+        traverseJson(jsonElement,jsonElement,null,context,0);
+        return jsonElement.getAsJsonObject();
+    }
+
+
+    /**
+     * 遍历json
+     * @param jsonElement json元素
+     * @param context 上下文
+     * @param deep 深度
+     */
+    public void traverseJson(JsonElement jsonElement, JsonElement currentElement,String currentKey,ApiContext context,Integer deep) {
+        deep++;
+        if(deep >= MAX_DEEP){
+            throw new BizException(String.format("请求payload的json配置深度达到允许的最大深度[%s]!",MAX_DEEP));
+        }
+        if (jsonElement.isJsonObject()) {
+            JsonObject jsonObject = jsonElement.getAsJsonObject();
+            for (String key : jsonObject.keySet()) {
+                traverseJson(jsonObject.get(key),jsonObject,key,context,deep);
+            }
+        } else if (jsonElement.isJsonArray()) {
+            JsonArray jsonArray = jsonElement.getAsJsonArray();
+            for (JsonElement elem : jsonArray) {
+                traverseJson(elem,currentElement,null,context,deep);
+            }
+        } else {
+            JsonPrimitive newElement = parseValueConfigTagToRealValue(jsonElement.getAsJsonPrimitive(),context);
+            if(StringUtils.isNotBlank(currentKey)){
+                currentElement.getAsJsonObject().add(currentKey,newElement);
+            }
+        }
+    }
+
+    /**
+     * 将spel表达式转换成真实值 暂时不使用后续如果有spel表达式可以采用类型推测进行适配
+     * @param jsonPrimitive json元素
+     */
+    private JsonPrimitive parseValueConfigTagToRealValue(JsonPrimitive jsonPrimitive, ApiContext context){
+        String valueStr = jsonPrimitive.getAsString();
+        if(valueStr.startsWith("<cv>") && valueStr.endsWith("</cv>")){
+            valueStr = StringUtils.replaceOnce(valueStr,CV_PREFIX_SIGN,"");
+            valueStr = StringUtils.substringBeforeLast(valueStr,CV_END_SIGN);
+            try {
+                ValueObject valueObject = new Gson().fromJson(valueStr, ValueObject.class);
+                Object realValue = valueObject.compile(context).getRealValue();
+                if(realValue instanceof Number){
+                    return new JsonPrimitive((Number)realValue);
+                }else if(realValue instanceof String){
+                    return new JsonPrimitive((String)realValue);
+                }else if(realValue instanceof Boolean){
+                    return new JsonPrimitive((Boolean)realValue);
+                }else if(realValue instanceof Character){
+                    return new JsonPrimitive((Character)realValue);
+                }
+            }catch (Exception ex){
+                log.error("'{}'解析失败,转为字符串类型。",valueStr,ex);
+                return jsonPrimitive;
+            }
+        }
+        return jsonPrimitive;
+    }
+
+
+}

+ 18 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiPayloadResolver.java

@@ -0,0 +1,18 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.payload;
+
+import com.google.gson.JsonObject;
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 15:37
+ * @description: http api payload
+ **/
+public interface ApiPayloadResolver {
+    /**
+     * 获取payload
+     * @param template payload模版
+     * @param context 上下文
+     */
+    JsonObject resolve(String template, ApiContext context);
+}

+ 58 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/payload/ApiPayloadResolverManage.java

@@ -0,0 +1,58 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.payload;
+
+import com.google.common.collect.Maps;
+import com.google.gson.JsonObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ContentTypeEnum;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Map;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 17:38
+ * @description: api payload 管理器
+ **/
+@Slf4j
+public class ApiPayloadResolverManage {
+    /**
+     * PAYLOAD MAP
+     */
+    private static final Map<String, ApiPayloadResolver> RESOLVER_MAP = Maps.newHashMap();
+    /**
+     * INSTANCE
+     */
+    private static final ApiPayloadResolverManage INSTANCE = new ApiPayloadResolverManage();
+
+    static {
+        regist();
+    }
+
+    private ApiPayloadResolverManage(){}
+
+    /**
+     * 获取实例
+     * @return 实例
+     */
+    public static ApiPayloadResolverManage getInstance(){
+        return INSTANCE;
+    }
+
+    /**
+     * 解析
+     * @param code 编码
+     * @param apiContext 上下文
+     * @return 解析结果
+     */
+    public JsonObject resolve(String code, String template, ApiContext apiContext){
+        return RESOLVER_MAP.get(code).resolve(template,apiContext);
+    }
+
+    /**
+     * 注册
+     */
+    private static void regist(){
+        log.info("开始注册Payload解析器!");
+        RESOLVER_MAP.put(ContentTypeEnum.APPLICATION_JSON.getCode(),new ApiJsonPayloadResolver());
+        RESOLVER_MAP.put(ContentTypeEnum.JSON.getCode(),new ApiJsonPayloadResolver());
+    }
+}

+ 26 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/BasicTypeValueObjectResolver.java

@@ -0,0 +1,26 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo;
+
+
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-31 14:35
+ * @description: 基础类型值对象解析器
+ **/
+public class BasicTypeValueObjectResolver implements ValueObjectResolver {
+    /**
+     * 基本类型
+     */
+    public static final String[] BASIC_TYPES = new String[]{"text","string","double","float","boolean"};
+    /**
+     * 解析
+     * @param valueObject 待解析对象
+     * @return 解析后对象
+     */
+    @Override
+    public Object resolve(ValueObject valueObject, ApiContext context) {
+        return valueObject.getValue();
+    }
+
+}

+ 17 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/JsonPathValueObjectResolver.java

@@ -0,0 +1,17 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo;
+
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import com.jayway.jsonpath.JsonPath;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-11 16:10
+ * @description: json path 值对象处理
+ **/
+public class JsonPathValueObjectResolver implements ValueObjectResolver {
+    @Override
+    public Object resolve(ValueObject valueObject, ApiContext context) {
+        return JsonPath.read(context.getInput(), valueObject.getValue());
+    }
+}

+ 37 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/SpelValueObjectResolver.java

@@ -0,0 +1,37 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo;
+
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.expression.ExpressionParser;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-31 14:38
+ * @description: Spel值对象解析器
+ **/
+@Slf4j
+public class SpelValueObjectResolver  implements ValueObjectResolver{
+    /**
+     * spel parser
+     */
+    private final ExpressionParser parser = new SpelExpressionParser();
+
+    /**
+     * 解析
+     * @param valueObject 解析对象
+     * @param context 上下文
+     * @return 解析结果
+     */
+    @Override
+    public Object resolve(ValueObject valueObject, ApiContext context) {
+        try{
+            return parser.parseExpression(valueObject.getValue()).getValue(context.getSpelContext());
+        }catch (Exception ex){
+            log.error("属性配置错误!",ex);
+            return null;
+        }
+    }
+
+
+}

+ 22 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/ValueObjectResolver.java

@@ -0,0 +1,22 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo;
+
+
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-31 14:32
+ * @description: 值对象解析器
+ **/
+public interface ValueObjectResolver {
+    /**
+     * 解析
+     * @param valueObject 解析对象
+     * @param context 上下文
+     * @return 解析结果
+     */
+    Object resolve(ValueObject valueObject, ApiContext context);
+
+}
+

+ 66 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/channel/guide/resolver/vo/ValueObjectResolverManager.java

@@ -0,0 +1,66 @@
+package com.hrsk.cloud.eg.domain.api.channel.guide.resolver.vo;
+
+import com.google.common.collect.Maps;
+import com.hrsk.cloud.eg.domain.api.ApiContext;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObject;
+import com.hrsk.cloud.eg.domain.api.channel.guide.common.ValueObjectTypeEnum;
+import com.hrsk.pangu.tool.exception.BizException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Map;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 09:53
+ * @description: 值对象处理器管理器
+ **/
+@Slf4j
+public class ValueObjectResolverManager {
+    /**
+     * 解析器映射
+     */
+    private static final Map<String,ValueObjectResolver> RESOLVERS = Maps.newHashMap();
+    /**
+     * INSTANCE
+     */
+    private static final ValueObjectResolverManager INSTANCE = new ValueObjectResolverManager();
+
+    /**
+     * 构造函数
+     */
+    private ValueObjectResolverManager(){
+        log.info("开始注册ValueObject解析器......");
+        RESOLVERS.put(ValueObjectTypeEnum.SPEL.getType(),new SpelValueObjectResolver());
+        RESOLVERS.put(ValueObjectTypeEnum.BASIC.getType(),new BasicTypeValueObjectResolver());
+        RESOLVERS.put(ValueObjectTypeEnum.JSON_PATH.getType(),new JsonPathValueObjectResolver());
+        log.info("结束注册ValueObject解析器,加载内容:{},{},{}.",ValueObjectTypeEnum.SPEL.getType(),ValueObjectTypeEnum.BASIC.getType(),ValueObjectTypeEnum.JSON_PATH.getType());
+    }
+
+    /**
+     * 获取实例
+     * @return 实例
+     */
+    public static ValueObjectResolverManager getInstance(){
+        return INSTANCE;
+    }
+
+    /**
+     * 解析
+     * @param valueObject 值对象
+     * @param context 上下文
+     * @return 解析结果
+     */
+    public Object resolve(ValueObject valueObject, ApiContext context){
+        String type = valueObject.getType();
+        String key = valueObject.getType();
+        if(StringUtils.equalsAnyIgnoreCase(type, BasicTypeValueObjectResolver.BASIC_TYPES)){
+            key = ValueObjectTypeEnum.BASIC.getType();
+        }
+        if(StringUtils.isBlank(key)){
+            throw new BizException("目前不支持此类型的解析!");
+        }
+        return RESOLVERS.get(key).resolve(valueObject,context);
+    }
+
+}

+ 0 - 2
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/EncryptionFunction.java

@@ -1,8 +1,6 @@
 package com.hrsk.cloud.eg.domain.api.func;
 
 
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
 import com.hrsk.cloud.eg.domain.api.FunctionParam;
 import com.hrsk.cloud.eg.domain.api.common.DataVoStatusEnum;
 import com.hrsk.cloud.eg.domain.api.common.ThreeplatfromResultCodeEnum;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/ValueObjectFunctionManager.java

@@ -1,7 +1,7 @@
 package com.hrsk.cloud.eg.domain.api.func;
 
-import com.alibaba.cola.exception.BizException;
 import com.hrsk.cloud.eg.domain.api.FunctionParam;
+import com.hrsk.pangu.tool.exception.BizException;
 import lombok.extern.slf4j.Slf4j;
 
 import java.util.HashMap;

+ 2 - 2
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/resolver/payload/ApiJsonPayloadResolver.java

@@ -1,10 +1,10 @@
 package com.hrsk.cloud.eg.domain.api.resolver.payload;
 
-import com.alibaba.cola.exception.BizException;
 import com.google.gson.*;
 import com.hrsk.cloud.eg.domain.api.ApiContext;
 import com.hrsk.cloud.eg.domain.api.ValueObject;
-import com.hrsk.cloud.eg.domain.common.utils.GsonUtils;
+import com.hrsk.cloud.eg.domain.common.GsonUtils;
+import com.hrsk.pangu.tool.exception.BizException;
 import org.apache.commons.lang3.StringUtils;
 
 /**

+ 0 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/resolver/result/ApiJsonResultResolver.java

@@ -4,7 +4,6 @@ import com.alibaba.cola.exception.BizException;
 import com.google.gson.*;
 import com.hrsk.cloud.eg.domain.api.ApiContext;
 import com.hrsk.cloud.eg.domain.api.ValueObject;
-import com.hrsk.cloud.eg.domain.common.utils.GsonUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.Map;

+ 56 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/ApiRoute.java

@@ -0,0 +1,56 @@
+package com.hrsk.cloud.eg.domain.api.route;
+
+import com.google.common.collect.Lists;
+import com.hrsk.cloud.eg.client.dto.cmd.RouteCmd;
+import com.hrsk.cloud.eg.domain.api.ApiChannel;
+import com.hrsk.cloud.eg.domain.api.route.strategy.ChannelCodeBasedRouteStrategy;
+import com.hrsk.cloud.eg.domain.api.route.strategy.RouteStrategy;
+
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 16:21
+ * @description:API路由
+ **/
+public class ApiRoute {
+    /**
+     * 单例
+     */
+    private static final ApiRoute ROUTE = new ApiRoute();
+    /**
+     * 路由策略列表
+     */
+    private List<RouteStrategy> routeStrategies = Lists.newArrayList();
+
+    /**
+     * 获取实例
+     * @return 实例
+     */
+    public static final ApiRoute getInstance(){
+        return ROUTE;
+    }
+    /**
+     * 构造函数
+     */
+    private ApiRoute(){
+        routeStrategies.add(new ChannelCodeBasedRouteStrategy());
+    }
+
+    /**
+     * 路由
+     * @param apiChannels API通道列表
+     */
+    public ApiChannel route(List<ApiChannel> apiChannels, RouteCmd route){
+        for(RouteStrategy routeStrategy : routeStrategies){
+            if(routeStrategy.route(apiChannels,route)){
+                break;
+            }
+        }
+        if(apiChannels.size()>0){
+            return apiChannels.get(0);
+        }
+        return null;
+    }
+
+}

+ 35 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/strategy/ChannelCodeBasedRouteStrategy.java

@@ -0,0 +1,35 @@
+package com.hrsk.cloud.eg.domain.api.route.strategy;
+
+import com.hrsk.cloud.eg.client.dto.cmd.RouteCmd;
+import com.hrsk.cloud.eg.domain.api.ApiChannel;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 17:26
+ * @description: API通道编码路由策略 这是一个过滤路由
+ **/
+public class ChannelCodeBasedRouteStrategy implements RouteStrategy{
+
+    @Override
+    public boolean route(List<ApiChannel> apiChannels, RouteCmd route){
+        if(StringUtils.isEmpty(route.getCode())){
+            return true;
+        }
+        apiChannels = apiChannels.stream().filter(new Predicate<ApiChannel>() {
+            @Override
+            public boolean test(ApiChannel apiChannel) {
+                return StringUtils.equals(apiChannel.getChannelCode(),route.getCode());
+            }
+        }).collect(Collectors.toList());
+        if(CollectionUtils.isEmpty(apiChannels)){
+            return false;
+        }
+        return true;
+    }
+}

+ 21 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/route/strategy/RouteStrategy.java

@@ -0,0 +1,21 @@
+package com.hrsk.cloud.eg.domain.api.route.strategy;
+
+import com.hrsk.cloud.eg.client.dto.cmd.RouteCmd;
+import com.hrsk.cloud.eg.domain.api.ApiChannel;
+
+import java.util.List;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-10 19:18
+ * @description:路由策略
+ **/
+public interface RouteStrategy {
+    /**
+     * 路由
+     * @param apiChannels 通道列表
+     * @param route 路由数据
+     * @return 是否下一个
+     */
+    boolean route(List<ApiChannel> apiChannels, RouteCmd route);
+}

+ 73 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/BeetlHelper.java

@@ -0,0 +1,73 @@
+package com.hrsk.cloud.eg.domain.common;
+
+import com.hrsk.cloud.eg.domain.api.channel.guide.http.HttpApiResponse;
+import com.hrsk.pangu.tool.exception.SysException;
+import lombok.extern.slf4j.Slf4j;
+import org.beetl.core.Configuration;
+import org.beetl.core.GroupTemplate;
+import org.beetl.core.Template;
+import org.beetl.core.resource.StringTemplateResourceLoader;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-12 17:32
+ * @description: beetl帮助类 此方法使用spring bean周期,spring启动前不可用
+ **/
+@Slf4j
+@Component
+public class BeetlHelper implements InitializingBean {
+    /**
+     * TEMPLATE
+     */
+    private static GroupTemplate GT = null;
+
+    /**
+     * 解析 {success: ${data.httpStatus == 200 ? true : false} , data: ${data.data}}
+     * @param templateStr
+     * @param input
+     * @return
+     */
+    public static String render(String templateStr, Object input){
+        Template template = GT.getTemplate(templateStr);
+        template.binding("response", input);
+        try {
+            return template.render();
+        } catch (Exception e) {
+            log.error("模板渲染失败!template:{}",templateStr,e);
+            throw new SysException(SysErrorCodeEnum.BEETL_ERROR.getCode(),SysErrorCodeEnum.BEETL_ERROR.getMessage());
+        }
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        StringTemplateResourceLoader resourceLoader = new StringTemplateResourceLoader();
+        Configuration cfg = null;
+        try {
+            cfg = Configuration.defaultConfiguration();
+        } catch (IOException e) {
+            log.error("初始化BEETLE配置失败!",e);
+        }
+        GT = new GroupTemplate(resourceLoader, cfg);
+        log.info("完成Beetl工具类加载 ...");
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        HttpApiResponse response = new HttpApiResponse(200,"<html>\n" +
+                "<meta http-equiv=\"refresh\" content=\"0;url=http://www.baidu.com/\">\n" +
+                "</html>");
+        Map<String,Object> map = new HashMap<>();
+        map.put("httpStatus",200);
+        map.put("data","<html>\n" +
+                "<meta http-equiv=\"refresh\" content=\"0;url=http://www.baidu.com/\">\n" +
+                "</html>");
+        new BeetlHelper().afterPropertiesSet();
+        System.out.println(BeetlHelper.render("{success: ${response.httpStatus == 200 ? true : false} , data: ${response.data}}",map));
+    }
+}

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/utils/BizPreconditions.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/BizPreconditions.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.utils;
+package com.hrsk.cloud.eg.domain.common;
 
 
 import com.hrsk.pangu.tool.exception.BizException;

+ 32 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/Constants.java

@@ -0,0 +1,32 @@
+package com.hrsk.cloud.eg.domain.common;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-09-05 14:46
+ * @description:
+ **/
+public class Constants {
+    /**
+     * url分隔符
+     */
+    public static final String URL_SEPARATOR = "/";
+
+    /**
+     * search分隔符
+     */
+    public static final String URL_SEARCH_SEPARATOR = "&";
+
+    /**
+     * 等于号
+     */
+    public static final String _EQUAL = "=";
+    /**
+     * search标记符
+     */
+    public static final String URL_SEARCH = "?";
+    /**
+     * 正则-jsonpath
+     */
+    public static final String REGEX_JSON_PATH = "^\\$\\..*";
+
+}

+ 70 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/GsonUtils.java

@@ -0,0 +1,70 @@
+package com.hrsk.cloud.eg.domain.common;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.regex.Pattern;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-01 16:58
+ * @description: Gson工具类
+ **/
+public class GsonUtils {
+    /**
+     * gson
+     */
+    public static final Gson GSON = new Gson();
+    /**
+     * 转换JSON
+     * @return 实体
+     * @param <T> 范型
+     */
+    public static <T> T fromJson(String json,Class<T> classz){
+        return GSON.fromJson(json,classz);
+    }
+
+    /**
+     * 转换JSON
+     * @return 实体
+     * @param <T> 范型
+     */
+    public static <T> T fromJson(JsonElement json, Class<T> classz){
+        return GSON.fromJson(json,classz);
+    }
+
+
+    /**
+     * 转化JSON
+     * @param object 参数
+     * @return JSON
+     */
+    public static String toJson(Object object){
+        return GSON.toJson(object);
+    }
+
+    /**
+     * 转化json object
+     * @param object
+     * @return
+     */
+    public static JsonObject toJsonObject(Object object){
+        String json = GSON.toJson(object);
+        return GSON.fromJson(json, JsonObject.class);
+    }
+
+    /**
+     * json类型推测,判断是否是json
+     * @param str
+     * @return
+     */
+    public static boolean isJson(String str){
+        if(StringUtils.isEmpty(str)){
+            return false;
+        }
+        Pattern pattern = Pattern.compile(Constants.REGEX_JSON_PATH);
+        return pattern.matcher(str).matches();
+    }
+}

+ 63 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/HessianUtils.java

@@ -0,0 +1,63 @@
+package com.hrsk.cloud.eg.domain.common;
+
+import com.caucho.hessian.io.Hessian2Input;
+import com.caucho.hessian.io.Hessian2Output;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-08-02 08:43
+ * @description: hessian工具类
+ **/
+@Slf4j
+public class HessianUtils {
+    public static byte[] serialize(Object object){
+        Hessian2Output ho = null;
+        try{
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ho = new Hessian2Output(bos);
+            ho.writeObject(object);
+            ho.flush();
+            return bos.toByteArray();
+        } catch (IOException e) {
+            log.error("序列化对象异常!",e);
+            //throw new SysException("序列化对象异常!",e);
+            throw new RuntimeException("序列化对象异常!",e);
+        }finally {
+            if(ho !=null){
+                try {
+                    ho.close();
+                } catch (IOException e) {
+                    log.error("序列化流关闭失败!",e);
+                }
+            }
+        }
+    }
+
+    /** Hessian反序列化 */
+    public static Object deserialize(byte[] bytes){
+        Hessian2Input hi = null;
+        try{
+            ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+            hi = new Hessian2Input(is);
+            return hi.readObject();
+        }catch (Exception e){
+            log.error("反序列化对象异常!",e);
+            //throw new SysException("反序列化对象异常!",e);
+            throw new RuntimeException("反序列化对象异常!",e);
+        }finally {
+            if(hi !=null){
+                try {
+                    hi.close();
+                } catch (IOException e) {
+                    log.error("序列化流关闭失败!",e);
+                }
+            }
+        }
+    }
+
+}

+ 44 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/SysErrorCodeEnum.java

@@ -0,0 +1,44 @@
+package com.hrsk.cloud.eg.domain.common;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-11-12 18:15
+ * @description: 系统错误编码枚举
+ **/
+public enum SysErrorCodeEnum {
+    BEETL_ERROR("100001","模版渲染失败!");
+    private String code;
+
+    private String message;
+    /**
+     * 前缀
+     */
+    private static final String PREFIX = "sys-";
+
+    /**
+     * 构造函数
+     * @param code 编码
+     * @param message 描述消息
+     */
+    SysErrorCodeEnum(String code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    /**
+     * 获取编码
+     * @return 编码
+     */
+    public String getCode() {
+        return PREFIX + code;
+    }
+
+    /**
+     * 获取消息
+     * @return 返回消息
+     */
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/egress/EgApiTypeEnum.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgApiTypeEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.constant.egress;
+package com.hrsk.cloud.eg.domain.common.constant;
 
 import lombok.AllArgsConstructor;
 import lombok.Getter;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/egress/EgressApiEndpointIntegrationModeEnum.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgressApiEndpointIntegrationModeEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.constant.egress;
+package com.hrsk.cloud.eg.domain.common.constant;
 
 import lombok.Getter;
 

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/egress/EgressApiStatusEnum.java → egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/EgressApiStatusEnum.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.domain.common.constant.egress;
+package com.hrsk.cloud.eg.domain.common.constant;
 
 import lombok.Getter;
 

+ 0 - 44
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/egress/EgRouteTypeEnum.java

@@ -1,44 +0,0 @@
-package com.hrsk.cloud.eg.domain.common.constant.egress;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author zhangyy
- * @version 1.0
- * @description: EgApiTypeEnum
- * @date 2024/9/23 13:58
- */
-@Getter
-@AllArgsConstructor
-public enum EgRouteTypeEnum {
-    CHECK_INTO("CHECK_INTO","准入"),
-    APPLY("APPLY","注册"),
-
-    ;
-    static Map<String, EgRouteTypeEnum> map = new HashMap();
-
-    static {
-        for (EgRouteTypeEnum value : EgRouteTypeEnum.values()) {
-            map.put(value.code, value);
-        }
-    }
-
-    public static EgRouteTypeEnum getByCode(String code) {
-        return map.get(code);
-    }
-    private String code;
-
-    private String msg;
-
-    public String getCode() {
-        return code;
-    }
-
-    public String getMsg() {
-        return msg;
-    }
-}

+ 0 - 24
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/utils/GsonUtils.java

@@ -1,24 +0,0 @@
-package com.hrsk.cloud.eg.domain.common.utils;
-
-import com.google.gson.Gson;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-01 16:58
- * @description: Gson工具类
- **/
-public class GsonUtils {
-    /**
-     * gson
-     */
-    public static final Gson GSON = new Gson();
-
-    /**
-     * 转换JSON
-     * @return 实体
-     * @param <T> 范型
-     */
-    public static  <T> T fromJson(String json,Class<T> classz){
-        return GSON.fromJson(json,classz);
-    }
-}

+ 1 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/package-info.java

@@ -0,0 +1 @@
+package com.hrsk.cloud.eg.domain;

+ 18 - 21
egress-gateway-service-infrastructure/pom.xml

@@ -16,51 +16,48 @@
     </properties>
 
     <dependencies>
-
         <dependency>
             <groupId>com.hrsk.cloud</groupId>
             <artifactId>egress-gateway-service-domain</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
         </dependency>
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid-spring-boot-starter</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
-            <groupId>com.caucho</groupId>
-            <artifactId>hessian</artifactId>
-            <version>${hessian.version}</version>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
         </dependency>
         <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus</artifactId>
         </dependency>
+
         <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk15on</artifactId>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
         </dependency>
     </dependencies>
 </project>

+ 40 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/HttpClient.java

@@ -0,0 +1,40 @@
+package com.hrsk.cloud.eg.infrastructure.client.http;
+
+import com.hrsk.cloud.eg.infrastructure.common.InfrastructureException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Objects;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-09-06 11:14
+ * @description: HTTP请求客户端
+ **/
+@Slf4j
+@Component
+public class HttpClient {
+    @Resource
+    private RetryRestTemplate restTemplate;
+    /**
+     * 数据交换
+     * @param request 请求
+     * @return response 响应
+     */
+    public ResponseEntity<String> exchange(HttpApiRequest request){
+        ResponseEntity<String> responseEntity = null;
+        try {
+            return restTemplate.restTemplate().exchange(request.getUrl(),
+                    Objects.requireNonNull(HttpMethod.resolve(request.getMethod())),
+                    new HttpEntity<>(request.getPayload()),
+                    String.class);
+        } catch (Exception e) {
+            log.error("请求异常,请求数据:[{}].", request.toString() ,e);
+            throw new InfrastructureException("请求异常!",e);
+        }
+    }
+}

+ 1 - 1
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/config/client/RetryRequestConfig.java → egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/RetryRequestConfig.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.infrastructure.config.client;
+package com.hrsk.cloud.eg.infrastructure.client.http;
 
 /**
  * Author: zhangyy

+ 1 - 1
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/config/client/RetryRestTemplate.java → egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/http/RetryRestTemplate.java

@@ -1,4 +1,4 @@
-package com.hrsk.cloud.eg.infrastructure.config.client;
+package com.hrsk.cloud.eg.infrastructure.client.http;
 
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.NoHttpResponseException;

+ 1 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/client/package-info.java

@@ -0,0 +1 @@
+package com.hrsk.cloud.eg.infrastructure.client;

+ 29 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/common/InfrastructureException.java

@@ -0,0 +1,29 @@
+package com.hrsk.cloud.eg.infrastructure.common;
+
+import com.hrsk.pangu.tool.exception.BaseException;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-09-06 17:01
+ * @description: 基础设施异常
+ **/
+public class InfrastructureException extends BaseException {
+    private static final long serialVersionUID = 1L;
+    private static final String DEFAULT_ERR_CODE = "INF_ERROR";
+
+    public InfrastructureException(String errMessage) {
+        super("INF_ERROR", errMessage);
+    }
+
+    public InfrastructureException(String errCode, String errMessage) {
+        super(errCode, errMessage);
+    }
+
+    public InfrastructureException(String errMessage, Throwable e) {
+        super("INF_ERROR", errMessage, e);
+    }
+
+    public InfrastructureException(String errorCode, String errMessage, Throwable e) {
+        super(errorCode, errMessage, e);
+    }
+}

Some files were not shown because too many files changed in this diff