improved polling logi

This commit is contained in:
Prince
2026-06-12 23:48:47 +02:00
parent 573e4b154c
commit 5d3c9a46a3
3 changed files with 49 additions and 59 deletions

View File

@@ -144,19 +144,17 @@ public class ProviderService {
return meta.get("hotProductId");
}
public String getExternalId(String providerId, String productUuid) {
public String getExternalId(String providerId, String productName) {
try {
UUID productUid = UUID.fromString(productUuid);
List<SBZProductDto> products = getProviderProducts(providerId);
return products.stream()
.filter(product -> product.getUid().equals(productUid))
.filter(product -> product.getName().equals(productName))
.map(SBZProductDto::getExternalId)
.findFirst()
.orElse(null);
} catch (IllegalArgumentException e) {
log.error("Invalid UUID format: " + productUuid, e);
} catch (Exception e) {
log.error("Failed to fetch external Id: " + productName, e);
return null;
}
}