我有一个使用WebClient的vertx方法来接收对API的请求,而我已经实现了该方法。
@Override
public YubiParserService runParserTask(String tourOperator, Handler<AsyncResult<Void>> handler) {
wc.get(443,"www.tez-tour.com", "/tariffSearch/getResult")
.addQueryParam("callback","")
.addQueryParam("_","")
.addQueryParam("priceMin", "0")
.addQueryParam("priceMax","")
.addQueryParam("currency","")
.addQueryParam("nightsMin","")
.addQueryParam("nightsMax","")
.addQueryParam("hotelClassId","")
.addQueryParam("accommodationId","")
.addQueryParam("rAndBId","")
.addQueryParam("tourType","")
.addQueryParam("locale","")
.addQueryParam("cityId","")
.addQueryParam("countryId","")
.addQueryParam("after","")
.addQueryParam("before","")
.addQueryParam("hotelInStop","")
.addQueryParam("specialInStop","")
.addQueryParam("version","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("tourId","")
.addQueryParam("hotelClassBetter","")
.addQueryParam("rAndBBetter","")
.addQueryParam("noTicketsTo","")
.addQueryParam("noTicketsFrom","")
.addQueryParam("searchTypeId","")
.addQueryParam("recommendedFlag","")
.addQueryParam("salePrivateFlag","")
.addQueryParam("onlineConfirmFlag","")
.addQueryParam("contentCountryId","")
.send(ar ->{
});
return this;
}
但是我的任务是制作参数的笛卡尔积。 每个API参数都有多个值,我需要多次调用操作员API(parameter1Count * parameter2Count * parameter3Count-这是笛卡尔乘积),我不确定如何实现,我很乐意得到任何建议,谢谢您。>
还有一个不确定的想法
param1 = {value1, value2, value3}
param2 = {value11, value22, value33}
2) and It's need to fetch API with all of these values (step by step, because of each parameter can contain single value)
for (param1Value in param1) {
for (param2Value in param2) {
webClient.request("https://api.tez-tour.com/searchtours?param1="+param1Value+"¶m2="+param2Value)
}
}