|
@@ -689,12 +689,12 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
JSONObject resultObj=new JSONObject();
|
|
|
KeyValueObject status=new KeyValueObject();
|
|
|
status.setType("spel");
|
|
|
- status.setValue("#root[code]");
|
|
|
- List<FunctionObject> functionObjects = Lists.newArrayList();
|
|
|
- FunctionObject functionObject = new FunctionObject();
|
|
|
- functionObject.setCode("resultCodeConvertStatusInteger");
|
|
|
- functionObjects.add(functionObject);
|
|
|
- status.setFunctions(functionObjects);
|
|
|
+ status.setValue("#root[code]=='0000'?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);
|
|
@@ -734,14 +734,20 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
head.setType(ValueObjectTypeEnum.BASIC.getType());
|
|
|
head.setKey("Content-Type");
|
|
|
head.setValue("application/json");
|
|
|
+ KeyValueObject head1=new KeyValueObject();
|
|
|
+ head1.setKey("channel");
|
|
|
+ head1.setType(ValueObjectTypeEnum.BASIC.getType());
|
|
|
+ head1.setValue(jsonObject.getString("channel"));
|
|
|
headers.add(head);
|
|
|
+ headers.add(head1);
|
|
|
+
|
|
|
httpApiConfig.setHeader(headers);
|
|
|
JSONObject body=new JSONObject();
|
|
|
KeyValueObject attackPhone=new KeyValueObject();
|
|
|
attackPhone.setType("spel");
|
|
|
attackPhone.setValue("#param.user.phoneMd5");
|
|
|
- body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
- body.put("phoneNo","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+ body.put("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
//主体
|
|
|
httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
|
|
@@ -826,4 +832,131 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
log.info("huixin api {}",jsonString);
|
|
|
return httpApiConfig;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 惠众直贷api对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:07
|
|
|
+ */
|
|
|
+ public void generateHuiZhongZhiConfig(String openApiConfig){
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Huizhong01");
|
|
|
+ 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(createHuiZhongCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 惠众直贷api Config
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:08
|
|
|
+ */
|
|
|
+ private HttpApiConfig createHuiZhongZhiCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"/api/user/check");
|
|
|
+ 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");
|
|
|
+ body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+ body.put("phoneNo","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]");
|
|
|
+ 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("huizhong api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 愉快花api对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:07
|
|
|
+ */
|
|
|
+ public void generateYuKuaiHuaConfig(String openApiConfig){
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":YuKuaiHua");
|
|
|
+ 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(createYuKuaiHuaCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createYuKuaiHuaCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"api/External/hit_library");
|
|
|
+ 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");
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+ body.put("userPhone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]==1?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("YuKuaiHua api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
}
|