Преглед изворни кода

add 惠融撞库api配置成功
del httpconfig配置

GITZYY пре 7 месеци
родитељ
комит
7d557a13a7

+ 73 - 0
README.md

@@ -29,5 +29,78 @@ mvn archetype:generate -DarchetypeCatalog=local
 
 # base_table
 
+# http 加载信息 初始化 参考
+```
+ JSONObject jsonObject=JSONObject.parseObject(param);
+        HttpApiConfig httpApiConfig = new HttpApiConfig();
+        httpApiConfig.setUrl(jsonObject.getString("checkUrl"));
+        httpApiConfig.setMethod("POST");
+        httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
+        List<KeyValueObject> headers = Lists.newArrayList();
+        KeyValueObject head=new KeyValueObject();
+        head.setType(ValueObjectTypeEnum.BASIC.getType());
+        head.setKey("Content-Type");
+        head.setValue("application/json");
+        headers.add(head);
+        httpApiConfig.setHeader(headers);
+        JSONObject body=new  JSONObject();
+        KeyValueObject attackPhone=new KeyValueObject();
+        attackPhone.setType("spel");
+        attackPhone.setValue("#param.user.phoneMd5");
+        KeyValueObject merchantNo=new KeyValueObject();
+        merchantNo.setType("spel");
+        merchantNo.setValue("#param.user.merchantNo");
+        body.put("attackPhone",JSONObject.toJSONString(attackPhone));
+        body.put("merchantNo",JSONObject.toJSONString(merchantNo));
+        //主体
+        httpApiConfig.setContent(JSONObject.toJSONString(body));
+        String jsonString = JSONObject.toJSONString(httpApiConfig);
+        log.info("json input data {}",jsonString);
+         return httpApiConfig;
+```
+# 格式化后的http请求格式
+```
+
+//
+//        FunctionObject md5 = new FunctionObject();
+//        md5.setCode("md5");
+//        HttpApiConfig hac = new HttpApiConfig()
+//                .setUrl("https://baidu.com");
+//        hac.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
+//        hac.setType("http");
+//        List<KeyValueObject> h = Lists.newArrayList();
+//        KeyValueObject h1 = new KeyValueObject();
+//        h1.setKey("secretKey");
+//        h1.setType("text");
+//        h1.setValue("Khw99%$l%-2gF7P4jXglp_-jQqQirtYnOY5D");
+//        h.add(h1);
+//        KeyValueObject h2 = new KeyValueObject();
+//        h2.setKey("merchantNo");
+//        h2.setType("spel");
+//        h2.setValue("#param.realName");
+//        h.add(h2);
+//        List<ValueObject> p = Lists.newArrayList();
+//        ValueObject p1 = new ValueObject();
+//        p1.setType("text");
+//        p1.setValue("123");
+//        ValueObject p2 = new ValueObject();
+//        p2.setType("text");
+//        p2.setValue("456");
+//        p2.getFunctions().add(md5);
+//        p.add(p1);
+//        p.add(p2);
+//        List<KeyValueObject> s = Lists.newArrayList();
+//        KeyValueObject s1 = new KeyValueObject();
+//        s1.setKey("username");
+//        s1.setType("spel");
+//        s1.setValue("#param.username");
+//        KeyValueObject s2 = new KeyValueObject();
+//        s2.setKey("channel");
+//        s2.setType("spel");
+//        s2.setValue("#param.channel");
+//        s.add(s2);
+//        hac.setPath(p).setSearch(s).setHeader(h).setMethod("GET");
+//        hac.setContent("{\"merchant\":\"xxxxxxfffff\",\"phone\":\"#{\\\"value\\\":\\\"#param.userMobile\\\",\\\"type\\\": \\\"spel\\\",\\\"functions\\\":[ {\\\"code\\\": \\\"md5\\\"}]}\"}");
+```
 
 

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

@@ -0,0 +1,38 @@
+package com.hrsk.cloud.eg.app.api;
+import com.hrsk.cloud.eg.domain.api.ApiGateway;
+import com.hrsk.cloud.eg.domain.common.response.DefaultResponseVo;
+import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+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-08-02 10:57
+ * @description: 保存api
+ **/
+@RestController
+@RequestMapping("/api/checkInto")
+public class ApiCheckIntoServiceImpl {
+
+    @Resource
+    private ApiGateway apiGateway;
+
+
+    /**
+     * @description:  撞库接口
+     * @param:
+     * @return:
+     * @author zhangyy
+     * @date: 2024/8/30 14:34
+     */
+    @RequestMapping("/v1")
+    public DefaultResponseVo<DataVo> checkInto(@RequestBody CheckIntoParamDto paramDto) {
+       return apiGateway.checkIntoRequest(paramDto);
+    }
+
+
+}

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

@@ -1,94 +0,0 @@
-package com.hrsk.cloud.eg.app.api;
-import com.google.common.collect.Lists;
-import com.hrsk.cloud.eg.domain.api.*;
-import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
-import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
-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.EgApiService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-02 10:57
- * @description: 保存api
- **/
-@RestController
-@RequestMapping("/api")
-public class ApiServiceImpl {
-    @Resource
-    private EgApiService egApiService;
-
-    @Resource
-    private EgApiEndpointService egApiEndpointService;
-
-    @Resource
-    private ApiGateway apiGateway;
-
-    @GetMapping("/save")
-    public void save(){
-        EgApiEndpointDo egApiEndpointDo = new EgApiEndpointDo();
-        egApiEndpointDo.setApiId(1234L);
-        egApiEndpointDo.setApiCode("http");
-        egApiEndpointDo.setCreateUid("100000");
-        egApiEndpointDo.setCreateUsername("admin");
-        egApiEndpointDo.setModifyUid("100000");
-        egApiEndpointDo.setModifyUsername("admin");
-        egApiEndpointDo.setApiConfig(HessianUtils.serialize(createBean()));
-        egApiEndpointService.save(egApiEndpointDo);
-    }
-
-    @GetMapping("/request")
-    public void request(){
-        apiGateway.request();
-    }
-
-
-    private HttpApiConfig createBean(){
-        FunctionObject md5 = new FunctionObject();
-        md5.setCode("md5");
-        HttpApiConfig hac = new HttpApiConfig()
-                .setUrl("https://baidu.com");
-        hac.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
-        hac.setType("http");
-        List<KeyValueObject> h = Lists.newArrayList();
-        KeyValueObject h1 = new KeyValueObject();
-        h1.setKey("secretKey");
-        h1.setType("text");
-        h1.setValue("Khw99%$l%-2gF7P4jXglp_-jQqQirtYnOY5D");
-        h.add(h1);
-        KeyValueObject h2 = new KeyValueObject();
-        h2.setKey("merchantNo");
-        h2.setType("spel");
-        h2.setValue("#param.realName");
-        h.add(h2);
-        List<ValueObject> p = Lists.newArrayList();
-        ValueObject p1 = new ValueObject();
-        p1.setType("text");
-        p1.setValue("123");
-        ValueObject p2 = new ValueObject();
-        p2.setType("text");
-        p2.setValue("456");
-        p2.getFunctions().add(md5);
-        p.add(p1);
-        p.add(p2);
-        List<KeyValueObject> s = Lists.newArrayList();
-        KeyValueObject s1 = new KeyValueObject();
-        s1.setKey("username");
-        s1.setType("spel");
-        s1.setValue("#param.username");
-        KeyValueObject s2 = new KeyValueObject();
-        s2.setKey("channel");
-        s2.setType("spel");
-        s2.setValue("#param.channel");
-        s.add(s2);
-        hac.setPath(p).setSearch(s).setHeader(h).setMethod("GET");
-        hac.setContent("{\"merchant\":\"xxxxxxfffff\",\"phone\":\"#{\\\"value\\\":\\\"#param.userMobile\\\",\\\"type\\\": \\\"spel\\\",\\\"functions\\\":[ {\\\"code\\\": \\\"md5\\\"}]}\"}");
-        return hac;
-    }
-}

+ 2 - 2
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/dto/data/egPlan/PlanDto.java

@@ -22,11 +22,11 @@ public class PlanDto  implements Serializable {
      * apiId
      *
      * */
-    private Integer apiId;
+    private Long apiId;
     /**
      * 推广计划id
      * */
-    private Long planId;
+    private Integer planId;
 
 
     /**

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

@@ -1,10 +1,21 @@
 package com.hrsk.cloud.eg.domain.api;
 
+import com.hrsk.cloud.eg.domain.common.response.DefaultResponseVo;
+import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+
 /**
  * @author: bianlanzhou
  * @create: 2024-08-01 18:14
  * @description: API防腐层
  **/
 public interface ApiGateway {
-    Object request();
+
+    /**
+     * @description:  撞库请求
+     * @author zhangyy
+     * @date 2024/8/30 14:11
+     * @version 1.0
+     */
+    DefaultResponseVo<DataVo> checkIntoRequest (CheckIntoParamDto param);
 }

+ 5 - 2
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/HttpApi.java

@@ -8,8 +8,11 @@ import lombok.Getter;
 import lombok.ToString;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -63,7 +66,7 @@ public class HttpApi implements Api {
      * header数据
      */
     @Getter
-    private final Map<String,Object> header = new HashMap<>();
+    private final Map<String, Object> header = new HashMap<>();
     /**
      * 请求payload数据
      */
@@ -109,7 +112,7 @@ public class HttpApi implements Api {
      */
     private void loadHeader(ApiContext context){
         for(KeyValueObject keyValueObject : httpApiConfig.getHeader()){
-            this.header.put(keyValueObject.getKey(),keyValueObject.compile(context).getRealValue());
+            this.header.put(keyValueObject.getKey(),  keyValueObject.compile(context).getRealValue().toString());
         }
     }
 

+ 10 - 15
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/ApiGateWayImpl/ApiGatewayImpl.java

@@ -1,7 +1,11 @@
 package com.hrsk.cloud.eg.infrastructure.ApiGateWayImpl;
 
 import com.hrsk.cloud.eg.domain.api.ApiGateway;
+import com.hrsk.cloud.eg.domain.common.response.DefaultResponseVo;
+import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
+import com.hrsk.cloud.eg.infrastructure.business.HttpRequestCheckIntoService;
 import com.hrsk.cloud.eg.infrastructure.config.client.HttpTemPlateClient;
+import com.hrsk.cloud.eg.vo.response.DataVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
@@ -18,22 +22,13 @@ public class ApiGatewayImpl implements ApiGateway {
 
 
     @Resource
-    private HttpTemPlateClient httpTemPlateClient;
+    private HttpRequestCheckIntoService checkIntoService;
+
+
 
     @Override
-    public Object request() {
-//        UserInfoDto userInfoDto = new UserInfoDto();
-//        userInfoDto.setUserId(12345L);
-//        userInfoDto.setUserMobile("17766668888");
-//        EgApiEndpointDo egApiEndpointDo = egApiEndpointMapper.selectById(1819284080014041090L);
-//        HttpApiConfig httpApiConfig = (HttpApiConfig)HessianUtils.deserialize(egApiEndpointDo.getEndpointConfig());
-//        Api api = apiFactory.createApi(httpApiConfig,userInfoDto);
-//        if(StringUtils.equals(ApiTypeEnums.HTTP.getType(),api.getType())){
-//            return httpClient.request((HttpApi) api);
-//        }else{
-//            log.error("不支持的请求配置类型!");
-//            throw new BizException("不支持的请求配置类型!");
-//        }
-        return null;
+    public DefaultResponseVo<DataVo> checkIntoRequest(CheckIntoParamDto param) {
+         checkIntoService.checkInto(param);
+        return DefaultResponseVo.success();
     }
 }

+ 12 - 46
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/business/GenerateHttpApiConfigService.java

@@ -8,6 +8,7 @@ import com.hrsk.cloud.eg.domain.api.HttpApiConfig;
 import com.hrsk.cloud.eg.domain.api.KeyValueObject;
 import com.hrsk.cloud.eg.domain.api.ValueObject;
 import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
+import com.hrsk.cloud.eg.domain.api.common.ValueObjectTypeEnum;
 import com.hrsk.cloud.eg.domain.common.utils.GsonUtils;
 import com.hrsk.cloud.eg.domain.common.utils.SnowflakeIdWorker;
 import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
@@ -67,19 +68,24 @@ public class GenerateHttpApiConfigService {
         JSONObject jsonObject=JSONObject.parseObject(param);
         HttpApiConfig httpApiConfig = new HttpApiConfig();
         httpApiConfig.setUrl(jsonObject.getString("checkUrl"));
-        httpApiConfig.setMethod("post");
+        httpApiConfig.setMethod("POST");
         httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
-        List<KeyValueObject> header = Lists.newArrayList();
-        httpApiConfig.setHeader(header);
+        List<KeyValueObject> headers = Lists.newArrayList();
+        KeyValueObject head=new KeyValueObject();
+        head.setType(ValueObjectTypeEnum.BASIC.getType());
+        head.setKey("Content-Type");
+        head.setValue("application/json");
+        headers.add(head);
+        httpApiConfig.setHeader(headers);
         JSONObject body=new  JSONObject();
         KeyValueObject attackPhone=new KeyValueObject();
         attackPhone.setType("spel");
         attackPhone.setValue("#param.user.phoneMd5");
         KeyValueObject merchantNo=new KeyValueObject();
         merchantNo.setType("spel");
-        merchantNo.setValue("#param.user.merchantNo");
-        body.put("attackPhone",JSONObject.toJSONString(attackPhone));
-        body.put("merchantNo",JSONObject.toJSONString(merchantNo));
+        merchantNo.setValue("#param.plan.bid");
+        body.put("attackPhone","#"+JSONObject.toJSONString(attackPhone));
+        body.put("merchantNo","#"+JSONObject.toJSONString(merchantNo));
         //主体
         httpApiConfig.setContent(JSONObject.toJSONString(body));
         String jsonString = JSONObject.toJSONString(httpApiConfig);
@@ -87,44 +93,4 @@ public class GenerateHttpApiConfigService {
          return httpApiConfig;
     }
 
-//
-//        FunctionObject md5 = new FunctionObject();
-//        md5.setCode("md5");
-//        HttpApiConfig hac = new HttpApiConfig()
-//                .setUrl("https://baidu.com");
-//        hac.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
-//        hac.setType("http");
-//        List<KeyValueObject> h = Lists.newArrayList();
-//        KeyValueObject h1 = new KeyValueObject();
-//        h1.setKey("secretKey");
-//        h1.setType("text");
-//        h1.setValue("Khw99%$l%-2gF7P4jXglp_-jQqQirtYnOY5D");
-//        h.add(h1);
-//        KeyValueObject h2 = new KeyValueObject();
-//        h2.setKey("merchantNo");
-//        h2.setType("spel");
-//        h2.setValue("#param.realName");
-//        h.add(h2);
-//        List<ValueObject> p = Lists.newArrayList();
-//        ValueObject p1 = new ValueObject();
-//        p1.setType("text");
-//        p1.setValue("123");
-//        ValueObject p2 = new ValueObject();
-//        p2.setType("text");
-//        p2.setValue("456");
-//        p2.getFunctions().add(md5);
-//        p.add(p1);
-//        p.add(p2);
-//        List<KeyValueObject> s = Lists.newArrayList();
-//        KeyValueObject s1 = new KeyValueObject();
-//        s1.setKey("username");
-//        s1.setType("spel");
-//        s1.setValue("#param.username");
-//        KeyValueObject s2 = new KeyValueObject();
-//        s2.setKey("channel");
-//        s2.setType("spel");
-//        s2.setValue("#param.channel");
-//        s.add(s2);
-//        hac.setPath(p).setSearch(s).setHeader(h).setMethod("GET");
-//        hac.setContent("{\"merchant\":\"xxxxxxfffff\",\"phone\":\"{\\\"value\\\":\\\"#param.userMobile\\\",\\\"type\\\": \\\"spel\\\",\\\"functions\\\":[ {\\\"code\\\": \\\"md5\\\"}]}\"}");
 }

+ 62 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/business/HttpRequestCheckIntoService.java

@@ -0,0 +1,62 @@
+package com.hrsk.cloud.eg.infrastructure.business;
+
+import com.hrsk.cloud.eg.domain.api.Api;
+import com.hrsk.cloud.eg.domain.api.ApiFactory;
+import com.hrsk.cloud.eg.domain.api.HttpApi;
+import com.hrsk.cloud.eg.domain.api.HttpApiConfig;
+import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
+import com.hrsk.cloud.eg.infrastructure.config.client.HttpTemPlateClient;
+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.EgApiService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import javax.annotation.Resource;
+
+/**
+ * @author zhangyy
+ * @version 1.0
+ * @description: HttpRequestCheckIntoService
+ * @date 2024/8/30 14:15
+ */
+@Slf4j
+@Service
+public class HttpRequestCheckIntoService {
+    @Resource
+    private EgApiService    egApiService;
+
+    @Resource
+    private EgApiEndpointService egApiEndpointService;
+
+    @Resource
+    private ApiFactory apiFactory;
+
+    @Resource
+    private HttpTemPlateClient httpTemPlateClient;
+
+
+    /**
+     * @description:  撞库
+     * @param:
+     * @return:
+     * @author zhangyy
+     * @date: 2024/8/30 14:24
+     */
+    public Object checkInto(CheckIntoParamDto paramDto){
+        EgApiEndpointDo eg = egApiEndpointService.getById(paramDto.getPlan().getApiId());
+        try {
+            HttpApiConfig httpApiConfig = (HttpApiConfig) HessianUtils.deserialize(eg.getApiConfig());
+            String type = httpApiConfig.getUrl().substring(0,httpApiConfig.getUrl().indexOf("://"));
+             httpApiConfig.setType(type);
+            Api api = apiFactory.createApi(httpApiConfig,paramDto);
+            Object result = httpTemPlateClient.request((HttpApi) api);
+            return  result;
+        } catch (Exception e) {
+            log.error("check into error ",e);
+        }
+        return null;
+    }
+}

+ 0 - 15
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/config/client/HttpConfiguration.java

@@ -1,15 +0,0 @@
-package com.hrsk.cloud.eg.infrastructure.config.client;
-
-import org.springframework.web.client.RestTemplate;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 11:01
- * @description: HTTP配置
- **/
-public class HttpConfiguration {
-
-    public RestTemplate restTemplate(){
-        return  new RestTemplate();
-    }
-}

+ 14 - 1
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/config/client/HttpTemPlateClient.java

@@ -3,12 +3,16 @@ package com.hrsk.cloud.eg.infrastructure.config.client;
 import com.hrsk.cloud.eg.domain.api.HttpApi;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
+import java.util.Map;
 import java.util.Objects;
 /**
  * @author: bianlanzhou
@@ -27,10 +31,19 @@ public class HttpTemPlateClient {
      */
     public Object request(HttpApi httpApi){
         ResponseEntity<String> responseEntity = null;
+        //补充headers
+        MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
+        if(!httpApi.getHeader().isEmpty()){
+          Map<String,Object> orgMap=httpApi.getHeader();
+            for (String key : orgMap.keySet()) {
+                headers.add(key, orgMap.get(key).toString());
+            }
+        }
         try {
             responseEntity = httpRestTemplate.exchange(httpApi.getUrl(),
                     Objects.requireNonNull(HttpMethod.resolve(httpApi.getMethod())),
-                    new HttpEntity<>(httpApi.getPayload()),
+                    new HttpEntity<>(httpApi.getPayload(),new HttpHeaders(headers))
+                    ,
                     String.class);
         } catch (Exception e) {
             log.error("请求异常,请求数据:[{}].", httpApi.toString() ,e);

+ 17 - 7
start/src/test/java/StartTest.java

@@ -1,7 +1,9 @@
 import com.hrsk.cloud.eg.Application;
+import com.hrsk.cloud.eg.domain.api.ApiGateway;
+import com.hrsk.cloud.eg.dto.data.CheckIntoParamDto;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
 import com.hrsk.cloud.eg.infrastructure.business.GenerateHttpApiConfigService;
-import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
-import com.hrsk.cloud.eg.infrastructure.repository.database.mapper.ProductBusinessApiInfoMapper;
 import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -25,6 +27,9 @@ public class StartTest {
 
     @Resource
     private ProductBusinessApiInfoService productBusinessApiInfoService  ;
+
+    @Resource
+    private ApiGateway apiGateway;
     @Test
   public void createApiTest(){
         String input="{\"priviteKey\":\"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIIftRt0MixH4UKwHEYD2TT9LblcgXaZYOMsBqW8zDnDfTuu6-LZz7EaRR4E4xRYsHHpL_lzhytnYd3MxAMt8kQYkrQHDGiZuw9CO5DxQdy4ysS6e6yKiGJC-1rubYicLAko322nV9f9xZ3aWl9xyjzVkQCeyxkU83UDe9SBBpbLAgMBAAECgYANTQZrLv5t7k8FTREmyv_p3bNNzjnhkJ4JupdXW6wYf3YOoruz7YXAWaoU_nTjwIkQq8BepEN92Ux0qpiippCr5ekXUnF4ya8TAKxc9J93jEXW_0grMbut3FOxQM6q2a4IWb0ahVNq7_6wbUNQavfR5HoBShhD798V89q9UWBO6QJBAL8JUqQseATgDkUjPunBUS2OhENqerDKfOmLAGa4o60b49nUG0Hr3WLm47qNM8-Hnozs-lqvnKWFyKntsin9ds8CQQCuX6Qgdy8_X-NhxtKfRkynCnKi5J5E8FEJvXyi_rMqQxWwDcu_4NRMUKD7FkmLjTf4xqfpBUg6k6CLNTO5JZ9FAkBUS1LR6mVTEWJ6k2DRWGHvjjFCZhuZIuAXVSRqLxLZ8bKKjZMxdVgMqgDWcjPoYNlPKcoWdeLTDsNKZ_3zlUn1AkEAjaLwHNLSlOadOoGV-XvPrWsGHJwYlqShHolEoNzDyRM-nYdHNa84olhnuiurR2hIy5EJOHRq6_GX2Rs4zS3rBQJACI2mG2n9L3y4J6bEs40KvURo4x4iu8c9nuUsLZppkfQNiy4VaZBJqXeXfWV0nRyvd0qWR7D_S91EI90FY_tBWQ\",\"secretKey\":\"3A4093B3E9A46A59A441E0B728260939\",\"applyUrl\":\"http://loan-crm-api.pre.jiebide.xin/crm/custom/add\",\"publicKey\":\"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCCH7UbdDIsR-FCsBxGA9k0_S25XIF2mWDjLAalvMw5w307ruvi2c-xGkUeBOMUWLBx6S_5c4crZ2HdzMQDLfJEGJK0BwxombsPQjuQ8UHcuMrEunusiohiQvta7m2InCwJKN9tp1fX_cWd2lpfcco81ZEAnssZFPN1A3vUgQaWywIDAQAB\",\"checkUrl\":\"http://loan-crm-api.pre.jiebide.xin/crm/custom/checkAttackData\",\"channelCode\":\"CHANEL240717000000005\"}";
@@ -33,11 +38,16 @@ public class StartTest {
 
     @Test
     public void apiTest(){
-        ProductBusinessApiInfoDo productBusinessApiInfoDo = new ProductBusinessApiInfoDo();
-        productBusinessApiInfoDo.setCreater("1");
-        productBusinessApiInfoService.save(productBusinessApiInfoDo);
-//        String input="{\"priviteKey\":\"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIIftRt0MixH4UKwHEYD2TT9LblcgXaZYOMsBqW8zDnDfTuu6-LZz7EaRR4E4xRYsHHpL_lzhytnYd3MxAMt8kQYkrQHDGiZuw9CO5DxQdy4ysS6e6yKiGJC-1rubYicLAko322nV9f9xZ3aWl9xyjzVkQCeyxkU83UDe9SBBpbLAgMBAAECgYANTQZrLv5t7k8FTREmyv_p3bNNzjnhkJ4JupdXW6wYf3YOoruz7YXAWaoU_nTjwIkQq8BepEN92Ux0qpiippCr5ekXUnF4ya8TAKxc9J93jEXW_0grMbut3FOxQM6q2a4IWb0ahVNq7_6wbUNQavfR5HoBShhD798V89q9UWBO6QJBAL8JUqQseATgDkUjPunBUS2OhENqerDKfOmLAGa4o60b49nUG0Hr3WLm47qNM8-Hnozs-lqvnKWFyKntsin9ds8CQQCuX6Qgdy8_X-NhxtKfRkynCnKi5J5E8FEJvXyi_rMqQxWwDcu_4NRMUKD7FkmLjTf4xqfpBUg6k6CLNTO5JZ9FAkBUS1LR6mVTEWJ6k2DRWGHvjjFCZhuZIuAXVSRqLxLZ8bKKjZMxdVgMqgDWcjPoYNlPKcoWdeLTDsNKZ_3zlUn1AkEAjaLwHNLSlOadOoGV-XvPrWsGHJwYlqShHolEoNzDyRM-nYdHNa84olhnuiurR2hIy5EJOHRq6_GX2Rs4zS3rBQJACI2mG2n9L3y4J6bEs40KvURo4x4iu8c9nuUsLZppkfQNiy4VaZBJqXeXfWV0nRyvd0qWR7D_S91EI90FY_tBWQ\",\"secretKey\":\"3A4093B3E9A46A59A441E0B728260939\",\"applyUrl\":\"http://loan-crm-api.pre.jiebide.xin/crm/custom/add\",\"publicKey\":\"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCCH7UbdDIsR-FCsBxGA9k0_S25XIF2mWDjLAalvMw5w307ruvi2c-xGkUeBOMUWLBx6S_5c4crZ2HdzMQDLfJEGJK0BwxombsPQjuQ8UHcuMrEunusiohiQvta7m2InCwJKN9tp1fX_cWd2lpfcco81ZEAnssZFPN1A3vUgQaWywIDAQAB\",\"checkUrl\":\"http://loan-crm-api.pre.jiebide.xin/crm/custom/checkAttackData\",\"channelCode\":\"CHANEL240717000000005\"}";
-//        generateHttpApiConfigService.generateHuiRonHuiRonApiConfig(input);
+      Long apiId= 441205582851136L;
+        UserInBaseInfoDto user =new UserInBaseInfoDto();
+        user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
+        PlanDto  plan =new PlanDto();
+        plan.setApiId(apiId);
+        plan.setBid("aff1c7b30d8b240826030235business");
+        CheckIntoParamDto checkin =new CheckIntoParamDto();
+        checkin.setPlan(plan);
+        checkin.setUser(user);
+        apiGateway.checkIntoRequest(checkin);
     }