diff --git a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/client/impl/ReceiptCosmosClientImpl.java b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/client/impl/ReceiptCosmosClientImpl.java index 99c0014..fb15f67 100644 --- a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/client/impl/ReceiptCosmosClientImpl.java +++ b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/client/impl/ReceiptCosmosClientImpl.java @@ -223,11 +223,16 @@ public Iterable> getIOErrorToNotifyReceiptDocuments(String CosmosContainer cosmosContainer = cosmosDatabase.getContainer(containerId); //Build query - String query = String.format("SELECT * FROM c WHERE c.status = '%s' AND c.generated_at >= %s OFFSET 0 LIMIT %s", + // String query = String.format("SELECT * FROM c WHERE c.status = '%s' AND c.generated_at >= %s OFFSET 0 LIMIT %s", + // ReceiptStatusType.IO_ERROR_TO_NOTIFY, + // OffsetDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays( + // Long.parseLong(numDaysRecoverNotNotified)).toInstant().toEpochMilli(), + // recordsLimitRecoverNotNotified + // ); + String query = String.format("SELECT * FROM c WHERE c.status = '%s' AND c.generated_at >= %s", ReceiptStatusType.IO_ERROR_TO_NOTIFY, OffsetDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays( - Long.parseLong(numDaysRecoverNotNotified)).toInstant().toEpochMilli(), - recordsLimitRecoverNotNotified + Long.parseLong(numDaysRecoverNotNotified)).toInstant().toEpochMilli() ); //Query the container diff --git a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/utils/RecoverNotNotifiedReceiptUtils.java b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/utils/RecoverNotNotifiedReceiptUtils.java index c797668..043a1bb 100644 --- a/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/utils/RecoverNotNotifiedReceiptUtils.java +++ b/src/main/java/it/gov/pagopa/receipt/pdf/helpdesk/utils/RecoverNotNotifiedReceiptUtils.java @@ -25,9 +25,12 @@ public static Receipt restoreReceipt(Receipt receipt) { } public static List receiptMassiveRestore(ReceiptStatusType statusType, ReceiptCosmosService receiptCosmosService) { + + List receiptList = new ArrayList<>(); String continuationToken = null; do { + Iterable> feedResponseIterator = receiptCosmosService.getNotNotifiedReceiptByStatus(continuationToken, 100, statusType); @@ -37,8 +40,11 @@ public static List receiptMassiveRestore(ReceiptStatusType statusType, receiptList.add(restoredReceipt); } continuationToken = page.getContinuationToken(); + } } while (continuationToken != null); + + return receiptList; }