diff --git a/src/main/java/io/gmss/fiscad/controllers/rfu/metier/EdeclarationProprieteController.java b/src/main/java/io/gmss/fiscad/controllers/rfu/metier/EdeclarationProprieteController.java index 6cf1b7a..758c3c7 100644 --- a/src/main/java/io/gmss/fiscad/controllers/rfu/metier/EdeclarationProprieteController.java +++ b/src/main/java/io/gmss/fiscad/controllers/rfu/metier/EdeclarationProprieteController.java @@ -1,6 +1,7 @@ package io.gmss.fiscad.controllers.rfu.metier; +import io.gmss.fiscad.enums.StatutEdeclarationPropriete; import io.gmss.fiscad.exceptions.*; import io.gmss.fiscad.interfaces.interface_sigibe.EdeclarationProprieteService; import io.gmss.fiscad.paylaods.ApiResponse; @@ -195,6 +196,69 @@ public class EdeclarationProprieteController { } + + @GetMapping("/en-attente/by-quartier-id/{quartierId}") + //@PreAuthorize("hasAuthority('READ_CARACTERISTIQUEBATIMENT')") + public ResponseEntity getEdeclarationProprieteEnAttenteByQuartierId(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId) { + try { + if(currentUser==null) + return new ResponseEntity<>( + new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"), + HttpStatus.OK + ); + Long userId = currentUser.getUser().getId(); + return new ResponseEntity<>( + new ApiResponse<>(true, edeclarationProprieteService.getEdeclarationProprieteListByStatutByQuartier(userId,quartierId,StatutEdeclarationPropriete.EN_ATTENTE), "Liste des déclaration du quartier."), + HttpStatus.OK + ); + } catch (HttpClientErrorException.MethodNotAllowed e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK); + } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException | + FileStorageException e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK); + } catch (NullPointerException e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK); + } catch (Exception e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK); + } + } + + @GetMapping("/page/en-attente/by-quartier-id/{quartierId}") + //@PreAuthorize("hasAuthority('READ_CARACTERISTIQUEBATIMENT')") + public ResponseEntity getEdeclarationProprieteEnAttenteByQuartierIdPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId,@RequestParam int pageNo, @RequestParam int pageSize) { + try { + Pageable pageable = PageRequest.of(pageNo, pageSize); + if(currentUser==null) + return new ResponseEntity<>( + new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"), + HttpStatus.OK + ); + Long userId = currentUser.getUser().getId(); + return new ResponseEntity<>( + new ApiResponse<>(true, edeclarationProprieteService.getEdeclarationProprieteListByStatutByQuartierPageable(userId,quartierId, StatutEdeclarationPropriete.EN_ATTENTE,pageable), "Liste des déclaration du quartier."), + HttpStatus.OK + ); + } catch (HttpClientErrorException.MethodNotAllowed e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK); + } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException | + FileStorageException e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK); + } catch (NullPointerException e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK); + } catch (Exception e) { + logger.error(e.getLocalizedMessage()); + return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK); + } + } + + @GetMapping("/by-personne-id/{personneId}") //@PreAuthorize("hasAuthority('READ_CARACTERISTIQUEBATIMENT')") public ResponseEntity getEdeclarationProprieteByPersonneId(@CurrentUser UserPrincipal currentUser, @PathVariable Long personneId) { diff --git a/src/main/java/io/gmss/fiscad/implementations/interface_sigibe/EdeclarationProprieteServiceImpl.java b/src/main/java/io/gmss/fiscad/implementations/interface_sigibe/EdeclarationProprieteServiceImpl.java index 96cb2ff..21e8232 100644 --- a/src/main/java/io/gmss/fiscad/implementations/interface_sigibe/EdeclarationProprieteServiceImpl.java +++ b/src/main/java/io/gmss/fiscad/implementations/interface_sigibe/EdeclarationProprieteServiceImpl.java @@ -106,4 +106,16 @@ public class EdeclarationProprieteServiceImpl implements EdeclarationProprieteSe return edeclarationProprieteRepository.findAllPayloadByQuartierId(quartierId,secteurIds); } + @Override + public Page getEdeclarationProprieteListByStatutByQuartierPageable(Long userId, Long quartierId, StatutEdeclarationPropriete statutEdeclarationPropriete, Pageable pageable) { + List secteurIds = parcelleService.getSecteurIdListForUser(userId); + return edeclarationProprieteRepository.findAllPayloadByStatutByQuartierIdPageable(quartierId,statutEdeclarationPropriete,secteurIds,pageable); + } + + @Override + public List getEdeclarationProprieteListByStatutByQuartier(Long userId, Long quartierId, StatutEdeclarationPropriete statutEdeclarationPropriete) { + List secteurIds = parcelleService.getSecteurIdListForUser(userId); + return edeclarationProprieteRepository.findAllPayloadByStatutByQuartierId(quartierId,statutEdeclarationPropriete,secteurIds); + } + } diff --git a/src/main/java/io/gmss/fiscad/interfaces/interface_sigibe/EdeclarationProprieteService.java b/src/main/java/io/gmss/fiscad/interfaces/interface_sigibe/EdeclarationProprieteService.java index cbeecf2..d397b7a 100755 --- a/src/main/java/io/gmss/fiscad/interfaces/interface_sigibe/EdeclarationProprieteService.java +++ b/src/main/java/io/gmss/fiscad/interfaces/interface_sigibe/EdeclarationProprieteService.java @@ -32,4 +32,9 @@ public interface EdeclarationProprieteService { Page getEdeclarationProprieteListByQuartierPageable(Long userId,Long quartierId, Pageable pageable); List getEdeclarationProprieteListByQuartier(Long userId,Long quartierId); + + Page getEdeclarationProprieteListByStatutByQuartierPageable(Long userId,Long quartierId, StatutEdeclarationPropriete statutEdeclarationPropriete, Pageable pageable); + + List getEdeclarationProprieteListByStatutByQuartier(Long userId,Long quartierId, StatutEdeclarationPropriete statutEdeclarationPropriete); + } diff --git a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_avis_contribuable.sql b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_avis_contribuable.sql new file mode 100644 index 0000000..20da1b2 --- /dev/null +++ b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_avis_contribuable.sql @@ -0,0 +1,135 @@ +CREATE OR REPLACE PROCEDURE integrer_avis_contribuable_depuis_sigibe() + LANGUAGE plpgsql +AS +$$ +DECLARE + v_conn TEXT; + v_nb_importe INTEGER; + v_ids TEXT; +BEGIN + + v_conn := get_dblink_connection(); + + ---------------------------------------------------------------------- + -- Chargement des données distantes + ---------------------------------------------------------------------- + CREATE TEMP TABLE tmp_avis_contribuable + ON COMMIT DROP + AS + SELECT * + FROM dblink + ( + v_conn, + ' + SELECT + date_information, + id_avis_contribuable, + id_avis, + id_contribuable_foncier, + ifu, + statut + FROM e_avis_contribuable + WHERE COALESCE(integre,0)=0 + ' + ) + AS src + ( + date_information DATE, + id_avis_contribuable BIGINT, + id_avis BIGINT, + id_contribuable_foncier BIGINT, + ifu VARCHAR, + statut VARCHAR + ); + + ---------------------------------------------------------------------- + -- Table temporaire des identifiants réellement insérés + ---------------------------------------------------------------------- + CREATE TEMP TABLE tmp_ids_importes + ( + id BIGINT + ) ON COMMIT DROP; + + ---------------------------------------------------------------------- + -- Insertion + récupération des identifiants insérés + ---------------------------------------------------------------------- + WITH inserted AS + ( + INSERT INTO eavis_contribuable + ( + created_at, + created_by, + deleted, + source, + updated_at, + updated_by, + date_information, + id_avis, + id_contribuable_foncier, + ifu, + statut, + id_avis_contribuable + ) + SELECT + now(), + NULL, + false, + 'SIGIBE', + now(), + NULL, + t.date_information, + t.id_avis, + t.id_contribuable_foncier, + t.ifu, + t.statut, + t.id_avis_contribuable + FROM tmp_avis_contribuable t + WHERE NOT EXISTS + ( + SELECT 1 + FROM eavis_contribuable d + WHERE d.id_avis_contribuable = t.id_avis_contribuable + AND d.source = 'SIGIBE' + ) + RETURNING id_avis_contribuable + ) + INSERT INTO tmp_ids_importes(id) + SELECT id_avis_contribuable + FROM inserted; + + ---------------------------------------------------------------------- + -- Nombre réellement importé + ---------------------------------------------------------------------- + SELECT COUNT(*) + INTO v_nb_importe + FROM tmp_ids_importes; + + ---------------------------------------------------------------------- + -- Construction de la liste des identifiants + ---------------------------------------------------------------------- + SELECT string_agg(id::text, ',') + INTO v_ids + FROM tmp_ids_importes; + + ---------------------------------------------------------------------- + -- Mise à jour de la base distante + ---------------------------------------------------------------------- + IF v_ids IS NOT NULL THEN + + PERFORM dblink_exec + ( + v_conn, + format( + 'UPDATE e_avis_contribuable + SET integre = 1 + WHERE id_avis_contribuable IN (%s)', + v_ids + ) + ); + + END IF; + + RAISE NOTICE '% enregistrement(s) importé(s).', v_nb_importe; + +END; +$$; \ No newline at end of file diff --git a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_declaration_propriete.sql b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_declaration_propriete.sql index 26f099a..720b420 100644 --- a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_declaration_propriete.sql +++ b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_declaration_propriete.sql @@ -11,12 +11,9 @@ BEGIN created_at, created_by, deleted, - enquete_external_key, - external_key, source, updated_at, updated_by, - bati, commentaire, date_construction, @@ -41,7 +38,6 @@ BEGIN superficie_sol_ulo, usage, valeur_batiment, - personne_id, quartier_id, statut_edeclaration_propriete @@ -50,12 +46,9 @@ BEGIN now() AS created_at, NULL::bigint AS created_by, false AS deleted, - NULL::bigint AS enquete_external_key, - NULL::bigint AS external_key, 'SIGIBE' AS source, NULL::timestamp with time zone AS updated_at, NULL::bigint AS updated_by, - src.bati, src.commentaire, src.date_construction, @@ -80,12 +73,11 @@ BEGIN src.superficie_sol_ulo, src.usage, src.valeur_batiment, - p.id AS personne_id, q.id AS quartier_id, 'EN_ATTENTE' FROM dblink( - 'host=localhost port=5432 dbname=sigibe_test user=sigibe_test_user password=1234567890', + get_dblink_connection(), ' SELECT bati, diff --git a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_acompte.sql b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_acompte.sql new file mode 100644 index 0000000..bc4c4a8 --- /dev/null +++ b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_acompte.sql @@ -0,0 +1,132 @@ +CREATE OR REPLACE PROCEDURE public.integrer_epaiement_acompte_depuis_sigibe() + LANGUAGE plpgsql +AS +$$ +DECLARE + v_nb_importe INTEGER; + v_conn TEXT; +BEGIN + + v_conn := get_dblink_connection(); + + INSERT INTO public.epaiement_acompte + ( + created_at, + created_by, + deleted, + enquete_external_key, + external_key, + source, + updated_at, + updated_by, + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_exercice, + id_impot_nature, + id_impot_type, + id_paiement_acompte, + id_paiement_impot, + ifu, + montant_paye, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_commune, + r_doc, + r_impot, + r_quartier, + exercice, + montant_payer + ) + SELECT + now(), + NULL, + false, + NULL, + src.id_paiement_acompte, + 'SIGIBE', + now(), + NULL, + src.date_avis_credit, + src.date_information, + src.date_rapprochement, + src.date_validation, + src.id_exercice, + src.id_impot_nature, + src.id_impot_type, + src.id_paiement_acompte, + src.id_paiement_impot, + src.ifu, + src.montant_paye, + src.nup, + src.qip_ilot, + src.qip_parcelle, + src.qip_quartier, + src.r_commune, + src.r_doc, + src.r_impot, + src.r_quartier, + src.id_exercice, + src.montant_paye + FROM dblink( + v_conn, + ' + SELECT + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_exercice, + id_impot_nature, + id_impot_type, + id_paiement_acompte, + id_paiement_impot, + ifu, + montant_paye, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_commune, + r_doc, + r_impot, + r_quartier + FROM public.e_paiement_acompte + ' + ) AS src + ( + date_avis_credit DATE, + date_information DATE, + date_rapprochement DATE, + date_validation DATE, + id_exercice BIGINT, + id_impot_nature VARCHAR, + id_impot_type VARCHAR, + id_paiement_acompte BIGINT, + id_paiement_impot BIGINT, + ifu VARCHAR, + montant_paye BIGINT, + nup VARCHAR, + qip_ilot VARCHAR, + qip_parcelle VARCHAR, + qip_quartier VARCHAR, + r_commune VARCHAR, + r_doc VARCHAR, + r_impot VARCHAR, + r_quartier VARCHAR + ) + WHERE NOT EXISTS ( + SELECT 1 + FROM epaiement_acompte d + WHERE d.id_paiement_acompte = src.id_paiement_acompte + ); + + GET DIAGNOSTICS v_nb_importe = ROW_COUNT; + + RAISE NOTICE '% enregistrement(s) importé(s) dans epaiement_acompte.', v_nb_importe; + +END; +$$; \ No newline at end of file diff --git a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_avis.sql b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_avis.sql new file mode 100644 index 0000000..68f3d97 --- /dev/null +++ b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_avis.sql @@ -0,0 +1,135 @@ +CREATE OR REPLACE PROCEDURE public.integrer_epaiement_avis_depuis_sigibe() + LANGUAGE plpgsql +AS +$$ +DECLARE + v_conn TEXT; + v_nb_importe INTEGER; +BEGIN + + v_conn := get_dblink_connection(); + + INSERT INTO public.epaiement_avis + ( + created_at, + created_by, + deleted, + enquete_external_key, + external_key, + source, + updated_at, + updated_by, + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_avis, + id_contribuable_foncier, + id_impot_nature, + id_impot_type, + id_paiement_impot, + id_unite_foncier, + ifu, + montant_payer, + r_commune, + r_doc, + r_impot, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_quartier + ) + SELECT + now(), + NULL, + false, + NULL, + src.id_paiement_impot, + 'SIGIBE', + now(), + NULL, + src.date_avis_credit, + src.date_information, + src.date_rapprochement, + src.date_validation, + src.id_avis, + src.id_contribuable_foncier, + src.id_impot_nature, + src.id_impot_type, + src.id_paiement_impot, + src.id_unite_foncier, + src.ifu, + src.montant_paye, + src.r_commune, + src.r_doc, + src.r_impot, + src.nup, + src.qip_ilot, + src.qip_parcelle, + src.qip_quartier, + src.r_quartier + FROM dblink + ( + v_conn, + ' + SELECT + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_avis, + id_contribuable_foncier, + id_impot_nature, + id_impot_type, + id_paiement_impot, + id_unite_foncier, + ifu, + montant_paye, + r_commune, + r_doc, + r_impot, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_quartier + FROM public.e_paiement_avis + ' + ) + AS src + ( + date_avis_credit DATE, + date_information DATE, + date_rapprochement DATE, + date_validation DATE, + id_avis BIGINT, + id_contribuable_foncier BIGINT, + id_impot_nature VARCHAR, + id_impot_type VARCHAR, + id_paiement_impot BIGINT, + id_unite_foncier BIGINT, + ifu VARCHAR, + montant_paye BIGINT, + r_commune VARCHAR, + r_doc VARCHAR, + r_impot VARCHAR, + nup VARCHAR, + qip_ilot VARCHAR, + qip_parcelle VARCHAR, + qip_quartier VARCHAR, + r_quartier VARCHAR + ) + WHERE NOT EXISTS + ( + SELECT 1 + FROM public.epaiement_avis d + WHERE d.id_paiement_impot = src.id_paiement_impot + ); + + GET DIAGNOSTICS v_nb_importe = ROW_COUNT; + + RAISE NOTICE '% enregistrement(s) importé(s) dans epaiement_avis.', v_nb_importe; + +END; +$$; \ No newline at end of file diff --git a/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_retenu.sql b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_retenu.sql new file mode 100644 index 0000000..7df4648 --- /dev/null +++ b/src/main/java/io/gmss/fiscad/persistence/procedure_fonction_stocke/interface_sigibe/recuperer_paiement_retenu.sql @@ -0,0 +1,123 @@ +CREATE OR REPLACE PROCEDURE public.integrer_epaiement_retenue_depuis_sigibe() + LANGUAGE plpgsql +AS +$$ +DECLARE + v_conn TEXT; + v_nb_importe INTEGER; +BEGIN + + v_conn := get_dblink_connection(); + + INSERT INTO public.epaiement_retenue + ( + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_exercice, + id_edi_generique, + id_impot_nature, + id_impot_type, + id_paiement_impot, + id_paiement_retenue, + ifu_payeur, + ifu_retenue, + montant_paye, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_commune, + r_doc, + r_impot, + r_quartier + ) + SELECT + src.date_avis_credit, + src.date_information, + src.date_rapprochement, + src.date_validation, + src.id_exercice, + src.id_edi_generique, + src.id_impot_nature, + src.id_impot_type, + src.id_paiement_impot, + src.id_paiement_retenue, + src.ifu_payeur, + src.ifu_retenue, + src.montant_paye, + src.nup, + src.qip_ilot, + src.qip_parcelle, + src.qip_quartier, + src.r_commune, + src.r_doc, + src.r_impot, + src.r_quartier + FROM dblink + ( + v_conn, + ' + SELECT + date_avis_credit, + date_information, + date_rapprochement, + date_validation, + id_exercice, + id_edi_generique, + id_impot_nature, + id_impot_type, + id_paiement_impot, + id_paiement_retenue, + ifu_payeur, + ifu_retenue, + montant_paye, + nup, + qip_ilot, + qip_parcelle, + qip_quartier, + r_commune, + r_doc, + r_impot, + r_quartier + FROM public.e_paiement_retenue + ' + ) + AS src + ( + date_avis_credit DATE, + date_information DATE, + date_rapprochement DATE, + date_validation DATE, + id_exercice BIGINT, + id_edi_generique BIGINT, + id_impot_nature VARCHAR, + id_impot_type VARCHAR, + id_paiement_impot BIGINT, + id_paiement_retenue BIGINT, + ifu_payeur VARCHAR, + ifu_retenue VARCHAR, + montant_paye BIGINT, + nup VARCHAR, + qip_ilot VARCHAR, + qip_parcelle VARCHAR, + qip_quartier VARCHAR, + r_commune VARCHAR, + r_doc VARCHAR, + r_impot VARCHAR, + r_quartier VARCHAR + ) + WHERE NOT EXISTS + ( + SELECT 1 + FROM public.epaiement_retenue d + WHERE d.id_paiement_retenue = src.id_paiement_retenue + ); + + GET DIAGNOSTICS v_nb_importe = ROW_COUNT; + + RAISE NOTICE '% enregistrement(s) importé(s) dans epaiement_retenue.', v_nb_importe; + +END; +$$; \ No newline at end of file diff --git a/src/main/java/io/gmss/fiscad/persistence/repositories/interface_sigibe/EdeclarationProprieteRepository.java b/src/main/java/io/gmss/fiscad/persistence/repositories/interface_sigibe/EdeclarationProprieteRepository.java index d311d74..8bb847a 100755 --- a/src/main/java/io/gmss/fiscad/persistence/repositories/interface_sigibe/EdeclarationProprieteRepository.java +++ b/src/main/java/io/gmss/fiscad/persistence/repositories/interface_sigibe/EdeclarationProprieteRepository.java @@ -2,6 +2,7 @@ package io.gmss.fiscad.persistence.repositories.interface_sigibe; import io.gmss.fiscad.entities.interface_sigibe.EdeclarationPropriete; import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment; +import io.gmss.fiscad.enums.StatutEdeclarationPropriete; import io.gmss.fiscad.paylaods.request.crudweb.CaracteristiqueBatimentPayloadWeb; import io.gmss.fiscad.paylaods.request.crudweb.EdeclarationProprietePayloadWeb; import io.gmss.fiscad.paylaods.response.restoration.CaracateristiqueBatimentPayLoadsRestor; @@ -367,6 +368,54 @@ public interface EdeclarationProprieteRepository extends JpaRepository findAllPayloadByQuartierId(@Param("quartierId") Long quartierId, @Param("secteurIds") List secteurIds); + + @Query(""" + SELECT new io.gmss.fiscad.paylaods.request.crudweb.EdeclarationProprietePayloadWeb( + e.id, + e.idImpot, + e.rImpot, + e.ifu, + e.rCommune, + e.rQuartier, + e.qipQuartier, + e.qipIlot, + e.qipParcelle, + e.nup, + e.gpsLatitude, + e.gpsLongitude, + e.commentaire, + e.dateValidation, + e.dateInformation, + e.valeurBatiment, + e.nub, + e.nul, + e.montantLocatifAnnuel, + e.dateConstruction, + e.superficieSolBat, + e.superficieSolUlo, + e.superficieParcelle, + e.usage, + e.bati, + p.id, + p.nom, + p.prenom, + p.raisonSociale, + q.id, + q.code, + q.nom, + e.statutEdeclarationPropriete + ) + FROM EdeclarationPropriete e + LEFT JOIN e.personne p + LEFT JOIN e.quartier q + INNER JOIN SecteurDecoupage sd on sd.quartier=q + WHERE q.id = :quartierId + AND sd.secteur.id IN (:secteurIds) + AND e.statutEdeclarationPropriete = :statutDeclarationProprieteParam + """) + List findAllPayloadByStatutByQuartierId(@Param("quartierId") Long quartierId, + @Param("statutDeclarationProprieteParam") StatutEdeclarationPropriete statutDeclarationProprieteParam, + @Param("secteurIds") List secteurIds); @Query(value = """ SELECT new io.gmss.fiscad.paylaods.request.crudweb.EdeclarationProprietePayloadWeb( e.id, @@ -424,6 +473,66 @@ public interface EdeclarationProprieteRepository extends JpaRepository secteurIds, Pageable pageable); + @Query(value = """ + SELECT new io.gmss.fiscad.paylaods.request.crudweb.EdeclarationProprietePayloadWeb( + e.id, + e.idImpot, + e.rImpot, + e.ifu, + e.rCommune, + e.rQuartier, + e.qipQuartier, + e.qipIlot, + e.qipParcelle, + e.nup, + e.gpsLatitude, + e.gpsLongitude, + e.commentaire, + e.dateValidation, + e.dateInformation, + e.valeurBatiment, + e.nub, + e.nul, + e.montantLocatifAnnuel, + e.dateConstruction, + e.superficieSolBat, + e.superficieSolUlo, + e.superficieParcelle, + e.usage, + e.bati, + p.id, + p.nom, + p.prenom, + p.raisonSociale, + q.id, + q.code, + q.nom, + e.statutEdeclarationPropriete + ) + FROM EdeclarationPropriete e + LEFT JOIN e.personne p + LEFT JOIN e.quartier q + INNER JOIN SecteurDecoupage sd on sd.quartier=q + WHERE q.id = :quartierId + AND sd.secteur.id IN (:secteurIds) + AND e.statutEdeclarationPropriete = :statutDeclarationProprieteParam + """, + countQuery = """ + SELECT COUNT(e) + FROM EdeclarationPropriete e + LEFT JOIN e.personne p + LEFT JOIN e.quartier q + INNER JOIN SecteurDecoupage sd on sd.quartier=q + WHERE q.id = :quartierId + AND sd.secteur.id IN (:secteurIds) + AND e.statutEdeclarationPropriete = :statutDeclarationProprieteParam + """) + Page findAllPayloadByStatutByQuartierIdPageable( + @Param("quartierId") Long quartierId, + @Param("statutDeclarationProprieteParam") StatutEdeclarationPropriete statutDeclarationProprieteParam, + @Param("secteurIds") List secteurIds, + Pageable pageable); + @Query( diff --git a/src/main/java/io/gmss/fiscad/service/EntityFromPayLoadService.java b/src/main/java/io/gmss/fiscad/service/EntityFromPayLoadService.java index 6c13a30..127aea8 100644 --- a/src/main/java/io/gmss/fiscad/service/EntityFromPayLoadService.java +++ b/src/main/java/io/gmss/fiscad/service/EntityFromPayLoadService.java @@ -1089,6 +1089,7 @@ public class EntityFromPayLoadService { fonctionnalite.setCode(fonctionnalitePayloadWeb.getCode()); fonctionnalite.setNom(fonctionnalitePayloadWeb.getNom()); fonctionnalite.setActif(fonctionnalitePayloadWeb.getActif()); + fonctionnalite.setLien(fonctionnalitePayloadWeb.getLien()); return fonctionnalite ; }