features/crud_entites #70

Merged
judaur2005 merged 2 commits from features/crud_entites into develop 2026-01-13 20:33:18 +00:00
23 changed files with 298 additions and 60 deletions
Showing only changes of commit 47b92f9341 - Show all commits

View File

@@ -32,7 +32,7 @@ import java.util.List;
@SecurityRequirement(name = "bearer")
@Tag(name = "Enquête")
@CrossOrigin(origins = "*")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
//@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
public class EnqueteController {
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.client.HttpClientErrorException;
import java.util.Optional;
@RestController
@RequestMapping(value = "api/personne", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
//@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
public class PersonneController {
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.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
import io.gmss.fiscad.entities.BaseEntity;
@@ -64,7 +65,7 @@ public class Enquete extends BaseEntity implements Serializable {
@OneToMany(mappedBy = "enquete")
private List<ActeurConcerne> acteurConcernes;
@JsonIgnore
//@JsonIgnore
@ManyToOne
private Parcelle parcelle;
@@ -82,7 +83,7 @@ public class Enquete extends BaseEntity implements Serializable {
@ManyToOne
private Equipe equipe;
@JsonIgnore
// @JsonIgnore
@ManyToOne
@JoinColumn(name = "proprietaire_id")
private Personne personne ;
@@ -163,8 +164,8 @@ public class Enquete extends BaseEntity implements Serializable {
private float superficie ;
private int nbreBatiment;
private int nbrePiscine;
private Long valeurMensuelleLocation;
private Long valeurAnnuelleLocation;
private Long montantMensuelleLocation;
private Long montantAnnuelleLocation;
private Long valeurParcelleEstime;
private Long valeurParcelleReel;
@@ -178,9 +179,11 @@ public class Enquete extends BaseEntity implements Serializable {
@JsonIgnore
@OneToMany(mappedBy = "enquete")
@JsonManagedReference
private List<EnqueteUniteLogement> enqueteUniteLogements;
@JsonIgnore
@JsonManagedReference
@OneToMany(mappedBy = "enquete")
private List<EnqueteBatiment> enqueteBatiments;
@@ -220,7 +223,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getDepartement() {
if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement();
if (arrondissement != null) {
if (arrondissement != null && arrondissement.getCommune()!=null && arrondissement.getCommune().getDepartement()!=null) {
return arrondissement.getCommune().getDepartement().getNom();
} else return "";
} else return "";
@@ -229,7 +232,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getCommune() {
if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement();
if (arrondissement != null) {
if (arrondissement != null && arrondissement.getCommune()!=null) {
return arrondissement.getCommune().getNom();
} else return "";
} else return "";
@@ -247,7 +250,7 @@ public class Enquete extends BaseEntity implements Serializable {
public String getTypeDomaine() {
if (this.parcelle != null) {
NatureDomaine natureDomaine = this.parcelle.getNatureDomaine();
if (natureDomaine != null) {
if (natureDomaine != null && natureDomaine.getTypeDomaine()!=null ) {
return natureDomaine.getTypeDomaine().getLibelle();
} else return "";
} else return "";
@@ -260,7 +263,7 @@ public class Enquete extends BaseEntity implements Serializable {
}
public String getStructureEnqueteur() {
if (this.user != null) {
if (this.user != null && this.user.getStructure()!=null) {
return this.user.getStructure().getNom();
} else return "";
}

View File

@@ -21,6 +21,7 @@ import org.hibernate.annotations.Where;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@@ -89,10 +90,11 @@ public class Personne extends BaseEntity implements Serializable {
private Long mobileDataId;
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() {
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)
private LocalDate dateConstruction;
private Long idDerniereEnquete;
@JsonIgnore
@ManyToOne
private Parcelle parcelle;
private Long parcelleExternalKey;
@JsonIgnore
@ManyToOne
private Tpe terminal;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -92,7 +92,7 @@ public class PersonneServiceImpl implements PersonneService {
@Override
public Optional<Personne> getPersonneById(Long id) {
return Optional.empty();
return personneRepository.findById(id);
}
@Override
@@ -109,7 +109,7 @@ public class PersonneServiceImpl implements PersonneService {
.toList();
System.out.println(uploadsDirects.size());
// 3. Pièces et leurs Uploads
List<PieceDTO> pieces = pieceRepository.findByPersonne_IdAndActeurConcerneIsNull(id)
List<PieceDTO> pieces = pieceRepository.findByPersonne_IdAndEnqueteIsNull(id)
.stream().map(piece -> {
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()))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,10 +12,7 @@ import java.util.Optional;
public interface PieceRepository extends JpaRepository<Piece, Long> {
Optional<Piece> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long terminalId);
@Query(nativeQuery = true, value = "delete from piece p where p.id in (select p.id " +
" 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)")
@Query(nativeQuery = true, value = "delete from piece p where p.enquete_id = ?1")
@Modifying
@Transactional
void deletePieceByEnqueteId(Long enqueteId);
@@ -27,7 +24,7 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
@Query(value = "Select " +
" p.id as idBackend, " +
" p.external_key as externalKey, " +
" ac.external_key as acteurConcerneId, " +
// " ac.external_key as acteurConcerneId, " +
" p.date_expiration as dateExpiration," +
" p.numero_piece as numeroPiece," +
" p.url," +
@@ -45,13 +42,14 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
" p.max_numero_piece_id, " +
" p.max_numero_acteur_concerne_id, " +
" 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"
, nativeQuery = true)
List<PiecePayLoadRestor> getPiecesByTerminalId(Long terminalId);
List<Piece> findByPersonne_Id(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.parametre.CaracteristiqueRepository;
import lombok.AllArgsConstructor;
import org.codehaus.groovy.transform.SourceURIASTTransformation;
import org.hibernate.event.spi.SaveOrUpdateEvent;
import org.springframework.stereotype.Service;
import java.util.Optional;
@@ -72,6 +74,8 @@ public class EntityFromPayLoadService {
if(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId()!=null)
optionalEnqueteBatiment=enqueteBatimentRepository.findById(caracteristiqueBatimentPayloadWeb.getEnqueteBatimentId());
System.out.println("CARACT ID" + caracteristiqueBatimentPayloadWeb.getCaracteristiqueId());
if(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId()!=null)
optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueBatimentPayloadWeb.getCaracteristiqueId());
@@ -91,6 +95,7 @@ public class EntityFromPayLoadService {
if(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId()!=null)
optionalEnqueteUniteLogement=enqueteUniteLogementRepository.findById(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId());
if(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId()!=null)
optionalCaracteristique=caracteristiqueRepository.findById(caracteristiqueUniteLogementPayloadWeb.getCaracteristiqueId());

View File

@@ -1,17 +1,17 @@
server.port=8282
#io.gmss.fiscad.profile=${IO_GMSS_FISCAD_PROFILE}
io.gmss.fiscad.profile=dgi
io.gmss.fiscad.profile=${IO_GMSS_FISCAD_PROFILE}
#io.gmss.fiscad.profile=dgi
# TEST ENV
#spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/dgi_db
#spring.datasource.username=infocad_user
#spring.datasource.password=W5fwD({9*q53
# LOCAL ENV
spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
spring.datasource.username=infocad_user
spring.datasource.password=W5fwD({9*q53
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
#spring.datasource.username=infocad_user
#spring.datasource.password=W5fwD({9*q53
# PROD ENVIRONNEMENT
#spring.datasource.url=${SPRING_DATASOURCE_URL}
#spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
#spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}
spring.datasource.url=${SPRING_DATASOURCE_URL}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
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=dgi
#spring.profiles.active=dgi
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.open-in-view=false
@@ -46,11 +46,11 @@ logging.file.name=/app/logs/fiscad.log
#app.abs.env.defaultuser = fiscad_admin
app.default-user.username=fiscad_admin
app.default-user.password=1234567890
#app.default-user.username=fiscad_admin
#app.default-user.password=1234567890
#app.default-user.username=${DEFAULT_USER_NAME}
#app.default-user.password=${DEFAULT_USER_PASSWORD}
app.default-user.username=${DEFAULT_USER_NAME}
app.default-user.password=${DEFAULT_USER_PASSWORD}
app.upload.root=${file.upload_dir}
app.upload.zips.received=${app.upload.root}/zips/received