|
@@ -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;
|
|
|
+ }
|
|
|
}
|