Merge pull request 'fusion maj parcelle,batiment,ulo et leur enquete' (#192) from features/fiche_refonte into develop
Reviewed-on: #192
This commit was merged in pull request #192.
This commit is contained in:
@@ -253,12 +253,28 @@ public class PersonneServiceImpl implements PersonneService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PersonnePayLoadWeb> recherchePersonne(RecherchePersonneResquestBody request) {
|
public List<PersonnePayLoadWeb> recherchePersonne(RecherchePersonneResquestBody request) {
|
||||||
|
|
||||||
List<PersonnePayLoadWeb> result = new ArrayList<>(
|
|
||||||
recherchePersonneLocal(request)
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if(request.getIfu()!=null && !request.getIfu().equals("")){
|
||||||
|
List<PersonnePayLoadWeb> personnePayLoadWebs =personneRepository.findAllPersonneByIfuToDto(request.getIfu());
|
||||||
|
if(!personnePayLoadWebs.isEmpty())
|
||||||
|
return personnePayLoadWebs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
||||||
|
|
||||||
|
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
||||||
|
if(!personnePayLoadWebs.isEmpty())
|
||||||
|
return personnePayLoadWebs;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PersonnePayLoadWeb> result=new ArrayList<>();
|
||||||
|
|
||||||
|
result = recherchePersonneLocal(request);
|
||||||
|
|
||||||
|
if (result != null && !result.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
// Conversion date en String format yyyy-MM-dd
|
// Conversion date en String format yyyy-MM-dd
|
||||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||||
@@ -301,29 +317,48 @@ public class PersonneServiceImpl implements PersonneService {
|
|||||||
personne.setEtatIdentificationPersonne(EtatIdentificationPersonne.IFU);
|
personne.setEtatIdentificationPersonne(EtatIdentificationPersonne.IFU);
|
||||||
result.add(personne);
|
result.add(personne);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
// logger.error("Erreur appel IFU EN LIGNE", e);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
// private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||||
|
// System.out.println("NOUS SOMMES DANS RECHERCHE NOM ET PRENOM :"+recherchePersonneResquestBody.getNom()+" "+recherchePersonneResquestBody.getPrenom());
|
||||||
|
// List<PersonnePayLoadWeb> personnePayLoadWebs=
|
||||||
|
// personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||||
|
// recherchePersonneResquestBody.getNom()==null?null: "%"+recherchePersonneResquestBody.getNom().trim().toUpperCase()+"%",
|
||||||
|
// recherchePersonneResquestBody.getPrenom()==null?null: "%"+recherchePersonneResquestBody.getPrenom().trim().toUpperCase()+"%",
|
||||||
|
// recherchePersonneResquestBody.getRaisonSociale()==null?null: "%"+recherchePersonneResquestBody.getRaisonSociale().trim().toUpperCase()+"%",
|
||||||
|
// recherchePersonneResquestBody.getNomMere()==null?null: "%"+recherchePersonneResquestBody.getNomMere().trim().toUpperCase()+"%"
|
||||||
|
// );
|
||||||
|
// return personnePayLoadWebs ;
|
||||||
|
// }
|
||||||
|
|
||||||
List<PersonnePayLoadWeb> personnePayLoadWebs=
|
private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody request) {
|
||||||
personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
String nom = normalizeLikeParam(request.getNom());
|
||||||
recherchePersonneResquestBody.getIfu()==null?null:recherchePersonneResquestBody.getIfu().trim().toLowerCase(),
|
String prenom = normalizeLikeParam(request.getPrenom());
|
||||||
recherchePersonneResquestBody.getNpi()==null?null:recherchePersonneResquestBody.getNpi().trim().toLowerCase(),
|
String raisonSociale = normalizeLikeParam(request.getRaisonSociale());
|
||||||
recherchePersonneResquestBody.getNom()==null?null:recherchePersonneResquestBody.getNom().trim().toLowerCase(),
|
String nomMere = normalizeLikeParam(request.getNomMere());
|
||||||
recherchePersonneResquestBody.getPrenom()==null?null:recherchePersonneResquestBody.getPrenom().trim().toLowerCase(),
|
|
||||||
recherchePersonneResquestBody.getRaisonSociale()==null?null:recherchePersonneResquestBody.getRaisonSociale().trim().toLowerCase(),
|
return personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||||
recherchePersonneResquestBody.getNomMere()==null?null:recherchePersonneResquestBody.getNomMere().trim().toLowerCase(),
|
nom,
|
||||||
recherchePersonneResquestBody.getDateNaissance()
|
prenom,
|
||||||
|
raisonSociale,
|
||||||
|
nomMere
|
||||||
);
|
);
|
||||||
return personnePayLoadWebs ;
|
|
||||||
}
|
}
|
||||||
|
private String normalizeLikeParam(String value) {
|
||||||
|
if (value == null) return null;
|
||||||
|
|
||||||
|
String cleaned = value.trim();
|
||||||
|
|
||||||
|
if (cleaned.isEmpty()) return null;
|
||||||
|
|
||||||
|
return "%" + cleaned.toUpperCase() + "%";
|
||||||
|
}
|
||||||
private List<PersonnePayLoadWeb> recherchePersonneSigibe(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
private List<PersonnePayLoadWeb> recherchePersonneSigibe(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||||
// callAPIService.callGetIfuEnLigneToken();
|
// callAPIService.callGetIfuEnLigneToken();
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,45 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
|||||||
List<StatistiqueTypeNombreResponse> getNombrePersonnesResponse();
|
List<StatistiqueTypeNombreResponse> getNombrePersonnesResponse();
|
||||||
|
|
||||||
|
|
||||||
@Query( """
|
// @Query( """
|
||||||
|
// SELECT new io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb(
|
||||||
|
// p.id,
|
||||||
|
// p.ifu,
|
||||||
|
// p.nom,
|
||||||
|
// p.prenom,
|
||||||
|
// p.raisonSociale,
|
||||||
|
// p.numRavip,
|
||||||
|
// p.npi,
|
||||||
|
// p.dateNaissanceOuConsti,
|
||||||
|
// p.lieuNaissance,
|
||||||
|
// p.tel1,
|
||||||
|
// p.nomJeuneFille,
|
||||||
|
// p.nomMere,
|
||||||
|
// io.gmss.fiscad.enums.EtatIdentificationPersonne.RFU
|
||||||
|
// )
|
||||||
|
// FROM Personne p
|
||||||
|
// WHERE
|
||||||
|
// p.etatIdentificationPersonne <> io.gmss.fiscad.enums.EtatIdentificationPersonne.NEANT
|
||||||
|
// AND (:ifu IS NULL OR UPPER(trim(p.ifu)) LIKE (CONCAT('%', :ifu, '%')))
|
||||||
|
// AND (:npi IS NULL OR UPPER(trim(p.npi)) LIKE (CONCAT('%', :npi, '%')))
|
||||||
|
// AND (:nom IS NULL OR UPPER(trim(p.nom)) LIKE (CONCAT('%', :nom, '%')))
|
||||||
|
// AND (:prenom IS NULL OR UPPER(trim(p.prenom)) LIKE (CONCAT('%', :prenom, '%')))
|
||||||
|
// AND (:raisonSociale IS NULL OR UPPER(trim(p.raisonSociale)) LIKE (CONCAT('%', :raisonSociale, '%')))
|
||||||
|
// AND (:nomMere IS NULL OR UPPER(trim(p.nomMere)) LIKE (CONCAT('%', :nomMere, '%')))
|
||||||
|
// AND p.dateNaissanceOuConsti =COALESCE(:dateNaissance, p.dateNaissanceOuConsti)
|
||||||
|
// """
|
||||||
|
// )
|
||||||
|
// List<PersonnePayLoadWeb> findByFiltersInBaseIfuNpiCorrecte(
|
||||||
|
// @Param("ifu") String ifu,
|
||||||
|
// @Param("npi") String npi,
|
||||||
|
// @Param("nom") String nom,
|
||||||
|
// @Param("prenom") String prenom,
|
||||||
|
// @Param("raisonSociale") String raisonSociale,
|
||||||
|
// @Param("nomMere") String nomMere,
|
||||||
|
// @Param("dateNaissance") LocalDate dateNaissance
|
||||||
|
// );
|
||||||
|
|
||||||
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
p.ifu,
|
p.ifu,
|
||||||
@@ -83,28 +121,20 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
|||||||
p.tel1,
|
p.tel1,
|
||||||
p.nomJeuneFille,
|
p.nomJeuneFille,
|
||||||
p.nomMere,
|
p.nomMere,
|
||||||
io.gmss.fiscad.enums.EtatIdentificationPersonne.RFU
|
p.etatIdentificationPersonne
|
||||||
)
|
)
|
||||||
FROM Personne p
|
FROM Personne p
|
||||||
WHERE
|
WHERE p.etatIdentificationPersonne <> io.gmss.fiscad.enums.EtatIdentificationPersonne.NEANT
|
||||||
p.etatIdentificationPersonne <> io.gmss.fiscad.enums.EtatIdentificationPersonne.NEANT
|
AND (:nom IS NULL OR UPPER(p.nom) LIKE :nom)
|
||||||
AND (:ifu IS NULL OR LOWER(trim(p.ifu)) LIKE (CONCAT('%', :ifu, '%')))
|
AND (:prenom IS NULL OR UPPER(p.prenom) LIKE :prenom)
|
||||||
AND (:npi IS NULL OR LOWER(trim(p.npi)) LIKE (CONCAT('%', :npi, '%')))
|
AND (:raisonSociale IS NULL OR UPPER(p.raisonSociale) LIKE :raisonSociale)
|
||||||
AND (:nom IS NULL OR LOWER(trim(p.nom)) LIKE (CONCAT('%', :nom, '%')))
|
AND (:nomMere IS NULL OR UPPER(p.nomMere) LIKE :nomMere)
|
||||||
AND (:prenom IS NULL OR LOWER(trim(p.prenom)) LIKE (CONCAT('%', :prenom, '%')))
|
""")
|
||||||
AND (:raisonSociale IS NULL OR LOWER(trim(p.raisonSociale)) LIKE (CONCAT('%', :raisonSociale, '%')))
|
|
||||||
AND (:nomMere IS NULL OR LOWER(trim(p.nomMere)) LIKE (CONCAT('%', :nomMere, '%')))
|
|
||||||
AND p.dateNaissanceOuConsti =COALESCE(:dateNaissance, p.dateNaissanceOuConsti)
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
List<PersonnePayLoadWeb> findByFiltersInBaseIfuNpiCorrecte(
|
List<PersonnePayLoadWeb> findByFiltersInBaseIfuNpiCorrecte(
|
||||||
@Param("ifu") String ifu,
|
|
||||||
@Param("npi") String npi,
|
|
||||||
@Param("nom") String nom,
|
@Param("nom") String nom,
|
||||||
@Param("prenom") String prenom,
|
@Param("prenom") String prenom,
|
||||||
@Param("raisonSociale") String raisonSociale,
|
@Param("raisonSociale") String raisonSociale,
|
||||||
@Param("nomMere") String nomMere,
|
@Param("nomMere") String nomMere
|
||||||
@Param("dateNaissance") LocalDate dateNaissance
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -186,4 +216,51 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query( """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb(
|
||||||
|
p.id,
|
||||||
|
p.ifu,
|
||||||
|
p.nom,
|
||||||
|
p.prenom,
|
||||||
|
p.raisonSociale,
|
||||||
|
p.numRavip,
|
||||||
|
p.npi,
|
||||||
|
p.dateNaissanceOuConsti,
|
||||||
|
p.lieuNaissance,
|
||||||
|
p.tel1,
|
||||||
|
p.nomJeuneFille,
|
||||||
|
p.nomMere,
|
||||||
|
p.etatIdentificationPersonne
|
||||||
|
)
|
||||||
|
FROM Personne p
|
||||||
|
where p.ifu= :ifu
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
List<PersonnePayLoadWeb> findAllPersonneByIfuToDto(
|
||||||
|
@Param("ifu") String ifu
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query( """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb(
|
||||||
|
p.id,
|
||||||
|
p.ifu,
|
||||||
|
p.nom,
|
||||||
|
p.prenom,
|
||||||
|
p.raisonSociale,
|
||||||
|
p.numRavip,
|
||||||
|
p.npi,
|
||||||
|
p.dateNaissanceOuConsti,
|
||||||
|
p.lieuNaissance,
|
||||||
|
p.tel1,
|
||||||
|
p.nomJeuneFille,
|
||||||
|
p.nomMere,
|
||||||
|
p.etatIdentificationPersonne
|
||||||
|
)
|
||||||
|
FROM Personne p
|
||||||
|
where p.npi= :npi
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
List<PersonnePayLoadWeb> findAllPersonneByNpiToDto(
|
||||||
|
@Param("npi") String npi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user