Fusion du code de M. Aurince avec la version actuelle de mon code. 27/02/2025
This commit is contained in:
@@ -38,6 +38,10 @@ import io.swagger.v3.oas.annotations.servers.Server;
|
||||
@Server(
|
||||
description = "PROD ENV (https)",
|
||||
url = "https://fiscadbackend.novatic.org"
|
||||
),
|
||||
@Server(
|
||||
description = "Local ENV (http) - 2",
|
||||
url = "http://192.168.1.106:8282"
|
||||
)
|
||||
},
|
||||
security = {
|
||||
|
||||
@@ -22,7 +22,8 @@ public class SwaggerOAS3Config {
|
||||
};
|
||||
|
||||
private static final String[] DECOUPAGE = {
|
||||
"/api/arrondissement/**", "/api/commune/**", "/api/departement/**", "/api/nationalite/**", "/api/quartier/**"
|
||||
"/api/arrondissement/**", "/api/commune/**", "/api/departement/**", "/api/nationalite/**", "/api/quartier/**",
|
||||
"/api/secteur/**","/api/secteur-decoupage/**"
|
||||
};
|
||||
|
||||
private static final String[] INFOCAD_METIER = {
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package io.gmss.fiscad.controllers.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.SecteurPayload;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/secteur", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Secteur")
|
||||
public class SecteurController {
|
||||
|
||||
private final SecteurService secteurService;
|
||||
|
||||
public SecteurController(SecteurService secteurService) {
|
||||
this.secteurService = secteurService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSecteur(@RequestBody @Valid @Validated SecteurPayload secteurPayload) {
|
||||
try{
|
||||
// Secteur secteur=getSecteurFromPayload(secteurPayload);
|
||||
Secteur secteur = secteurService.createSecteur(secteurPayload);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteur, "Secteur créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPayload secteurPayload) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayload), "Secteur mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteSecteurr(@PathVariable Long id) {
|
||||
try{
|
||||
secteurService.deleteSecteur(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Secteur supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllSecteurList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurService.getSecteurList(), "Liste des secteurs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllSecteurPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurService.getSecteurList(pageable), "Liste des secteurs chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getSecteurById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurService.getSecteurById(id), "Secteur trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.gmss.fiscad.controllers.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/secteur-decoupage", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "SecteurDecoupage")
|
||||
public class SecteurDecoupageController {
|
||||
|
||||
private final SecteurDecoupageService secteurDecoupageService;
|
||||
|
||||
public SecteurDecoupageController(SecteurDecoupageService secteurDecoupageService) {
|
||||
this.secteurDecoupageService = secteurDecoupageService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSecteurDecoupage(@RequestBody @Valid @Validated SecteurDecoupage secteurDecoupage) {
|
||||
try{
|
||||
secteurDecoupage = secteurDecoupageService.createSecteurDecoupage(secteurDecoupage);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupage, "SecteurDecoupage créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateSecteurDecoupage(@PathVariable Long id, @RequestBody SecteurDecoupage secteurDecoupage) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupage), "SecteurDecoupage mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteSecteurDecoupager(@PathVariable Long id) {
|
||||
try{
|
||||
secteurDecoupageService.deleteSecteurDecoupage(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,"Secteur découpage supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllSecteurDecoupageList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(), "Liste des secteurDecoupages chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllSecteurDecoupagePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(pageable), "Liste des secteurDecoupages chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getSecteurDecoupageById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageById(id), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.EquipePayload;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -30,9 +31,9 @@ public class EquipeController {
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated Equipe equipe) {
|
||||
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated EquipePayload equipePayload) {
|
||||
try{
|
||||
equipe = equipeService.createEquipe(equipe);
|
||||
Equipe equipe = equipeService.createEquipe(equipePayload);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -46,10 +47,10 @@ public class EquipeController {
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody Equipe equipe) {
|
||||
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody EquipePayload equipePayload) {
|
||||
try{
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.updateEquipe(id, equipe), "Equipe mis à jour avec succès."),
|
||||
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
|
||||
@@ -86,4 +86,39 @@ public class RestaurationController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path = "/batiment/{terminalId}")
|
||||
public ResponseEntity<?> getBatiments(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getBatiment(terminalId), "liste des batiments avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path = "/enquete-batiment/{terminalId}")
|
||||
public ResponseEntity<?> getEnqueteBatiment(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getEnqueteBatiment(terminalId), "liste des enquetes batiments avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path = "/caracteristique-batiment/{terminalId}")
|
||||
public ResponseEntity<?> getCaracteristiqueBatiment(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getCaracateristiqueBatiment(terminalId), "liste des caractéristiques batiments avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/caracteristique-unite-logement/{terminalId}")
|
||||
public ResponseEntity<?> getCaracteristiqueUniteLogement(@PathVariable Long terminalId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, restaurationService.getCaracateristiqueUniteLogement(terminalId), "liste des caractéristiques des unités de logement avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
38
src/main/java/io/gmss/fiscad/entities/decoupage/Secteur.java
Normal file
38
src/main/java/io/gmss/fiscad/entities/decoupage/Secteur.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package io.gmss.fiscad.entities.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Secteur extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@ManyToOne
|
||||
private User chefSecteur;
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
//@JsonIgnore
|
||||
//@OneToMany(mappedBy = "secteur")
|
||||
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "secteur_id")
|
||||
private List<SecteurDecoupage> secteurDecoupages;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.gmss.fiscad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class SecteurDecoupage extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Secteur secteur;
|
||||
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "secteurDecoupage")
|
||||
private List<Bloc> blocs;
|
||||
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -63,7 +63,7 @@ public class Bloc extends BaseEntity implements Serializable {
|
||||
@OneToMany(mappedBy = "bloc")
|
||||
private List<Enquete> enquetes;
|
||||
@ManyToOne
|
||||
private User chefSecteur;
|
||||
private SecteurDecoupage secteurDecoupage;
|
||||
|
||||
public String getNomArrondissement() {
|
||||
return arrondissement.getNom();
|
||||
|
||||
@@ -37,5 +37,4 @@ public class CaracteristiqueBatiment extends BaseEntity implements Serializable
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private float surface;
|
||||
private int nbrePiece; //les champs int sont des integer,
|
||||
// c'est juste la taille en mémoire que je veux préserver
|
||||
private int nbrePiece;
|
||||
private int nbreHabitant;
|
||||
private int nbreMenage;
|
||||
private boolean enLocation;
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import jakarta.persistence.*;
|
||||
@@ -30,9 +31,11 @@ public class Equipe extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Bloc bloc;
|
||||
@ManyToOne
|
||||
private Secteur secteur ;
|
||||
@ManyToOne
|
||||
private Campagne campagne;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "equipe")
|
||||
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "equipe_id")
|
||||
private List<Participer> participers;
|
||||
|
||||
@JsonIgnore
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
@@ -31,6 +32,7 @@ public class Participer extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Equipe equipe;
|
||||
@ManyToOne
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.gmss.fiscad.entities.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.enums.UserRole;
|
||||
@@ -62,7 +62,12 @@ public class User extends BaseEntity implements Serializable {
|
||||
private List<Participer> participers;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "chefSecteur")
|
||||
private List<Bloc> blocs ;
|
||||
private List<Secteur> secteurs ;
|
||||
|
||||
@Transient
|
||||
private Long idCampagneCourant;
|
||||
@Transient
|
||||
private Long idSecteurCourant;
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = this.email;
|
||||
@@ -77,4 +82,24 @@ public class User extends BaseEntity implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public Long getIdCampagneCourant(){
|
||||
for (Participer p:participers){
|
||||
if(p.getDateFin()==null){
|
||||
return p.getEquipe().getCampagne().getId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Long getIdSecteurCourant(){
|
||||
for (Participer p:participers){
|
||||
if(p.getDateFin()==null){
|
||||
return p.getEquipe().getSecteur().getId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package io.gmss.fiscad.implementations.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.repositories.decoupage.SecteurDecoupageRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
||||
|
||||
public SecteurDecoupageServiceImpl(SecteurDecoupageRepository secteurDecoupageRepository) {
|
||||
this.secteurDecoupageRepository = secteurDecoupageRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException {
|
||||
if(secteurDecoupage.getId() != null ){
|
||||
throw new BadRequestException("Impossible de créer un nouveau secteur découpage ayant un id non null.");
|
||||
}
|
||||
return secteurDecoupageRepository.save(secteurDecoupage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException {
|
||||
if(secteurDecoupage.getId() == null ){
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau secteur découpage ayant un id null.");
|
||||
}
|
||||
if(!secteurDecoupageRepository.existsById(secteurDecoupage.getId())){
|
||||
throw new NotFoundException("Impossible de trouver le secteur découpage spécifié.");
|
||||
}
|
||||
return secteurDecoupageRepository.save(secteurDecoupage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecteurDecoupage(Long id) throws NotFoundException {
|
||||
Optional<SecteurDecoupage> secteurDecoupageOptional = secteurDecoupageRepository.findById(id);
|
||||
if(secteurDecoupageOptional.isPresent()){
|
||||
secteurDecoupageRepository.deleteById(secteurDecoupageOptional.get().getId());
|
||||
}else{
|
||||
throw new NotFoundException("Impossible de trouver le secteur découpage spécifié.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable) {
|
||||
return secteurDecoupageRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecteurDecoupage> getSecteurDecoupageList() {
|
||||
return secteurDecoupageRepository.findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<SecteurDecoupage> getSecteurDecoupageById(Long id) {
|
||||
return secteurDecoupageRepository.findById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package io.gmss.fiscad.implementations.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.paylaods.request.SecteurDecoupagePayload;
|
||||
import io.gmss.fiscad.paylaods.request.SecteurPayload;
|
||||
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.repositories.decoupage.QuartierRepository;
|
||||
import io.gmss.fiscad.repositories.decoupage.SecteurRepository;
|
||||
import io.gmss.fiscad.repositories.user.UserRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class SecteurServiceImpl implements SecteurService {
|
||||
private final SecteurRepository secteurRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final QuartierRepository quartierRepository;
|
||||
|
||||
public SecteurServiceImpl(SecteurRepository secteurRepository, UserRepository userRepository, ArrondissementRepository arrondissementRepository, QuartierRepository quartierRepository) {
|
||||
this.secteurRepository = secteurRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.arrondissementRepository = arrondissementRepository;
|
||||
this.quartierRepository = quartierRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Secteur createSecteur(SecteurPayload secteurPayload) throws BadRequestException {
|
||||
if(secteurPayload.getId() != null ){
|
||||
throw new BadRequestException("Impossible de créer un nouveau secteur ayant un id non null.");
|
||||
}
|
||||
|
||||
if(secteurPayload.getChefSecteurId()!=null && userRepository.existsById(secteurPayload.getChefSecteurId()) ) {
|
||||
Secteur secteur = getSecteurFromPayload(secteurPayload);
|
||||
return secteurRepository.save(secteur);
|
||||
}else{
|
||||
throw new BadRequestException("Impossible de créer un nouveau secteur sans le chef le Chef Secteur.");
|
||||
}
|
||||
}
|
||||
|
||||
private Secteur getSecteurFromPayload(SecteurPayload secteurPayload) {
|
||||
Secteur secteur=new Secteur();
|
||||
Optional<User> optionalUser=userRepository.findById(secteurPayload.getChefSecteurId());
|
||||
secteur.setChefSecteur(optionalUser.orElse(null));
|
||||
List<SecteurDecoupage> secteurDecoupageList=new ArrayList<>();
|
||||
|
||||
for (SecteurDecoupagePayload sdp: secteurPayload.getSecteurDecoupages()){
|
||||
SecteurDecoupage sd=new SecteurDecoupage();
|
||||
if(sdp.getSecteurId()!=null && secteurRepository.existsById(sdp.getSecteurId()) ){
|
||||
sd.setSecteur(secteurRepository.findById(sdp.getSecteurId()).orElse(null));
|
||||
}
|
||||
|
||||
if(sdp.getArrondissementId()!=null && arrondissementRepository.existsById(sdp.getArrondissementId()) ){
|
||||
sd.setArrondissement(arrondissementRepository.findById(sdp.getArrondissementId()).orElse(null));
|
||||
}
|
||||
|
||||
if(sdp.getQuartierId()!=null && quartierRepository.existsById(sdp.getQuartierId()) ){
|
||||
sd.setQuartier(quartierRepository.findById(sdp.getQuartierId()).orElse(null));
|
||||
}
|
||||
sd.setDateDebut(sdp.getDateDebut());
|
||||
sd.setDateFin(sdp.getDateFin());
|
||||
sd.setId(sdp.getId());
|
||||
secteurDecoupageList.add(sd);
|
||||
}
|
||||
secteur.setSecteurDecoupages(secteurDecoupageList);
|
||||
secteur.setId(secteurPayload.getId());
|
||||
secteur.setCode(secteurPayload.getCode());
|
||||
secteur.setNom(secteurPayload.getNom());
|
||||
return secteur;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Secteur updateSecteur(Long id, SecteurPayload secteurPayload) throws NotFoundException {
|
||||
if(secteurPayload.getId() == null ){
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau secteur ayant un id null.");
|
||||
}
|
||||
|
||||
if(!secteurRepository.existsById(secteurPayload.getId())){
|
||||
throw new NotFoundException("Impossible de trouver le secteur spécifié.");
|
||||
}
|
||||
if(secteurPayload.getChefSecteurId()!=null && userRepository.existsById(secteurPayload.getChefSecteurId()) ) {
|
||||
Secteur secteur = getSecteurFromPayload(secteurPayload);
|
||||
return secteurRepository.save(secteur);
|
||||
}else{
|
||||
throw new BadRequestException("Impossible de créer un nouveau secteur sans le chef le Chef Secteur.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecteur(Long id) throws NotFoundException {
|
||||
Optional<Secteur> secteurOptional = secteurRepository.findById(id);
|
||||
if(secteurOptional.isPresent()){
|
||||
secteurRepository.deleteById(secteurOptional.get().getId());
|
||||
}else{
|
||||
throw new NotFoundException("Impossible de trouver le secteur spécifié.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Secteur> getSecteurList(Pageable pageable) {
|
||||
return secteurRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Secteur> getSecteurList() {
|
||||
return secteurRepository.findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<Secteur> getSecteurById(Long id) {
|
||||
return secteurRepository.findById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,94 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||
import io.gmss.fiscad.paylaods.request.EquipePayload;
|
||||
import io.gmss.fiscad.paylaods.request.ParticiperPayload;
|
||||
import io.gmss.fiscad.repositories.decoupage.SecteurRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.parametre.BlocRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.CampagneRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.EquipeRepository;
|
||||
import io.gmss.fiscad.repositories.user.UserRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class EquipeServiceImpl implements EquipeService {
|
||||
private final EquipeRepository equipeRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final BlocRepository blocRepository;
|
||||
private final SecteurRepository secteurRepository;
|
||||
private final CampagneRepository campagneRepository;
|
||||
|
||||
public EquipeServiceImpl(EquipeRepository equipeRepository) {
|
||||
public EquipeServiceImpl(EquipeRepository equipeRepository, UserRepository userRepository, BlocRepository blocRepository, SecteurRepository secteurRepository, CampagneRepository campagneRepository) {
|
||||
this.equipeRepository = equipeRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.blocRepository = blocRepository;
|
||||
this.secteurRepository = secteurRepository;
|
||||
this.campagneRepository = campagneRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Equipe createEquipe(Equipe equipe) throws BadRequestException {
|
||||
if(equipe.getId() != null ){
|
||||
public Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException {
|
||||
if(equipePayload.getId() != null ){
|
||||
throw new BadRequestException("Impossible de créer une nouvelle equipe ayant un id non null.");
|
||||
}
|
||||
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||
return equipeRepository.save(equipe);
|
||||
}
|
||||
|
||||
private Equipe getEquipeFromPayload(EquipePayload equipePayload) {
|
||||
Equipe equipe=new Equipe();
|
||||
Optional<Bloc> optionalBloc=blocRepository.findById(equipePayload.getBlocId());
|
||||
equipe.setBloc(optionalBloc.orElse(null));
|
||||
equipe.setId(equipePayload.getId());
|
||||
equipe.setCode(equipePayload.getCode());
|
||||
equipe.setNom(equipePayload.getNom());
|
||||
Optional<Secteur> optionalSecteur=secteurRepository.findById(equipePayload.getSecteurId());
|
||||
equipe.setSecteur(optionalSecteur.orElse(null));
|
||||
Optional<Campagne> optionalCampagne=campagneRepository.findById(equipePayload.getCampagneId());
|
||||
equipe.setCampagne(optionalCampagne.orElse(null));
|
||||
|
||||
List<Participer> participerList=new ArrayList<>();
|
||||
|
||||
for (ParticiperPayload pp: equipePayload.getParticiperPayloads()){
|
||||
Participer part=new Participer();
|
||||
if(pp.getEquipeId()!=null && equipeRepository.existsById(pp.getEquipeId()) ){
|
||||
part.setEquipe(equipeRepository.findById(pp.getEquipeId()).orElse(null));
|
||||
}
|
||||
if(pp.getUserId()!=null && userRepository.existsById(pp.getUserId()) ){
|
||||
part.setUser(userRepository.findById(pp.getUserId()).orElse(null));
|
||||
}
|
||||
part.setDateDebut(pp.getDateDebut());
|
||||
part.setDateFin(pp.getDateFin());
|
||||
participerList.add(part);
|
||||
}
|
||||
equipe.setParticipers(participerList);
|
||||
|
||||
return equipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Equipe updateEquipe(Long id, Equipe equipe) throws NotFoundException {
|
||||
if(equipe.getId() == null ){
|
||||
public Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException {
|
||||
if(equipePayload.getId() == null ){
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle equipe ayant un id null.");
|
||||
}
|
||||
if(!equipeRepository.existsById(equipe.getId())){
|
||||
if(!equipeRepository.existsById(equipePayload.getId())){
|
||||
throw new NotFoundException("Impossible de trouver la equipe spécifiée dans notre base de données.");
|
||||
}
|
||||
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||
return equipeRepository.save(equipe);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.*;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.*;
|
||||
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.*;
|
||||
import io.gmss.fiscad.service.FileStorageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@@ -17,6 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RestaurationServiceImpl implements RestaurationService {
|
||||
public final ActeurConcerneRepository acteurConcerneRepository;
|
||||
public final EnqueteRepository enqueteRepository;
|
||||
@@ -29,19 +32,13 @@ public class RestaurationServiceImpl implements RestaurationService {
|
||||
private final TpeRepository tpeRepository;
|
||||
private final UserService userService;
|
||||
private Authentication authentication;
|
||||
|
||||
public RestaurationServiceImpl(ActeurConcerneRepository acteurConcerneRepository, EnqueteRepository enqueteRepository, PersonneRepository personneRepository, ParcelleRepository parcelleRepository, MembreGroupeRepository membreGroupeRepository, PieceRepository pieceRepository, UploadRepository uploadRepository, FileStorageService fileStorageService, TpeRepository tpeRepository, UserService userService) {
|
||||
this.acteurConcerneRepository = acteurConcerneRepository;
|
||||
this.enqueteRepository = enqueteRepository;
|
||||
this.personneRepository = personneRepository;
|
||||
this.parcelleRepository = parcelleRepository;
|
||||
this.membreGroupeRepository = membreGroupeRepository;
|
||||
this.pieceRepository = pieceRepository;
|
||||
this.uploadRepository = uploadRepository;
|
||||
this.fileStorageService = fileStorageService;
|
||||
this.tpeRepository = tpeRepository;
|
||||
this.userService = userService;
|
||||
}
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final CaracteristiqueBatimentRepository caracteristiqueBatimentRepository;
|
||||
private final CaracteristiqueUniteLogementRepository caracteristiqueUniteLogementRepository;
|
||||
private final CaracteristiqueParcelleRepository caracteristiqueParcelleRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final UniteLogementRepository uniteLogementRepository;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -83,8 +80,6 @@ public class RestaurationServiceImpl implements RestaurationService {
|
||||
List<UploadPayLoad> uploadPayLoads = uploadRepository.getUploadByTerminalId(terminaleId);
|
||||
|
||||
List<io.gmss.fiscad.paylaods.request.UploadPayLoad> uploadPayLoadsOut=new ArrayList<>();
|
||||
|
||||
System.out.println(uploadPayLoads.size());
|
||||
uploadPayLoads.forEach(uploadPayLoad -> {
|
||||
io.gmss.fiscad.paylaods.request.UploadPayLoad uploadPayLoadLocal=new io.gmss.fiscad.paylaods.request.UploadPayLoad();
|
||||
uploadPayLoadLocal.setTerminalId(uploadPayLoad.getTerminalId());
|
||||
@@ -108,6 +103,41 @@ public class RestaurationServiceImpl implements RestaurationService {
|
||||
return uploadPayLoadsOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BatimentPayload> getBatiment(Long terminalId) {
|
||||
return batimentRepository.getBatimentByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayLoad> getEnqueteBatiment(Long terminalId) {
|
||||
return enqueteBatimentRepository.getEnqueteBatimentByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaracateristiqueParcellePayLoads> getCaracateristiqueParcelle(Long terminalId) {
|
||||
return caracteristiqueParcelleRepository.getCaracteristiqueParcelleByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaracateristiqueBatimentPayLoads> getCaracateristiqueBatiment(Long terminalId) {
|
||||
return caracteristiqueBatimentRepository.getCaracteristiqueBatimentByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaracteristiqueUniteLogementPayLoad> getCaracateristiqueUniteLogement(Long terminalId) {
|
||||
return caracteristiqueUniteLogementRepository.getCaracteristiqueUniteLogementByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayLoad> getEnqueteUniteLogement(Long terminalId) {
|
||||
return enqueteUniteLogementRepository.getEnqueteUniteLogementByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UniteLogementPayLoad> getUniteLogement(Long terminalId) {
|
||||
return uniteLogementRepository.getUniteLogementByTerminalId(terminalId);
|
||||
}
|
||||
|
||||
private String getUploadFile(UploadPayLoad uploadPayLoad) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -143,8 +143,17 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
List<QuartierSyncResponse> quartierSyncResponses =
|
||||
quartierRepository.getQuartierResponse(user.getStructure().getId());
|
||||
|
||||
List<BlocSyncResponse> blocSyncResponses =
|
||||
blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
// List<BlocSyncResponse> blocSyncResponses =
|
||||
// blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
|
||||
List<BlocSyncResponse> blocSyncResponses=new ArrayList<>();
|
||||
if(user.getIdSecteurCourant()==null) {
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
}else{
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocSecteurResponse(user.getStructure().getId(),user.getIdSecteurCourant());
|
||||
}
|
||||
|
||||
UserDecoupageSyncResponses userDecoupageSyncResponses = new UserDecoupageSyncResponses();
|
||||
userDecoupageSyncResponses.setDepartementSyncResponses(departementSyncResponses);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.gmss.fiscad.interfaces.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface SecteurDecoupageService {
|
||||
|
||||
SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException;
|
||||
SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException;
|
||||
void deleteSecteurDecoupage(Long id) throws NotFoundException;
|
||||
Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable);
|
||||
List<SecteurDecoupage> getSecteurDecoupageList();
|
||||
|
||||
Optional<SecteurDecoupage> getSecteurDecoupageById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.gmss.fiscad.interfaces.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.SecteurPayload;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface SecteurService {
|
||||
|
||||
Secteur createSecteur(SecteurPayload secteur) throws BadRequestException;
|
||||
Secteur updateSecteur(Long id, SecteurPayload secteur) throws NotFoundException;
|
||||
void deleteSecteur(Long id) throws NotFoundException;
|
||||
Page<Secteur> getSecteurList(Pageable pageable);
|
||||
List<Secteur> getSecteurList();
|
||||
|
||||
Optional<Secteur> getSecteurById(Long id);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EquipePayload;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,8 +12,8 @@ import java.util.Optional;
|
||||
|
||||
public interface EquipeService {
|
||||
|
||||
Equipe createEquipe(Equipe campagne) throws BadRequestException;
|
||||
Equipe updateEquipe(Long id, Equipe campagne) throws NotFoundException;
|
||||
Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException;
|
||||
Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException;
|
||||
void deleteEquipe(Long id) throws NotFoundException;
|
||||
Page<Equipe> getEquipeList(Pageable pageable);
|
||||
List<Equipe> getEquipeList();
|
||||
|
||||
@@ -15,6 +15,14 @@ public interface RestaurationService {
|
||||
List<MembreGroupePayLoad> getMembreGroupe(Long terminaleId) ;
|
||||
List<io.gmss.fiscad.paylaods.request.UploadPayLoad> getUpload(Long terminaleId) ;
|
||||
|
||||
List<BatimentPayload> getBatiment(Long terminalId);
|
||||
List<EnqueteBatimentPayLoad> getEnqueteBatiment(Long terminalId);
|
||||
List<CaracateristiqueParcellePayLoads> getCaracateristiqueParcelle(Long terminalId);
|
||||
List<CaracateristiqueBatimentPayLoads> getCaracateristiqueBatiment(Long terminalId);
|
||||
List<CaracteristiqueUniteLogementPayLoad> getCaracateristiqueUniteLogement(Long terminalId);
|
||||
List<EnqueteUniteLogementPayLoad> getEnqueteUniteLogement(Long terminalId);
|
||||
List<UniteLogementPayLoad> getUniteLogement(Long terminalId);
|
||||
|
||||
public List<Tpe> getTpeListByCurrentUser();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipePayload implements Serializable {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
private Long blocId;
|
||||
private Long secteurId ;
|
||||
private Long campagneId;
|
||||
private List<ParticiperPayload> participerPayloads;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ParticiperPayload implements Serializable {
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
private Long equipeId ;
|
||||
private Long userId;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SecteurDecoupagePayload implements Serializable {
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Long secteurId;
|
||||
|
||||
private Long arrondissementId;
|
||||
|
||||
private Long quartierId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SecteurPayload implements Serializable {
|
||||
private Long id ;
|
||||
private String code ;
|
||||
private String nom ;
|
||||
private Long chefSecteurId ;
|
||||
private Long structure_id ;
|
||||
private List<SecteurDecoupagePayload> secteurDecoupages ;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public interface BatimentPayload {
|
||||
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
|
||||
public String getNub();
|
||||
public String getCode();
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate getDateConstruction();
|
||||
|
||||
public Long getParcelleId();
|
||||
|
||||
public Long getTerminalId();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
public interface CaracateristiqueBatimentPayLoads {
|
||||
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
|
||||
public Long getEnqueteBatimentId();
|
||||
|
||||
public Long getCaracteristiqueId();
|
||||
|
||||
public String getValeur();
|
||||
|
||||
public Long getTerminalId();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
public interface CaracateristiqueParcellePayLoads {
|
||||
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
|
||||
public Long getEnqueteId();
|
||||
|
||||
public Long getCaracteristiqueId();
|
||||
|
||||
public String getValeur();
|
||||
|
||||
public Long getTerminalId();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
public interface CaracteristiqueUniteLogementPayLoad {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public interface EnqueteBatimentPayLoad {
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
public float getSurfaceAuSol();
|
||||
public String getAutreMenuisierie();
|
||||
public String getAutreMur();
|
||||
public boolean getSbee();
|
||||
public String getNumCompteurSbee();
|
||||
public boolean getSoneb();
|
||||
public String getNumCompteurSoneb();
|
||||
public int getNbreLotUnite();
|
||||
public int getNbreUniteLocation();
|
||||
public float getSurfaceLouee();
|
||||
public int getNbreMenage();
|
||||
public int getNbreHabitant();
|
||||
public float getValeurMensuelleLocation();
|
||||
public int getNbreMoisLocation();
|
||||
public String getAutreCaracteristiquePhysique();
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate getDateDebutExcemption();
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate getDateFinExcemption();
|
||||
public Long getPersonneId();
|
||||
public Long getBatimentId();
|
||||
public Long getEnqueteId();
|
||||
public Long getTerminalId();
|
||||
public Long getUserId();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public interface EnqueteUniteLogementPayLoad {
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
public float getSurface();
|
||||
public int getNbrePiece();
|
||||
public int getNbreHabitant();
|
||||
public int getNbreMenage();
|
||||
public boolean getEnLocation();
|
||||
public float getMontantMensuelLoyer();
|
||||
public int getNbreMoisEnLocation();
|
||||
public float getMontantLocatifAnnuelDeclare();
|
||||
public float getSurfaceLouee();
|
||||
public boolean getSbee();
|
||||
public boolean getSoneb();
|
||||
public String getNumCompteurSbee();
|
||||
public String getNumCompteurSoneb();
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate getDateDebutExcemption();
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate getDateFinExcemption();
|
||||
public Long getPersonneId();
|
||||
public Long getUniteLogementId();
|
||||
public Long getEnqueteId();
|
||||
public Long getTerminalId();
|
||||
public Long getUserId();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
|
||||
public interface UniteLogementPayLoad {
|
||||
|
||||
public Long getIdBackend();
|
||||
public Long getExternalKey();
|
||||
public Long getTerminalId();
|
||||
public String getNul();
|
||||
public String getNumeroEtage();
|
||||
public String getCode();
|
||||
public Long getBatimentId();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package io.gmss.fiscad.repositories.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SecteurDecoupageRepository extends JpaRepository<SecteurDecoupage, Long> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package io.gmss.fiscad.repositories.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SecteurRepository extends JpaRepository<Secteur, Long> {
|
||||
}
|
||||
@@ -164,6 +164,21 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
" e.nom_proprietaire_parcelle as nomProprietaireParcelle, " +
|
||||
" e.code_equipe as codeEquipe, " +
|
||||
" e.numero_titre_foncier as numeroTitreFoncier " +
|
||||
|
||||
" e.num_enter_parcelle as numEnterParcelle" +
|
||||
" e.num_rue as numRue" +
|
||||
" e.num_nom_rue as nomRue" +
|
||||
" e.emplacement as emplacement" +
|
||||
" e.altitude as altitude" +
|
||||
" e.precision as precision" +
|
||||
" e.nbre_co_proprietaire as nbreCoProprietaire" +
|
||||
" e.nbre_indivisiaire as nbreIndivisiaire" +
|
||||
" e.autre_adresse as autreAdresse" +
|
||||
" e.surface as surface" +
|
||||
" e.nbre_batiment as nbreBatiment" +
|
||||
" e.nbre_piscine as nbrePiscine" +
|
||||
" e.date_debut_excemption as dateDebutExcemption" +
|
||||
" e.date_fin_excemption as dateFinExcemption" +
|
||||
" FROM enquete e inner join parcelle p on p.id = e.parcelle_id " +
|
||||
" WHERE e.terminal_id = ?1", nativeQuery = true)
|
||||
List<EnquetePayLoad> getEnqueteByTerminalId(Long terminalId);
|
||||
|
||||
@@ -18,6 +18,13 @@ public interface BlocRepository extends JpaRepository<Bloc, Long> {
|
||||
" where b.deleted is false and b.structure_id = ?1 ",nativeQuery = true)
|
||||
List<BlocSyncResponse> getBlocResponse(Long structure_id);
|
||||
|
||||
@Query(value = "select b.id, b.cote, b.nom, b.arrondissement_id as arrondissementid, b.quartier_id as quartierid " +
|
||||
" from bloc b " +
|
||||
" inner join secteur_decoupage sd on cd.bloc_id=b.id " +
|
||||
" where b.deleted is false and s.structure_id = ?1 and sd.secteur_id=?2",nativeQuery = true)
|
||||
List<BlocSyncResponse> getBlocSecteurResponse(Long structure_id,Long secteur_id);
|
||||
|
||||
|
||||
@Query(value = " select b.id, b.cote as code, b.nom as nom , a.nom as arrondissement, c.nom as commune, d.nom as departement " +
|
||||
" from bloc b inner join arrondissement a on a.id=b.arrondissement_id" +
|
||||
" inner join commune c on c.id=a.commune_id " +
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.BatimentPayload;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface BatimentRepository extends JpaRepository<Batiment, Long> {
|
||||
|
||||
Optional<Batiment> findFirstByExternalKeyAndTerminal_Id(Long externalKey,Long TerminalId);
|
||||
|
||||
@Query(value = "SELECT " +
|
||||
" b.id as idBackend," +
|
||||
" b.external_key as externalKey," +
|
||||
" b.nub as nub, " +
|
||||
" b.code as code," +
|
||||
" b.date_construction as dateConstruction," +
|
||||
" p.external_key as parcelleId," +
|
||||
" b.terminal_id as terminalId " +
|
||||
" FROM batiment b inner join parcelle p on b.id = b.parcelle_id " +
|
||||
" WHERE b.terminal_id = ?1", nativeQuery = true)
|
||||
List<BatimentPayload> getBatimentByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,27 @@ package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.CaracateristiqueBatimentPayLoads;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface CaracteristiqueBatimentRepository extends JpaRepository<CaracteristiqueBatiment, Long> {
|
||||
void deleteAllByEnqueteBatiment(EnqueteBatiment enqueteBatiment);
|
||||
|
||||
@Query(
|
||||
nativeQuery = true,
|
||||
value = "select cb.id as idBackend, " +
|
||||
"cb.external_key as externalKey, " +
|
||||
"c.external_key as caracteristiqueId, " +
|
||||
"eb.external_key as enqueteBatimentId, " +
|
||||
"cb.valeur as valeur " +
|
||||
"from caracteristique_batiment cb " +
|
||||
"inner join caracteristique c on cb.caracteristique_id = c.id " +
|
||||
"inner join enquete_batiment eb on eb.id = cb.enquete_batiment_id " +
|
||||
"where cb.terminal_id = ?1"
|
||||
)
|
||||
List<CaracateristiqueBatimentPayLoads> getCaracteristiqueBatimentByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.CaracateristiqueParcellePayLoads;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,4 +13,16 @@ public interface CaracteristiqueParcelleRepository extends JpaRepository<Caracte
|
||||
|
||||
void deleteAllByEnquete(Enquete enquete);
|
||||
List<CaracteristiqueParcelle> findAllByEnquete_Id(Long id);
|
||||
|
||||
@Query(nativeQuery = true,
|
||||
value = "select cp.id as idBackend, " +
|
||||
"cp.external_key as externalKey, " +
|
||||
"c.external_key as caracteristiqueId, " +
|
||||
"e.external_key as enqueteId, " +
|
||||
"cp.valeur as valeur " +
|
||||
"from caracteristique_parcelle cp " +
|
||||
"inner join caracteristique c on cp.caracteristique_id = c.id " +
|
||||
"inner join enquete e on cp.enquete_id = e.id " +
|
||||
"where cp.terminal_id = ?")
|
||||
List<CaracateristiqueParcellePayLoads> getCaracteristiqueParcelleByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,26 @@ package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.CaracteristiqueUniteLogementPayLoad;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface CaracteristiqueUniteLogementRepository extends JpaRepository<CaracteristiqueUniteLogement, Long> {
|
||||
void deleteAllByEnqueteUniteLogement(EnqueteUniteLogement enqueteUniteLogement);
|
||||
|
||||
@Query(nativeQuery = true,
|
||||
value = "select cul.id as idBackend, " +
|
||||
"cul.external_key as externalKey, " +
|
||||
"c.external_key as caracteristiqueId, " +
|
||||
"eul.external_key as enqueteUniteLogementId, " +
|
||||
"cul.valeur as valeur " +
|
||||
"from caracteristique_unite_logement cul " +
|
||||
"inner join caracteristique c on c.id = cul.caracteristique_id " +
|
||||
"inner join enquete_unite_logement eul on eul.id = cul.enquete_unite_logement_id " +
|
||||
"where cul.terminal_id = ?"
|
||||
)
|
||||
List<CaracteristiqueUniteLogementPayLoad> getCaracteristiqueUniteLogementByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.EnqueteBatimentPayLoad;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -12,4 +14,38 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
Optional<EnqueteBatiment> findFirstByExternalKeyAndTerminal_Id(Long externalKey,Long TerminalId);
|
||||
|
||||
List<EnqueteBatiment> findAllByEnquete_Id(Long enqueteId);
|
||||
|
||||
@Query(
|
||||
nativeQuery = true,
|
||||
value = "select eb.id as idBackend, " +
|
||||
"eb.terminal_id as terminalId, " +
|
||||
"eb.external_key as externalKey, " +
|
||||
"eb.autre_caracteristique_physique as autreCaracteristiquePhysique, " +
|
||||
"eb.autre_menuisierie as autreMenuisierie, " +
|
||||
"eb.autre_mur as autreMur, " +
|
||||
"eb.date_debut_excemption as dateDebutExcemption, " + //ok
|
||||
"eb.date_fin_excemption as dateFinExcemption, " + //ok
|
||||
"eb.nbre_habitant as nbreHabitant, " + //ok
|
||||
"eb.nbre_lot_unite as nbreLotUnite, " + //ok
|
||||
"eb.nbre_menage as nbreMenage, " + //ok
|
||||
"eb.nbre_mois_location as nbreMoisLocation, " + //ok
|
||||
"eb.num_compteur_sbee as numCompteurSbee, " + //ok
|
||||
"eb.num_compteur_soneb as numCompteurSoneb, " + //ok
|
||||
"eb.sbee as sbee, " + //ok
|
||||
"eb.nbre_unite_location as nbreUniteLocation, " + //ok
|
||||
"eb.soneb as soneb, " + //ok
|
||||
"eb.surface_au_sol as surfaceAuSol, " + //ok
|
||||
"eb.surface_louee as surfaceLouee, " + //ok
|
||||
"eb.valeur_mensuelle_location as valeurMensuelleLocation, " + //ok
|
||||
"b.external_key as batimentId, " + //ok
|
||||
"e.external_key as enquteId, " + //ok
|
||||
"p2.external_key as personeId " + //ok
|
||||
"from enquete_batiment eb " +
|
||||
"inner join batiment b on b.id = eb.batiment_id " +
|
||||
"inner join parcelle p on p.id = b.parcelle_id " +
|
||||
"inner join personne p2 on p2.id = eb.personne_id " +
|
||||
"inner join enquete e on e.id = eb.enquete_id " +
|
||||
"WHERE eb.terminal_id = ?1"
|
||||
)
|
||||
List<EnqueteBatimentPayLoad> getEnqueteBatimentByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,45 @@
|
||||
package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.EnqueteUniteLogementPayLoad;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUniteLogement, Long> {
|
||||
Optional<EnqueteUniteLogement> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
List<EnqueteUniteLogement> findAllByEnquete_Id(Long id);
|
||||
Optional<EnqueteUniteLogement> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
List<EnqueteUniteLogement> findAllByEnquete_Id(Long id);
|
||||
|
||||
@Query(nativeQuery = true,
|
||||
value = "select eul.id as idBackend, " +
|
||||
"eul.terminal_id as terminalId, " +
|
||||
"eul.external_key as externalKey, " +
|
||||
"eul.surface as surface, " +
|
||||
"eul.nbre_piece as nbrePiece, " +
|
||||
"eul.nbre_habitant as nbreHabitant, " +
|
||||
"eul.nbre_menage as nbreMenage, " +
|
||||
"eul.en_location as enLocation, " +
|
||||
"eul.montant_mensuel_loyer as montantMensuelLoyer, " +
|
||||
"eul.nbre_mois_en_location as nbreMoisEnLocation, " +
|
||||
"eul.montant_locatif_annuel_declare as montantLocatifAnnuelDeclare, " +
|
||||
"eul.surface_louee as surfaceLouee, " +
|
||||
"eul.sbee as sbee, " +
|
||||
"eul.soneb as soneb, " +
|
||||
"eul.num_compteur_sbee as numCompteurSbee, " +
|
||||
"eul.num_compteur_soneb as numCompteurSoneb, " +
|
||||
"eul.date_debut_excemption as dateDebutExcemption, " +
|
||||
"eul.date_fin_excemption as dateFinExcemption, " +
|
||||
"eul.personne_id as personneId, " +
|
||||
"eul.unite_logement_id as uniteLogementId, " +
|
||||
"eul.enquete_id as enqueteId, " +
|
||||
"eul.user_id as userId " +
|
||||
"from enquete_unite_logement eul " +
|
||||
"inner join enquete e on e.id = eul.enquete_id " +
|
||||
"inner join unite_logement ul on eul.unite_logement_id = ul.id " +
|
||||
"inner join personne p on eul.personne_id = p.id " +
|
||||
"where eul.terminal_id = ?1")
|
||||
List<EnqueteUniteLogementPayLoad> getEnqueteUniteLogementByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
package io.gmss.fiscad.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.UniteLogement;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.UniteLogementPayLoad;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface UniteLogementRepository extends JpaRepository<UniteLogement, Long> {
|
||||
Optional<UniteLogement> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
|
||||
@Query(
|
||||
nativeQuery = true,
|
||||
value = "select ul.id as idBackend, " +
|
||||
" ul.external_key as externalKey, " +
|
||||
" ul.terminal_id as terminalId, " +
|
||||
" ul.nul as nul, " +
|
||||
" ul.numero_etage as numeroEtage, " +
|
||||
" ul.code as code, " +
|
||||
" ul.batiment_id as batimentId " +
|
||||
" from unite_logement ul " +
|
||||
" inner join batiment b on b.id = ul.batiment_id " +
|
||||
" where ul.terminal_id = ?1"
|
||||
)
|
||||
List<UniteLogementPayLoad> getUniteLogementByTerminalId(Long terminalId);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
||||
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||
# TEST ENV
|
||||
spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/abomey_db
|
||||
spring.datasource.username=infocad_user
|
||||
spring.datasource.password=W5fwD({9*q53
|
||||
|
||||
# LOCAL ENV
|
||||
#
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad
|
||||
#spring.datasource.username=fiscad
|
||||
#spring.datasource.password=fiscad
|
||||
|
||||
|
||||
#spring.datasource.url=jdbc:postgresql://192.168.1.107:5432/abomey_db
|
||||
#spring.datasource.username=infocad_user
|
||||
#spring.datasource.password=12345
|
||||
|
||||
|
||||
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.show-sql=true
|
||||
|
||||
Reference in New Issue
Block a user