|
|
|
|
@ -5,6 +5,7 @@ import java.io.FileWriter;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.net.http.HttpResponse;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@ -139,19 +140,28 @@ public class PostplusServiceBean extends ScheduledServiceBean implements Postplu
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StatusResponse updateProductionStatus(String apiName, String intfID) {
|
|
|
|
|
HttpResponse<String> hresp = new WebClient().post(req ->
|
|
|
|
|
req.uri(conf.productionStatusURL())
|
|
|
|
|
.json(json)
|
|
|
|
|
.data("apiKey", conf.api(apiName).getKey())
|
|
|
|
|
.data("inputCode", intfID)
|
|
|
|
|
);
|
|
|
|
|
String body = hresp.body();
|
|
|
|
|
log().debug("response:\n{}", body);
|
|
|
|
|
|
|
|
|
|
StatusResponse resp = json.parse(body, StatusResponse.class);
|
|
|
|
|
logProductionStatus(resp);
|
|
|
|
|
return resp;
|
|
|
|
|
public Map<String, StatusResponse> updateProductionStatus(String apiName, List<String> intfIDs) {
|
|
|
|
|
String apiKey = conf.api(apiName).getKey();
|
|
|
|
|
String productionStatusURL = conf.productionStatusURL();
|
|
|
|
|
LinkedHashMap<String, StatusResponse> responses = new LinkedHashMap<>();
|
|
|
|
|
WebClient webClient = new WebClient();
|
|
|
|
|
|
|
|
|
|
for (String intfID: intfIDs) {
|
|
|
|
|
HttpResponse<String> hresp = webClient.post(req ->
|
|
|
|
|
req.uri(productionStatusURL)
|
|
|
|
|
.json(json)
|
|
|
|
|
.data("apiKey", apiKey)
|
|
|
|
|
.data("inputCode", intfID)
|
|
|
|
|
);
|
|
|
|
|
String body = hresp.body();
|
|
|
|
|
log().debug("response:\n{}", body);
|
|
|
|
|
|
|
|
|
|
StatusResponse resp = json.parse(body, StatusResponse.class);
|
|
|
|
|
responses.put(intfID, resp);
|
|
|
|
|
}
|
|
|
|
|
responses.values().forEach(this::logProductionStatus);
|
|
|
|
|
|
|
|
|
|
return responses;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void logProductionStatus(StatusResponse resp) {
|
|
|
|
|
|