浏览代码

add 迁移

GITZYY 7 月之前
父节点
当前提交
090e731bcb

+ 6 - 1
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/dto/data/user/UserInBaseInfoDto.java

@@ -54,9 +54,14 @@ public class UserInBaseInfoDto {
      * */
     private Integer age;
     /**
-     * 城市名称
+     * 城市名称简称数据库中获取 重庆
      * */
     private String companyCity;
+
+    /**
+     * 城市名称全称 重庆市
+     * */
+    private String cityAllName;
     /**
      * 社保
      * */

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

@@ -100,4 +100,74 @@ public class GenerateCheckIntoHttpApiConfigV2Service {
         return httpApiConfig;
     }
 
+    /**
+     * @description:  快亿贷 api配置
+     * @param:
+     * @return:
+     * @author zhangyy
+     * @date: 2024/9/9 18:06
+     */
+    public void generateKuaiyidaiConfig(String openApiConfig) {
+        EgApiDo egApiDo=new EgApiDo();
+        egApiDo.setApiCode("EG:"+ BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Kuaiyidai");
+        egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
+        egApiService.save(egApiDo);
+        JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
+        EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
+        egApiEndpointDo.setApiCode(egApiDo.getApiCode());
+        egApiEndpointDo.setApiId(egApiDo.getId());
+        egApiEndpointDo.setApiName(jsonObject.getString("name"));
+        egApiEndpointDo.setApiConfig(HessianUtils.serialize(createKuaiyidaiCheckIntoBean(openApiConfig)));
+        egApiEndpointService.save(egApiEndpointDo);
+    }
+
+    private HttpApiConfig createKuaiyidaiCheckIntoBean(String openApiConfig) {
+        JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
+        HttpApiConfig httpApiConfig = new HttpApiConfig();
+        httpApiConfig.setUrl(jsonObject.getString("url")+"/Admin/UserIncomeApi/comparePhoneMonitor");
+        httpApiConfig.setMethod("POST");
+        httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_X_WWW_FORM_URLENCODED.getCode());
+        List<KeyValueObject> headers = Lists.newArrayList();
+        KeyValueObject head=new KeyValueObject();
+        head.setType(ValueObjectTypeEnum.BASIC.getType());
+        head.setKey("Content-Type");
+        head.setValue("application/x-www-form-urlencoded; charset=UTF-8");
+        headers.add(head);
+        httpApiConfig.setHeader(headers);
+//        List<KeyValueObject> search = Lists.newArrayList();
+//        KeyValueObject searchKey=new KeyValueObject();
+//        searchKey.setType(ValueObjectTypeEnum.SPEL.getType());
+//        searchKey.setKey("mobnum_md5");
+//        searchKey.setValue("#param.user.phoneMd5");
+//        search.add(searchKey);
+//        httpApiConfig.setSearch(search);
+        JSONObject body=new  JSONObject();
+        body.put("qdName",jsonObject.getString("qdName"));
+        KeyValueObject attackPhone=new KeyValueObject();
+        attackPhone.setType("spel");
+        attackPhone.setValue("#param.user.phoneMd5");
+        body.put("phone","#"+JSONObject.toJSONString(attackPhone));
+        KeyValueObject city=new KeyValueObject();
+        city.setType("spel");
+        city.setValue("#param.user.cityAllName");
+        body.put("city","#"+JSONObject.toJSONString(city));
+
+        //主体
+        httpApiConfig.setContent(JSONObject.toJSONString(body));
+        httpApiConfig.setContent("");
+        JSONObject resultObj=new  JSONObject();
+        KeyValueObject status=new KeyValueObject();
+        status.setType("spel");
+        status.setValue("#root[status]==200?0:1");
+//        List<FunctionObject> functionObjects = Lists.newArrayList();
+//        FunctionObject functionObject = new FunctionObject();
+//        functionObject.setCode("resultCodeConvertStatusInteger");
+//        functionObjects.add(functionObject);
+//        status.setFunctions(functionObjects);
+        resultObj.put("status","#"+JSONObject.toJSONString(status));
+        httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
+        String jsonString = JSONObject.toJSONString(httpApiConfig);
+        log.info("Kuaiyidai api {}",jsonString);
+        return httpApiConfig;
+    }
 }

+ 5 - 1
start/src/test/java/GenerateConfigTest.java

@@ -137,5 +137,9 @@ public class GenerateConfigTest {
         generateCheckIntoHttpApiConfigV2Service.generateGexinjinfuConfig(productBusinessApiInfoDos.get(0).getThreeSystemConfig());
     }
 
-
+    @Test
+    public void createKuaiyidaiApiTest(){
+        List<ProductBusinessApiInfoDo> productBusinessApiInfoDos = productBusinessApiInfoService.selectByJointJonintTypeForList("Kuaiyidai");
+        generateCheckIntoHttpApiConfigV2Service.generateKuaiyidaiConfig(productBusinessApiInfoDos.get(0).getThreeSystemConfig());
+    }
 }

+ 15 - 0
start/src/test/java/StartApiTest.java

@@ -348,6 +348,21 @@ public class StartApiTest {
         apiGateway.checkIntoRequest(checkin);
     }
 
+    @Test
+    public void kuaiyidaiApiTest(){
+        Long apiId= 441428658950208L;
+        UserInBaseInfoDto user =new UserInBaseInfoDto();
+        user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
+        user.setCityAllName("重庆市");
+        PlanDto  plan =new PlanDto();
+        plan.setApiId(apiId);
+        plan.setBid("aff1c7b30d8b240826030235business");
+        CheckIntoParamDto checkin =new CheckIntoParamDto();
+        checkin.setPlan(plan);
+        checkin.setUser(user);
+        apiGateway.checkIntoRequest(checkin);
+    }
+
     @Test
     public void spel(){
         Map<String,Object> map =new HashMap<>();