develop #263
@@ -112,30 +112,38 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Optional<Quartier> optionalQuartier = quartierRepository.findById(enquetePayLoadWeb.getQuartierId());
|
Optional<Quartier> optionalQuartier = quartierRepository.findById(enquetePayLoadWeb.getQuartierId());
|
||||||
if (!optionalQuartier.isPresent()) {
|
if (optionalQuartier.isEmpty()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Quartier inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Quartier inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||||
if (!optionalUser.isPresent()) {
|
if (optionalUser.isEmpty()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
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());
|
Optional<Personne> optionalPersonne = personneRepository.findById(enquetePayLoadWeb.getPersonneId());
|
||||||
if (!optionalPersonne.isPresent()) {
|
if (optionalPersonne.isEmpty()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||||
if (!optionalParcelle.isPresent()) {
|
if (optionalParcelle.isEmpty()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
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());
|
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
|
||||||
if (!optionalZoneRfu.isPresent()) {
|
if (optionalZoneRfu.isEmpty()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -817,11 +817,10 @@ public class EntityFromPayLoadService {
|
|||||||
enquete.setParcelle(parcelle);
|
enquete.setParcelle(parcelle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enquetePayLoadWeb.getPersonneId() != null) {
|
|
||||||
Personne personne = new Personne();
|
Personne personne = new Personne();
|
||||||
personne.setId(enquetePayLoadWeb.getPersonneId());
|
personne.setId(enquetePayLoadWeb.getPersonneId());
|
||||||
enquete.setPersonne(personne);
|
enquete.setPersonne(personne);
|
||||||
}
|
|
||||||
|
|
||||||
if (enquetePayLoadWeb.getEnqueteurId() != null) {
|
if (enquetePayLoadWeb.getEnqueteurId() != null) {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
|
|||||||
Reference in New Issue
Block a user