|
@@ -761,4 +761,69 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
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.setApiCode(egApiDo.getApiCode());
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
+ egApiEndpointDo.setApiConfig(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;
|
|
|
+ }
|
|
|
}
|