|
@@ -139,6 +139,271 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
egApiEndpointService.save(egApiEndpointDo);
|
|
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.setApiCode(egApiDo.getApiCode());
|
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
|
+ egApiEndpointDo.setApiConfig(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.setApiCode(egApiDo.getApiCode());
|
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
|
+ egApiEndpointDo.setApiConfig(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]");
|
|
|
|
+ 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.setApiCode(egApiDo.getApiCode());
|
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
|
+ egApiEndpointDo.setApiConfig(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("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 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.setApiCode(egApiDo.getApiCode());
|
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
|
+ egApiEndpointDo.setApiConfig(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("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转化
|
|
* @description: 鑫鹿api转化
|
|
* @author zhangyy
|
|
* @author zhangyy
|