|
@@ -8,6 +8,7 @@ import com.hrsk.cloud.eg.domain.api.HttpApiConfig;
|
|
import com.hrsk.cloud.eg.domain.api.KeyValueObject;
|
|
import com.hrsk.cloud.eg.domain.api.KeyValueObject;
|
|
import com.hrsk.cloud.eg.domain.api.ValueObject;
|
|
import com.hrsk.cloud.eg.domain.api.ValueObject;
|
|
import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
|
|
import com.hrsk.cloud.eg.domain.api.common.ApiPayloadTypeEnum;
|
|
|
|
+import com.hrsk.cloud.eg.domain.api.common.ValueObjectTypeEnum;
|
|
import com.hrsk.cloud.eg.domain.common.utils.GsonUtils;
|
|
import com.hrsk.cloud.eg.domain.common.utils.GsonUtils;
|
|
import com.hrsk.cloud.eg.domain.common.utils.SnowflakeIdWorker;
|
|
import com.hrsk.cloud.eg.domain.common.utils.SnowflakeIdWorker;
|
|
import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
|
|
import com.hrsk.cloud.eg.infrastructure.config.client.HessianUtils;
|
|
@@ -67,19 +68,24 @@ public class GenerateHttpApiConfigService {
|
|
JSONObject jsonObject=JSONObject.parseObject(param);
|
|
JSONObject jsonObject=JSONObject.parseObject(param);
|
|
HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
HttpApiConfig httpApiConfig = new HttpApiConfig();
|
|
httpApiConfig.setUrl(jsonObject.getString("checkUrl"));
|
|
httpApiConfig.setUrl(jsonObject.getString("checkUrl"));
|
|
- httpApiConfig.setMethod("post");
|
|
|
|
|
|
+ httpApiConfig.setMethod("POST");
|
|
httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
|
|
httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
|
|
- List<KeyValueObject> header = Lists.newArrayList();
|
|
|
|
- httpApiConfig.setHeader(header);
|
|
|
|
|
|
+ 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();
|
|
JSONObject body=new JSONObject();
|
|
KeyValueObject attackPhone=new KeyValueObject();
|
|
KeyValueObject attackPhone=new KeyValueObject();
|
|
attackPhone.setType("spel");
|
|
attackPhone.setType("spel");
|
|
attackPhone.setValue("#param.user.phoneMd5");
|
|
attackPhone.setValue("#param.user.phoneMd5");
|
|
KeyValueObject merchantNo=new KeyValueObject();
|
|
KeyValueObject merchantNo=new KeyValueObject();
|
|
merchantNo.setType("spel");
|
|
merchantNo.setType("spel");
|
|
- merchantNo.setValue("#param.user.merchantNo");
|
|
|
|
- body.put("attackPhone",JSONObject.toJSONString(attackPhone));
|
|
|
|
- body.put("merchantNo",JSONObject.toJSONString(merchantNo));
|
|
|
|
|
|
+ merchantNo.setValue("#param.plan.bid");
|
|
|
|
+ body.put("attackPhone","#"+JSONObject.toJSONString(attackPhone));
|
|
|
|
+ body.put("merchantNo","#"+JSONObject.toJSONString(merchantNo));
|
|
//主体
|
|
//主体
|
|
httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
httpApiConfig.setContent(JSONObject.toJSONString(body));
|
|
String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
String jsonString = JSONObject.toJSONString(httpApiConfig);
|
|
@@ -87,44 +93,4 @@ public class GenerateHttpApiConfigService {
|
|
return httpApiConfig;
|
|
return httpApiConfig;
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
-// FunctionObject md5 = new FunctionObject();
|
|
|
|
-// md5.setCode("md5");
|
|
|
|
-// HttpApiConfig hac = new HttpApiConfig()
|
|
|
|
-// .setUrl("https://baidu.com");
|
|
|
|
-// hac.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
|
|
|
|
-// hac.setType("http");
|
|
|
|
-// List<KeyValueObject> h = Lists.newArrayList();
|
|
|
|
-// KeyValueObject h1 = new KeyValueObject();
|
|
|
|
-// h1.setKey("secretKey");
|
|
|
|
-// h1.setType("text");
|
|
|
|
-// h1.setValue("Khw99%$l%-2gF7P4jXglp_-jQqQirtYnOY5D");
|
|
|
|
-// h.add(h1);
|
|
|
|
-// KeyValueObject h2 = new KeyValueObject();
|
|
|
|
-// h2.setKey("merchantNo");
|
|
|
|
-// h2.setType("spel");
|
|
|
|
-// h2.setValue("#param.realName");
|
|
|
|
-// h.add(h2);
|
|
|
|
-// List<ValueObject> p = Lists.newArrayList();
|
|
|
|
-// ValueObject p1 = new ValueObject();
|
|
|
|
-// p1.setType("text");
|
|
|
|
-// p1.setValue("123");
|
|
|
|
-// ValueObject p2 = new ValueObject();
|
|
|
|
-// p2.setType("text");
|
|
|
|
-// p2.setValue("456");
|
|
|
|
-// p2.getFunctions().add(md5);
|
|
|
|
-// p.add(p1);
|
|
|
|
-// p.add(p2);
|
|
|
|
-// List<KeyValueObject> s = Lists.newArrayList();
|
|
|
|
-// KeyValueObject s1 = new KeyValueObject();
|
|
|
|
-// s1.setKey("username");
|
|
|
|
-// s1.setType("spel");
|
|
|
|
-// s1.setValue("#param.username");
|
|
|
|
-// KeyValueObject s2 = new KeyValueObject();
|
|
|
|
-// s2.setKey("channel");
|
|
|
|
-// s2.setType("spel");
|
|
|
|
-// s2.setValue("#param.channel");
|
|
|
|
-// s.add(s2);
|
|
|
|
-// hac.setPath(p).setSearch(s).setHeader(h).setMethod("GET");
|
|
|
|
-// hac.setContent("{\"merchant\":\"xxxxxxfffff\",\"phone\":\"{\\\"value\\\":\\\"#param.userMobile\\\",\\\"type\\\": \\\"spel\\\",\\\"functions\\\":[ {\\\"code\\\": \\\"md5\\\"}]}\"}");
|
|
|
|
}
|
|
}
|