From 2e3064dba03d59353e167dcc8987f0329fdc973e Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 31 Jan 2024 15:17:19 +0000 Subject: [PATCH 1/8] [PAGOPA-1488] renewal debt positions: first CRON JOB impl --- helm/Chart.yaml | 4 +- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi_external.json | 2 +- openapi/openapi_external_massive.json | 2 +- openapi/openapi_internal.json | 2 +- openapi/openapi_send.json | 2 +- pom.xml | 2 +- .../debtposition/config/SchedulerConfig.java | 2 - .../debtposition/entity/PaymentOption.java | 4 + .../entity/PaymentOptionMetadata.java | 4 + .../debtposition/entity/PaymentPosition.java | 5 + .../pagopa/debtposition/entity/Transfer.java | 4 + .../debtposition/entity/TransferMetadata.java | 4 + .../scheduler/HistoricizationScheduler.java | 92 +++++++++++++++++++ .../debtposition/scheduler/Scheduler.java | 4 + src/main/resources/application-h2.properties | 5 + src/main/resources/application.properties | 7 ++ src/test/resources/application.properties | 5 + 20 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java diff --git a/helm/Chart.yaml b/helm/Chart.yaml index cb601502..b070b6cc 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-gpd-core description: micro-service to manage Creditor Institution debtor positions type: application -version: 0.84.0 -appVersion: 0.11.0 +version: 0.85.0 +appVersion: 0.11.1 dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 541c28a5..d6b34ada 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 3bbd05c4..09f3507f 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index b3556a42..f1d9e376 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi_external.json b/openapi/openapi_external.json index 7104fe0b..f435a06a 100644 --- a/openapi/openapi_external.json +++ b/openapi/openapi_external.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_external_massive.json b/openapi/openapi_external_massive.json index fefa81a5..658ef220 100644 --- a/openapi/openapi_external_massive.json +++ b/openapi/openapi_external_massive.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index cc6bf852..5a1c5dec 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_send.json b/openapi/openapi_send.json index c4312d56..a4986d4d 100644 --- a/openapi/openapi_send.json +++ b/openapi/openapi_send.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 63c0d8c6..32d2202a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ it.gov.pagopa.debtposition gpd - 0.11.0 + 0.11.1 Gestione Posizioni Debitorie Progetto Gestione Posizioni Debitorie diff --git a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java index 03de0521..6bd1b6fe 100644 --- a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java +++ b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java @@ -1,6 +1,5 @@ package it.gov.pagopa.debtposition.config; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -8,7 +7,6 @@ @Configuration @EnableScheduling @EnableAsync -@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class SchedulerConfig { } diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java index 72cd70eb..f25f9a84 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java @@ -24,6 +24,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import it.gov.pagopa.debtposition.model.enumeration.PaymentOptionStatus; import lombok.AllArgsConstructor; import lombok.Builder; @@ -49,6 +52,7 @@ columnNames = {"iuv", "organization_fiscal_code"}) }, indexes = @Index(name = "payment_option_payment_position_id_idx", columnList = "payment_position_id")) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionId") public class PaymentOption implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java index c20b4c19..7844e148 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java @@ -15,6 +15,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -32,6 +35,7 @@ @AllArgsConstructor @Entity @Builder +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionMetadataId") public class PaymentOptionMetadata implements Serializable { diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java index e42d09f8..c563b47a 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java @@ -10,6 +10,10 @@ import javax.persistence.*; import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import java.io.Serializable; import java.time.LocalDateTime; import java.util.ArrayList; @@ -32,6 +36,7 @@ }, indexes = @Index(name = "payment_position_status_validity_date_idx", columnList = "status, validity_date") ) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentPositionId") public class PaymentPosition implements Serializable { diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java b/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java index fc372e19..9e903b20 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java @@ -23,6 +23,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import it.gov.pagopa.debtposition.model.enumeration.TransferStatus; import lombok.AllArgsConstructor; import lombok.Builder; @@ -50,6 +53,7 @@ columnNames = {"iuv", "organization_fiscal_code", "transfer_id"}) }, indexes = @Index(name = "transfer_payment_option_id_idx", columnList = "payment_option_id")) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferId") public class Transfer implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java b/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java index 89860724..69611579 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java @@ -15,6 +15,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -32,6 +35,7 @@ @AllArgsConstructor @Entity @Builder +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferMetadataId") public class TransferMetadata implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java new file mode 100644 index 00000000..3533bf6d --- /dev/null +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java @@ -0,0 +1,92 @@ +package it.gov.pagopa.debtposition.scheduler; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.transaction.Transactional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import it.gov.pagopa.debtposition.entity.PaymentPosition; +import it.gov.pagopa.debtposition.repository.PaymentPositionRepository; +import lombok.extern.slf4j.Slf4j; + +@Component +@Slf4j +@ConditionalOnProperty(name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) +public class HistoricizationScheduler { + + private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; + private static final String CRON_JOB = "CRON JOB"; + private static final String METHOD = "manageDebtPositionsToHistoricize"; + private Thread threadOfExecution; + + @Value("${cron.job.schedule.extraction.history.query:SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1}") + private String extractionQuery; + @Value("${cron.job.schedule.extraction.history.query.interval:1}") + private byte extractionInterval; + + @Autowired + private PaymentPositionRepository paymentPositionRepository; + @PersistenceUnit + private EntityManagerFactory emf; + + + @Scheduled(cron = "${cron.job.schedule.expression.historicization.debt.positions}") + @Async + @Transactional + public void manageDebtPositionsToHistoricize() throws JsonProcessingException { + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "Running at " + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()))); + EntityManager em = emf.createEntityManager(); + LocalDateTime ldt = LocalDateTime.now().minusYears(extractionInterval); + List ppList = em.createQuery(extractionQuery, PaymentPosition.class).setParameter(1,ldt).getResultList(); + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "Number of extracted rows to historicize: " + ppList.size())); + + Map> ppListByOrganizationFiscalCode = ppList.stream() + .collect(Collectors.groupingBy(p -> p.getOrganizationFiscalCode(), Collectors.mapping((PaymentPosition p) -> p, Collectors.toList()))); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + + for (Entry> entry : ppListByOrganizationFiscalCode.entrySet()) { + List organizationPpList = ppListByOrganizationFiscalCode.get(entry.getKey()); + for (PaymentPosition pp: organizationPpList) { + pp.getPaymentOption().forEach(po -> { + // TODO write on azure table storage 'table1' to persist the debt position info + //System.out.print("["); + //System.out.print(entry.getKey() +","+po.getIuv()+","+po.getPaymentDate()+","+pp.getIupd()); + //System.out.print("]"); + }); + // TODO write on azure table storage 'table2' to persist the debt position json + //System.out.print("("); + //System.out.print(entry.getKey() +","+pp.getIupd()+","+objectMapper.writeValueAsString(pp)); + //System.out.print(")"); + } + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "historicized n. "+organizationPpList.size()+" debt positions for the organization fiscal code: " +entry.getKey())); + } + + // historicized debt positions are removed + //paymentPositionRepository.deleteAll(ppList); + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "deleted historicized debt positions")); + } + + public Thread getThreadOfExecution() { + return this.threadOfExecution; + } +} diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java index 60069e6e..7bfc5474 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java @@ -4,6 +4,7 @@ import it.gov.pagopa.debtposition.repository.PaymentPositionRepository; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -15,6 +16,7 @@ @Component @Slf4j +@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class Scheduler { private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; @@ -34,6 +36,7 @@ public void changeDebtPositionStatusToValid() { this.threadOfExecution = Thread.currentThread(); } + @Scheduled(cron = "${cron.job.schedule.expression.expired.status}") @Async @Transactional @@ -44,6 +47,7 @@ public void changeDebtPositionStatusToExpired() { log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "changeDebtPositionStatusToExpired", "Number of updated rows " + numAffectedRows)); this.threadOfExecution = Thread.currentThread(); } + public Thread getThreadOfExecution() { return this.threadOfExecution; diff --git a/src/main/resources/application-h2.properties b/src/main/resources/application-h2.properties index cf4f51f3..b232f88c 100644 --- a/src/main/resources/application-h2.properties +++ b/src/main/resources/application-h2.properties @@ -36,6 +36,11 @@ cron.job.schedule.enabled=false cron.job.schedule.expression.valid.status=*/35 * * * * * cron.job.schedule.expression.expired.status=*/35 * * * * * +cron.job.schedule.historicization.enabled=true +cron.job.schedule.expression.historicization.debt.positions=*/55 * * * * * +cron.job.schedule.extraction.history.query =SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1 +cron.job.schedule.extraction.history.query.interval=0 + # Flyway settings spring.flyway.schemas=apd diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f6b2f4f5..0085b842 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -34,6 +34,13 @@ cron.job.schedule.enabled = ${CRON_JOB_SCHEDULE_ENABLED} cron.job.schedule.expression.valid.status = ${CRON_JOB_SCHEDULE_EXPRESSION_TO_VALID} cron.job.schedule.expression.expired.status = ${CRON_JOB_SCHEDULE_EXPRESSION_TO_EXPIRED} +cron.job.schedule.historicization.enabled = ${CRON_JOB_SCHEDULE_HISTORICIZATION_ENABLED} +cron.job.schedule.expression.historicization.debt.positions = ${CRON_JOB_SCHEDULE_EXPRESSION_HISTORICIZATION_DEBT_POS} +cron.job.schedule.extraction.history.query = ${CRON_JOB_SCHEDULE_EXTRACTION_HISTORY_QUERY} +# The time, in years, to be subtracted from the current date to decide how old, the debt positions to be historicized, must be (default 1 year) +cron.job.schedule.extraction.history.query.interval = ${CRON_JOB_SCHEDULE_EXTRACTION_HISTORY_QUERY_INTERVAL} + + # Max num. of days for the recovery of debt positions max.days.interval = ${MAX_DAYS_INTERVAL:#{'30'}} diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 8488c216..d92bcab5 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -31,6 +31,11 @@ cron.job.schedule.enabled=false cron.job.schedule.expression.valid.status=*/35 * * * * * cron.job.schedule.expression.expired.status =*/55 * * * * * +cron.job.schedule.historicization.enabled=false +cron.job.schedule.expression.historicization.debt.positions=*/55 * * * * * +cron.job.schedule.extraction.history.query =SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1 +cron.job.schedule.extraction.history.query.interval=0 + # Max num. of days for the recovery of debt positions max.days.interval = 30 From fcb1cf89d8eadba5c246b2763873468ee4567ec9 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Wed, 31 Jan 2024 15:17:19 +0000 Subject: [PATCH 2/8] [PAGOPA-1488] renewal debt positions: writing on azure table --- helm/Chart.yaml | 4 +- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi_external.json | 2 +- openapi/openapi_external_massive.json | 2 +- openapi/openapi_internal.json | 2 +- openapi/openapi_send.json | 2 +- pom.xml | 16 +- .../debtposition/config/SchedulerConfig.java | 2 - .../debtposition/entity/PaymentOption.java | 4 + .../entity/PaymentOptionMetadata.java | 4 + .../debtposition/entity/PaymentPosition.java | 5 + .../pagopa/debtposition/entity/Transfer.java | 4 + .../debtposition/entity/TransferMetadata.java | 4 + .../scheduler/HistoricizationScheduler.java | 148 ++++++++++++++++++ .../debtposition/scheduler/Scheduler.java | 4 + src/main/resources/application-h2.properties | 10 ++ src/main/resources/application.properties | 11 ++ src/test/resources/application.properties | 10 ++ 20 files changed, 228 insertions(+), 12 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java diff --git a/helm/Chart.yaml b/helm/Chart.yaml index cb601502..b070b6cc 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-gpd-core description: micro-service to manage Creditor Institution debtor positions type: application -version: 0.84.0 -appVersion: 0.11.0 +version: 0.85.0 +appVersion: 0.11.1 dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 541c28a5..d6b34ada 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 3bbd05c4..09f3507f 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index b3556a42..f1d9e376 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.0" + tag: "0.11.1" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi_external.json b/openapi/openapi_external.json index 7104fe0b..f435a06a 100644 --- a/openapi/openapi_external.json +++ b/openapi/openapi_external.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_external_massive.json b/openapi/openapi_external_massive.json index fefa81a5..658ef220 100644 --- a/openapi/openapi_external_massive.json +++ b/openapi/openapi_external_massive.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index cc6bf852..5a1c5dec 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/openapi/openapi_send.json b/openapi/openapi_send.json index c4312d56..a4986d4d 100644 --- a/openapi/openapi_send.json +++ b/openapi/openapi_send.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.0" + "version": "0.11.1" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 63c0d8c6..0bb89f20 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ it.gov.pagopa.debtposition gpd - 0.11.0 + 0.11.1 Gestione Posizioni Debitorie Progetto Gestione Posizioni Debitorie @@ -21,6 +21,8 @@ 2.13.1 8.5.10 3.1.8 + 12.3.18 + 1.45.1 @@ -55,6 +57,18 @@ springdoc-openapi-ui ${springdoc-version} + + + com.azure + azure-core + ${azure.core.version} + + + com.azure + azure-data-tables + ${azure.data.table.version} + + org.springframework.boot spring-boot-devtools diff --git a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java index 03de0521..6bd1b6fe 100644 --- a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java +++ b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java @@ -1,6 +1,5 @@ package it.gov.pagopa.debtposition.config; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -8,7 +7,6 @@ @Configuration @EnableScheduling @EnableAsync -@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class SchedulerConfig { } diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java index 72cd70eb..f25f9a84 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOption.java @@ -24,6 +24,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import it.gov.pagopa.debtposition.model.enumeration.PaymentOptionStatus; import lombok.AllArgsConstructor; import lombok.Builder; @@ -49,6 +52,7 @@ columnNames = {"iuv", "organization_fiscal_code"}) }, indexes = @Index(name = "payment_option_payment_position_id_idx", columnList = "payment_position_id")) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionId") public class PaymentOption implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java index c20b4c19..7844e148 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentOptionMetadata.java @@ -15,6 +15,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -32,6 +35,7 @@ @AllArgsConstructor @Entity @Builder +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionMetadataId") public class PaymentOptionMetadata implements Serializable { diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java index e42d09f8..c563b47a 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/PaymentPosition.java @@ -10,6 +10,10 @@ import javax.persistence.*; import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import java.io.Serializable; import java.time.LocalDateTime; import java.util.ArrayList; @@ -32,6 +36,7 @@ }, indexes = @Index(name = "payment_position_status_validity_date_idx", columnList = "status, validity_date") ) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentPositionId") public class PaymentPosition implements Serializable { diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java b/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java index fc372e19..9e903b20 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java @@ -23,6 +23,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import it.gov.pagopa.debtposition.model.enumeration.TransferStatus; import lombok.AllArgsConstructor; import lombok.Builder; @@ -50,6 +53,7 @@ columnNames = {"iuv", "organization_fiscal_code", "transfer_id"}) }, indexes = @Index(name = "transfer_payment_option_id_idx", columnList = "payment_option_id")) +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferId") public class Transfer implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java b/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java index 89860724..69611579 100644 --- a/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java +++ b/src/main/java/it/gov/pagopa/debtposition/entity/TransferMetadata.java @@ -15,6 +15,9 @@ import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -32,6 +35,7 @@ @AllArgsConstructor @Entity @Builder +@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferMetadataId") public class TransferMetadata implements Serializable { /** diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java new file mode 100644 index 00000000..504a250c --- /dev/null +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java @@ -0,0 +1,148 @@ +package it.gov.pagopa.debtposition.scheduler; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.transaction.Transactional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.azure.data.tables.TableClient; +import com.azure.data.tables.TableClientBuilder; +import com.azure.data.tables.models.TableEntity; +import com.azure.data.tables.models.TableErrorCode; +import com.azure.data.tables.models.TableServiceException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import it.gov.pagopa.debtposition.entity.PaymentOption; +import it.gov.pagopa.debtposition.entity.PaymentPosition; +import it.gov.pagopa.debtposition.repository.PaymentPositionRepository; +import lombok.extern.slf4j.Slf4j; + +@Component +@Slf4j +@ConditionalOnProperty(name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) +public class HistoricizationScheduler { + + private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; + private static final String CRON_JOB = "CRON JOB"; + private static final String METHOD = "manageDebtPositionsToHistoricize"; + private Thread threadOfExecution; + private TableClient tableClient; + + @Value("${cron.job.schedule.extraction.history.query:SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1}") + private String extractionQuery; + @Value("${cron.job.schedule.extraction.history.query.interval:365}") + private short extractionInterval; + @Value("${azure.archive.storage.connection}") + private String archiveStorageConnection; + @Value("${azure.archive.storage.table.po:pagopadweugpsarchivesapaymentoptiontable}") + private String archiveStoragePOTable; + @Value("${azure.archive.storage.table.pp:pagopadweugpsarchivesapaymentpositiontable}") + private String archiveStoragePPTable; + + @Autowired + private PaymentPositionRepository paymentPositionRepository; + @PersistenceUnit + private EntityManagerFactory emf; + + + @Scheduled(cron = "${cron.job.schedule.expression.historicization.debt.positions}") + @Async + @Transactional + public void manageDebtPositionsToHistoricize() throws JsonProcessingException, TableServiceException { + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "Running at " + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()))); + EntityManager em = emf.createEntityManager(); + LocalDateTime ldt = LocalDateTime.now().minusDays(extractionInterval); + List ppList = em.createQuery(extractionQuery, PaymentPosition.class).setParameter(1,ldt).getResultList(); + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "Number of extracted rows to historicize: " + ppList.size())); + + Map> ppListByOrganizationFiscalCode = ppList.stream() + .collect(Collectors.groupingBy(p -> p.getOrganizationFiscalCode(), Collectors.mapping((PaymentPosition p) -> p, Collectors.toList()))); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + + for (Entry> entry : ppListByOrganizationFiscalCode.entrySet()) { + List organizationPpList = ppListByOrganizationFiscalCode.get(entry.getKey()); + for (PaymentPosition pp: organizationPpList) { + pp.getPaymentOption().forEach(po -> { + // write on azure table storage to persist the PO debt position info + this.saveToPOTable(entry.getKey(), pp, po); + }); + // write on azure table storage to persist the PP debt position info and json + this.saveToPPTable(entry.getKey(), pp, objectMapper); + } + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "historicized n. "+organizationPpList.size()+" debt positions for the organization fiscal code: " +entry.getKey())); + } + + // historicized debt positions are removed + //paymentPositionRepository.deleteAll(ppList); + log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, METHOD, "deleted historicized debt positions")); + } + + public Thread getThreadOfExecution() { + return this.threadOfExecution; + } + + private void saveToPOTable(String organizationFiscalCode, PaymentPosition pp, PaymentOption po) { + tableClient = new TableClientBuilder() + .connectionString(archiveStorageConnection) + .tableName(archiveStoragePOTable) + .buildClient(); + TableEntity tableEntity = new TableEntity(organizationFiscalCode, po.getIuv()); + try { + Map properties = new HashMap<>(); + properties.put("PaymentDate", po.getPaymentDate()); + properties.put("IUPD", pp.getIupd()); + tableEntity.setProperties(properties); + tableClient.createEntity(tableEntity); + } catch (TableServiceException e) { + if (e.getValue().getErrorCode() == TableErrorCode.ENTITY_ALREADY_EXISTS) { + tableClient.updateEntity(tableEntity); + } else { + log.error(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "saveToPOTable", + "error while storing the table information [organizationFiscalCode="+organizationFiscalCode+", iuv="+po.getIuv()+"]"), e); + throw e; + } + } + } + + private void saveToPPTable(String organizationFiscalCode, PaymentPosition pp, ObjectMapper objectMapper) + throws JsonProcessingException { + tableClient = new TableClientBuilder() + .connectionString(archiveStorageConnection) + .tableName(archiveStoragePPTable) + .buildClient(); + TableEntity tableEntity = new TableEntity(organizationFiscalCode, pp.getIupd()); + try { + Map properties = new HashMap<>(); + properties.put("PaymentPosition", objectMapper.writeValueAsString(pp)); + tableEntity.setProperties(properties); + tableClient.createEntity(tableEntity); + } catch (TableServiceException e) { + if (e.getValue().getErrorCode() == TableErrorCode.ENTITY_ALREADY_EXISTS) { + tableClient.updateEntity(tableEntity); + } else { + log.error(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "saveToPPTable", + "error while storing the table information [organizationFiscalCode="+organizationFiscalCode+", iupd="+pp.getIupd()+"]"), e); + throw e; + } + } + } +} diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java index 60069e6e..7bfc5474 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java @@ -4,6 +4,7 @@ import it.gov.pagopa.debtposition.repository.PaymentPositionRepository; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -15,6 +16,7 @@ @Component @Slf4j +@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class Scheduler { private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; @@ -34,6 +36,7 @@ public void changeDebtPositionStatusToValid() { this.threadOfExecution = Thread.currentThread(); } + @Scheduled(cron = "${cron.job.schedule.expression.expired.status}") @Async @Transactional @@ -44,6 +47,7 @@ public void changeDebtPositionStatusToExpired() { log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "changeDebtPositionStatusToExpired", "Number of updated rows " + numAffectedRows)); this.threadOfExecution = Thread.currentThread(); } + public Thread getThreadOfExecution() { return this.threadOfExecution; diff --git a/src/main/resources/application-h2.properties b/src/main/resources/application-h2.properties index cf4f51f3..8690ff3d 100644 --- a/src/main/resources/application-h2.properties +++ b/src/main/resources/application-h2.properties @@ -36,6 +36,16 @@ cron.job.schedule.enabled=false cron.job.schedule.expression.valid.status=*/35 * * * * * cron.job.schedule.expression.expired.status=*/35 * * * * * +cron.job.schedule.historicization.enabled=true +cron.job.schedule.expression.historicization.debt.positions=*/55 * * * * * +cron.job.schedule.extraction.history.query =SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1 +# The time, in days, to be subtracted from the current date to decide how old, the debt positions to be historicized, must be (default 365 days) +cron.job.schedule.extraction.history.query.interval=0 + +azure.archive.storage.connection=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +azure.archive.storage.table.po=pagopadweugpsarchivesapaymentoptiontable +azure.archive.storage.table.pp=pagopadweugpsarchivesapaymentpositiontable + # Flyway settings spring.flyway.schemas=apd diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f6b2f4f5..1f317cb2 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -34,6 +34,17 @@ cron.job.schedule.enabled = ${CRON_JOB_SCHEDULE_ENABLED} cron.job.schedule.expression.valid.status = ${CRON_JOB_SCHEDULE_EXPRESSION_TO_VALID} cron.job.schedule.expression.expired.status = ${CRON_JOB_SCHEDULE_EXPRESSION_TO_EXPIRED} +cron.job.schedule.historicization.enabled = ${CRON_JOB_SCHEDULE_HISTORICIZATION_ENABLED} +cron.job.schedule.expression.historicization.debt.positions = ${CRON_JOB_SCHEDULE_EXPRESSION_HISTORICIZATION_DEBT_POS} +cron.job.schedule.extraction.history.query = ${CRON_JOB_SCHEDULE_EXTRACTION_HISTORY_QUERY} +# The time, in days, to be subtracted from the current date to decide how old, the debt positions to be historicized, must be (default 365 days) +cron.job.schedule.extraction.history.query.interval = ${CRON_JOB_SCHEDULE_EXTRACTION_HISTORY_QUERY_INTERVAL} + +azure.archive.storage.connection=${ARCHIVE_SA_CONNECTION_STRING} +azure.archive.storage.table.po=${ARCHIVE_SA_PO_TABLE} +azure.archive.storage.table.pp=${ARCHIVE_SA_PP_TABLE} + + # Max num. of days for the recovery of debt positions max.days.interval = ${MAX_DAYS_INTERVAL:#{'30'}} diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 8488c216..fda594a3 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -31,6 +31,16 @@ cron.job.schedule.enabled=false cron.job.schedule.expression.valid.status=*/35 * * * * * cron.job.schedule.expression.expired.status =*/55 * * * * * +cron.job.schedule.historicization.enabled=false +cron.job.schedule.expression.historicization.debt.positions=*/55 * * * * * +cron.job.schedule.extraction.history.query =SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1 +# The time, in days, to be subtracted from the current date to decide how old, the debt positions to be historicized, must be (default 365 days) +cron.job.schedule.extraction.history.query.interval=0 + +azure.archive.storage.connection=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +azure.archive.storage.table.po=pagopadweugpsarchivesapaymentoptiontable +azure.archive.storage.table.pp=pagopadweugpsarchivesapaymentpositiontable + # Max num. of days for the recovery of debt positions max.days.interval = 30 From a91b57c112d3f26de568911301be4a047a346c56 Mon Sep 17 00:00:00 2001 From: aacitelli Date: Wed, 7 Feb 2024 12:22:19 +0100 Subject: [PATCH 3/8] [PAGOPA-1488] renewal debt positions: typo --- .../pagopa/debtposition/scheduler/HistoricizationScheduler.java | 2 +- .../java/it/gov/pagopa/debtposition/scheduler/Scheduler.java | 2 +- src/main/resources/application-h2.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java index 71cbf33b..a1c3b013 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java @@ -39,7 +39,7 @@ @Component @Slf4j -@ConditionalOnProperty(prefix = "archiving-service", name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) @NoArgsConstructor public class HistoricizationScheduler { diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java index 053e8065..7bfc5474 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java @@ -16,7 +16,7 @@ @Component @Slf4j -@ConditionalOnProperty(prefix = "status-change-service", name = "cron.job.schedule.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class Scheduler { private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; diff --git a/src/main/resources/application-h2.properties b/src/main/resources/application-h2.properties index 18d02f08..414fb54b 100644 --- a/src/main/resources/application-h2.properties +++ b/src/main/resources/application-h2.properties @@ -14,7 +14,7 @@ management.health.readinessState.enabled=true management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95, 0.99 # Database settings -spring.datasource.url=jdbc:h2:mem:db;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS APD\\;SET SCHEMA APD +spring.datasource.url=jdbc:h2:mem:db;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS APD\\;SET SCHEMA APD\\;CREATE TABLE IF NOT EXISTS APD.shedlock (name VARCHAR(64),lock_until TIMESTAMP(3) NULL,locked_at TIMESTAMP(3) NULL,locked_by VARCHAR(255),PRIMARY KEY (name)) spring.datasource.username=sa spring.datasource.password=sa spring.datasource.driver-class-name=org.h2.Driver From 93fed17acbb3f2b969d757e0fb27e62d0b5ef54d Mon Sep 17 00:00:00 2001 From: aacitelli Date: Wed, 7 Feb 2024 12:22:19 +0100 Subject: [PATCH 4/8] [PAGOPA-1488] renewal debt positions: sonar issue --- .../debtposition/scheduler/HistoricizationScheduler.java | 8 ++++---- .../it/gov/pagopa/debtposition/scheduler/Scheduler.java | 2 +- src/main/resources/application-h2.properties | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java index 71cbf33b..ec104d14 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java @@ -39,7 +39,7 @@ @Component @Slf4j -@ConditionalOnProperty(prefix = "archiving-service", name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "cron.job.schedule.historicization.enabled", matchIfMissing = true) @NoArgsConstructor public class HistoricizationScheduler { @@ -179,10 +179,10 @@ private void archivesDebtPositions(List ppList) throws JsonProc for (Entry> entry : ppListByOrganizationFiscalCode.entrySet()) { List organizationPpList = ppListByOrganizationFiscalCode.get(entry.getKey()); for (PaymentPosition pp: organizationPpList) { - pp.getPaymentOption().forEach(po -> { + pp.getPaymentOption().forEach(po -> // write on azure table storage to persist the PO debt position info - this.saveToPOTable(entry.getKey(), pp, po); - }); + this.saveToPOTable(entry.getKey(), pp, po) + ); // write on azure table storage to persist the PP debt position info and json this.saveToPPTable(entry.getKey(), pp, objectMapper); } diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java index 053e8065..7bfc5474 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/Scheduler.java @@ -16,7 +16,7 @@ @Component @Slf4j -@ConditionalOnProperty(prefix = "status-change-service", name = "cron.job.schedule.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true) public class Scheduler { private static final String LOG_BASE_HEADER_INFO = "[OperationType: %s] - [ClassMethod: %s] - [MethodParamsToLog: %s]"; diff --git a/src/main/resources/application-h2.properties b/src/main/resources/application-h2.properties index 18d02f08..414fb54b 100644 --- a/src/main/resources/application-h2.properties +++ b/src/main/resources/application-h2.properties @@ -14,7 +14,7 @@ management.health.readinessState.enabled=true management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95, 0.99 # Database settings -spring.datasource.url=jdbc:h2:mem:db;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS APD\\;SET SCHEMA APD +spring.datasource.url=jdbc:h2:mem:db;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS APD\\;SET SCHEMA APD\\;CREATE TABLE IF NOT EXISTS APD.shedlock (name VARCHAR(64),lock_until TIMESTAMP(3) NULL,locked_at TIMESTAMP(3) NULL,locked_by VARCHAR(255),PRIMARY KEY (name)) spring.datasource.username=sa spring.datasource.password=sa spring.datasource.driver-class-name=org.h2.Driver From 52460726b85b64c94a473017b7187241a49f0152 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 12 Feb 2024 08:25:12 +0000 Subject: [PATCH 5/8] Bump to version 0.11.1-1-PAGOPA-1488-renewal-debt-positions [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi_external.json | 2 +- openapi/openapi_external_massive.json | 2 +- openapi/openapi_internal.json | 2 +- openapi/openapi_send.json | 2 +- pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index b070b6cc..3d97c171 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-gpd-core description: micro-service to manage Creditor Institution debtor positions type: application -version: 0.85.0 -appVersion: 0.11.1 +version: 0.86.0 +appVersion: 0.11.1-1-PAGOPA-1488-renewal-debt-positions dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 13d74074..65d73bf5 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1" + tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 4ecede5e..0e77f1ee 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1" + tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index e8fce721..3049f17d 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1" + tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi_external.json b/openapi/openapi_external.json index f435a06a..72ded529 100644 --- a/openapi/openapi_external.json +++ b/openapi/openapi_external.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1" + "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_external_massive.json b/openapi/openapi_external_massive.json index 658ef220..2fafb8ba 100644 --- a/openapi/openapi_external_massive.json +++ b/openapi/openapi_external_massive.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1" + "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index 5a1c5dec..c018be20 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1" + "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_send.json b/openapi/openapi_send.json index a4986d4d..5a9409be 100644 --- a/openapi/openapi_send.json +++ b/openapi/openapi_send.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1" + "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 9fc08857..4e85d607 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ it.gov.pagopa.debtposition gpd - 0.11.1 + 0.11.1-1-PAGOPA-1488-renewal-debt-positions Gestione Posizioni Debitorie Progetto Gestione Posizioni Debitorie From db72d979ca05ffd0342fe60f2a86bcd2f2bb26d5 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 12 Feb 2024 08:31:42 +0000 Subject: [PATCH 6/8] Bump to version 0.11.1-2-PAGOPA-1488-renewal-debt-positions [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi_external.json | 2 +- openapi/openapi_external_massive.json | 2 +- openapi/openapi_internal.json | 2 +- openapi/openapi_send.json | 2 +- pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 3d97c171..32870362 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-gpd-core description: micro-service to manage Creditor Institution debtor positions type: application -version: 0.86.0 -appVersion: 0.11.1-1-PAGOPA-1488-renewal-debt-positions +version: 0.87.0 +appVersion: 0.11.1-2-PAGOPA-1488-renewal-debt-positions dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 65d73bf5..3b5fc886 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 0e77f1ee..0a19f328 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 3049f17d..4b8bf118 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi_external.json b/openapi/openapi_external.json index 72ded529..f7668ced 100644 --- a/openapi/openapi_external.json +++ b/openapi/openapi_external.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_external_massive.json b/openapi/openapi_external_massive.json index 2fafb8ba..3d5da14b 100644 --- a/openapi/openapi_external_massive.json +++ b/openapi/openapi_external_massive.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index c018be20..99c3e9f2 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_send.json b/openapi/openapi_send.json index 5a9409be..690d085b 100644 --- a/openapi/openapi_send.json +++ b/openapi/openapi_send.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-1-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 4e85d607..7449fe8c 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ it.gov.pagopa.debtposition gpd - 0.11.1-1-PAGOPA-1488-renewal-debt-positions + 0.11.1-2-PAGOPA-1488-renewal-debt-positions Gestione Posizioni Debitorie Progetto Gestione Posizioni Debitorie From 4f5f11dc928aa55a7619731806e3f6782ba26e3e Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 12 Feb 2024 09:05:15 +0000 Subject: [PATCH 7/8] Bump to version 0.11.1-3-PAGOPA-1488-renewal-debt-positions [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi_external.json | 2 +- openapi/openapi_external_massive.json | 2 +- openapi/openapi_internal.json | 2 +- openapi/openapi_send.json | 2 +- pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 32870362..6846adca 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-gpd-core description: micro-service to manage Creditor Institution debtor positions type: application -version: 0.87.0 -appVersion: 0.11.1-2-PAGOPA-1488-renewal-debt-positions +version: 0.88.0 +appVersion: 0.11.1-3-PAGOPA-1488-renewal-debt-positions dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 3b5fc886..70707721 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-3-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 0a19f328..b2bc3579 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-3-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 4b8bf118..138c4939 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-debt-position - tag: "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + tag: "0.11.1-3-PAGOPA-1488-renewal-debt-positions" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi_external.json b/openapi/openapi_external.json index f7668ced..4ec6f328 100644 --- a/openapi/openapi_external.json +++ b/openapi/openapi_external.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-3-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_external_massive.json b/openapi/openapi_external_massive.json index 3d5da14b..1b11a56d 100644 --- a/openapi/openapi_external_massive.json +++ b/openapi/openapi_external_massive.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-3-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index 99c3e9f2..3744615b 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-3-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/openapi/openapi_send.json b/openapi/openapi_send.json index 690d085b..71e2815b 100644 --- a/openapi/openapi_send.json +++ b/openapi/openapi_send.json @@ -4,7 +4,7 @@ "title": "PagoPA API Debt Position", "description": "Progetto Gestione Posizioni Debitorie", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.11.1-2-PAGOPA-1488-renewal-debt-positions" + "version": "0.11.1-3-PAGOPA-1488-renewal-debt-positions" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 7449fe8c..73208f49 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ it.gov.pagopa.debtposition gpd - 0.11.1-2-PAGOPA-1488-renewal-debt-positions + 0.11.1-3-PAGOPA-1488-renewal-debt-positions Gestione Posizioni Debitorie Progetto Gestione Posizioni Debitorie From 870db999ae5fc88b600a6476a2260b29151d47c0 Mon Sep 17 00:00:00 2001 From: aacitelli Date: Mon, 12 Feb 2024 10:39:44 +0100 Subject: [PATCH 8/8] [PAGOPA-1488] renewal debt positions: debug log --- .../it/gov/pagopa/debtposition/config/SchedulerConfig.java | 5 ++++- .../debtposition/scheduler/HistoricizationScheduler.java | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java index a299978b..e92bce5d 100644 --- a/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java +++ b/src/main/java/it/gov/pagopa/debtposition/config/SchedulerConfig.java @@ -3,6 +3,7 @@ import javax.sql.DataSource; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; @@ -17,9 +18,11 @@ @EnableAsync @EnableSchedulerLock(defaultLockAtMostFor = "${cron.job.schedule.history.shedlock.defaultlockatmostfor}") public class SchedulerConfig { + @Value("${spring.jpa.properties.hibernate.default_schema:apd}") + private String defaultSchema; @Bean public LockProvider lockProvider(DataSource dataSource) { - return new JdbcTemplateLockProvider(dataSource, "apd.shedlock"); + return new JdbcTemplateLockProvider(dataSource, defaultSchema+".shedlock"); } } diff --git a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java index 3f41caa5..05fbfc96 100644 --- a/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java +++ b/src/main/java/it/gov/pagopa/debtposition/scheduler/HistoricizationScheduler.java @@ -97,7 +97,7 @@ public void manageDebtPositionsToHistoricize() throws JsonProcessingException, T int numOfPages = (int)Math.ceil((float)countResult/pageSize); for (int pageNumber=0; pageNumber ppList) throws JsonProc // write on azure table storage to persist the PP debt position info and json this.upsertPPTable(entry.getKey(), pp, objectMapper); } - log.info(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "archivesDebtPositions", "historicized n. "+organizationPpList.size()+" debt positions for the organization fiscal code: " +entry.getKey())); + log.debug(String.format(LOG_BASE_HEADER_INFO, CRON_JOB, "archivesDebtPositions", "historicized n. "+organizationPpList.size()+" debt positions for the organization fiscal code: " +entry.getKey())); } } }