Skip to content

Commit

Permalink
Issue #517
Browse files Browse the repository at this point in the history
Corretta valorizzazione della data evento, che veniva impostata con
timezone errato.
  • Loading branch information
pintorig committed Jul 29, 2022
1 parent 00765bb commit 7118861
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 70 deletions.
6 changes: 6 additions & 0 deletions jars/client-api-gde/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@
<interfaceOnly>true</interfaceOnly>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<typeMappings>
<typeMapping>OffsetDateTime=java.time.LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
</configuration>
</execution>
</executions>
Expand Down
47 changes: 22 additions & 25 deletions jars/client-api-gde/src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Lista eventi
content:
application/json:
schema:
$ref: '#/components/schemas/PagedModel'
"401":
description: Unauthorized
content:
Expand All @@ -183,6 +177,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Lista eventi
content:
application/json:
schema:
$ref: '#/components/schemas/PagedModel'
post:
tags:
- eventi
Expand Down Expand Up @@ -214,30 +214,30 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"400":
description: Bad Request
"201":
description: Evento salvato con successo
content:
application/json:
'*/*':
schema:
$ref: '#/components/schemas/problem'
type: object
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"201":
description: Evento salvato con successo
content:
'*/*':
schema:
type: object
"403":
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
/eventi/{id}:
get:
tags:
Expand Down Expand Up @@ -278,18 +278,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Dettaglio Evento
content:
application/json:
schema:
$ref: '#/components/schemas/evento'
"403":
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Dettaglio Evento
content:
application/json:
schema:
$ref: '#/components/schemas/evento'
components:
schemas:
problem:
Expand Down Expand Up @@ -337,9 +337,6 @@ components:
type: string
idFlusso:
type: string
dataFlusso:
type: string
format: date-time
idTracciato:
type: number
_links:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.govpay.core.dao.eventi.utils;

import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Date;

Expand Down Expand Up @@ -53,7 +54,8 @@ private static NuovoEvento toEventoModel(Evento context) {
}

if(context.getData() != null) {
dto.setDataEvento(context.getData().toInstant().atOffset(ZoneOffset.UTC));
dto.setDataEvento(context.getData().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
// dto.setDataEvento(context.getData().toInstant().atOffset(ZoneOffset.UTC));
}

dto.setDatiPagoPA(getDatiPagoPA(context));
Expand Down Expand Up @@ -110,14 +112,7 @@ private static NuovoEvento toEventoModel(Evento context) {

private static it.govpay.gde.v1.model.DatiPagoPA getDatiPagoPA(Evento evento) {
DatiPagoPA datiPagoPA = evento.getPagoPA();
Date dataFlusso = null; // evento.getDataFlusso();
Long idTracciato = evento.getIdTracciato();

it.govpay.gde.v1.model.DatiPagoPA datiPagoPAModel = getDatiPagoPA(datiPagoPA, dataFlusso, idTracciato);
return datiPagoPAModel;
}

private static it.govpay.gde.v1.model.DatiPagoPA getDatiPagoPA(DatiPagoPA datiPagoPA, Date dataFlusso, Long idTracciato) {
it.govpay.gde.v1.model.DatiPagoPA datiPagoPAModel = null;
if(datiPagoPA != null) {
datiPagoPAModel = new it.govpay.gde.v1.model.DatiPagoPA();
Expand All @@ -140,14 +135,8 @@ private static it.govpay.gde.v1.model.DatiPagoPA getDatiPagoPA(DatiPagoPA datiPa
datiPagoPAModel.setIdRiconciliazione(datiPagoPA.getTrn());
datiPagoPAModel.setSct(datiPagoPA.getSct());


if(dataFlusso != null) {
datiPagoPAModel.setDataFlusso(dataFlusso.toInstant().atOffset(ZoneOffset.UTC));
}


if(idTracciato != null)
datiPagoPAModel.setIdTracciato(new BigDecimal(idTracciato));
if(datiPagoPA.getIdTracciato() != null)
datiPagoPAModel.setIdTracciato(new BigDecimal(datiPagoPA.getIdTracciato()));

}
return datiPagoPAModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package it.govpay.gde.model;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import org.springframework.hateoas.RepresentationModel;

Expand Down Expand Up @@ -45,9 +44,6 @@ public class DatiPagoPAModel extends RepresentationModel<DatiPagoPAModel> {

private String idFlusso;

@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime dataFlusso;

private BigDecimal idTracciato;

}
Expand Down
47 changes: 22 additions & 25 deletions wars/api-gde/src/main/resources/openapi_gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Lista eventi
content:
application/json:
schema:
$ref: '#/components/schemas/PagedModel'
"401":
description: Unauthorized
content:
Expand All @@ -183,6 +177,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Lista eventi
content:
application/json:
schema:
$ref: '#/components/schemas/PagedModel'
post:
tags:
- eventi
Expand Down Expand Up @@ -214,30 +214,30 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"400":
description: Bad Request
"201":
description: Evento salvato con successo
content:
application/json:
'*/*':
schema:
$ref: '#/components/schemas/problem'
type: object
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"201":
description: Evento salvato con successo
content:
'*/*':
schema:
type: object
"403":
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
/eventi/{id}:
get:
tags:
Expand Down Expand Up @@ -278,18 +278,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Dettaglio Evento
content:
application/json:
schema:
$ref: '#/components/schemas/evento'
"403":
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/problem'
"200":
description: Dettaglio Evento
content:
application/json:
schema:
$ref: '#/components/schemas/evento'
components:
schemas:
problem:
Expand Down Expand Up @@ -337,9 +337,6 @@ components:
type: string
idFlusso:
type: string
dataFlusso:
type: string
format: date-time
idTracciato:
type: number
_links:
Expand Down

0 comments on commit 7118861

Please sign in to comment.