|
@@ -0,0 +1,1206 @@
|
|
|
+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.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.service.EgApiService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author zhangyy
|
|
|
+ * @version 1.0
|
|
|
+ * @description: GenerateHttpApiConfig 迁移api配置的处理类
|
|
|
+ * @date 2024/8/29 17:54
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class GenerateCheckIntoHttpApiConfigCmdExe {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private EgApiService egApiService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private EgApiEndpointService egApiEndpointService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 原始惠融对接api转化
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/8/29 17:58
|
|
|
+ */
|
|
|
+ public void generateHuiRonHuiRonApiConfig(String huiRonApiConfig){
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 对接我们openapiRsa文档转化
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/4 10:42
|
|
|
+ */
|
|
|
+ public void generateOpenApiRSAConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":OPEN_API:1");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createOpenApiRsaCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 对接我们openapiAes文档转化
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/4 10:42
|
|
|
+ */
|
|
|
+ public void generateOpenApiAesConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":OPEN_API_AES:13");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createOpenApiAesCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 庆鱼api转化 !!!暂时不支持
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/4 14:58
|
|
|
+ */
|
|
|
+ public void generateQinYuConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_QY:4");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createQinYuCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 鑫鹿api对接方式
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/5 11:06
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ public void generateXinLuConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_XL:7");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 享可达 api配置对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/5 14:31
|
|
|
+ */
|
|
|
+ public void generateXkdConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_XKD:10");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createXkdApiCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description:锦碟 api配置对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/5 14:31
|
|
|
+ */
|
|
|
+ public void generateJinDieConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_JD:5");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createJinDieCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createJinDieCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ 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");
|
|
|
+ body.put("Appid",jsonObject.getString("Appid"));
|
|
|
+ body.put("Appkey",jsonObject.getString("AppKey"));
|
|
|
+ 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]==400?0:1");
|
|
|
+// List<FunctionObject> functionObjects = Lists.newArrayList();
|
|
|
+// FunctionObject functionObject = new FunctionObject();
|
|
|
+// functionObject.setCode("resultCodeConvertStatus");
|
|
|
+// functionObjects.add(functionObject);
|
|
|
+// status.setFunctions(functionObjects);
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("xkd api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description:锦碟 api配置对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/5 14:31
|
|
|
+ */
|
|
|
+ public void generateJinDieV3Config(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_JDV3:12");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createJinDieCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createJinDieV3CheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ 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");
|
|
|
+ body.put("Appid",jsonObject.getString("Appid"));
|
|
|
+ body.put("Appkey",jsonObject.getString("AppKey"));
|
|
|
+ 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]");
|
|
|
+ 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("xkd api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description:融享客 api配置对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/5 14:31
|
|
|
+ */
|
|
|
+ public void generateRxkConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":CRM_RXK:6");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createRxkCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createRxkCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ if(null !=jsonObject.getString("private") && jsonObject.getBoolean("private")){
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("domain")+"/youka/api/user_filter/md5");
|
|
|
+ }else {
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("domain")+"/xxb-filter/api/filter/md5");
|
|
|
+ }
|
|
|
+ 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("sourceCode",jsonObject.getString("sourceCode"));
|
|
|
+ body.put("accessKey",jsonObject.getString("accessKey"));
|
|
|
+ body.put("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("");
|
|
|
+ List<FunctionObject> functionObjects = Lists.newArrayList();
|
|
|
+ FunctionObject functionObject = new FunctionObject();
|
|
|
+ functionObject.setCode("combinationCodeSuccessIsExit");
|
|
|
+ List<ValueObject> valueObjectList= Lists.newArrayList();
|
|
|
+ ValueObject valueObject = new ValueObject();
|
|
|
+ valueObject.setType(ValueObjectTypeEnum.SPEL.getType());
|
|
|
+ valueObject.setValue("#root[code]");
|
|
|
+ valueObjectList.add(valueObject);
|
|
|
+ ValueObject valueObject1 = new ValueObject();
|
|
|
+ valueObject1.setType(ValueObjectTypeEnum.SPEL.getType());
|
|
|
+ valueObject1.setValue("#root[success]");
|
|
|
+ valueObjectList.add(valueObject1);
|
|
|
+
|
|
|
+ ValueObject valueObject2 = new ValueObject();
|
|
|
+ valueObject2.setType(ValueObjectTypeEnum.SPEL.getType());
|
|
|
+ valueObject2.setValue("#root[data][phoneMd5Exist]");
|
|
|
+ valueObjectList.add(valueObject2);
|
|
|
+
|
|
|
+ functionObject.setArgs(valueObjectList);
|
|
|
+ functionObjects.add(functionObject);
|
|
|
+ status.setFunctions(functionObjects);
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("rxk api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 享可达 api转化
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/5 14:32
|
|
|
+ */
|
|
|
+ private HttpApiConfig createXkdApiCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ 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");
|
|
|
+ body.put("phone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("type",2);
|
|
|
+ body.put("tenantId",jsonObject.getString("tenantId"));
|
|
|
+ //主体
|
|
|
+ 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("xkd api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 鑫鹿api转化
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/5 11:07
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ private HttpApiConfig createXinLuApiCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ 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");
|
|
|
+ body.put("phone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("type",2);
|
|
|
+ body.put("tenantId",jsonObject.getString("tenantId"));
|
|
|
+ //主体
|
|
|
+ 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("xinLu api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 庆鱼创建api !!! 暂时不支持
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/4 14:58
|
|
|
+ */
|
|
|
+ private HttpApiConfig createQinYuCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"/openapi/interface/query/phones");
|
|
|
+ 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 data=new KeyValueObject();
|
|
|
+ data.setType("spel");
|
|
|
+ JSONObject dataJson=new JSONObject();
|
|
|
+ List<JSONObject> attackPhone=new ArrayList<>();
|
|
|
+ JSONObject phoneJson=new JSONObject();
|
|
|
+ phoneJson.put("phone","#param.user.phoneMd5");
|
|
|
+ attackPhone.add(phoneJson);
|
|
|
+ dataJson.put("customers",attackPhone);
|
|
|
+ dataJson.put("tenantId",jsonObject.getString("tenantId"));
|
|
|
+ data.setValue("#"+JSONObject.toJSONString(dataJson));
|
|
|
+ FunctionObject functionObject=new FunctionObject();
|
|
|
+ functionObject.setCode("outPrint");
|
|
|
+ data.setFunctions(Lists.newArrayList(functionObject));
|
|
|
+// log.info("qin yu input {}", JSONObject.toJSONString(data));
|
|
|
+ body.put("trafficPlatformId",jsonObject.getString("trafficPlatformId"));
|
|
|
+ body.put("data","#"+JSONObject.toJSONString(data));
|
|
|
+ List<ValueObject> args=Lists.newArrayList();
|
|
|
+ ValueObject valueObject=new ValueObject();
|
|
|
+ valueObject.setValue("#param.content.data");
|
|
|
+ args.add(valueObject);
|
|
|
+ ValueObject valueObject1=new ValueObject();
|
|
|
+ valueObject1.setValue("#param.content.trafficPlatformId");
|
|
|
+ args.add(valueObject1);
|
|
|
+ ValueObject valueObject2=new ValueObject();
|
|
|
+ valueObject1.setValue(jsonObject.getString("key"));
|
|
|
+ args.add(valueObject2);
|
|
|
+ FunctionObject functionObject1=new FunctionObject();
|
|
|
+ functionObject1.setCode("md5Sign");
|
|
|
+ functionObject1.setArgs(args);
|
|
|
+ body.put("sign","#"+JSONObject.toJSONString(functionObject1));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[data][status]");
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("qin yu api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: openapi Rsa 信息
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/4 10:56
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ private HttpApiConfig createOpenApiAesCheckIntoBean(String param) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(param);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("openapiCheckUrl"));
|
|
|
+ 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.companyCity");
|
|
|
+ body.put("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("city","#"+JSONObject.toJSONString(merchantNo));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[data][status]");
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("open api rsa{}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @description: openapi Rsa 信息
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/4 10:56
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ private HttpApiConfig createOpenApiRsaCheckIntoBean(String param) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(param);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("openapiCheckUrl"));
|
|
|
+ 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.companyCity");
|
|
|
+ body.put("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("city","#"+JSONObject.toJSONString(merchantNo));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[data][status]");
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("open api rsa{}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 创建撞库httpApi信息
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/8/30 09:31
|
|
|
+ */
|
|
|
+ public HttpApiConfig createHuiRonCheckIntoBean(String param){
|
|
|
+ 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.plan.bid");
|
|
|
+ body.put("attackPhone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("merchantNo","#"+JSONObject.toJSONString(merchantNo));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[data][status]");
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("huiRon api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 惠众api对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:07
|
|
|
+ */
|
|
|
+ public void generateHuiZhongConfig(String openApiConfig){
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Huizhong");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHuiZhongCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description:
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:08
|
|
|
+ */
|
|
|
+ private HttpApiConfig createHuiZhongCheckIntoBean(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]=='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);
|
|
|
+ log.info("huizhong api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 银华api对接方式
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 10:07
|
|
|
+ */
|
|
|
+ public void generateYinHuaConfig(String openApiConfig){
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":YinHua");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYinHuaCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createYinHuaCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"api/channel/clue/md5/_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");
|
|
|
+ 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("phoneMd5","#"+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("resultCodeConvertStatusString");
|
|
|
+ functionObjects.add(functionObject);
|
|
|
+ status.setFunctions(functionObjects);
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ log.info("yinhua api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 汇鑫对接方式
|
|
|
+ * @param threeSystemConfig
|
|
|
+ */
|
|
|
+ public void generateHuixinConfig(String threeSystemConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Huixin");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(threeSystemConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHuixinCheckIntoBean(threeSystemConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createHuixinCheckIntoBean(String threeSystemConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(threeSystemConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"pushdata.ashx?type=CheckMobilePhone");
|
|
|
+ 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("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ List<FunctionObject> functionObjects = Lists.newArrayList();
|
|
|
+ FunctionObject functionObject = new FunctionObject();
|
|
|
+ functionObject.setCode("combinationCodeSuccessIsExit");
|
|
|
+ List<ValueObject> valueObjectList= Lists.newArrayList();
|
|
|
+ ValueObject valueObject = new ValueObject();
|
|
|
+ valueObject.setType(ValueObjectTypeEnum.SPEL.getType());
|
|
|
+ valueObject.setValue("#root[code]");
|
|
|
+ valueObjectList.add(valueObject);
|
|
|
+ ValueObject valueObject1 = new ValueObject();
|
|
|
+ valueObject1.setType(ValueObjectTypeEnum.SPEL.getType());
|
|
|
+ valueObject1.setValue("#root[status]");
|
|
|
+ valueObjectList.add(valueObject1);
|
|
|
+
|
|
|
+
|
|
|
+ functionObject.setArgs(valueObjectList);
|
|
|
+ functionObjects.add(functionObject);
|
|
|
+ status.setFunctions(functionObjects);
|
|
|
+ resultObj.put("status","#"+JSONObject.toJSONString(status));
|
|
|
+ httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
|
|
|
+ String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
|
+ 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.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(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.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(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;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 易借 api生成配置
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author zhangyy
|
|
|
+ * @date: 2024/9/9 15:16
|
|
|
+ */
|
|
|
+ public void generateYinJieConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":YiJie");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYinJieCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createYinJieCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"api/third/check_loan?server=1");
|
|
|
+ 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();
|
|
|
+
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+ body.put("channel",jsonObject.getString("channel"));
|
|
|
+ KeyValueObject attackPhone=new KeyValueObject();
|
|
|
+ attackPhone.setType("spel");
|
|
|
+ attackPhone.setValue("#param.user.phoneMd5");
|
|
|
+ JSONObject data=new JSONObject();
|
|
|
+ data.put("type",102);
|
|
|
+ data.put("mobileMd5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("data","#"+JSONObject.toJSONString(data));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]==0?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("YinJie api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 有融对接api
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/9 15:40
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ public void generateYouRonConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Yourong");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createYouRonCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createYouRonCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"channel/openapi/checkuser");
|
|
|
+ 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();
|
|
|
+
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+ body.put("channelCode",jsonObject.getString("channelCode"));
|
|
|
+ KeyValueObject attackPhone=new KeyValueObject();
|
|
|
+ attackPhone.setType("spel");
|
|
|
+ attackPhone.setValue("#param.user.phoneMd5");
|
|
|
+ body.put("phone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]==0?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("YouRon api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 哈蜜瓜 对接api 配置
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/9 16:05
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ public void generateHamiguaConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Hamigua");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHamiguaCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createHamiguaCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"v1/api/customer/repeat/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();
|
|
|
+
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+// body.put("channelCode",jsonObject.getString("channelCode"));
|
|
|
+ KeyValueObject attackPhone=new KeyValueObject();
|
|
|
+ attackPhone.setType("spel");
|
|
|
+ attackPhone.setValue("#param.user.phoneMd5");
|
|
|
+ body.put("mobile_md5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+
|
|
|
+ KeyValueObject city=new KeyValueObject();
|
|
|
+ city.setType("spel");
|
|
|
+ city.setValue("#param.user.companyCity");
|
|
|
+ body.put("city","#"+JSONObject.toJSONString(city));
|
|
|
+
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]==10?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("Hamigua api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 灏瀚无崟
|
|
|
+ * @author zhangyy
|
|
|
+ * @date 2024/9/9 16:22
|
|
|
+ * @version 1.0
|
|
|
+ */
|
|
|
+ public void generateHaohanwuyinConfig(String openApiConfig) {
|
|
|
+ EgApiDo egApiDo=new EgApiDo();
|
|
|
+ egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Haohanwuyin");
|
|
|
+ egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
|
|
|
+ egApiService.save(egApiDo);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(openApiConfig);
|
|
|
+ EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
|
|
|
+
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+
|
|
|
+ egApiEndpointDo.setRequestConfig(HessianUtils.serialize(createHaohanwuyinCheckIntoBean(openApiConfig)));
|
|
|
+ egApiEndpointService.save(egApiEndpointDo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private HttpApiConfig createHaohanwuyinCheckIntoBean(String openApiConfig) {
|
|
|
+ JSONObject jsonObject=JSONObject.parseObject(openApiConfig);
|
|
|
+ HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
|
+ httpApiConfig.setUrl(jsonObject.getString("url")+"/api/customer/collisionLibrary");
|
|
|
+ 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();
|
|
|
+
|
|
|
+// body.put("channelSource",jsonObject.getString("channelSource"));
|
|
|
+// body.put("channelCode",jsonObject.getString("channelCode"));
|
|
|
+ KeyValueObject attackPhone=new KeyValueObject();
|
|
|
+ attackPhone.setType("spel");
|
|
|
+ attackPhone.setValue("#param.user.phoneMd5");
|
|
|
+ body.put("md5_phone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
+ body.put("channel_code",jsonObject.getString("channelCode"));
|
|
|
+ body.put("channel_secret_key",jsonObject.getString("channelSecretKey"));
|
|
|
+ //主体
|
|
|
+ httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
|
+ JSONObject resultObj=new JSONObject();
|
|
|
+ KeyValueObject status=new KeyValueObject();
|
|
|
+ status.setType("spel");
|
|
|
+ status.setValue("#root[code]==0?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("Haohanwuyin api {}",jsonString);
|
|
|
+ return httpApiConfig;
|
|
|
+ }
|
|
|
+}
|