Compare commits
42 Commits
966fd2ca7a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| cd4fcb7aa0 | |||
| f50ed9aa5f | |||
| 95eb4ad0b9 | |||
| 1e0cfead5b | |||
| 0837d0ce08 | |||
| b58316bb88 | |||
| 209d1cd777 | |||
| 1eb3aeeda0 | |||
| b3c288628c | |||
| d45e01ac85 | |||
| 9bb0cc5c75 | |||
| 3a68fd2ce4 | |||
| fa7421c35b | |||
| 5cb9497163 | |||
| 15cac660bc | |||
| 0feec2982f | |||
| b5ab0772a0 | |||
| f293f65650 | |||
| cfd1104c28 | |||
| 7d64390bae | |||
| 4876d8ab14 | |||
| 2bfb298054 | |||
| 54ef33d1ab | |||
| 3fd779854f | |||
| de2928414b | |||
| 9d6d278d78 | |||
| c8b0457195 | |||
| 9cc74a9a38 | |||
| 8e6168d4ee | |||
| c1a8ce86a6 | |||
| 14feb49dcd | |||
| 39de1c48c0 | |||
| f9e2b32118 | |||
| 3ebb1cf165 | |||
| c84176b8d3 | |||
| 61f4dd513f | |||
| 5e9f437497 | |||
| 69af57f876 | |||
| 56f78e77f3 | |||
| 0c7dc082fd | |||
| 3f5d7e980c | |||
| 87be4e4483 |
@@ -41,7 +41,7 @@ public class StructureController {
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createStructure(@RequestBody @Valid @Validated StructurePaylaodWeb structurePaylaodWeb) {
|
||||
public ResponseEntity<?> createStructure(@RequestBody StructurePaylaodWeb structurePaylaodWeb) {
|
||||
try {
|
||||
structurePaylaodWeb = structureService.createStructure(structurePaylaodWeb);
|
||||
return new ResponseEntity<>(
|
||||
@@ -211,7 +211,7 @@ public class StructureController {
|
||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getStructureByIdToDto(id), "Structure trouvé avec succès."),
|
||||
new ApiResponse<>(true, structureService.getStructureById(id), "Structure trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -116,18 +116,5 @@ public class AuthController {
|
||||
}
|
||||
}
|
||||
|
||||
private User getUser(UserRequest userRequest) {
|
||||
User user = new User();
|
||||
user.setNom(userRequest.getNom());
|
||||
user.setPrenom(userRequest.getPrenom());
|
||||
user.setTel(userRequest.getTelephone());
|
||||
user.setEmail(userRequest.getEmail());
|
||||
user.setUsername(userRequest.getEmail());
|
||||
user.setPassword(userRequest.getPassword());
|
||||
user.setActive(false);
|
||||
//Set<Role> roleSet = new HashSet<>();
|
||||
//user.setAvoirFonctions(roleSet);
|
||||
user.setStructure(structureService.getStructureById(userRequest.getStructureId()).get());
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ import java.util.Set;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE structure " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE structure " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
//@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
public class Structure extends BaseEntity implements Serializable {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Structure extends BaseEntity implements Serializable {
|
||||
private String tel;
|
||||
private String email;
|
||||
private String adresse;
|
||||
@NotNull(message = "Veuillez préciser la commune du centre d'impôts")
|
||||
//@NotNull(message = "Veuillez préciser la commune du centre d'impôts")
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
|
||||
@@ -61,4 +61,17 @@ public class Structure extends BaseEntity implements Serializable {
|
||||
)
|
||||
private Set<Arrondissement> arrondissements;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Structure{" +
|
||||
"id=" + id +
|
||||
", code='" + code + '\'' +
|
||||
", nom='" + nom + '\'' +
|
||||
", ifu='" + ifu + '\'' +
|
||||
", rccm='" + rccm + '\'' +
|
||||
", tel='" + tel + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", adresse='" + adresse + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.BlocService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.BlocRepository;
|
||||
import io.gmss.fiscad.service.StringService;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -77,7 +78,7 @@ public class BlocServiceImpl implements BlocService {
|
||||
}
|
||||
}
|
||||
|
||||
Optional<Structure> structureOptional = structureService.getStructureById(structure_id);
|
||||
Optional<StructurePaylaodWeb> structureOptional = structureService.getStructureById(structure_id);
|
||||
if (structureOptional.isPresent()) {
|
||||
builder.append(structureOptional.get().getCode());
|
||||
builder.append(bloc.getArrondissement().getCode());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.implementations.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.decoupage.Section;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
@@ -23,64 +24,34 @@ public class StructureServiceImpl implements StructureService {
|
||||
private final StructureRepository structureRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
// @Override
|
||||
// public StructurePaylaodWeb createStructure(StructurePaylaodWeb structurePaylaodWeb) throws BadRequestException {
|
||||
// if (structure.getId() != null) {
|
||||
// throw new BadRequestException("Impossible de créer une structure ayant un id non null.");
|
||||
// }
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// builder.append("C");
|
||||
// builder.append(structureRepository.getLastRecordId() + 1);
|
||||
// structure.setCode(builder.toString());
|
||||
// return structureRepository.save(structure);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Structure updateStructure(Long id, Structure structure) throws NotFoundException {
|
||||
//
|
||||
// System.out.println("structure = " + structure);
|
||||
//
|
||||
// if (structure.getId() == null) {
|
||||
// throw new BadRequestException("Impossible de mettre à jour une structure ayant un id null.");
|
||||
// }
|
||||
// if (!structureRepository.existsById(structure.getId())) {
|
||||
// throw new NotFoundException("Impossible de trouver la structure spécifiée dans notre base de données.");
|
||||
// }
|
||||
// try {
|
||||
// structureRepository.save(structure);
|
||||
//
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// Structure structure1 = structureRepository.getById(structure.getId());
|
||||
//
|
||||
// return structure1;
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public StructurePaylaodWeb createStructure(StructurePaylaodWeb structurePaylaodWeb) throws BadRequestException {
|
||||
if (structurePaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau centre ayant un id non null.");
|
||||
}
|
||||
Structure structure= entityFromPayLoadService.getStructureFromPayLoadWeb(structurePaylaodWeb);
|
||||
structureRepository.save(structure);
|
||||
structure=structureRepository.save(structure);
|
||||
return structureRepository.findStructureToDtoById(structure.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructurePaylaodWeb updateStructure(Long id, StructurePaylaodWeb structurePaylaodWeb) throws NotFoundException {
|
||||
if (structurePaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau centre ayant un id null.");
|
||||
throw new BadRequestException("ID obligatoire pour une mise à jour.");
|
||||
}
|
||||
|
||||
if (!structureRepository.existsById(structurePaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le centre spécifiée.");
|
||||
System.out.println(structurePaylaodWeb.getId());
|
||||
Optional<Structure> optionalStructure = structureRepository.findById(structurePaylaodWeb.getId());
|
||||
if(optionalStructure.isEmpty()){
|
||||
throw new NotFoundException("Structure inexistante.");
|
||||
}
|
||||
|
||||
Structure structure = entityFromPayLoadService.getStructureFromPayLoadWeb(structurePaylaodWeb);
|
||||
structure = structureRepository.save(structure);
|
||||
// structureRepository.findStructureToDtoById(structure.getId()).orElse(null);
|
||||
return structureRepository.findStructureToDtoById(structure.getId()).orElse(null);
|
||||
structureRepository.save(structure);
|
||||
|
||||
return structureRepository
|
||||
.findStructureToDtoById(structure.getId())
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,16 +85,9 @@ public class StructureServiceImpl implements StructureService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<StructurePaylaodWeb> getStructureByIdToDto(Long id) {
|
||||
public Optional<StructurePaylaodWeb> getStructureById(Long id) {
|
||||
return structureRepository.findStructureToDtoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Structure> getStructureById(Long id) {
|
||||
if (structureRepository.existsById(id)) {
|
||||
return structureRepository.findById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la structure spécifiée dans la base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,16 +12,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface StructureService {
|
||||
|
||||
// Structure createStructure(Structure structure) throws BadRequestException;
|
||||
//
|
||||
// Structure updateStructure(Long id, Structure structure) throws NotFoundException;
|
||||
//
|
||||
// void deleteStructure(Long id) throws NotFoundException;
|
||||
//
|
||||
// Page<Structure> getStructureList(Pageable pageable);
|
||||
//
|
||||
// List<Structure> getStructureList();
|
||||
StructurePaylaodWeb createStructure(StructurePaylaodWeb structurePaylaodWeb) throws BadRequestException;
|
||||
|
||||
StructurePaylaodWeb updateStructure(Long id, StructurePaylaodWeb structurePaylaodWeb) throws NotFoundException;
|
||||
@@ -30,13 +20,15 @@ public interface StructureService {
|
||||
|
||||
Page<StructurePaylaodWeb> getStructureList(Pageable pageable);
|
||||
List<StructurePaylaodWeb> getStructureList();
|
||||
List<StructurePaylaodWeb> getStructureListByCommuneId(Long structureId);
|
||||
Page<StructurePaylaodWeb> getStructureListByCommuneId(Long structureId,Pageable pageable);
|
||||
|
||||
Optional<StructurePaylaodWeb> getStructureByIdToDto(Long id);
|
||||
List<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId);
|
||||
|
||||
Page<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId,Pageable pageable);
|
||||
|
||||
Optional<StructurePaylaodWeb> getStructureById(Long id);
|
||||
|
||||
|
||||
//List<StructureResponse> getStructuresByArrondissement(Long arrondissementID);
|
||||
|
||||
Optional<Structure> getStructureById(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,14 +12,18 @@ import io.gmss.fiscad.entities.user.AvoirFonction;
|
||||
import io.gmss.fiscad.entities.user.Fonction;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.*;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.PieceRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CaracteristiqueRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.AvoirFonctionRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -56,9 +60,20 @@ public class EntityFromPayLoadService {
|
||||
private final SectionRepository sectionRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final QuartierRepository quartierRepository;
|
||||
private final CaracteristiqueBatimentRepository caracteristiqueBatimentRepository;
|
||||
private final CaracteristiqueParcelleRepository caracteristiqueParcelleRepository;
|
||||
private final CaracteristiqueUniteLogementRepository caracteristiqueUniteLogementRepository;
|
||||
private final UploadRepository uploadRepository;
|
||||
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
||||
private final AvoirFonctionRepository avoirFonctionRepository;
|
||||
private final EnqueteActiviteRepository enqueteActiviteRepository;
|
||||
|
||||
|
||||
public CaracteristiqueParcelle getCaracteristiqueParcelleFromPayLoadWeb(CaracteristiqueParcellePayloadWeb caracteristiqueParcellePayloadWeb){
|
||||
CaracteristiqueParcelle caracteristiqueParcelle=new CaracteristiqueParcelle();
|
||||
if(caracteristiqueParcellePayloadWeb.getId()!=null)
|
||||
caracteristiqueParcelle = caracteristiqueParcelleRepository.findById(caracteristiqueParcellePayloadWeb.getId()).orElse(new CaracteristiqueParcelle());
|
||||
|
||||
Optional<Enquete> optionalEnquete=Optional.empty();
|
||||
Optional<Caracteristique> optionalCaracteristique=Optional.empty();
|
||||
|
||||
@@ -77,6 +92,9 @@ public class EntityFromPayLoadService {
|
||||
|
||||
public CaracteristiqueBatiment getCaracteristiqueBatimentFromPayLoadWeb(CaracteristiqueBatimentPayloadWeb caracteristiqueBatimentPayloadWeb){
|
||||
CaracteristiqueBatiment caracteristiqueBatiment=new CaracteristiqueBatiment();
|
||||
if(caracteristiqueBatimentPayloadWeb.getId()!=null)
|
||||
caracteristiqueBatiment = caracteristiqueBatimentRepository.findById(caracteristiqueBatimentPayloadWeb.getId()).orElse(new CaracteristiqueBatiment());
|
||||
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment=Optional.empty();
|
||||
Optional<Caracteristique> optionalCaracteristique=Optional.empty();
|
||||
|
||||
@@ -101,6 +119,10 @@ public class EntityFromPayLoadService {
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement=Optional.empty();
|
||||
Optional<Caracteristique> optionalCaracteristique=Optional.empty();
|
||||
|
||||
if(caracteristiqueUniteLogementPayloadWeb.getId()!=null)
|
||||
caracteristiqueUniteLogement = caracteristiqueUniteLogementRepository.findById(caracteristiqueUniteLogementPayloadWeb.getId()).orElse(new CaracteristiqueUniteLogement());
|
||||
|
||||
|
||||
if(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId()!=null)
|
||||
optionalEnqueteUniteLogement=enqueteUniteLogementRepository.findById(caracteristiqueUniteLogementPayloadWeb.getEnqueteUniteLogementId());
|
||||
|
||||
@@ -123,6 +145,9 @@ public class EntityFromPayLoadService {
|
||||
Optional<SourceDroit> optionalSourceDroit=Optional.empty();
|
||||
Optional<ModeAcquisition> optionalModeAcquisition=Optional.empty();
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
if(piecePayLoadWeb.getId()!=null)
|
||||
piece = pieceRepository.findById(piecePayLoadWeb.getId()).orElse(new Piece());
|
||||
|
||||
|
||||
if(piecePayLoadWeb.getEnqueteId()!=null)
|
||||
optionalEnquete=enqueteRepository.findById(piecePayLoadWeb.getEnqueteId());
|
||||
@@ -156,6 +181,10 @@ public class EntityFromPayLoadService {
|
||||
Optional<Enquete> optionalEnquete=Optional.empty();
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
Optional<Structure> optionalStructure=Optional.empty();
|
||||
if(declarationNcPayloadWeb.getId()!=null)
|
||||
declarationNc = declarationNcRepository.findById(declarationNcPayloadWeb.getId()).orElse(new DeclarationNc());
|
||||
|
||||
|
||||
if(declarationNcPayloadWeb.getEnqueteId()!=null)
|
||||
optionalEnquete=enqueteRepository.findById(declarationNcPayloadWeb.getEnqueteId());
|
||||
if(declarationNcPayloadWeb.getPersonneId()!=null)
|
||||
@@ -178,6 +207,8 @@ public class EntityFromPayLoadService {
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment=Optional.empty();
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement=Optional.empty();
|
||||
if(uploadPayLoadWeb.getId()!=null)
|
||||
upload = uploadRepository.findById(uploadPayLoadWeb.getId()).orElse(new Upload());
|
||||
|
||||
// if(uploadPayLoadWeb.getEnqueteId()!=null)
|
||||
// optionalEnquete=enqueteRepository.findById(uploadPayLoadWeb.getEnqueteId());
|
||||
@@ -206,6 +237,9 @@ public class EntityFromPayLoadService {
|
||||
public Batiment getBatimentFromPayLoadWeb(BatimentPaylaodWeb batimentPaylaodWeb){
|
||||
Batiment batiment=new Batiment();
|
||||
Optional<Parcelle> optionalParcelle=Optional.empty();
|
||||
if(batimentPaylaodWeb.getId()!=null)
|
||||
batiment = batimentRepository.findById(batimentPaylaodWeb.getId()).orElse(new Batiment());
|
||||
|
||||
|
||||
if(batimentPaylaodWeb.getParcelleId()!=null)
|
||||
optionalParcelle=parcelleRepository.findById(batimentPaylaodWeb.getParcelleId());
|
||||
@@ -223,6 +257,9 @@ public class EntityFromPayLoadService {
|
||||
public Section getSectionFromPayLoadWeb(SectionPaylaodWeb sectionPaylaodWeb){
|
||||
Section section =new Section();
|
||||
Optional<Structure> optionalStructure = Optional.empty();
|
||||
if(sectionPaylaodWeb.getId()!=null)
|
||||
section = sectionRepository.findById(sectionPaylaodWeb.getId()).orElse(new Section());
|
||||
|
||||
|
||||
if(sectionPaylaodWeb.getStructureId()!=null)
|
||||
optionalStructure=structureRepository.findById(sectionPaylaodWeb.getStructureId());
|
||||
@@ -236,13 +273,16 @@ public class EntityFromPayLoadService {
|
||||
|
||||
public Structure getStructureFromPayLoadWeb(StructurePaylaodWeb structurePaylaodWeb){
|
||||
Structure structure =new Structure();
|
||||
Optional<Commune> optionalCommune = Optional.empty();
|
||||
if(structurePaylaodWeb.getId()!=null)
|
||||
structure = structureRepository.findById(structurePaylaodWeb.getId()).orElse(new Structure());
|
||||
|
||||
if(structurePaylaodWeb.getCommuneId()!=null)
|
||||
optionalCommune=communeRepository.findById(structurePaylaodWeb.getCommuneId());
|
||||
if (structurePaylaodWeb.getCommuneId() == null) {
|
||||
throw new BadRequestException("La commune est obligatoire.");
|
||||
}
|
||||
Commune commune = communeRepository.findById(structurePaylaodWeb.getCommuneId())
|
||||
.orElseThrow(() -> new NotFoundException("Commune inexistante"));
|
||||
structure.setCommune(commune);
|
||||
|
||||
structure.setId(structurePaylaodWeb.getId());
|
||||
structure.setCommune(optionalCommune.orElse(null));
|
||||
structure.setCode(structurePaylaodWeb.getCode());
|
||||
structure.setNom(structurePaylaodWeb.getNom());
|
||||
structure.setAdresse(structurePaylaodWeb.getAdresse());
|
||||
@@ -255,6 +295,9 @@ public class EntityFromPayLoadService {
|
||||
public Secteur getSecteurFromPayLoadWeb(SecteurPaylaodWeb secteurPaylaodWeb){
|
||||
Secteur secteur =new Secteur();
|
||||
Optional<Section> optionalSection = Optional.empty();
|
||||
if(secteurPaylaodWeb.getId()!=null)
|
||||
secteur = secteurRepository.findById(secteurPaylaodWeb.getId()).orElse(new Secteur());
|
||||
|
||||
|
||||
if(secteurPaylaodWeb.getSectionId()!=null)
|
||||
optionalSection=sectionRepository.findById(secteurPaylaodWeb.getSectionId());
|
||||
@@ -272,6 +315,9 @@ public class EntityFromPayLoadService {
|
||||
Optional<Secteur> optionalSecteur = Optional.empty();
|
||||
Optional<Arrondissement> optionalArrondissement = Optional.empty();
|
||||
Optional<Quartier> optionalQuartier = Optional.empty();
|
||||
if(secteurDecoupagePaylaodWeb.getId()!=null)
|
||||
secteurDecoupage = secteurDecoupageRepository.findById(secteurDecoupagePaylaodWeb.getId()).orElse(new SecteurDecoupage());
|
||||
|
||||
|
||||
if(secteurDecoupagePaylaodWeb.getSecteurId()!=null)
|
||||
optionalSecteur=secteurRepository.findById(secteurDecoupagePaylaodWeb.getSecteurId());
|
||||
@@ -293,6 +339,10 @@ public class EntityFromPayLoadService {
|
||||
public UniteLogement getUniteLogementFromPayLoadWeb(UniteLogementPaylaodWeb uniteLogementPaylaodWeb){
|
||||
UniteLogement uniteLogement=new UniteLogement();
|
||||
Optional<Batiment> optionalBatiment=Optional.empty();
|
||||
if(uniteLogementPaylaodWeb.getId()!=null)
|
||||
uniteLogement = uniteLogementRepository.findById(uniteLogementPaylaodWeb.getId()).orElse(new UniteLogement());
|
||||
|
||||
|
||||
if(uniteLogementPaylaodWeb.getBatimentId()!=null)
|
||||
optionalBatiment=batimentRepository.findById(uniteLogementPaylaodWeb.getBatimentId());
|
||||
uniteLogement.setBatiment(optionalBatiment.orElse(null));
|
||||
@@ -311,6 +361,10 @@ public class EntityFromPayLoadService {
|
||||
Optional<Profile> optionalProfile=Optional.empty();
|
||||
Optional<User> optionalUser=Optional.empty();
|
||||
Optional<Structure> optionalStructure=Optional.empty();
|
||||
if(fonctionPaylaodWeb.getId()!=null)
|
||||
fonction = fonctionRepository.findById(fonctionPaylaodWeb.getId()).orElse(new Fonction());
|
||||
|
||||
|
||||
|
||||
if(fonctionPaylaodWeb.getSecteurId()!=null)
|
||||
optionalSecteur=secteurRepository.findById(fonctionPaylaodWeb.getSecteurId());
|
||||
@@ -337,6 +391,9 @@ public class EntityFromPayLoadService {
|
||||
AvoirFonction avoirFonction =new AvoirFonction();
|
||||
Optional<Fonction> optionalFonction=Optional.empty();
|
||||
Optional<User> optionalUser=Optional.empty();
|
||||
if(avoirFonctionPaylaodWeb.getId()!=null)
|
||||
avoirFonction = avoirFonctionRepository.findById(avoirFonctionPaylaodWeb.getId()).orElse(new AvoirFonction());
|
||||
|
||||
|
||||
if(avoirFonctionPaylaodWeb.getFonctionId()!=null)
|
||||
optionalFonction=fonctionRepository.findById(avoirFonctionPaylaodWeb.getFonctionId());
|
||||
@@ -356,10 +413,14 @@ public class EntityFromPayLoadService {
|
||||
|
||||
public Profile getProfileFromPayLoadWeb(ProfilePaylaodWeb profilePaylaodWeb){
|
||||
Profile profile =new Profile();
|
||||
if(profilePaylaodWeb.getId()!=null)
|
||||
profile = profileRepository.findById(profilePaylaodWeb.getId()).orElse(new Profile());
|
||||
|
||||
profile.setDescription(profilePaylaodWeb.getDescription());
|
||||
profile.setRoles(profilePaylaodWeb.getRoles());
|
||||
profile.setNom(profilePaylaodWeb.getNom());
|
||||
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -370,6 +431,9 @@ public class EntityFromPayLoadService {
|
||||
Optional<TypePersonne> optionalTypePersonne=Optional.empty();
|
||||
Optional<Profession> optionalProfession=Optional.empty();
|
||||
Optional<Commune> optionalCommune=Optional.empty();
|
||||
if(personnePayLoadWeb.getId()!=null)
|
||||
personne = personneRepository.findById(personnePayLoadWeb.getId()).orElse(new Personne());
|
||||
|
||||
|
||||
if(personnePayLoadWeb.getSituationMatrimonialeId()!=null)
|
||||
optionalSituationMatrimoniale=situationMatrimonialeRepository.findById(personnePayLoadWeb.getSituationMatrimonialeId());
|
||||
@@ -425,6 +489,8 @@ public class EntityFromPayLoadService {
|
||||
Optional<UniteLogement> optionalUniteLogement=Optional.empty();
|
||||
Optional<Parcelle> optionalParcelle=Optional.empty();
|
||||
Optional<Profession> optionalProfession=Optional.empty();
|
||||
if(enqueteActivitePayLoadWeb.getId()!=null)
|
||||
enqueteActivite = enqueteActiviteRepository.findById(enqueteActivitePayLoadWeb.getId()).orElse(new EnqueteActivite());
|
||||
|
||||
|
||||
if(enqueteActivitePayLoadWeb.getBatimentId()!=null)
|
||||
@@ -470,8 +536,9 @@ public class EntityFromPayLoadService {
|
||||
public User getUserFromPayLoadWeb(UserPaylaodWeb userPaylaodWeb){
|
||||
User user =new User();
|
||||
Optional<Structure> optionalStructure = Optional.empty();
|
||||
if(userPaylaodWeb.getId()!=null)
|
||||
user = userRepository.findById(userPaylaodWeb.getId()).orElse(new User());
|
||||
|
||||
System.out.println(userPaylaodWeb.getStructureId());
|
||||
|
||||
if(userPaylaodWeb.getStructureId()!=null)
|
||||
optionalStructure=structureRepository.findById(userPaylaodWeb.getStructureId());
|
||||
|
||||
Reference in New Issue
Block a user