How to implement a cartesian product of api parame

2019-06-09 12:40发布

I have a vertx method using WebClient to receive request to an API, the method i have implemented as such.

@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;
    }

But my task is to make a cartesian product of the parameters. Each API parameter has number of values and i need to call operator API multiple times (parameter1Count * parameter2Count * parameter3Count - it's the Cartesian product) I am not sure how to implement this, I would be happy to get any suggestions thank you.

Also an idea how to go about it not sure

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+"&param2="+param2Value)
}

}

0条回答
登录 后发表回答