|
@@ -1,9 +1,7 @@
|
|
|
package com.hrsk.cloud.eg.infrastructure.business;
|
|
package com.hrsk.cloud.eg.infrastructure.business;
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.google.gson.JsonObject;
|
|
|
|
|
import com.hrsk.cloud.eg.constant.BusinessPrefixEnum;
|
|
import com.hrsk.cloud.eg.constant.BusinessPrefixEnum;
|
|
|
import com.hrsk.cloud.eg.domain.api.*;
|
|
import com.hrsk.cloud.eg.domain.api.*;
|
|
|
import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
|
|
import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
|
|
@@ -1128,9 +1126,9 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
body.put("mobile_md5","#"+JSONObject.toJSONString(attackPhone));
|
|
body.put("mobile_md5","#"+JSONObject.toJSONString(attackPhone));
|
|
|
|
|
|
|
|
KeyValueObject city=new KeyValueObject();
|
|
KeyValueObject city=new KeyValueObject();
|
|
|
- attackPhone.setType("spel");
|
|
|
|
|
- attackPhone.setValue("#param.user.companyCity");
|
|
|
|
|
- body.put("city","#"+JSONObject.toJSONString(attackPhone));
|
|
|
|
|
|
|
+ city.setType("spel");
|
|
|
|
|
+ city.setValue("#param.user.companyCity");
|
|
|
|
|
+ body.put("city","#"+JSONObject.toJSONString(city));
|
|
|
|
|
|
|
|
//主体
|
|
//主体
|
|
|
httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
@@ -1149,4 +1147,66 @@ public class GenerateCheckIntoHttpApiConfigService {
|
|
|
log.info("Hamigua api {}",jsonString);
|
|
log.info("Hamigua api {}",jsonString);
|
|
|
return httpApiConfig;
|
|
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.setApiCode(egApiDo.getApiCode());
|
|
|
|
|
+ egApiEndpointDo.setApiId(egApiDo.getId());
|
|
|
|
|
+ egApiEndpointDo.setApiName(jsonObject.getString("name"));
|
|
|
|
|
+ egApiEndpointDo.setApiConfig(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;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|