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
|
||||
public List<PersonnePayLoadWeb> recherchePersonne(RecherchePersonneResquestBody request) {
|
||||
|
||||
List<PersonnePayLoadWeb> result = new ArrayList<>(
|
||||
recherchePersonneLocal(request)
|
||||
);
|
||||
|
||||
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
|
||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||
@@ -301,29 +317,48 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
personne.setEtatIdentificationPersonne(EtatIdentificationPersonne.IFU);
|
||||
result.add(personne);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// logger.error("Erreur appel IFU EN LIGNE", e);
|
||||
}
|
||||
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=
|
||||
personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||
recherchePersonneResquestBody.getIfu()==null?null:recherchePersonneResquestBody.getIfu().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNpi()==null?null:recherchePersonneResquestBody.getNpi().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNom()==null?null:recherchePersonneResquestBody.getNom().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getPrenom()==null?null:recherchePersonneResquestBody.getPrenom().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getRaisonSociale()==null?null:recherchePersonneResquestBody.getRaisonSociale().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNomMere()==null?null:recherchePersonneResquestBody.getNomMere().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getDateNaissance()
|
||||
private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody request) {
|
||||
String nom = normalizeLikeParam(request.getNom());
|
||||
String prenom = normalizeLikeParam(request.getPrenom());
|
||||
String raisonSociale = normalizeLikeParam(request.getRaisonSociale());
|
||||
String nomMere = normalizeLikeParam(request.getNomMere());
|
||||
|
||||
return personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||
nom,
|
||||
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) {
|
||||
// callAPIService.callGetIfuEnLigneToken();
|
||||
|
||||
|
||||
@@ -69,7 +69,45 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
||||
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(
|
||||
p.id,
|
||||
p.ifu,
|
||||
@@ -83,28 +121,20 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
||||
p.tel1,
|
||||
p.nomJeuneFille,
|
||||
p.nomMere,
|
||||
io.gmss.fiscad.enums.EtatIdentificationPersonne.RFU
|
||||
p.etatIdentificationPersonne
|
||||
)
|
||||
FROM Personne p
|
||||
WHERE
|
||||
p.etatIdentificationPersonne <> io.gmss.fiscad.enums.EtatIdentificationPersonne.NEANT
|
||||
AND (:ifu IS NULL OR LOWER(trim(p.ifu)) LIKE (CONCAT('%', :ifu, '%')))
|
||||
AND (:npi IS NULL OR LOWER(trim(p.npi)) LIKE (CONCAT('%', :npi, '%')))
|
||||
AND (:nom IS NULL OR LOWER(trim(p.nom)) LIKE (CONCAT('%', :nom, '%')))
|
||||
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)
|
||||
"""
|
||||
)
|
||||
WHERE p.etatIdentificationPersonne <> io.gmss.fiscad.enums.EtatIdentificationPersonne.NEANT
|
||||
AND (:nom IS NULL OR UPPER(p.nom) LIKE :nom)
|
||||
AND (:prenom IS NULL OR UPPER(p.prenom) LIKE :prenom)
|
||||
AND (:raisonSociale IS NULL OR UPPER(p.raisonSociale) LIKE :raisonSociale)
|
||||
AND (:nomMere IS NULL OR UPPER(p.nomMere) LIKE :nomMere)
|
||||
""")
|
||||
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
|
||||
@Param("nomMere") String nomMere
|
||||
);
|
||||
|
||||
|
||||
@@ -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