gestion des enregistrement par web
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 30s

This commit is contained in:
2026-01-13 21:28:53 +01:00
parent 9947716ef3
commit 47b92f9341
23 changed files with 298 additions and 60 deletions

View File

@@ -32,7 +32,7 @@ import java.util.List;
@SecurityRequirement(name = "bearer") @SecurityRequirement(name = "bearer")
@Tag(name = "Enquête") @Tag(name = "Enquête")
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')") //@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
public class EnqueteController { public class EnqueteController {
private final EnqueteService enqueteService; private final EnqueteService enqueteService;

View File

@@ -21,11 +21,13 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
import java.util.Optional;
@RestController @RestController
@RequestMapping(value = "api/personne", produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "api/personne", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor @RequiredArgsConstructor
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')") //@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
public class PersonneController { public class PersonneController {
private static final Logger logger = LoggerFactory.getLogger(PersonneController.class); private static final Logger logger = LoggerFactory.getLogger(PersonneController.class);
@@ -93,4 +95,20 @@ public class PersonneController {
); );
} }
} }
@GetMapping("/id/{id}")
public ResponseEntity<?> getPersonneById(@PathVariable Long id) {
try{
Optional<Personne> optionalPersonne= personneService.getPersonneById(id);
return new ResponseEntity<>(
new ApiResponse<>(true, optionalPersonne.orElse(null), "Personne retrouvée avec succès."),
HttpStatus.OK
);
}catch (Exception e){
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
}
}
} }

View File

@@ -0,0 +1,179 @@
package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.EnqueteActivite;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteActiviteService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteActivitePayLoadWeb ;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@RequestMapping(value = "api/enquete-activite", produces = MediaType.APPLICATION_JSON_VALUE)
@SecurityRequirement(name = "bearer")
@Tag(name = "EnqueteActivite")
@CrossOrigin(origins = "*")
public class EnqueteActiviteController {
private final EnqueteActiviteService enqueteActiviteService;
private static final Logger logger = LoggerFactory.getLogger(EnqueteActiviteController.class);
public EnqueteActiviteController(EnqueteActiviteService enqueteActiviteService) {
this.enqueteActiviteService = enqueteActiviteService;
}
@PostMapping("/create")
public ResponseEntity<?> createEnqueteActivite(@RequestBody @Valid @Validated EnqueteActivitePayLoadWeb enqueteActivitePayLoadWeb) {
try {
EnqueteActivite enqueteActivite = enqueteActiviteService.createEnqueteActivite(enqueteActivitePayLoadWeb);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteActivite, "Enquete Activite créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PutMapping("/update/{id}")
public ResponseEntity<?> updateEnqueteActivite(@PathVariable Long id, @RequestBody EnqueteActivitePayLoadWeb enqueteActivitePayLoadWeb) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteActiviteService.updateEnqueteActivite(id,enqueteActivitePayLoadWeb), "EnqueteActivite mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@DeleteMapping("/delete/{id}")
public ResponseEntity<?> deleteEnqueteActivite(@PathVariable Long id) {
try {
enqueteActiviteService.deleteEnqueteActivite(id);
return new ResponseEntity<>(
new ApiResponse<>(true, "Enquete Activite supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllEnqueteActiviteList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteActiviteService.getEnqueteActiviteList(), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllEnqueteActivitePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteActiviteService.getEnqueteActiviteList(pageable), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getEnqueteActiviteById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteActiviteService.getEnqueteActiviteById(id), "EnqueteActivite trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.infocad.metier;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.gmss.fiscad.deserializer.LocalDateDeserializer; import io.gmss.fiscad.deserializer.LocalDateDeserializer;
import io.gmss.fiscad.entities.BaseEntity; import io.gmss.fiscad.entities.BaseEntity;
@@ -64,7 +65,7 @@ public class Enquete extends BaseEntity implements Serializable {
@OneToMany(mappedBy = "enquete") @OneToMany(mappedBy = "enquete")
private List<ActeurConcerne> acteurConcernes; private List<ActeurConcerne> acteurConcernes;
@JsonIgnore //@JsonIgnore
@ManyToOne @ManyToOne
private Parcelle parcelle; private Parcelle parcelle;
@@ -82,7 +83,7 @@ public class Enquete extends BaseEntity implements Serializable {
@ManyToOne @ManyToOne
private Equipe equipe; private Equipe equipe;
@JsonIgnore // @JsonIgnore
@ManyToOne @ManyToOne
@JoinColumn(name = "proprietaire_id") @JoinColumn(name = "proprietaire_id")
private Personne personne ; private Personne personne ;
@@ -163,8 +164,8 @@ public class Enquete extends BaseEntity implements Serializable {
private float superficie ; private float superficie ;
private int nbreBatiment; private int nbreBatiment;
private int nbrePiscine; private int nbrePiscine;
private Long valeurMensuelleLocation; private Long montantMensuelleLocation;
private Long valeurAnnuelleLocation; private Long montantAnnuelleLocation;
private Long valeurParcelleEstime; private Long valeurParcelleEstime;
private Long valeurParcelleReel; private Long valeurParcelleReel;
@@ -178,9 +179,11 @@ public class Enquete extends BaseEntity implements Serializable {
@JsonIgnore @JsonIgnore
@OneToMany(mappedBy = "enquete") @OneToMany(mappedBy = "enquete")
@JsonManagedReference
private List<EnqueteUniteLogement> enqueteUniteLogements; private List<EnqueteUniteLogement> enqueteUniteLogements;
@JsonIgnore @JsonIgnore
@JsonManagedReference
@OneToMany(mappedBy = "enquete") @OneToMany(mappedBy = "enquete")
private List<EnqueteBatiment> enqueteBatiments; private List<EnqueteBatiment> enqueteBatiments;
@@ -220,7 +223,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getDepartement() { public String getDepartement() {
if (this.bloc != null) { if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement(); Arrondissement arrondissement = this.bloc.getArrondissement();
if (arrondissement != null) { if (arrondissement != null && arrondissement.getCommune()!=null && arrondissement.getCommune().getDepartement()!=null) {
return arrondissement.getCommune().getDepartement().getNom(); return arrondissement.getCommune().getDepartement().getNom();
} else return ""; } else return "";
} else return ""; } else return "";
@@ -229,7 +232,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getCommune() { public String getCommune() {
if (this.bloc != null) { if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement(); Arrondissement arrondissement = this.bloc.getArrondissement();
if (arrondissement != null) { if (arrondissement != null && arrondissement.getCommune()!=null) {
return arrondissement.getCommune().getNom(); return arrondissement.getCommune().getNom();
} else return ""; } else return "";
} else return ""; } else return "";
@@ -247,7 +250,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getTypeDomaine() { public String getTypeDomaine() {
if (this.parcelle != null) { if (this.parcelle != null) {
NatureDomaine natureDomaine = this.parcelle.getNatureDomaine(); NatureDomaine natureDomaine = this.parcelle.getNatureDomaine();
if (natureDomaine != null) { if (natureDomaine != null && natureDomaine.getTypeDomaine()!=null ) {
return natureDomaine.getTypeDomaine().getLibelle(); return natureDomaine.getTypeDomaine().getLibelle();
} else return ""; } else return "";
} else return ""; } else return "";
@@ -260,7 +263,7 @@ public class Enquete extends BaseEntity implements Serializable {
} }
public String getStructureEnqueteur() { public String getStructureEnqueteur() {
if (this.user != null) { if (this.user != null && this.user.getStructure()!=null) {
return this.user.getStructure().getNom(); return this.user.getStructure().getNom();
} else return ""; } else return "";
} }

View File

@@ -21,6 +21,7 @@ import org.hibernate.annotations.Where;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@@ -89,10 +90,11 @@ public class Personne extends BaseEntity implements Serializable {
private Long mobileDataId; private Long mobileDataId;
public List<Upload> getUploads() { public List<Upload> getUploads() {
return uploads.stream().filter(upload -> upload.getPiece() == null && upload.getMembreGroupe() == null).toList();
return uploads==null ? new ArrayList<>():uploads.stream().filter(upload -> upload.getPiece() == null && upload.getMembreGroupe() == null).toList();
} }
public List<Piece> getPieces() { public List<Piece> getPieces() {
return pieces.stream().filter(piece -> piece.getPersonne() != null).toList(); return pieces==null ? new ArrayList<>():pieces.stream().filter(piece -> piece.getPersonne() != null).toList();
} }
} }

View File

@@ -34,10 +34,13 @@ public class Batiment extends BaseEntity implements Serializable {
@JsonDeserialize(using = LocalDateDeserializer.class) @JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate dateConstruction; private LocalDate dateConstruction;
private Long idDerniereEnquete; private Long idDerniereEnquete;
@JsonIgnore @JsonIgnore
@ManyToOne @ManyToOne
private Parcelle parcelle; private Parcelle parcelle;
private Long parcelleExternalKey; private Long parcelleExternalKey;
@JsonIgnore @JsonIgnore
@ManyToOne @ManyToOne
private Tpe terminal; private Tpe terminal;

View File

@@ -30,9 +30,12 @@ public class CaracteristiqueUniteLogement extends BaseEntity implements Serializ
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JsonBackReference @JsonBackReference
private EnqueteUniteLogement enqueteUniteLogement; private EnqueteUniteLogement enqueteUniteLogement;
private Long enqueteUniteLogementExternalKey; private Long enqueteUniteLogementExternalKey;
@ManyToOne @ManyToOne
private Caracteristique caracteristique; private Caracteristique caracteristique;

View File

@@ -65,20 +65,30 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
@JsonFormat(pattern = "dd-MM-yyyy") @JsonFormat(pattern = "dd-MM-yyyy")
@JsonDeserialize(using = LocalDateDeserializer.class) @JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate dateFinExcemption; private LocalDate dateFinExcemption;
@OneToOne
private Personne personne; //@JsonIgnore
private Long personneExternalKey;
@ManyToOne @ManyToOne
private Batiment batiment; private Personne personne;
private Long batimentExternalKey;
private Long personneExternalKey;
@JsonIgnore @JsonIgnore
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
@JsonBackReference
private Batiment batiment;
private Long batimentExternalKey;
private Long nbreEtage;
// @JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
@JsonBackReference
private Enquete enquete; private Enquete enquete;
@JsonManagedReference ///pour couper la récurcivité
@OneToMany(mappedBy = "enqueteBatiment") @OneToMany(mappedBy = "enqueteBatiment")
@JsonManagedReference ///pour couper la récurcivité
private List<CaracteristiqueBatiment> caracteristiqueBatiments; private List<CaracteristiqueBatiment> caracteristiqueBatiments;
@JsonIgnore @JsonIgnore

View File

@@ -1,5 +1,6 @@
package io.gmss.fiscad.entities.rfu.metier; package io.gmss.fiscad.entities.rfu.metier;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonManagedReference;
@@ -61,16 +62,25 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
@JsonFormat(pattern = "dd-MM-yyyy") @JsonFormat(pattern = "dd-MM-yyyy")
@JsonDeserialize(using = LocalDateDeserializer.class) @JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate dateFinExcemption; private LocalDate dateFinExcemption;
@JsonIgnore @JsonIgnore
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
@JsonBackReference
private Enquete enquete; private Enquete enquete;
@ManyToOne @ManyToOne
private UniteLogement uniteLogement; private UniteLogement uniteLogement;
private Long uniteLogementExternalKey; private Long uniteLogementExternalKey;
@OneToOne @OneToOne
private Personne personne; private Personne personne;
private Long personneExternalKey; private Long personneExternalKey;
private Long mobileDataId; private Long mobileDataId;
@OneToMany(mappedBy = "enqueteUniteLogement") @OneToMany(mappedBy = "enqueteUniteLogement")
@JsonManagedReference @JsonManagedReference
private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements; private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;

View File

@@ -39,6 +39,7 @@ public class Caracteristique extends BaseEntity implements Serializable {
private Tpe terminal; private Tpe terminal;
@ManyToOne @ManyToOne
private CategorieBatiment categorieBatiment; private CategorieBatiment categorieBatiment;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private Arrondissement arrondissement; private Arrondissement arrondissement;
} }

View File

@@ -52,6 +52,7 @@ public class User extends BaseEntity implements Serializable {
inverseJoinColumns = @JoinColumn(name = "roles_id") inverseJoinColumns = @JoinColumn(name = "roles_id")
) )
private Set<Role> roles; private Set<Role> roles;
@ManyToOne @ManyToOne
private Structure structure; private Structure structure;
// @JsonIgnore // @JsonIgnore

View File

@@ -110,12 +110,14 @@ public class EnqueteServiceImpl implements EnqueteService {
throw new BadRequestException("Echec de l'enregistrement : zone inexistante"); throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
} }
if(enquetePayLoadWeb.getZoneRfuId()!=null) {
Optional<Rue> optionalRue = rueRepository.findById(enquetePayLoadWeb.getZoneRfuId()); Optional<Rue> optionalRue = rueRepository.findById(enquetePayLoadWeb.getZoneRfuId());
if (optionalRue.isPresent()) { if (optionalRue.isPresent()) {
rueId=optionalRue.get().getId(); rueId = optionalRue.get().getId();
enquetePayLoadWeb.getParcellePayLoadWeb().setRueId(rueId); enquetePayLoadWeb.getParcellePayLoadWeb().setRueId(rueId);
} }
}
Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId()); Optional<Equipe> optionalEquipe = equipeRepository.findById(enquetePayLoadWeb.getEquipeId());
@@ -127,6 +129,7 @@ public class EnqueteServiceImpl implements EnqueteService {
parcelle = parcelleService.updateParcelle(enquetePayLoadWeb.getParcellePayLoadWeb().getId(),enquetePayLoadWeb.getParcellePayLoadWeb()); parcelle = parcelleService.updateParcelle(enquetePayLoadWeb.getParcellePayLoadWeb().getId(),enquetePayLoadWeb.getParcellePayLoadWeb());
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
throw new ApplicationException("Echec de l'enregistrement : La parcelle non enregistrée."); throw new ApplicationException("Echec de l'enregistrement : La parcelle non enregistrée.");
} }
////enregistrement de l'enquete ////enregistrement de l'enquete
@@ -154,8 +157,8 @@ public class EnqueteServiceImpl implements EnqueteService {
enquete.setNomRue(enquetePayLoadWeb.getNomRue()); enquete.setNomRue(enquetePayLoadWeb.getNomRue());
enquete.setNumRue(enquetePayLoadWeb.getNumRue()); enquete.setNumRue(enquetePayLoadWeb.getNumRue());
enquete.setSuperficie(enquetePayLoadWeb.getSuperficie()); enquete.setSuperficie(enquetePayLoadWeb.getSuperficie());
enquete.setValeurMensuelleLocation(enquetePayLoadWeb.getValeurMensuelleLocation()); enquete.setMontantMensuelleLocation(enquetePayLoadWeb.getMontantMensuelleLocation());
enquete.setValeurAnnuelleLocation(enquetePayLoadWeb.getValeurAnnuelleLocation()); enquete.setMontantAnnuelleLocation(enquetePayLoadWeb.getMontantAnnuelleLocation());
enquete.setValeurParcelleEstime(enquetePayLoadWeb.getValeurParcelleEstime()); enquete.setValeurParcelleEstime(enquetePayLoadWeb.getValeurParcelleEstime());
enquete.setValeurParcelleReel(enquetePayLoadWeb.getValeurParcelleReel()); enquete.setValeurParcelleReel(enquetePayLoadWeb.getValeurParcelleReel());
Enquete finalEnquete=enqueteRepository.save(enquete); Enquete finalEnquete=enqueteRepository.save(enquete);
@@ -268,8 +271,8 @@ public class EnqueteServiceImpl implements EnqueteService {
enquete.setNomRue(enquetePayLoadWeb.getNomRue()); enquete.setNomRue(enquetePayLoadWeb.getNomRue());
enquete.setNumRue(enquetePayLoadWeb.getNumRue()); enquete.setNumRue(enquetePayLoadWeb.getNumRue());
enquete.setSuperficie(enquetePayLoadWeb.getSuperficie()); enquete.setSuperficie(enquetePayLoadWeb.getSuperficie());
enquete.setValeurMensuelleLocation(enquetePayLoadWeb.getValeurMensuelleLocation()); enquete.setMontantMensuelleLocation(enquetePayLoadWeb.getMontantMensuelleLocation());
enquete.setValeurAnnuelleLocation(enquetePayLoadWeb.getValeurAnnuelleLocation()); enquete.setMontantAnnuelleLocation(enquetePayLoadWeb.getMontantAnnuelleLocation());
enquete.setValeurParcelleEstime(enquetePayLoadWeb.getValeurParcelleEstime()); enquete.setValeurParcelleEstime(enquetePayLoadWeb.getValeurParcelleEstime());
enquete.setValeurParcelleReel(enquetePayLoadWeb.getValeurParcelleReel()); enquete.setValeurParcelleReel(enquetePayLoadWeb.getValeurParcelleReel());
return enqueteRepository.save(enquete); return enqueteRepository.save(enquete);

View File

@@ -113,7 +113,10 @@ public class ParcelleServiceImpl implements ParcelleService {
} }
private Parcelle getParcelleFromPayload(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb) { private Parcelle getParcelleFromPayload(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb) {
if(parcellePayLoadWeb.getRueId()!=null) {
Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId()); Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId());
parcelle.setRue(optionalRue.orElse(null));
}
parcelle.setP(parcellePayLoadWeb.getP()); parcelle.setP(parcellePayLoadWeb.getP());
parcelle.setI(parcellePayLoadWeb.getI()); parcelle.setI(parcellePayLoadWeb.getI());
parcelle.setQ(parcellePayLoadWeb.getQ()); parcelle.setQ(parcellePayLoadWeb.getQ());
@@ -126,7 +129,7 @@ public class ParcelleServiceImpl implements ParcelleService {
parcelle.setAutreNumeroTitreFoncier(parcellePayLoadWeb.getNumTitreFoncier()); parcelle.setAutreNumeroTitreFoncier(parcellePayLoadWeb.getNumTitreFoncier());
parcelle.setObservation(parcellePayLoadWeb.getObservation()); parcelle.setObservation(parcellePayLoadWeb.getObservation());
parcelle.setSuperficie(parcellePayLoadWeb.getSuperficie()); parcelle.setSuperficie(parcellePayLoadWeb.getSuperficie());
parcelle.setRue(optionalRue.orElse(null));
return parcelle; return parcelle;
} }

View File

@@ -92,7 +92,7 @@ public class PersonneServiceImpl implements PersonneService {
@Override @Override
public Optional<Personne> getPersonneById(Long id) { public Optional<Personne> getPersonneById(Long id) {
return Optional.empty(); return personneRepository.findById(id);
} }
@Override @Override
@@ -109,7 +109,7 @@ public class PersonneServiceImpl implements PersonneService {
.toList(); .toList();
System.out.println(uploadsDirects.size()); System.out.println(uploadsDirects.size());
// 3. Pièces et leurs Uploads // 3. Pièces et leurs Uploads
List<PieceDTO> pieces = pieceRepository.findByPersonne_IdAndActeurConcerneIsNull(id) List<PieceDTO> pieces = pieceRepository.findByPersonne_IdAndEnqueteIsNull(id)
.stream().map(piece -> { .stream().map(piece -> {
List<UploadDTO> uploads = piece.getUploads().stream() List<UploadDTO> uploads = piece.getUploads().stream()
.map(u -> new UploadDTO(u.getId(), u.getExternalKey(), u.getObservation(), u.isSynchronise(), u.getFileName(), u.getOriginalFileName(), u.getURIFile(), u.getCheckSum(), u.getSize(), u.getMimeType())) .map(u -> new UploadDTO(u.getId(), u.getExternalKey(), u.getObservation(), u.isSynchronise(), u.getFileName(), u.getOriginalFileName(), u.getURIFile(), u.getCheckSum(), u.getSize(), u.getMimeType()))

View File

@@ -84,6 +84,7 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
enqueteBatiment.setValeurBatimentReel(enqueteBatimentPayloadWeb.getValeurBatimentReel()); enqueteBatiment.setValeurBatimentReel(enqueteBatimentPayloadWeb.getValeurBatimentReel());
enqueteBatiment.setValeurBatimentEstime(enqueteBatimentPayloadWeb.getValeurBatimentEstime()); enqueteBatiment.setValeurBatimentEstime(enqueteBatimentPayloadWeb.getValeurBatimentEstime());
enqueteBatiment.setMontantLocatifAnnuelDeclare(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelDeclare()); enqueteBatiment.setMontantLocatifAnnuelDeclare(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelDeclare());
enqueteBatiment.setNbreEtage(enqueteBatimentPayloadWeb.getNbreEtage());
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment); enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
//////Enregistrement des caractéristiques batiment //////Enregistrement des caractéristiques batiment

View File

@@ -27,6 +27,7 @@ public class EnqueteBatimentPayloadWeb {
private int nbreHabitant; private int nbreHabitant;
private Long montantMensuelLocation; private Long montantMensuelLocation;
private Long montantLocatifAnnuelDeclare; private Long montantLocatifAnnuelDeclare;
private Long nbreEtage;
private Long valeurBatimentEstime; private Long valeurBatimentEstime;
private Long valeurBatimentReel; private Long valeurBatimentReel;

View File

@@ -41,8 +41,8 @@ public class EnquetePayLoadWeb {
private Long zoneRfuId; private Long zoneRfuId;
private Long proprietaireId; private Long proprietaireId;
private Long EnqueteurId; private Long EnqueteurId;
private Long valeurMensuelleLocation; private Long montantMensuelleLocation;
private Long valeurAnnuelleLocation; private Long montantAnnuelleLocation;
private Long valeurParcelleEstime; private Long valeurParcelleEstime;
private Long valeurParcelleReel; private Long valeurParcelleReel;
} }

View File

@@ -11,9 +11,6 @@ public class EnqueteUniteLogementPayloadWeb {
private UniteLogementPaylaodWeb uniteLogementPaylaodWeb ; private UniteLogementPaylaodWeb uniteLogementPaylaodWeb ;
private List<CaracteristiqueUniteLogementPayloadWeb> caracteristiqueUniteLogementPayloadWebs; private List<CaracteristiqueUniteLogementPayloadWeb> caracteristiqueUniteLogementPayloadWebs;
private List<UploadPayLoadWeb> uploadPayLoadWebs; private List<UploadPayLoadWeb> uploadPayLoadWebs;
private Long externalKey;
private Long terminalId;
private boolean synchronise;
private String observation; private String observation;
private Long userId; private Long userId;
private float surface; private float surface;

View File

@@ -7,7 +7,7 @@ public class UploadPayLoadWeb {
private Long id; private Long id;
private Long pieceId; private Long pieceId;
private String Observation; private String Observation;
private boolean synchronise; //private boolean synchronise;
//private String fileBase64; //private String fileBase64;
///////////////////////////////// /////////////////////////////////
private String name; private String name;

View File

@@ -12,10 +12,7 @@ import java.util.Optional;
public interface PieceRepository extends JpaRepository<Piece, Long> { public interface PieceRepository extends JpaRepository<Piece, Long> {
Optional<Piece> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long terminalId); Optional<Piece> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long terminalId);
@Query(nativeQuery = true, value = "delete from piece p where p.id in (select p.id " + @Query(nativeQuery = true, value = "delete from piece p where p.enquete_id = ?1")
" from piece p inner join acteur_concerne a on a.id = p.acteur_concerne_id" +
" inner join enquete e on e.id = a.enquete_id" +
" where e.id = ?1)")
@Modifying @Modifying
@Transactional @Transactional
void deletePieceByEnqueteId(Long enqueteId); void deletePieceByEnqueteId(Long enqueteId);
@@ -27,7 +24,7 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
@Query(value = "Select " + @Query(value = "Select " +
" p.id as idBackend, " + " p.id as idBackend, " +
" p.external_key as externalKey, " + " p.external_key as externalKey, " +
" ac.external_key as acteurConcerneId, " + // " ac.external_key as acteurConcerneId, " +
" p.date_expiration as dateExpiration," + " p.date_expiration as dateExpiration," +
" p.numero_piece as numeroPiece," + " p.numero_piece as numeroPiece," +
" p.url," + " p.url," +
@@ -45,13 +42,14 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
" p.max_numero_piece_id, " + " p.max_numero_piece_id, " +
" p.max_numero_acteur_concerne_id, " + " p.max_numero_acteur_concerne_id, " +
" p.bloc_id as blocId " + " p.bloc_id as blocId " +
" from piece p left join personne pp on p.personne_id = pp.id left join acteur_concerne ac on ac.id = p.personne_id " + " from piece p left join personne pp on p.personne_id = pp.id " +
" where p.terminal_id = ?1" " where p.terminal_id = ?1"
, nativeQuery = true) , nativeQuery = true)
List<PiecePayLoadRestor> getPiecesByTerminalId(Long terminalId); List<PiecePayLoadRestor> getPiecesByTerminalId(Long terminalId);
List<Piece> findByPersonne_Id(Long id); List<Piece> findByPersonne_Id(Long id);
Optional<Piece> findByMobileDataId(Long id); Optional<Piece> findByMobileDataId(Long id);
List<Piece> findByPersonne_IdAndActeurConcerneIsNull(Long id);
List<Piece> findByPersonne_IdAndEnqueteIsNull(Long id);
} }

View File

@@ -20,6 +20,8 @@ import io.gmss.fiscad.repositories.infocad.parametre.*;
import io.gmss.fiscad.repositories.rfu.metier.*; import io.gmss.fiscad.repositories.rfu.metier.*;
import io.gmss.fiscad.repositories.rfu.parametre.CaracteristiqueRepository; import io.gmss.fiscad.repositories.rfu.parametre.CaracteristiqueRepository;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.codehaus.groovy.transform.SourceURIASTTransformation;
import org.hibernate.event.spi.SaveOrUpdateEvent;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Optional; import java.util.Optional;
@@ -72,6 +74,8 @@ public class EntityFromPayLoadService {
if(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId()!=null) if(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId()!=null)
optionalEnqueteBatiment=enqueteBatimentRepository.findById(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId()); optionalEnqueteBatiment=enqueteBatimentRepository.findById(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId());
System.out.println("CARACT ID" + caracteristiqueBatimentPayloadWeb.getCaracteristiqueId());
if(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId()!=null) if(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId()!=null)
optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId()); optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId());
@@ -91,6 +95,7 @@ public class EntityFromPayLoadService {
if(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId()!=null) if(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId()!=null)
optionalEnqueteUniteLogement=enqueteUniteLogementRepository.findById(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId()); optionalEnqueteUniteLogement=enqueteUniteLogementRepository.findById(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId());
if(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId()!=null) if(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId()!=null)
optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId()); optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId());

View File

@@ -1,17 +1,17 @@
server.port=8282 server.port=8282
#io.gmss.fiscad.profile=${IO_GMSS_FISCAD_PROFILE} io.gmss.fiscad.profile=${IO_GMSS_FISCAD_PROFILE}
io.gmss.fiscad.profile=dgi #io.gmss.fiscad.profile=dgi
# TEST ENV # TEST ENV
#spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/dgi_db #spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/dgi_db
#spring.datasource.username=infocad_user #spring.datasource.username=infocad_user
#spring.datasource.password=W5fwD({9*q53 #spring.datasource.password=W5fwD({9*q53
# LOCAL ENV # LOCAL ENV
spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi #spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
spring.datasource.username=infocad_user #spring.datasource.username=infocad_user
spring.datasource.password=W5fwD({9*q53 #spring.datasource.password=W5fwD({9*q53
# PROD ENVIRONNEMENT # PROD ENVIRONNEMENT
#spring.datasource.url=${SPRING_DATASOURCE_URL} spring.datasource.url=${SPRING_DATASOURCE_URL}
#spring.datasource.username=${SPRING_DATASOURCE_USERNAME} spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
#spring.datasource.password=${SPRING_DATASOURCE_PASSWORD} spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}

View File

@@ -1,6 +1,6 @@
#spring.profiles.active=${SPRING_PROFILES_ACTIVE} spring.profiles.active=${SPRING_PROFILES_ACTIVE}
#spring.profiles.active=abomey #spring.profiles.active=abomey
spring.profiles.active=dgi #spring.profiles.active=dgi
spring.jpa.properties.hibernate.id.new_generator_mappings=false spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.open-in-view=false spring.jpa.open-in-view=false
@@ -46,11 +46,11 @@ logging.file.name=/app/logs/fiscad.log
#app.abs.env.defaultuser = fiscad_admin #app.abs.env.defaultuser = fiscad_admin
app.default-user.username=fiscad_admin #app.default-user.username=fiscad_admin
app.default-user.password=1234567890 #app.default-user.password=1234567890
#app.default-user.username=${DEFAULT_USER_NAME} app.default-user.username=${DEFAULT_USER_NAME}
#app.default-user.password=${DEFAULT_USER_PASSWORD} app.default-user.password=${DEFAULT_USER_PASSWORD}
app.upload.root=${file.upload_dir} app.upload.root=${file.upload_dir}
app.upload.zips.received=${app.upload.root}/zips/received app.upload.zips.received=${app.upload.root}/zips/received