From deaeb4d17f5b182c8c446b5bc04fe3805d15a548 Mon Sep 17 00:00:00 2001 From: lcucuzzella <lorenzo.cucuzzella@dxc.com> Date: Fri, 4 Oct 2024 18:05:46 +0200 Subject: [PATCH] feat(monitoraggio-caricamenti): aggiornamento endpoint /ente/progetti/dropdown 20241004 --- .../ente/repository/EnteRepository.java | 4 ++-- .../pa/repdgt/ente/request/FiltroRequest.java | 3 +++ .../pa/repdgt/ente/service/EnteService.java | 19 +++++++++---------- .../repdgt/ente/service/EnteServiceTest.java | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ms-ente/src/main/java/it/pa/repdgt/ente/repository/EnteRepository.java b/ms-ente/src/main/java/it/pa/repdgt/ente/repository/EnteRepository.java index 6281a2501..50f6065f1 100644 --- a/ms-ente/src/main/java/it/pa/repdgt/ente/repository/EnteRepository.java +++ b/ms-ente/src/main/java/it/pa/repdgt/ente/repository/EnteRepository.java @@ -264,7 +264,7 @@ public List<Map<String, String>> findAllProgrammiFiltrati( +" AND ( COALESCE(:idsProgetti) IS NULL OR prgt.ID IN (:idsProgetti) )" +" ) AS progetti " +" WHERE 1=1 " - +" AND ( :policy IS NULL OR progetti.POLICY = :policy ) " + +" AND ( COALESCE(:policies) IS NULL OR progetti.POLICY IN (:policies) ) " +" AND ( :criterioRicerca IS NULL " +" OR CONVERT( progetti.ID_ENTE, CHAR ) = :criterioRicerca " +" OR UPPER( progetti.NOME_ENTE ) LIKE UPPER( :criterioRicercaLike ) " @@ -278,7 +278,7 @@ public List<Map<String, String>> findAllProgettiFiltrati( @Param("idsProgrammi") List<String> idsProgrammi, @Param("idsProgetti") List<String> idsProgetti, @Param("profiliEnte") List<String> profiliEnte, - @Param("policy") String policy + @Param("policies") List<String> policies ); diff --git a/ms-ente/src/main/java/it/pa/repdgt/ente/request/FiltroRequest.java b/ms-ente/src/main/java/it/pa/repdgt/ente/request/FiltroRequest.java index 38af8a1e5..95190035c 100644 --- a/ms-ente/src/main/java/it/pa/repdgt/ente/request/FiltroRequest.java +++ b/ms-ente/src/main/java/it/pa/repdgt/ente/request/FiltroRequest.java @@ -26,4 +26,7 @@ public class FiltroRequest implements Serializable { @JsonProperty(value = "idsProgetti") private List<String> idsProgetti; + + @JsonProperty(value = "filtroPolicies") + private List<String> policies; } \ No newline at end of file diff --git a/ms-ente/src/main/java/it/pa/repdgt/ente/service/EnteService.java b/ms-ente/src/main/java/it/pa/repdgt/ente/service/EnteService.java index 46e67d2a4..65b53ea1a 100644 --- a/ms-ente/src/main/java/it/pa/repdgt/ente/service/EnteService.java +++ b/ms-ente/src/main/java/it/pa/repdgt/ente/service/EnteService.java @@ -377,8 +377,7 @@ public List<Map<String, String>> getAllProgettiFiltrati(FiltroRequest filtro) { .map(profilo -> profilo.toUpperCase()) .collect(Collectors.toList()); } - String policy = null; - return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policy); + return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, filtro.getPolicies()); } private List<AllEntiProjection> getAllEntiPerDSCUFiltrati(FiltroRequest filtro) { @@ -426,8 +425,8 @@ public List<Map<String, String>> getAllProgettiPerDSCUFiltrati(FiltroRequest fil .map(profilo -> profilo.toUpperCase()) .collect(Collectors.toList()); } - String policy = PolicyEnum.SCD.toString(); - return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policy); + List<String> policies = Arrays.asList(PolicyEnum.SCD.toString()); + return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policies); } @LogMethod @@ -460,8 +459,8 @@ private List<Map<String, String>> getAllProgettiGestoreProgrammaByIdProgrammaFil .map(profilo -> profilo.toUpperCase()) .collect(Collectors.toList()); } - String policy = null; - return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policy); + List<String> policies = null; + return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policies); } private List<AllEntiProjection> getAllEntiGestoreProgetto(EntiPaginatiParam entiPaginatiParam) { @@ -492,8 +491,8 @@ private List<Map<String, String>> getAllProgettiGestoreProgetto(EntiPaginatiPara .map(profilo -> profilo.toUpperCase()) .collect(Collectors.toList()); } - String policy = null; - return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policy); + List<String> policies = null; + return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policies); } private List<AllEntiProjection> getAllEntiPartnerProgetto(EntiPaginatiParam entiPaginatiParam) { @@ -526,8 +525,8 @@ private List<Map<String, String>> getAllProgettiPartnerProgetto(EntiPaginatiPara .map(profilo -> profilo.toUpperCase()) .collect(Collectors.toList()); } - String policy = null; - return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policy); + List<String> policies = null; + return this.enteRepository.findAllProgettiFiltrati(criterioRicerca, "%" + criterioRicerca + "%", idsProgrammi, idsProgetti, profiliEnteUpperCase, policies); } private List<Map<String, String>> getProgrammaById(Long idProgramma) { diff --git a/ms-ente/src/test/java/it/pa/repdgt/ente/service/EnteServiceTest.java b/ms-ente/src/test/java/it/pa/repdgt/ente/service/EnteServiceTest.java index fd89c6ebb..4114b8260 100644 --- a/ms-ente/src/test/java/it/pa/repdgt/ente/service/EnteServiceTest.java +++ b/ms-ente/src/test/java/it/pa/repdgt/ente/service/EnteServiceTest.java @@ -374,7 +374,7 @@ public void getAllProgettiDropdownDSCUTest() { filtro.getIdsProgrammi(), filtro.getIdsProgetti(), filtro.getProfili(), - PolicyEnum.SCD.toString()); + filtro.getPolicies()); } @Test