reajustement secteur decoupage perimetre #264
@@ -102,7 +102,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
||||||
|
|
||||||
if((enquetePayLoadWeb.getParcelleQ()==null || enquetePayLoadWeb.getParcelleI()==null || enquetePayLoadWeb.getParcelleP()!=null) && enquetePayLoadWeb.getParcelleNup()==null){
|
if((enquetePayLoadWeb.getParcelleQ()==null || enquetePayLoadWeb.getParcelleI()==null || enquetePayLoadWeb.getParcelleP()==null) && enquetePayLoadWeb.getParcelleNup()==null){
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Vous devez préciser le QIP ou le NUP");
|
throw new BadRequestException("Echec de l'enregistrement : Vous devez préciser le QIP ou le NUP");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,10 +116,12 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
throw new BadRequestException("Echec de l'enregistrement : Quartier inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Quartier inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enquetePayLoadWeb.getEnqueteurId()!=null) {
|
||||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||||
if (optionalUser.isEmpty()) {
|
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) {
|
if(enquetePayLoadWeb.getPersonneId()==null) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Veuillez préciser le Propriétaire");
|
throw new BadRequestException("Echec de l'enregistrement : Veuillez préciser le Propriétaire");
|
||||||
@@ -189,9 +191,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
parcellePayLoadWeb.setTypeDomaineId(enquetePayLoadWeb.getTypeDomaineId());
|
parcellePayLoadWeb.setTypeDomaineId(enquetePayLoadWeb.getTypeDomaineId());
|
||||||
parcellePayLoadWeb.setRueId(enquetePayLoadWeb.getRueId());
|
parcellePayLoadWeb.setRueId(enquetePayLoadWeb.getRueId());
|
||||||
parcellePayLoadWeb.setProprietaireId(enquetePayLoadWeb.getPersonneId());
|
parcellePayLoadWeb.setProprietaireId(enquetePayLoadWeb.getPersonneId());
|
||||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
|
||||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
|
||||||
|
|
||||||
return parcellePayLoadWeb;
|
return parcellePayLoadWeb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,22 +56,23 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParcellePayLoadWeb createParcelle(ParcellePayLoadWeb parcellePayLoadWeb) throws BadRequestException {
|
public ParcellePayLoadWeb createParcelle(ParcellePayLoadWeb parcellePayLoadWeb) throws BadRequestException {
|
||||||
|
|
||||||
Optional<NatureDomaine> optionalNatureDomaine = natureDomaineRepository.findById(parcellePayLoadWeb.getNatureDomaineId());
|
Optional<NatureDomaine> optionalNatureDomaine = natureDomaineRepository.findById(parcellePayLoadWeb.getNatureDomaineId());
|
||||||
if (!optionalNatureDomaine.isPresent()) {
|
if (optionalNatureDomaine.isEmpty()) {
|
||||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec une nature de domaine inexistant");
|
throw new BadRequestException("Impossible d'enregistrer une parcelle avec une nature de domaine inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Quartier> optionalQuartier = quartierRepository.findById(parcellePayLoadWeb.getQuartierId());
|
Optional<Quartier> optionalQuartier = quartierRepository.findById(parcellePayLoadWeb.getQuartierId());
|
||||||
if (!optionalQuartier.isPresent()) {
|
if (optionalQuartier.isEmpty()) {
|
||||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoadWeb.getTypeDomaineId());
|
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoadWeb.getTypeDomaineId());
|
||||||
if (!optionalTypeDomaine.isPresent()) {
|
if (optionalTypeDomaine.isEmpty()) {
|
||||||
throw new BadRequestException("Veuillez préciser le type de domaine");
|
throw new BadRequestException("Veuillez préciser le type de domaine");
|
||||||
}
|
}
|
||||||
|
|
||||||
Parcelle parcelle = new Parcelle();
|
Parcelle parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||||
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
|
||||||
parcelle= parcelleRepository.save(parcelle);
|
parcelle= parcelleRepository.save(parcelle);
|
||||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user