develop #263

Merged
judaur2005 merged 2 commits from develop into main 2026-07-24 13:36:53 +00:00
2 changed files with 17 additions and 10 deletions
Showing only changes of commit e1b9ac8915 - Show all commits

View File

@@ -112,30 +112,38 @@ public class EnqueteServiceImpl implements EnqueteService {
}
Optional<Quartier> optionalQuartier = quartierRepository.findById(enquetePayLoadWeb.getQuartierId());
if (!optionalQuartier.isPresent()) {
if (optionalQuartier.isEmpty()) {
throw new BadRequestException("Echec de l'enregistrement : Quartier inexistant");
}
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
if (!optionalUser.isPresent()) {
if (optionalUser.isEmpty()) {
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
}
if(enquetePayLoadWeb.getPersonneId()==null) {
throw new BadRequestException("Echec de l'enregistrement : Veuillez préciser le Propriétaire");
}
Optional<Personne> optionalPersonne = personneRepository.findById(enquetePayLoadWeb.getPersonneId());
if (!optionalPersonne.isPresent()) {
if (optionalPersonne.isEmpty()) {
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
}
if(enquetePayLoadWeb.getParcelleId()!=null) {
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
if (!optionalParcelle.isPresent()) {
if (optionalParcelle.isEmpty()) {
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
}
}
if(enquetePayLoadWeb.getZoneRfuId()==null){
throw new BadRequestException("Echec de l'enregistrement : Veuillez préciser la zone RFU");
}
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
if (!optionalZoneRfu.isPresent()) {
if (optionalZoneRfu.isEmpty()) {
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
}

View File

@@ -817,11 +817,10 @@ public class EntityFromPayLoadService {
enquete.setParcelle(parcelle);
}
if (enquetePayLoadWeb.getPersonneId() != null) {
Personne personne = new Personne();
personne.setId(enquetePayLoadWeb.getPersonneId());
enquete.setPersonne(personne);
}
Personne personne = new Personne();
personne.setId(enquetePayLoadWeb.getPersonneId());
enquete.setPersonne(personne);
if (enquetePayLoadWeb.getEnqueteurId() != null) {
User user = new User();