Compare commits

38 Commits

Author SHA1 Message Date
03a661cdc0 Merge pull request 'gestion de profil, secteur, section et arbre decoupage' (#72) from features/crud_entites into develop
Reviewed-on: #72
2026-01-27 08:37:52 +00:00
a68ec444cc Merge pull request 'features/crud_entites' (#70) from features/crud_entites into develop
Reviewed-on: #70
2026-01-13 20:33:17 +00:00
58f517bf31 Merge pull request 'correction creation user par defaut' (#68) from features/crud_entites into develop
Reviewed-on: #68
2025-12-20 19:03:51 +00:00
7f18f22efb Merge pull request 'correction creation user par defaut' (#66) from features/crud_entites into develop
Reviewed-on: #66
2025-12-20 18:55:42 +00:00
af3218412f Merge pull request 'correction creation user par defaut' (#64) from features/crud_entites into develop
Reviewed-on: #64
2025-12-20 17:06:19 +00:00
f35670c72e Merge pull request 'correction creation user par defaut' (#62) from features/crud_entites into develop
Reviewed-on: #62
2025-12-20 15:03:45 +00:00
a77c0e854d Merge pull request 'correction creation user par defaut' (#60) from features/crud_entites into develop
Reviewed-on: #60
2025-12-20 14:48:47 +00:00
e75eff4e20 Merge pull request 'correction lecture de secret chargement' (#58) from features/crud_entites into develop
Reviewed-on: #58
2025-12-20 14:33:59 +00:00
40d078c653 Merge pull request 'correction lecture de secret chargement' (#56) from features/crud_entites into develop
Reviewed-on: #56
2025-12-20 14:14:02 +00:00
31dd11d017 Merge pull request 'correction lecture de secret chargement' (#54) from features/crud_entites into develop
Reviewed-on: #54
2025-12-20 13:10:40 +00:00
6dfd12fae8 Merge pull request 'correction lecture de secret chargement' (#52) from features/crud_entites into develop
Reviewed-on: #52
2025-12-20 12:57:46 +00:00
a4ad0a4556 Merge pull request 'correction lecture de secret chargement' (#50) from features/crud_entites into develop
Reviewed-on: #50
2025-12-20 12:41:09 +00:00
411a6c0c2d Merge pull request 'correction lecture de secret' (#48) from features/crud_entites into develop
Reviewed-on: #48
2025-12-20 12:21:25 +00:00
bed73b2b16 Merge pull request 'correction lecture de secret' (#46) from features/crud_entites into develop
Reviewed-on: #46
2025-12-20 12:10:00 +00:00
5a0814a0ba Merge pull request 'correction lecture de secret' (#44) from features/crud_entites into develop
Reviewed-on: #44
2025-12-20 12:00:12 +00:00
126254ea94 Merge pull request 'correction lecture de secret' (#42) from features/crud_entites into develop
Reviewed-on: #42
2025-12-20 11:43:55 +00:00
f9e4681af4 Merge pull request 'correction lecture de secret' (#40) from features/crud_entites into develop
Reviewed-on: #40
2025-12-20 11:39:40 +00:00
84089d3639 Merge pull request 'correction profil actif' (#38) from features/crud_entites into develop
Reviewed-on: #38
2025-12-20 10:48:01 +00:00
02b0a937b4 Merge pull request 'correction profil actif' (#36) from features/crud_entites into develop
Reviewed-on: #36
2025-12-20 10:02:19 +00:00
c0096457fb Merge pull request 'nouvelle verson ci-cd avec gitea runner natif intallé sur hote' (#34) from features/crud_entites into develop
Reviewed-on: #34
2025-12-19 19:14:24 +00:00
b6062ba4d1 Merge pull request 'nouvelle verson ci-cd avec gitea runner natif intallé sur hote' (#33) from features/crud_entites into develop
Reviewed-on: #33
2025-12-19 10:50:02 +00:00
8dc8c974d3 Merge pull request 'correction docker composer avec les secrets' (#32) from features/crud_entites into develop
Reviewed-on: #32
2025-12-19 10:39:57 +00:00
957416df9e Merge pull request 'correction docker composer avec les secrets' (#30) from features/crud_entites into develop
Reviewed-on: #30
2025-12-18 15:47:21 +00:00
8d8af75108 Merge pull request 'correction docker composer avec les secrets' (#28) from features/crud_entites into develop
Reviewed-on: #28
2025-12-18 15:46:02 +00:00
555f13508e Merge pull request 'correction docker composer avec les secrets' (#26) from features/crud_entites into develop
Reviewed-on: #26
2025-12-18 10:36:10 +00:00
d92a2b2503 Merge pull request 'correction docker composer avec les secrets' (#24) from features/crud_entites into develop
Reviewed-on: #24
2025-12-17 17:13:46 +00:00
5ccfdb6a3f Merge pull request 'correction docker composer avec les secrets' (#22) from features/crud_entites into develop
Reviewed-on: #22
2025-12-17 16:58:50 +00:00
87b3bfbe83 Merge pull request 'correction docker composer avec les secrets' (#20) from features/crud_entites into develop
Reviewed-on: #20
2025-12-17 16:49:15 +00:00
62f25ea726 Merge pull request 'correction docker composer avec les secrets' (#18) from features/crud_entites into develop
Reviewed-on: #18
2025-12-17 16:41:46 +00:00
6125fcbd0b Merge pull request 'correction docker composer' (#16) from features/crud_entites into develop
Reviewed-on: #16
2025-12-17 16:26:17 +00:00
211af6103a Merge pull request 'features/crud_entites' (#14) from features/crud_entites into develop
Reviewed-on: #14
2025-12-17 14:12:53 +00:00
d27b622db8 Merge pull request 'Changement en DB du nom de la colonne personne_id en proprietaire_id dans la table enquete' (#12) from features/crud_entites into develop
All checks were successful
CD - Deploy on main / deploy (pull_request) Successful in 35s
Reviewed-on: #12
2025-12-16 18:22:48 +00:00
c80b40082c Merge pull request 'Changement en DB du nom de la colonne personne_id en proprietaire_id dans la table enquete' (#10) from features/crud_entites into develop
All checks were successful
CD - Deploy on main / deploy (pull_request) Successful in 44s
Reviewed-on: #10
2025-12-16 18:06:52 +00:00
4a88af6487 Merge pull request 'Changement en DB du nom de la colonne personne_id en proprietaire_id dans la table enquete' (#8) from features/crud_entites into develop
All checks were successful
CD - Deploy on main / deploy (pull_request) Successful in 34s
Reviewed-on: #8
2025-12-05 19:24:00 +00:00
966b0af1c2 Merge pull request 'Changement en DB du nom de la colonne personne_id en proprietaire_id dans la table enquete' (#6) from features/crud_entites into develop
All checks were successful
CD - Deploy on main / deploy (pull_request) Successful in 36s
Reviewed-on: #6
2025-12-05 19:20:57 +00:00
58aa088ac3 Merge pull request 'ajout de ci-cd' (#4) from features/crud_entites into develop
All checks were successful
CD - Deploy on main / deploy (pull_request) Successful in 39s
Reviewed-on: #4
2025-12-05 19:10:37 +00:00
033b430051 Merge pull request 'ajout de ci-cd' (#2) from features/crud_entites into develop
Some checks failed
CD - Deploy on main / deploy (pull_request) Failing after 39s
Reviewed-on: #2
2025-12-05 19:06:43 +00:00
b8dbc7f625 Merge pull request 'ajout de ci-cd' (#1) from features/crud_entites into develop
Reviewed-on: #1
2025-12-05 17:53:30 +00:00
258 changed files with 1470 additions and 4097 deletions

View File

@@ -1,10 +1,11 @@
package io.gmss.fiscad.component;
import io.gmss.fiscad.entities.user.Profile;
import io.gmss.fiscad.entities.user.Role;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.persistence.repositories.user.RoleRepository;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.repositories.user.RoleRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.crypto.password.PasswordEncoder;

View File

@@ -1,7 +1,7 @@
package io.gmss.fiscad.configuration;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;

View File

@@ -1,6 +1,6 @@
package io.gmss.fiscad.configuration;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import io.gmss.fiscad.security.UserPrincipal;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.authentication.AnonymousAuthenticationToken;

View File

@@ -27,7 +27,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Arrondissement")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class ArrondissementController {
private final ArrondissementService arrondissementService;
@@ -175,7 +175,7 @@ public class ArrondissementController {
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementById(id).orElse(null), "Arrondissement trouvé avec succès."),
new ApiResponse<>(true, arrondissementService.getArrondissementById(id), "Arrondissement trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -199,31 +199,7 @@ public class ArrondissementController {
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementListByCommuneId(communeId), "Liste des arrondissements par commune 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("/page/commune/{communeId}")
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId,@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementListByCommuneId(communeId,pageable), "Liste des arrondissements par commune chargée avec succès."),
new ApiResponse<>(true, arrondissementService.getArrondissementByComune(communeId), "Liste des arrondissements par commune chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {

View File

@@ -26,7 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Commune")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class CommuneController {
private final CommuneService communeService;
@@ -185,31 +185,7 @@ public class CommuneController {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, communeService.getCommunesByDepartementId(departementId), "Liste des communes par département 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("/page/by-departement-id/{departementId}")
public ResponseEntity<?> getCommuneByDepartementIdPaged(@PathVariable Long departementId,@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, communeService.getCommunesByDepartementId(departementId,pageable), "Liste des communes par département chargée avec succès."),
new ApiResponse<>(true, communeService.getCommunesByDepartement(departementId), "Liste des communes par département chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {

View File

@@ -26,7 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Département")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class DepartementController {
private final DepartementService departementService;

View File

@@ -26,7 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Nationalité")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class NationaliteController {
private final NationaliteService nationaliteService;

View File

@@ -26,7 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Quartier")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class QuartierController {
private final QuartierService quartierService;
@@ -158,7 +158,7 @@ public class QuartierController {
public ResponseEntity<?> getQuartierById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierById(id).orElse(null), "Quartier trouvé avec succès."),
new ApiResponse<>(true, quartierService.getQuartierById(id), "Quartier trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -182,31 +182,7 @@ public class QuartierController {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierListByArrondissementId(arrondissementId), "Liste des quartiers par commune 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("/page/arrondissement/{arrondissementId}")
public ResponseEntity<?> getQuartierByArrondissementPaged(@PathVariable Long arrondissementId,@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierListByArrondissementId(arrondissementId,pageable), "Liste des quartiers par commune chargée avec succès."),
new ApiResponse<>(true, quartierService.getQuartierByArrondissement(arrondissementId), "Liste des quartiers par commune chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {

View File

@@ -4,9 +4,7 @@ import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurPayload;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
@@ -26,7 +24,7 @@ import org.springframework.web.client.HttpClientErrorException;
@RequestMapping(value = "api/secteur", produces = MediaType.APPLICATION_JSON_VALUE)
//@SecurityRequirement(name = "bearer")
@Tag(name = "Secteur")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class SecteurController {
private final SecteurService secteurService;
@@ -36,16 +34,14 @@ public class SecteurController {
this.secteurService = secteurService;
}
@Operation(
summary = "Créer un secteur",
description = "Permet de Créer un secteur"
)
@PostMapping("/create")
public ResponseEntity<?> createSecteur(@RequestBody @Valid @Validated SecteurPaylaodWeb secteurPaylaodWeb) {
public ResponseEntity<?> createSecteur(@RequestBody @Valid @Validated SecteurPayload secteurPayload) {
try {
secteurPaylaodWeb = secteurService.createSecteur(secteurPaylaodWeb);
// Secteur secteur=getSecteurFromPayload(secteurPayload);
Secteur secteur = secteurService.createSecteur(secteurPayload);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurPaylaodWeb, "Secteur créé avec succès."),
new ApiResponse<>(true, secteur, "Secteur créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -64,15 +60,12 @@ public class SecteurController {
}
}
@Operation(
summary = "mettre à jour un secteur",
description = "Permet de modifier un secteur"
)
@PutMapping("/update/{id}")
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPaylaodWeb secteurPayloadWeb) {
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPayload secteurPayload) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayloadWeb), "Secteur mis à jour avec succès."),
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayload), "Secteur mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -90,10 +83,7 @@ public class SecteurController {
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@Operation(
summary = "supprimer un secteur",
description = "Permet de supprimer un secteur"
)
@DeleteMapping("/delete/{id}")
public ResponseEntity<?> deleteSecteurr(@PathVariable Long id) {
try {
@@ -117,10 +107,7 @@ public class SecteurController {
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@Operation(
summary = "recuperer tous les secteurs",
description = "Permet de récuperer l'ensemble des secteurs"
)
@GetMapping("/all")
public ResponseEntity<?> getAllSecteurList() {
try {
@@ -144,10 +131,6 @@ public class SecteurController {
}
}
@Operation(
summary = "recuperer tous les secteurs avec pagination",
description = "Permet de récuperer l'ensemble des secteurs avec pagination"
)
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSecteurPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
@@ -172,10 +155,6 @@ public class SecteurController {
}
}
@Operation(
summary = "recuperer un secteurs par son ID ",
description = "Permet de récuperer le secteur ayant l'ID fournie en path"
)
@GetMapping("/id/{id}")
public ResponseEntity<?> getSecteurById(@PathVariable Long id) {
try {
@@ -199,15 +178,12 @@ public class SecteurController {
}
}
@Operation(
summary = "recuperer tous les secteurs d'une structure",
description = "Permet de récuperer l'ensemble des secteurs de la structure dont l'ID est fourni en path"
)
@GetMapping("/by-structure-id/{structureId}")
public ResponseEntity<?> getSecteurByStructureId(@PathVariable Long structureId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurListByStructureId(structureId), "Secteur trouvée avec succès."),
new ApiResponse<>(true, secteurService.getSecteurListUneStruture(structureId), "Secteur trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -227,92 +203,4 @@ public class SecteurController {
}
@Operation(
summary = "recuperer tous les secteurs d'une structure",
description = "Permet de récuperer l'ensemble des secteurs de la structure dont l'ID est fourni en path avec pagination"
)
@GetMapping("/page/by-structure-id/{structureId}")
public ResponseEntity<?> getSecteurByStructureIdPage(@PathVariable Long structureId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurListByStructureId(structureId,pageable), "Secteur 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);
}
}
@Operation(
summary = "recuperer tous les secteurs d'une section",
description = "Permet de récuperer l'ensemble des secteurs de la section dont l'ID est fourni en path"
)
@GetMapping("/by-section-id/{sectionId}")
public ResponseEntity<?> getSecteurBySectionId(@PathVariable Long sectionId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurListBySectionId(sectionId), "Secteur 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);
}
}
@Operation(
summary = "recuperer tous les secteurs d'une section avec pagination",
description = "Permet de récuperer l'ensemble des secteurs de la section dont l'ID est fourni en path avec pagination"
)
@GetMapping("/page/by-section-id/{sectionId}")
public ResponseEntity<?> getSecteurBySectionIdPage(@PathVariable Long sectionId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurListBySectionId(sectionId,pageable), "Secteur 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

@@ -5,7 +5,6 @@ import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
@@ -36,11 +35,11 @@ public class SecteurDecoupageController {
@PostMapping("/create")
public ResponseEntity<?> createSecteurDecoupage(@RequestBody @Valid @Validated SecteurDecoupagePaylaodWeb secteurDecoupagePaylaodWeb) {
public ResponseEntity<?> createSecteurDecoupage(@RequestBody @Valid @Validated SecteurDecoupage secteurDecoupage) {
try {
secteurDecoupagePaylaodWeb = secteurDecoupageService.createSecteurDecoupage(secteurDecoupagePaylaodWeb);
secteurDecoupage = secteurDecoupageService.createSecteurDecoupage(secteurDecoupage);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupagePaylaodWeb, "SecteurDecoupage créé avec succès."),
new ApiResponse<>(true, secteurDecoupage, "SecteurDecoupage créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -60,10 +59,10 @@ public class SecteurDecoupageController {
}
@PutMapping("/update/{id}")
public ResponseEntity<?> updateSecteurDecoupage(@PathVariable Long id, @RequestBody SecteurDecoupagePaylaodWeb secteurDecoupagePaylaodWeb) {
public ResponseEntity<?> updateSecteurDecoupage(@PathVariable Long id, @RequestBody SecteurDecoupage secteurDecoupage) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupagePaylaodWeb), "SecteurDecoupage mis à jour avec succès."),
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupage), "SecteurDecoupage mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -153,58 +152,11 @@ public class SecteurDecoupageController {
}
}
@GetMapping("/by-secteur-id/{secteurId}")
public ResponseEntity<?> getAllSecteurDecoupageListBySecteurId(@PathVariable Long secteurId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageListBySecteurId(secteurId), "Liste des secteurDecoupages 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("/page/by-secteur-decoupage-id/{secteurId}")
public ResponseEntity<?> getAllSecteurDecoupageListBySecteurIdPaged(@PathVariable Long secteurId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageListBySecteurId(secteurId,pageable), "Liste des secteurDecoupages 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<?> getSecteurDecoupageById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageByIdToDto(id), "SecteurDecoupage trouvée avec succès."),
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageById(id), "SecteurDecoupage trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -228,7 +180,7 @@ public class SecteurDecoupageController {
public ResponseEntity<?> getArborescenceByUserId(@PathVariable Long userId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getStatParcelleDecoupageByUserId(userId), "SecteurDecoupage trouvée avec succès."),
new ApiResponse<>(true, secteurService.getStatParcelleDecoupageByUserId(userId), "SecteurDecoupage trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {

View File

@@ -1,255 +0,0 @@
package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.SectionService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.crudweb.SectionPaylaodWeb;
import io.swagger.v3.oas.annotations.Operation;
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/section", produces = MediaType.APPLICATION_JSON_VALUE)
//@SecurityRequirement(name = "bearer")
@Tag(name = "Section")
//@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
public class SectionController {
private final SectionService sectionService;
private static final Logger logger = LoggerFactory.getLogger(SectionController.class);
public SectionController(SectionService sectionService) {
this.sectionService = sectionService;
}
@Operation(
summary = "Créer un section",
description = "Permet de Créer un section"
)
@PostMapping("/create")
public ResponseEntity<?> createSection(@RequestBody @Valid @Validated SectionPaylaodWeb sectionPaylaodWeb) {
try {
sectionPaylaodWeb = sectionService.createSection(sectionPaylaodWeb);
return new ResponseEntity<>(
new ApiResponse<>(true, sectionPaylaodWeb, "Section 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);
}
}
@Operation(
summary = "mettre à jour un section",
description = "Permet de modifier un section"
)
@PutMapping("/update/{id}")
public ResponseEntity<?> updateSection(@PathVariable Long id, @RequestBody SectionPaylaodWeb sectionPayloadWeb) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.updateSection(id, sectionPayloadWeb), "Section mis à 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);
}
}
@Operation(
summary = "supprimer un section",
description = "Permet de supprimer un section"
)
@DeleteMapping("/delete/{id}")
public ResponseEntity<?> deleteSection(@PathVariable Long id) {
try {
sectionService.deleteSection(id);
return new ResponseEntity<>(
new ApiResponse<>(true, "Section 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);
}
}
@Operation(
summary = "recuperer tous les sections",
description = "Permet de récuperer l'ensemble des sections"
)
@GetMapping("/all")
public ResponseEntity<?> getAllSectionList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.getSectionList(), "Liste des sections 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);
}
}
@Operation(
summary = "recuperer tous les sections avec pagination",
description = "Permet de récuperer l'ensemble des sections avec pagination"
)
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSectionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.getSectionList(pageable), "Liste des sections 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);
}
}
@Operation(
summary = "recuperer un sections par son ID ",
description = "Permet de récuperer le section ayant l'ID fournie en path"
)
@GetMapping("/id/{id}")
public ResponseEntity<?> getSectionById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.getSectionById(id).orElse(null), "Section 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);
}
}
@Operation(
summary = "recuperer tous les sections d'une structure",
description = "Permet de récuperer l'ensemble des sections de la structure dont l'ID est fourni en path"
)
@GetMapping("/by-structure-id/{structureId}")
public ResponseEntity<?> getSectionByStructureId(@PathVariable Long structureId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.getSectionListByStructureId(structureId), "Section 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);
}
}
@Operation(
summary = "recuperer tous les sections d'une structure",
description = "Permet de récuperer l'ensemble des sections de la structure dont l'ID est fourni en path avec pagination"
)
@GetMapping("/page/by-structure-id/{structureId}")
public ResponseEntity<?> getSectionByStructureIdPage(@PathVariable Long structureId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, sectionService.getSectionListByStructureId(structureId,pageable), "Section 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

@@ -10,7 +10,6 @@ import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
import io.gmss.fiscad.paylaods.request.synchronisation.EnquetePayLoad;
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
@@ -208,35 +207,6 @@ public class EnqueteController {
}
}
@Operation(
summary = "Récupérer les enquetes d'une parcelle",
description = "Permet de récuperer les enquêtes déjà réalisées sur une parcelles"
)
@GetMapping("/all/by-parcelle-id/{parcelleId}")
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin(@PathVariable Long parcelleId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteListByParcelle(parcelleId), "Liste des enquetes 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/dgi/decoupage-admin-for-enquete")
public ResponseEntity<?> getAllByEnqueteDecoupageAdminForDgi() {

View File

@@ -218,31 +218,5 @@ public class ParcelleController {
@GetMapping("/user-id/{userId}")
public ResponseEntity<?> getParcellesByUserId(@PathVariable Long userId,@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, parcelleService.getParcelleDataTableListByUserId(userId,pageable), "enquete trouvé 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

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.metier.Upload;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.JobModels;
import io.gmss.fiscad.proprietes.ZipStorageProperties;
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.service.FileStorageService;
import io.gmss.fiscad.service.StringManager;
import io.gmss.fiscad.service.ZipAsyncService;

View File

@@ -6,7 +6,6 @@ import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
@@ -28,7 +27,7 @@ import org.springframework.web.client.HttpClientErrorException;
@SecurityRequirement(name = "bearer")
@Tag(name = "Structure")
@CrossOrigin(origins = "*")
//@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
public class StructureController {
private final StructureService structureService;
@@ -41,11 +40,11 @@ public class StructureController {
}
@PostMapping("/create")
public ResponseEntity<?> createStructure(@RequestBody StructurePaylaodWeb structurePaylaodWeb) {
public ResponseEntity<?> createStructure(@RequestBody @Valid @Validated Structure structure) {
try {
structurePaylaodWeb = structureService.createStructure(structurePaylaodWeb);
structure = structureService.createStructure(structure);
return new ResponseEntity<>(
new ApiResponse<>(true, structurePaylaodWeb, "Structure créé avec succès."),
new ApiResponse<>(true, structure, "Structure créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -65,10 +64,10 @@ public class StructureController {
}
@PutMapping("/update/{id}")
public ResponseEntity<?> updateStructure(@PathVariable Long id, @RequestBody StructurePaylaodWeb structurePaylaodWeb) {
public ResponseEntity<?> updateStructure(@PathVariable Long id, @RequestBody Structure structure) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.updateStructure(id, structurePaylaodWeb), "Structure mise à jour avec succès."),
new ApiResponse<>(true, structureService.updateStructure(id, structure), "Structure mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -135,6 +134,36 @@ public class StructureController {
}
@GetMapping("/all-by-arrondissement")
public ResponseEntity<?> getAllStructureListByArrondissement(@RequestParam Long arrondissementId) {
try {
if (arrondissementService.getArrondissementById(arrondissementId).isPresent()) {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructuresByArrondissement(arrondissementId), "Liste des structures chargée avec succès."),
HttpStatus.OK
);
} else {
return new ResponseEntity<>(
new ApiResponse<>(false, "Impossible de trouver l'arrondissement spécifiée."),
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<?> getAllStructurePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
@@ -160,53 +189,6 @@ public class StructureController {
}
@GetMapping("/by-commune/{communeId}")
public ResponseEntity<?> getAllStructureListByCommune(@PathVariable Long communeId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructureListByCommuneId(communeId), "Liste des structures 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("/page/by-commune/{communeId}")
public ResponseEntity<?> getAllStructureListByCommunePageable(@PathVariable Long communeId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructureListByCommuneId(communeId,pageable), "Liste des structures 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<?> getStructureById(@PathVariable Long id) {
try {

View File

@@ -7,8 +7,8 @@ package io.gmss.fiscad.controllers.report;
import io.gmss.fiscad.enums.FormatRapport;
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.service.ReportService;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@@ -7,7 +7,7 @@ import io.gmss.fiscad.enums.StatusAvis;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@@ -11,7 +11,6 @@ import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.JwtAuthenticationResponse;
import io.gmss.fiscad.paylaods.Login;
import io.gmss.fiscad.paylaods.UserRequest;
import io.gmss.fiscad.paylaods.request.crudweb.UserPaylaodWeb;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
@@ -91,13 +90,13 @@ public class AuthController {
}
@PostMapping("/signup")
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated UserPaylaodWeb userPaylaodWeb) {
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated UserRequest userRequest) {
try {
//User user = getUser(userRequest);
//user.setUsername(userRequest.getEmail());
userPaylaodWeb = userService.createUser(userPaylaodWeb);
User user = getUser(userRequest);
user.setUsername(userRequest.getEmail());
user = userService.createUser(user, true);
return new ResponseEntity<>(
new ApiResponse<>(true, userPaylaodWeb, "Inscription effectué avec succès."),
new ApiResponse<>(true, user, "Inscription effectué avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -116,5 +115,18 @@ 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;
}
}

View File

@@ -39,8 +39,9 @@ public class AvoirFonctionController {
@PostMapping("/create")
public ResponseEntity<?> createAvoirFonction(@RequestBody @Valid @Validated AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb ) {
try {
AvoirFonction avoirFonction = avoirFonctionService.createAvoirFonction(avoirFonctionPaylaodWeb);
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.createAvoirFonction(avoirFonctionPaylaodWeb), "Fonction utilisateur créée avec succès."),
new ApiResponse<>(true, avoirFonction, "Fonction utilisateur créée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -130,6 +131,52 @@ public class AvoirFonctionController {
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.getAvoirFonctionById(id), "Fonction utilisateur trouvés 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("/utilisateur-id/{userId}")
public ResponseEntity<?> getByUserId(@PathVariable Long userId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.getUserAvoirFonctionById(userId), "Fonctions de utilisateur trouvées 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<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
@@ -156,79 +203,4 @@ public class AvoirFonctionController {
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.getAvoirFonctionById(id), "Fonction utilisateur trouvés 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("/by-utilisateur-id/{userId}")
public ResponseEntity<?> getByUserId(@PathVariable Long userId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.getAvoirFonctionByUserId(userId), "Fonctions de utilisateur trouvées 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("/page/by-utilisateur-id/{userId}")
public ResponseEntity<?> getByUserIdPageable(@PathVariable Long userId,@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, avoirFonctionService.getAvoirFonctionByUserId(userId,pageable), "Fonctions de utilisateur trouvées 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

@@ -111,7 +111,7 @@ public class FonctionController {
public ResponseEntity<?> getAllFonctionList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, fonctionService.getFonctionListToDto(), "Liste des caractéristiques chargée avec succès."),
new ApiResponse<>(true, fonctionService.getFonctionList(), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -135,7 +135,7 @@ public class FonctionController {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, fonctionService.getFonctionListToDtoPageable(pageable), "Liste des caractéristiques chargée avec succès."),
new ApiResponse<>(true, fonctionService.getFonctionList(pageable), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {

View File

@@ -8,15 +8,12 @@ import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.Login;
import io.gmss.fiscad.paylaods.request.crudweb.UserPaylaodWeb;
import io.gmss.fiscad.security.CurrentUser;
import io.gmss.fiscad.security.UserPrincipal;
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;
@@ -24,7 +21,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import java.util.Optional;
import java.util.Set;
@@ -44,11 +40,12 @@ public class UserController {
}
@PostMapping("/create")
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated UserPaylaodWeb userPaylaodWeb) {
public ResponseEntity<?> createUser(@RequestBody @Valid @Validated User user) {
try {
userPaylaodWeb = userService.createUser(userPaylaodWeb);
user.setUsername(user.getEmail());
user = userService.createUser(user, true);
return new ResponseEntity<>(
new ApiResponse<>(true, userPaylaodWeb, "Utilisateur créé avec succès"),
new ApiResponse<>(true, user, "Utilisateur créé avec succès"),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -94,9 +91,9 @@ public class UserController {
@PostMapping("/reset-password")
public ResponseEntity<?> resetUserPassword(@RequestBody @Valid @Validated Login login) {
try {
UserPaylaodWeb userPaylaodWeb= userService.resetPassword(login.getUsername(), login.getPassword());
User user = userService.resetPassword(login.getUsername(), login.getPassword());
return new ResponseEntity<>(
new ApiResponse<>(true, userPaylaodWeb, "Votre mot de passe à été réinitialisée avec succès."),
new ApiResponse<>(true, user, "Votre mot de passe à été réinitialisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -115,10 +112,10 @@ public class UserController {
}
}
@PostMapping("/validate-user-account/{userName}")
public ResponseEntity<?> validateUserAccount(@PathVariable String userName) {
@PostMapping("/validate-user-account")
public ResponseEntity<?> validateUserAccount(@RequestBody @Valid @Validated Login login) {
try {
User user = userService.validateUserAccount(userName);
User user = userService.validateUserAccount(login.getUsername(), login.getUserRole());
return new ResponseEntity<>(
new ApiResponse<>(true, user, "Cet compte à été activé avec succès."),
HttpStatus.OK
@@ -141,10 +138,10 @@ public class UserController {
@PutMapping("/update/{id}")
public ResponseEntity<?> updateUser(@PathVariable Long id, @RequestBody UserPaylaodWeb userPaylaodWeb) {
public ResponseEntity<?> updateUser(@PathVariable Long id, @RequestBody User user) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.updateUser(id, userPaylaodWeb), "Utilisateur modifié avec succès."),
new ApiResponse<>(true, userService.updateUser(id, user), "Utilisateur modifié avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
@@ -232,11 +229,17 @@ public class UserController {
@GetMapping("/all")
public ResponseEntity<?> getAll() {
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
try {
if(userPrincipal==null){
return new ResponseEntity<>(
new ApiResponse<>(false, null, "Vous n'êtes pas authorisés à accéder à la liste des utilisateurs"),
HttpStatus.OK
);
}
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getListUserToDto(), "Liste des utilisateurs chargée avec succès."),
new ApiResponse<>(true, userService.getListUserResponseByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs chargée avec succès."),
HttpStatus.OK);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
@@ -254,65 +257,20 @@ public class UserController {
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
@GetMapping("/all-by-structure")
public ResponseEntity<?> getAllByStructure(@CurrentUser UserPrincipal userPrincipal) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getListUserToDto(pageable), "Liste des utilisateurs 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-by-structure/{structureId}")
public ResponseEntity<?> getAllByStructure(@PathVariable Long structureId) {
try {
if (userPrincipal.getUser().getStructure() != null) {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getListUserByStructureToDto(structureId), "Liste des utilisateurs chargée avec succès."),
new ApiResponse<>(true, userService.getListUserByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs 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("/page/all-by-structure/{structureId}")
public ResponseEntity<?> getAllByStructurePaged(@PathVariable Long structureId, @RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
} else {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getListUserByStructureToDto(structureId,pageable), "Liste des utilisateurs chargée avec succès."),
new ApiResponse<>(false, "Impossible de trouver la structure indiquée."),
HttpStatus.OK
);
}
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
@@ -385,5 +343,26 @@ public class UserController {
}
}
@GetMapping("/all-by-role/{userrole}")
public ResponseEntity<?> getUserByUserRole(@PathVariable UserRole userrole) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getUserByProfil(userrole), "Users found."),
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

@@ -28,15 +28,15 @@ public class Secteur extends BaseEntity implements Serializable {
private String code;
private String nom;
// @ManyToOne
// private Structure structure;
@ManyToOne
private Structure structure;
//@JsonBackReference
@ManyToOne
private Section section ;
//@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
// @JoinColumn(name = "secteur_id")
// @JsonManagedReference
// private List<SecteurDecoupage> secteurDecoupages;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "secteur_id")
@JsonManagedReference
private List<SecteurDecoupage> secteurDecoupages;
}

View File

@@ -25,6 +25,7 @@ import java.util.List;
@AllArgsConstructor
@Where(clause = " deleted = false")
public class SecteurDecoupage extends BaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@@ -35,7 +36,7 @@ public class SecteurDecoupage extends BaseEntity implements Serializable {
@JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate dateFin;
//@JsonBackReference
@JsonBackReference
@ManyToOne
private Secteur secteur;

View File

@@ -26,12 +26,11 @@ public class Section extends BaseEntity implements Serializable {
private Long id;
private String code;
private String nom;
@ManyToOne
private Structure structure;
//@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
//@JoinColumn(name = "section_id")
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "section_id")
//@JsonManagedReference
//private List<Secteur> secteurs;
private List<Secteur> fonctionList;
}

View File

@@ -157,18 +157,18 @@ public class Enquete extends BaseEntity implements Serializable {
private String numeroTitreFoncier;
/// Nouveau champs ajoutés pour RFU Abomey
private String numEntreeParcelle;
private String numEnterParcelle;
private String numRue;
private String nomRue;
private String emplacement;
private Float altitude;
private Float precision;
private Integer nbreCoProprietaire;
private Integer nbreIndivisiaire;
private float altitude;
private float precision;
private int nbreCoProprietaire;
private int nbreIndivisiaire;
private String autreAdresse;
private Float superficie ;
private Integer nbreBatiment;
private Integer nbrePiscine;
private float superficie ;
private int nbreBatiment;
private int nbrePiscine;
private Long montantMensuelleLocation;
private Long montantAnnuelleLocation;
private Long valeurParcelleEstime;

View File

@@ -2,11 +2,9 @@ package io.gmss.fiscad.entities.infocad.parametre;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import io.gmss.fiscad.entities.BaseEntity;
import io.gmss.fiscad.entities.decoupage.Arrondissement;
import io.gmss.fiscad.entities.decoupage.Commune;
import io.gmss.fiscad.entities.user.Fonction;
import io.gmss.fiscad.entities.user.User;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
@@ -30,11 +28,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 +47,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
@ManyToOne
private Commune commune;
@@ -60,18 +58,11 @@ public class Structure extends BaseEntity implements Serializable {
inverseJoinColumns = @JoinColumn(name = "arrondissement_id")
)
private Set<Arrondissement> arrondissements;
// @JsonIgnore
// @OneToMany(mappedBy = "structure")
// private List<User> agents;
// @JsonIgnore
// @OneToMany(mappedBy = "structure")
// private List<Bloc> blocs;
@Override
public String toString() {
return "Structure{" +
"id=" + id +
", code='" + code + '\'' +
", nom='" + nom + '\'' +
", ifu='" + ifu + '\'' +
", rccm='" + rccm + '\'' +
", tel='" + tel + '\'' +
", email='" + email + '\'' +
", adresse='" + adresse + '\'' +
'}';
}
}

View File

@@ -6,7 +6,6 @@ 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.decoupage.Departement;
import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.entities.decoupage.Section;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
@@ -43,17 +42,14 @@ public class Fonction extends BaseEntity implements Serializable {
@ManyToOne
private Secteur secteur;
//@JsonBackReference
@JsonBackReference
@ManyToOne
private Section section;
//@JsonBackReference
@ManyToOne
@JoinColumn(name = "structure_id")
private Structure structure;
@ManyToOne
private Departement departement;
//@JsonIgnore
@ManyToOne //(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "profile_id", nullable = false)

View File

@@ -6,8 +6,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
import io.gmss.fiscad.interfaces.decoupage.CommuneService;
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -56,28 +55,27 @@ public class ArrondissementServiceImpl implements ArrondissementService {
}
@Override
public Page<ArrondissementPaylaodWeb> getArrondissementList(Pageable pageable) {
return arrondissementRepository.findAllArrondissementToDtoPageable(pageable);
public Page<Arrondissement> getArrondissementList(Pageable pageable) {
return arrondissementRepository.findAll(pageable);
}
@Override
public List<ArrondissementPaylaodWeb> getArrondissementList() {
return arrondissementRepository.findAllArrondissementToDto();
public List<Arrondissement> getArrondissementList() {
return arrondissementRepository.findAll();
}
@Override
public List<ArrondissementPaylaodWeb> getArrondissementListByCommuneId(Long communeId) {
return arrondissementRepository.findAllArrondissementByCommuneToDto(communeId);
public Optional<Arrondissement> getArrondissementById(Long id) {
return arrondissementRepository.findById(id);
}
@Override
public Page<ArrondissementPaylaodWeb> getArrondissementListByCommuneId(Long communeId, Pageable pageable) {
return arrondissementRepository.findAllArrondissementByCommuneToDtoPageable(communeId,pageable);
}
@Override
public Optional<ArrondissementPaylaodWeb> getArrondissementById(Long id) {
return arrondissementRepository.findArrondissementToDtoById(id);
public List<Arrondissement> getArrondissementByComune(Long communeId) {
Optional<Commune> communeOptional = communeService.getCommuneById(communeId);
if (communeOptional.isEmpty()) {
throw new NotFoundException("Impossible de trouver la commune spécifiée.");
}
return arrondissementRepository.findAllByCommune(communeOptional.get());
}

View File

@@ -6,9 +6,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.CommuneService;
import io.gmss.fiscad.interfaces.decoupage.DepartementService;
import io.gmss.fiscad.paylaods.request.crudweb.CommunePaylaodWeb;
import io.gmss.fiscad.paylaods.request.crudweb.DepartementPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.CommuneRepository;
import io.gmss.fiscad.repositories.decoupage.CommuneRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -57,28 +55,27 @@ public class CommuneServiceImpl implements CommuneService {
}
@Override
public Page<CommunePaylaodWeb> getCommuneList(Pageable pageable) {
return communeRepository.findAllCommuneToDtoPageable(pageable);
public Page<Commune> getCommuneList(Pageable pageable) {
return communeRepository.findAll(pageable);
}
@Override
public List<Commune> getCommuneList() {
return communeRepository.findAll();
}
@Override
public List<CommunePaylaodWeb> getCommuneList() {
return communeRepository.findAllCommuneToDto();
public List<Commune> getCommunesByDepartement(Long departementId) {
Optional<Departement> departementOptional = departementService.getDepartementById(departementId);
if (departementOptional.isEmpty()) {
throw new NotFoundException("Impossible de trouver le département spécifié.");
}
return communeRepository.findAllByDepartement(departementOptional.get());
}
@Override
public List<CommunePaylaodWeb> getCommunesByDepartementId(Long departementId) {
return communeRepository.findAllCommuneByDepartementToDto(departementId);
}
@Override
public Page<CommunePaylaodWeb> getCommunesByDepartementId(Long departementId, Pageable pageable) {
return communeRepository.findAllCommuneByDepartementToDtoPageable(departementId,pageable);
}
@Override
public Optional<CommunePaylaodWeb> getCommuneById(Long id) {
return communeRepository.findCommuneToDtoById(id);
public Optional<Commune> getCommuneById(Long id) {
return communeRepository.findById(id);
}
}

View File

@@ -4,8 +4,7 @@ import io.gmss.fiscad.entities.decoupage.Departement;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.DepartementService;
import io.gmss.fiscad.paylaods.request.crudweb.DepartementPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.DepartementRepository;
import io.gmss.fiscad.repositories.decoupage.DepartementRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -52,20 +51,20 @@ public class DepartementServiceImpl implements DepartementService {
}
@Override
public Page<DepartementPaylaodWeb> getDepartementList(Pageable pageable) {
return departementRepository.findAllDepartementToDtoPageable(pageable);
public Page<Departement> getDepartementList(Pageable pageable) {
return departementRepository.findAll(pageable);
}
@Override
public List<DepartementPaylaodWeb> getDepartementList() {
return departementRepository.findAllDepartementToDto();
public List<Departement> getDepartementList() {
return departementRepository.findAll();
}
@Override
public Optional<DepartementPaylaodWeb> getDepartementById(Long id) {
public Optional<Departement> getDepartementById(Long id) {
if (departementRepository.existsById(id)) {
return departementRepository.findDepartementToDtoById(id);
return departementRepository.findById(id);
} else {
throw new NotFoundException("Impossible de trouver le département spécifié dans la base de données.");
}

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.decoupage.Nationalite;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.NationaliteService;
import io.gmss.fiscad.persistence.repositories.decoupage.NationaliteRepository;
import io.gmss.fiscad.repositories.decoupage.NationaliteRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -6,8 +6,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
import io.gmss.fiscad.interfaces.decoupage.QuartierService;
import io.gmss.fiscad.paylaods.request.crudweb.QuartierPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.QuartierRepository;
import io.gmss.fiscad.repositories.decoupage.QuartierRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -56,28 +55,31 @@ public class QuartierServiceImpl implements QuartierService {
}
@Override
public Page<QuartierPaylaodWeb> getQuartierList(Pageable pageable) {
return quartierRepository.findAllQuartierToDtoPageable(pageable);
public Page<Quartier> getQuartierList(Pageable pageable) {
return quartierRepository.findAll(pageable);
}
@Override
public List<QuartierPaylaodWeb> getQuartierList() {
return quartierRepository.findAllQuartierToDto();
public List<Quartier> getQuartierList() {
return quartierRepository.findAll();
}
@Override
public List<QuartierPaylaodWeb> getQuartierListByArrondissementId(Long arrondissementId) {
return quartierRepository.findAllQuartierByArrondissementToDto(arrondissementId);
public Optional<Quartier> getQuartierById(Long id) {
if (quartierRepository.existsById(id)) {
return quartierRepository.findById(id);
} else {
throw new NotFoundException("Impossible de trouver le quartier spécifié dans la base de données.");
}
}
@Override
public Page<QuartierPaylaodWeb> getQuartierListByArrondissementId(Long arrondissementId, Pageable pageable) {
return quartierRepository.findAllQuartierByArrondissementToDtoPageable(arrondissementId,pageable);
public List<Quartier> getQuartierByArrondissement(Long arrondissementId) {
Optional<Arrondissement> arrondissementOptional = arrondissementService.getArrondissementById(arrondissementId);
if (arrondissementOptional.isEmpty()) {
throw new NotFoundException("Impossible de trouver l'arrondissement spécifié.");
}
return quartierRepository.getAllByArrondissement(arrondissementOptional.get());
}
@Override
public Optional<QuartierPaylaodWeb> getQuartierById(Long id) {
return quartierRepository.findQuartierToDtoById(id);
}
}

View File

@@ -1,58 +1,42 @@
package io.gmss.fiscad.implementations.decoupage;
import io.gmss.fiscad.entities.decoupage.Secteur;
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.interfaces.decoupage.SecteurService;
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurDecoupageRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
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.ArrayList;
import java.util.List;
import java.util.Optional;
@AllArgsConstructor
@Service
public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
private final SecteurDecoupageRepository secteurDecoupageRepository;
private final SecteurService secteurService;
private final ParcelleRepository parcelleRepository;
private final EntityFromPayLoadService entityFromPayLoadService;
@Override
public SecteurDecoupagePaylaodWeb createSecteurDecoupage(SecteurDecoupagePaylaodWeb secteurDecoupagePaylaodWeb) throws BadRequestException {
if (secteurDecoupagePaylaodWeb.getId() != null) {
throw new BadRequestException("Impossible de créer un nouveau secteur découpage ayant un id non null.");
}
SecteurDecoupage secteurDecoupage = entityFromPayLoadService.getSecteurDecoupageFromPayLoadWeb(secteurDecoupagePaylaodWeb);
secteurDecoupage = secteurDecoupageRepository.save(secteurDecoupage);
return secteurDecoupageRepository.findSecteurDecoupageToDtoById(secteurDecoupage.getId()).orElse(null);
public SecteurDecoupageServiceImpl(SecteurDecoupageRepository secteurDecoupageRepository) {
this.secteurDecoupageRepository = secteurDecoupageRepository;
}
@Override
public SecteurDecoupagePaylaodWeb updateSecteurDecoupage(Long id, SecteurDecoupagePaylaodWeb secteurDecoupagePaylaodWeb) throws NotFoundException {
if (secteurDecoupagePaylaodWeb.getId() == null) {
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(secteurDecoupagePaylaodWeb.getId())) {
if (!secteurDecoupageRepository.existsById(secteurDecoupage.getId())) {
throw new NotFoundException("Impossible de trouver le secteur découpage spécifié.");
}
SecteurDecoupage secteurDecoupage = entityFromPayLoadService.getSecteurDecoupageFromPayLoadWeb(secteurDecoupagePaylaodWeb);
secteurDecoupage = secteurDecoupageRepository.save(secteurDecoupage);
return secteurDecoupageRepository.findSecteurDecoupageToDtoById(secteurDecoupage.getId()).orElse(null);
return secteurDecoupageRepository.save(secteurDecoupage);
}
@Override
@@ -66,28 +50,13 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
}
@Override
public Page<SecteurDecoupagePaylaodWeb> getSecteurDecoupageList(Pageable pageable) {
return secteurDecoupageRepository.findAllSecteurDecoupageToDtoPageable(pageable);
public Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable) {
return secteurDecoupageRepository.findAll(pageable);
}
@Override
public List<SecteurDecoupagePaylaodWeb> getSecteurDecoupageList() {
return secteurDecoupageRepository.findAllSecteurDecoupageToDto();
}
@Override
public Page<SecteurDecoupagePaylaodWeb> getSecteurDecoupageListBySecteurId(Long secteurId, Pageable pageable) {
return secteurDecoupageRepository.findAllSecteurDecoupageBySecteurToDtoPageable(secteurId,pageable);
}
@Override
public List<SecteurDecoupagePaylaodWeb> getSecteurDecoupageListBySecteurId(Long sectionId) {
return secteurDecoupageRepository.findAllSecteurDecoupageBySecteurToDto(sectionId);
}
@Override
public Optional<SecteurDecoupagePaylaodWeb> getSecteurDecoupageByIdToDto(Long id) {
return secteurDecoupageRepository.findSecteurDecoupageToDtoById(id);
public List<SecteurDecoupage> getSecteurDecoupageList() {
return secteurDecoupageRepository.findAll();
}
@@ -95,21 +64,4 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
public Optional<SecteurDecoupage> getSecteurDecoupageById(Long id) {
return secteurDecoupageRepository.findById(id);
}
@Override
public List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) {
return parcelleRepository.findStatsBySecteurs(List.of(secteurId));
}
@Override
public List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) {
List<ParcelleStatsProjectionUnSecteur> parcelleStatsProjectionUnSecteurs = new ArrayList<>();
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
List<Long> secteurIds = secteurs.stream()
.map(Secteur::getId)
.toList();
parcelleStatsProjectionUnSecteurs = parcelleRepository.findStatsBySecteurs(secteurIds);
return parcelleStatsProjectionUnSecteurs ;
}
}

View File

@@ -8,17 +8,16 @@ 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.crudweb.SecteurPaylaodWeb;
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurDecoupagePayload;
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurPayload;
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.persistence.repositories.decoupage.QuartierRepository;
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.persistence.repositories.user.AvoirFonctionRepository;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
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.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.repositories.user.AvoirFonctionRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -28,6 +27,7 @@ import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
@AllArgsConstructor
@Service
@@ -39,67 +39,73 @@ public class SecteurServiceImpl implements SecteurService {
private final QuartierRepository quartierRepository;
private final StructureRepository structureRepository;
private final AvoirFonctionRepository avoirFonctionRepository;
private final EntityFromPayLoadService entityFromPayLoadService;
@Override
public SecteurPaylaodWeb createSecteur(SecteurPaylaodWeb secteurPaylaodWeb) throws BadRequestException {
if (secteurPaylaodWeb.getId() != null) {
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.");
}
Secteur secteur = entityFromPayLoadService.getSecteurFromPayLoadWeb(secteurPaylaodWeb);
secteur = secteurRepository.save(secteur);
return secteurRepository.findSecteurToDtoById(secteur.getId()).orElse(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));
//// Optional<Structure> optionalStructure = structureRepository.findById(secteurPayload.getStructureId());
//// secteur.setStructure(optionalStructure.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);
// //TODO
// secteur.setId(secteurPayload.getId());
// secteur.setCode(secteurPayload.getCode());
// secteur.setNom(secteurPayload.getNom());
// return secteur;
// }
private Secteur getSecteurFromPayload(SecteurPayload secteurPayload) {
Secteur secteur = new Secteur();
Optional<User> optionalUser = userRepository.findById(secteurPayload.getChefSecteurId());
//secteur.setChefSecteur(optionalUser.orElse(null));
Optional<Structure> optionalStructure = structureRepository.findById(secteurPayload.getStructureId());
secteur.setStructure(optionalStructure.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);
//TODO
secteur.setId(secteurPayload.getId());
secteur.setCode(secteurPayload.getCode());
secteur.setNom(secteurPayload.getNom());
return secteur;
}
@Override
public SecteurPaylaodWeb updateSecteur(Long id, SecteurPaylaodWeb secteurPaylaodWeb) throws NotFoundException {
if (secteurPaylaodWeb.getId() == null) {
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(secteurPaylaodWeb.getId())) {
if (!secteurRepository.existsById(secteurPayload.getId())) {
throw new NotFoundException("Impossible de trouver le secteur spécifié.");
}
Secteur secteur = entityFromPayLoadService.getSecteurFromPayLoadWeb(secteurPaylaodWeb);
secteur = secteurRepository.save(secteur);
return secteurRepository.findSecteurToDtoById(secteur.getId()).orElse(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.");
}
}
@Override
@@ -113,58 +119,59 @@ public class SecteurServiceImpl implements SecteurService {
}
@Override
public Page<SecteurPaylaodWeb> getSecteurList(Pageable pageable) {
return secteurRepository.findAllSecteurToDtoPageable(pageable);
public Page<Secteur> getSecteurList(Pageable pageable) {
return secteurRepository.findAll(pageable);
}
@Override
public List<SecteurPaylaodWeb> getSecteurList() {
return secteurRepository.findAllSecteurToDto();
public List<Secteur> getSecteurList() {
return secteurRepository.findAll();
}
@Override
public Page<SecteurPaylaodWeb> getSecteurListBySectionId(Long sectionId, Pageable pageable) {
return secteurRepository.findAllSecteurBySectionIdToDtoPageable(sectionId,pageable);
}
@Override
public List<SecteurPaylaodWeb> getSecteurListBySectionId(Long sectionId) {
return secteurRepository.findAllSecteurBySectionIdToDto(sectionId);
}
@Override
public List<SecteurPaylaodWeb> getSecteurListByStructureId(Long structureId) {
return secteurRepository.findAllSecteurByStructureIdToDto(structureId);
}
@Override
public Page<SecteurPaylaodWeb> getSecteurListByStructureId(Long structureId, Pageable pageable) {
return secteurRepository.findAllSecteurByStructureIdToDtoPageable(structureId,pageable);
public List<Secteur> getSecteurListUneStruture(Long structureId) {
return secteurRepository.findAllByStructure_Id(structureId);
}
@Override
public Optional<SecteurPaylaodWeb> getSecteurById(Long id) {
return secteurRepository.findSecteurToDtoById(id);
public Optional<Secteur> getSecteurById(Long id) {
return secteurRepository.findById(id);
}
@Override
public List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) {
return parcelleRepository.findStatsBySecteurs(List.of(secteurId));
}
@Override
public List<Secteur> getListSecteurUserId(Long userId) {
public List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) {
List<AvoirFonction> avoirFonctions= avoirFonctionRepository.findAvoirFonctionByUser_Id(userId);
List<Secteur> secteurs = new ArrayList<>();
AtomicReference<List<ParcelleStatsProjectionUnSecteur>> parcelleStatsProjectionUnSecteurs = new AtomicReference<>(new ArrayList<>());
avoirFonctions.stream()
.filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now()))
.forEach(avoirFonction -> {
if(avoirFonction.getFonction().getSecteur()!=null){
secteurs.addAll(List.of(avoirFonction.getFonction().getSecteur()));
parcelleStatsProjectionUnSecteurs.set(parcelleRepository.findStatsBySecteurs(List.of(avoirFonction.getFonction().getSecteur().getId())));
}else
if (avoirFonction.getFonction().getSection()!=null){
secteurs.addAll(secteurRepository.findDistinctBySection_Id(avoirFonction.getFonction().getSection().getId()));
}else if(avoirFonction.getFonction().getStructure()!=null){
secteurs.addAll(secteurRepository.findDistinctBySection_Structure_Id(avoirFonction.getFonction().getStructure().getId()));
}
if (avoirFonction.getFonction().getSection()!=null){
List<Secteur> secteurs= secteurRepository.findDistinctBySection_Id(avoirFonction.getFonction().getSection().getId());
List<Long> secteurIds = secteurs.stream()
.map(Secteur::getId)
.toList();
parcelleStatsProjectionUnSecteurs.set(parcelleRepository.findStatsBySecteurs(secteurIds));
}else if(avoirFonction.getFonction().getStructure()!=null){
List<Secteur> secteurs= secteurRepository.findDistinctBySection_Structure_Id(avoirFonction.getFonction().getStructure().getId());
List<Long> secteurIds = secteurs.stream()
.map(Secteur::getId)
.toList();
parcelleStatsProjectionUnSecteurs.set(parcelleRepository.findStatsBySecteurs(secteurIds));
}
});
return secteurs;
return parcelleStatsProjectionUnSecteurs.get();
}
}

View File

@@ -1,90 +0,0 @@
package io.gmss.fiscad.implementations.decoupage;
import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.entities.decoupage.Section;
import io.gmss.fiscad.entities.rfu.metier.Batiment;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.SectionService;
import io.gmss.fiscad.paylaods.request.crudweb.SectionPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.SectionRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
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;
@AllArgsConstructor
@Service
public class SectionServiceImpl implements SectionService {
private final StructureRepository structureRepository;
private final SectionRepository sectionRepository;
private final EntityFromPayLoadService entityFromPayLoadService;
@Override
public SectionPaylaodWeb createSection(SectionPaylaodWeb sectionPaylaodWeb) throws BadRequestException {
if (sectionPaylaodWeb.getId() != null) {
throw new BadRequestException("Impossible de créer une nouvelle section ayant un id non null.");
}
Section section= entityFromPayLoadService.getSectionFromPayLoadWeb(sectionPaylaodWeb);
section=sectionRepository.save(section);
return sectionRepository.findSectionToDtoById(section.getId()).orElse(null);
}
@Override
public SectionPaylaodWeb updateSection(Long id, SectionPaylaodWeb sectionPaylaodWeb) throws NotFoundException {
if (sectionPaylaodWeb.getId() == null) {
throw new BadRequestException("Impossible de mettre à jour un nouveau section ayant un id null.");
}
if (!sectionRepository.existsById(sectionPaylaodWeb.getId())) {
throw new NotFoundException("Impossible de trouver le section spécifié.");
}
Section section= entityFromPayLoadService.getSectionFromPayLoadWeb(sectionPaylaodWeb);
section=sectionRepository.save(section);
return sectionRepository.findSectionToDtoById(section.getId()).orElse(null);
}
@Override
public void deleteSection(Long id) throws NotFoundException {
Optional<Section> optionalSection = sectionRepository.findById(id);
if (optionalSection.isPresent()) {
sectionRepository.deleteById(optionalSection.get().getId());
} else {
throw new NotFoundException("Impossible de trouver la section spécifié.");
}
}
@Override
public Page<SectionPaylaodWeb> getSectionList(Pageable pageable) {
return sectionRepository.findAllSectionToDtoPageable(pageable);
}
@Override
public List<SectionPaylaodWeb> getSectionList() {
return sectionRepository.findAllSectionToDto();
}
@Override
public List<SectionPaylaodWeb> getSectionListByStructureId(Long structureId) {
return sectionRepository.findAllSectionByStructureToDto(structureId);
}
@Override
public Page<SectionPaylaodWeb> getSectionListByStructureId(Long structureId, Pageable pageable) {
return sectionRepository.findAllSectionByStructureToDtoPageable(structureId,pageable);
}
@Override
public Optional<SectionPaylaodWeb> getSectionById(Long id) {
return sectionRepository.findSectionToDtoById(id);
}
}

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.metier.ActeurConcerne;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.metier.ActeurConcerneService;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ActeurConcerneRepository;
import io.gmss.fiscad.repositories.infocad.metier.ActeurConcerneRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

View File

@@ -7,7 +7,7 @@ import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.metier.CommentaireService;
import io.gmss.fiscad.paylaods.request.SyncCommentaireRequest;
import io.gmss.fiscad.paylaods.response.CommentaireResponse;
import io.gmss.fiscad.persistence.repositories.infocad.metier.CommentaireRepository;
import io.gmss.fiscad.repositories.infocad.metier.CommentaireRepository;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

View File

@@ -1,6 +1,7 @@
package io.gmss.fiscad.implementations.infocad.metier;
import io.gmss.fiscad.entities.infocad.metier.*;
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
import io.gmss.fiscad.entities.infocad.parametre.Personne;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
@@ -17,6 +18,7 @@ import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
import io.gmss.fiscad.interfaces.rfu.parametre.CaracteristiqueService;
import io.gmss.fiscad.interfaces.user.UserService;
//import io.gmss.fiscad.paylaods.request.synchronisation.EnquetePayLoad ;
//import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb ;
@@ -25,20 +27,20 @@ import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
import io.gmss.fiscad.paylaods.response.* ;
import io.gmss.fiscad.paylaods.response.FicheResponse.* ;
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.persistence.repositories.decoupage.CommuneRepository;
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.*;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.CaracteristiqueParcelleRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ZoneRfuRepository;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.repositories.decoupage.CommuneRepository;
import io.gmss.fiscad.repositories.decoupage.SecteurRepository;
import io.gmss.fiscad.repositories.infocad.metier.*;
import io.gmss.fiscad.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.repositories.rfu.metier.CaracteristiqueParcelleRepository;
import io.gmss.fiscad.repositories.rfu.metier.EnqueteBatimentRepository;
import io.gmss.fiscad.repositories.rfu.metier.EnqueteUniteLogementRepository;
import io.gmss.fiscad.repositories.rfu.parametre.CaracteristiqueRepository;
import io.gmss.fiscad.repositories.rfu.parametre.EquipeRepository;
import io.gmss.fiscad.repositories.rfu.parametre.ZoneRfuRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
@@ -151,7 +153,7 @@ public class EnqueteServiceImpl implements EnqueteService {
enquete.setNbrePiscine(enquetePayLoadWeb.getNbrePiscine());
enquete.setNbreIndivisiaire(enquetePayLoadWeb.getNbreIndivisiaire());
enquete.setNbreCoProprietaire(enquetePayLoadWeb.getNbreCoProprietaire());
enquete.setNumEntreeParcelle(enquetePayLoadWeb.getNumEntreeParcelle());
enquete.setNumEnterParcelle(enquetePayLoadWeb.getNumEnterParcelle());
enquete.setNomRue(enquetePayLoadWeb.getNomRue());
enquete.setNumRue(enquetePayLoadWeb.getNumRue());
enquete.setSuperficie(enquetePayLoadWeb.getSuperficie());
@@ -265,7 +267,7 @@ public class EnqueteServiceImpl implements EnqueteService {
enquete.setNbrePiscine(enquetePayLoadWeb.getNbrePiscine());
enquete.setNbreIndivisiaire(enquetePayLoadWeb.getNbreIndivisiaire());
enquete.setNbreCoProprietaire(enquetePayLoadWeb.getNbreCoProprietaire());
enquete.setNumEntreeParcelle(enquetePayLoadWeb.getNumEntreeParcelle());
enquete.setNumEnterParcelle(enquetePayLoadWeb.getNumEnterParcelle());
enquete.setNomRue(enquetePayLoadWeb.getNomRue());
enquete.setNumRue(enquetePayLoadWeb.getNumRue());
enquete.setSuperficie(enquetePayLoadWeb.getSuperficie());
@@ -399,11 +401,6 @@ public class EnqueteServiceImpl implements EnqueteService {
return enqueteRepository.findAll();
}
@Override
public List<Enquete> getEnqueteListByParcelle(Long parcelleId) {
return enqueteRepository.findAllByParcelle_Id(parcelleId);
}
@Override
public Optional<Enquete> getEnqueteById(Long id) {
if (enqueteRepository.existsById(id)) {

View File

@@ -3,15 +3,19 @@ package io.gmss.fiscad.implementations.infocad.metier;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.gmss.fiscad.entities.infocad.metier.Enquete;
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
import io.gmss.fiscad.entities.infocad.metier.ParcelleGeom;
import io.gmss.fiscad.entities.infocad.metier.Upload;
import io.gmss.fiscad.enums.StatutParcelle;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
import io.gmss.fiscad.paylaods.request.synchronisation.UploadPayLoad;
import io.gmss.fiscad.paylaods.response.EnqueteCheckResponse;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleGeomRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.ParcelleGeomRepository;
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.service.FileStorageService;
import lombok.RequiredArgsConstructor;
import org.locationtech.jts.geom.Coordinate;

View File

@@ -1,28 +1,26 @@
package io.gmss.fiscad.implementations.infocad.metier;
import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
import io.gmss.fiscad.entities.infocad.metier.Rue;
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
import io.gmss.fiscad.entities.infocad.parametre.SituationGeographique;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleService;
import io.gmss.fiscad.paylaods.request.FiltreParcellePayLoad;
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
import io.gmss.fiscad.persistence.repositories.decoupage.QuartierRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.RueRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.NatureDomaineRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationGeographiqueRepository;
import io.gmss.fiscad.persistence.specification.ParcelleSpecification;
import io.gmss.fiscad.repositories.decoupage.QuartierRepository;
import io.gmss.fiscad.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.repositories.infocad.metier.RueRepository;
import io.gmss.fiscad.repositories.infocad.parametre.NatureDomaineRepository;
import io.gmss.fiscad.repositories.infocad.parametre.SituationGeographiqueRepository;
import io.gmss.fiscad.service.GeometryService;
import jakarta.persistence.Query;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -36,7 +34,6 @@ public class ParcelleServiceImpl implements ParcelleService {
private final ParcelleRepository parcelleRepository;
private final RueRepository rueRepository;
private final GeometryService geometryService;
private final SecteurService secteurService;
// @Value("${infocad.geom.srid}")
// private String defaultSrid32631;
@@ -126,37 +123,6 @@ public class ParcelleServiceImpl implements ParcelleService {
}
}
@Override
public Page<ParcelleDataTableResponse> getParcelleDataTableListByUserId(Long userId, Pageable pageable) {
List<Secteur> secteurs = secteurService.getListSecteurUserId(userId);
List<Long> secteurIds = secteurs.stream()
.map(Secteur::getId)
.toList();
Page<ParcelleDataTableResponse> parcelleDataTableResponses=parcelleRepository.getParcelleDataTableResponse(secteurIds,pageable);
return parcelleDataTableResponses ;
}
@Override
public Page<ParcelleDataTableResponse> getParcelleDataTableListByMultiFiltre(Long userId, FiltreParcellePayLoad filtreParcellePayLoad, Pageable pageable) {
List<Secteur> secteurs = secteurService.getListSecteurUserId(userId);
List<Long> secteurIds = secteurs.stream()
.map(Secteur::getId)
.toList();
//
// return parcelleRepository.findAll(
// ParcelleSpecification.filtre(filtreParcellePayLoad, secteurIds),
// pageable
// );
Page<ParcelleDataTableResponse> parcelleDataTableResponses=parcelleRepository.getParcelleDataTableResponse(secteurIds,pageable);
return parcelleDataTableResponses ;
}
private Parcelle getParcelleFromPayload(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb) {
if(parcellePayLoadWeb.getRueId()!=null) {
Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId());

View File

@@ -1,6 +1,9 @@
package io.gmss.fiscad.implementations.infocad.metier;
import io.gmss.fiscad.entities.decoupage.Commune;
import io.gmss.fiscad.entities.decoupage.Nationalite;
import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.entities.infocad.parametre.*;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
@@ -8,15 +11,15 @@ import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
import io.gmss.fiscad.paylaods.dto.*;
import io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb;
import io.gmss.fiscad.persistence.repositories.decoupage.CommuneRepository;
import io.gmss.fiscad.persistence.repositories.decoupage.NationaliteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.MembreGroupeRepository;
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.PersonneRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.ProfessionRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationMatrimonialeRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypePersonneRepository;
import io.gmss.fiscad.repositories.decoupage.CommuneRepository;
import io.gmss.fiscad.repositories.decoupage.NationaliteRepository;
import io.gmss.fiscad.repositories.infocad.metier.MembreGroupeRepository;
import io.gmss.fiscad.repositories.infocad.metier.PieceRepository;
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.repositories.infocad.parametre.ProfessionRepository;
import io.gmss.fiscad.repositories.infocad.parametre.SituationMatrimonialeRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypePersonneRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import jakarta.persistence.EntityNotFoundException;
import lombok.RequiredArgsConstructor;

View File

@@ -4,8 +4,8 @@ import io.gmss.fiscad.entities.infocad.metier.Tpe;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.metier.TpeService;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.TpeRepository;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.TpeRepository;
import io.gmss.fiscad.service.StringService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

View File

@@ -9,8 +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.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.service.StringService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -78,7 +77,7 @@ public class BlocServiceImpl implements BlocService {
}
}
Optional<StructurePaylaodWeb> structureOptional = structureService.getStructureById(structure_id);
Optional<Structure> structureOptional = structureService.getStructureById(structure_id);
if (structureOptional.isPresent()) {
builder.append(structureOptional.get().getCode());
builder.append(bloc.getArrondissement().getCode());
@@ -134,7 +133,10 @@ public class BlocServiceImpl implements BlocService {
@Override
public List<Bloc> getBlocsByArrondissement(Long idArrondissement) {
return blocRepository.findAllByArrondissement_Id(idArrondissement);
Arrondissement arrondissement = arrondissementService.getArrondissementById(idArrondissement).orElseThrow(() -> {
throw new NotFoundException("Impossible de trouver l'arrondissement");
});
return blocRepository.findAllByArrondissement(arrondissement);
}
@Override

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.ModeAcquisitionService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.ModeAcquisitionRepository;
import io.gmss.fiscad.repositories.infocad.parametre.ModeAcquisitionRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.NatureDomaineService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.NatureDomaineRepository;
import io.gmss.fiscad.repositories.infocad.parametre.NatureDomaineRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.PositionRepresentation;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.PositionRepresentationService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PositionRepresentationRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PositionRepresentationRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.Profession;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.ProfessionService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.ProfessionRepository;
import io.gmss.fiscad.repositories.infocad.parametre.ProfessionRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.SituationGeographique;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.SituationGeographiqueService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationGeographiqueRepository;
import io.gmss.fiscad.repositories.infocad.parametre.SituationGeographiqueRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.SituationMatrimoniale;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.SituationMatrimonialeService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationMatrimonialeRepository;
import io.gmss.fiscad.repositories.infocad.parametre.SituationMatrimonialeRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.SourceDroit;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.SourceDroitService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SourceDroitRepository;
import io.gmss.fiscad.repositories.infocad.parametre.SourceDroitRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -1,57 +1,60 @@
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;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
import io.gmss.fiscad.paylaods.response.StructureResponse;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
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;
@AllArgsConstructor
@Service
public class StructureServiceImpl implements StructureService {
private final StructureRepository structureRepository;
private final EntityFromPayLoadService entityFromPayLoadService;
@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);
structure=structureRepository.save(structure);
return structureRepository.findStructureToDtoById(structure.getId()).orElse(null);
public StructureServiceImpl(StructureRepository structureRepository) {
this.structureRepository = structureRepository;
}
@Override
public StructurePaylaodWeb updateStructure(Long id, StructurePaylaodWeb structurePaylaodWeb) throws NotFoundException {
if (structurePaylaodWeb.getId() == null) {
throw new BadRequestException("ID obligatoire pour une mise à jour.");
public Structure createStructure(Structure structure) 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();
}
System.out.println(structurePaylaodWeb.getId());
Optional<Structure> optionalStructure = structureRepository.findById(structurePaylaodWeb.getId());
if(optionalStructure.isEmpty()){
throw new NotFoundException("Structure inexistante.");
}
Structure structure1 = structureRepository.getById(structure.getId());
Structure structure = entityFromPayLoadService.getStructureFromPayLoadWeb(structurePaylaodWeb);
structureRepository.save(structure);
return structureRepository
.findStructureToDtoById(structure.getId())
.orElse(null);
return structure1;
}
@Override
@@ -65,29 +68,26 @@ public class StructureServiceImpl implements StructureService {
}
@Override
public Page<StructurePaylaodWeb> getStructureList(Pageable pageable) {
return structureRepository.findAllStructureToDtoPageable(pageable);
public Page<Structure> getStructureList(Pageable pageable) {
return structureRepository.findAll(pageable);
}
@Override
public List<StructurePaylaodWeb> getStructureList() {
return structureRepository.findAllStructureToDto();
public List<Structure> getStructureList() {
return structureRepository.findAll();
}
@Override
public List<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId) {
return structureRepository.findAllStructureByCommuneToDto(communeId);
public List<StructureResponse> getStructuresByArrondissement(Long arrondissementID) {
return structureRepository.getStructureByArrondissement(arrondissementID);
}
@Override
public Page<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId, Pageable pageable) {
return structureRepository.findAllStructureByCommuneToDtoPageable(communeId,pageable);
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.");
}
}
@Override
public Optional<StructurePaylaodWeb> getStructureById(Long id) {
return structureRepository.findStructureToDtoById(id);
}
}

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypeContestation;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeContestationService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeContestationRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypeContestationRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeDomaineService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeDomaineRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypeDomaineRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypePersonne;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypePersonneService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypePersonneRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypePersonneRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypePiece;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypePieceService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypePieceRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypePieceRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypeRepresentation;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeRepresentationService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeRepresentationRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypeRepresentationRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.TypeRue;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeRueService;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeRueRepository;
import io.gmss.fiscad.repositories.infocad.parametre.TypeRueRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
import io.gmss.fiscad.repositories.rfu.metier.BatimentRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.CaracteristiqueBatimentRepository;
import io.gmss.fiscad.repositories.rfu.metier.CaracteristiqueBatimentRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.CaracteristiqueParcelleRepository;
import io.gmss.fiscad.repositories.rfu.metier.CaracteristiqueParcelleRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.CaracteristiqueUniteLogementRepository;
import io.gmss.fiscad.repositories.rfu.metier.CaracteristiqueUniteLogementRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.DeclarationNcRepository;
import io.gmss.fiscad.repositories.rfu.metier.DeclarationNcRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -1,20 +1,23 @@
package io.gmss.fiscad.implementations.rfu.metier;
import io.gmss.fiscad.entities.decoupage.Arrondissement;
import io.gmss.fiscad.entities.infocad.metier.Enquete;
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.DonneesImpositionTfuRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ExerciceRepository;
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.repositories.rfu.metier.DonneesImpositionTfuRepository;
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
import io.gmss.fiscad.repositories.rfu.parametre.BaremRfuNonBatiRepository;
import io.gmss.fiscad.repositories.rfu.parametre.ExerciceRepository;
import jakarta.transaction.Transactional;
import lombok.AllArgsConstructor;
import org.springframework.dao.DataIntegrityViolationException;

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteActiviteService;
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteActivitePayLoadWeb;
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteActiviteRepository;
import io.gmss.fiscad.repositories.rfu.metier.EnqueteActiviteRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;

View File

@@ -5,6 +5,7 @@ import io.gmss.fiscad.entities.infocad.metier.Upload;
import io.gmss.fiscad.entities.infocad.parametre.Personne;
import io.gmss.fiscad.entities.rfu.metier.Batiment;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
@@ -12,16 +13,17 @@ import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.repositories.rfu.metier.EnqueteBatimentRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import javax.swing.text.html.Option;
import java.util.List;
import java.util.Optional;
@AllArgsConstructor

View File

@@ -10,10 +10,10 @@ import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.repositories.rfu.metier.EnqueteUniteLogementRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.FonctionService;
import io.gmss.fiscad.paylaods.request.crudweb.FonctionPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.rfu.metier.FonctionRepository;
import io.gmss.fiscad.repositories.rfu.metier.FonctionRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
@@ -19,7 +19,7 @@ import java.util.Optional;
@Service
public class FonctionServiceImpl implements FonctionService {
private final FonctionRepository fonctionRepository;
private final FonctionRepository gererSecteurRepository;
private final EntityFromPayLoadService entityFromPayLoadService;
@@ -30,7 +30,7 @@ public class FonctionServiceImpl implements FonctionService {
}
Fonction fonction = entityFromPayLoadService.getFonctionFromPayLoadWeb(fonctionPaylaodWeb);
return fonctionRepository.save(fonction);
return gererSecteurRepository.save(fonction);
}
@Override
@@ -38,49 +38,39 @@ public class FonctionServiceImpl implements FonctionService {
if (fonctionPaylaodWeb.getId() == null) {
throw new BadRequestException("Impossible de mettre à jour un nouveau fonction ayant un id null.");
}
if (!fonctionRepository.existsById(fonctionPaylaodWeb.getId())) {
if (!gererSecteurRepository.existsById(fonctionPaylaodWeb.getId())) {
throw new NotFoundException("Impossible de trouver le fonction spécifié dans notre base de données.");
}
Fonction fonction = entityFromPayLoadService.getFonctionFromPayLoadWeb(fonctionPaylaodWeb);
return fonctionRepository.save(fonction);
return gererSecteurRepository.save(fonction);
}
@Override
public void deleteFonction(Long id) throws NotFoundException {
Optional<Fonction> fonctionOptional = fonctionRepository.findById(id);
if (fonctionOptional.isPresent()) {
fonctionRepository.deleteById(fonctionOptional.get().getId());
Optional<Fonction> gererSecteurOptional = gererSecteurRepository.findById(id);
if (gererSecteurOptional.isPresent()) {
gererSecteurRepository.deleteById(gererSecteurOptional.get().getId());
} else {
throw new NotFoundException("Impossible de trouver le fonction spécifié dans notre base de données.");
throw new NotFoundException("Impossible de trouver le gererSecteur spécifié dans notre base de données.");
}
}
@Override
public Page<Fonction> getFonctionList(Pageable pageable) {
return fonctionRepository.findAll(pageable);
return gererSecteurRepository.findAll(pageable);
}
@Override
public List<Fonction> getFonctionList() {
return fonctionRepository.findAll();
}
@Override
public List<FonctionPaylaodWeb> getFonctionListToDto() {
return fonctionRepository.findAllFonctionToDto() ;
}
@Override
public Page<FonctionPaylaodWeb> getFonctionListToDtoPageable(Pageable pageable) {
return fonctionRepository.findAllFonctionToDtoPageable(pageable);
return gererSecteurRepository.findAll();
}
@Override
public Optional<Fonction> getFonctionById(Long id) {
if (fonctionRepository.existsById(id)) {
return fonctionRepository.findById(id);
if (gererSecteurRepository.existsById(id)) {
return gererSecteurRepository.findById(id);
} else {
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans la base de données.");
}

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.enums.StatusAvis;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.metier.UniteLogement;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
import io.gmss.fiscad.repositories.rfu.metier.UniteLogementRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuNonBatiService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
import io.gmss.fiscad.repositories.rfu.parametre.BaremRfuNonBatiRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuRepository;
import io.gmss.fiscad.repositories.rfu.parametre.BaremRfuRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.enums.TypeCampagne;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
import io.gmss.fiscad.repositories.rfu.parametre.CampagneRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.CaracteristiqueService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CaracteristiqueRepository;
import io.gmss.fiscad.repositories.rfu.parametre.CaracteristiqueRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.CategorieBatimentService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
import io.gmss.fiscad.repositories.rfu.parametre.CategorieBatimentRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -10,11 +10,11 @@ import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
import io.gmss.fiscad.paylaods.request.synchronisation.ParticiperPayload;
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurRepository;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.BlocRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
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;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Exercice;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ExerciceRepository;
import io.gmss.fiscad.repositories.rfu.parametre.ExerciceRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.TypeCaracteristique;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.TypeCaracteristiqueService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.TypeCaracteristiqueRepository;
import io.gmss.fiscad.repositories.rfu.parametre.TypeCaracteristiqueRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.rfu.parametre.ZoneRfuService;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ZoneRfuRepository;
import io.gmss.fiscad.repositories.rfu.parametre.ZoneRfuRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -3,12 +3,12 @@ package io.gmss.fiscad.implementations.statistiques;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.paylaods.response.statistique.*;
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.parametre.PersonneRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
import io.gmss.fiscad.paylaods.response.*;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.metier.ParcelleRepository;
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
import io.gmss.fiscad.repositories.rfu.metier.BatimentRepository;
import io.gmss.fiscad.repositories.rfu.metier.UniteLogementRepository;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

View File

@@ -6,9 +6,9 @@ import io.gmss.fiscad.interfaces.synchronisation.RestaurationService;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.paylaods.request.synchronisation.UploadPayLoad;
import io.gmss.fiscad.paylaods.response.restoration.*;
import io.gmss.fiscad.persistence.repositories.infocad.metier.*;
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
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;

View File

@@ -12,15 +12,15 @@ import io.gmss.fiscad.enums.TypeObjet;
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.paylaods.request.EnqueteAllDataPayload;
import io.gmss.fiscad.paylaods.response.*;
import io.gmss.fiscad.paylaods.request.synchronisation.*;
import io.gmss.fiscad.paylaods.response.synchronisation.*;
import io.gmss.fiscad.persistence.repositories.decoupage.*;
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
import io.gmss.fiscad.persistence.repositories.metadata.*;
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CaracteristiqueRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.TypeCaracteristiqueRepository;
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ZoneRfuRepository;
import io.gmss.fiscad.repositories.decoupage.*;
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
import io.gmss.fiscad.repositories.infocad.parametre.*;
import io.gmss.fiscad.repositories.metadata.*;
import io.gmss.fiscad.repositories.rfu.parametre.CaracteristiqueRepository;
import io.gmss.fiscad.repositories.rfu.parametre.TypeCaracteristiqueRepository;
import io.gmss.fiscad.repositories.rfu.parametre.ZoneRfuRepository;
import io.gmss.fiscad.service.FileStorageService;
import io.gmss.fiscad.service.worker.*;
import jakarta.transaction.Transactional;
@@ -31,6 +31,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import io.gmss.fiscad.paylaods.request.synchronisation.*;
import java.util.ArrayList;
import java.util.Collections;

View File

@@ -1,11 +1,13 @@
package io.gmss.fiscad.implementations.user;
import io.gmss.fiscad.entities.user.AvoirFonction;
import io.gmss.fiscad.entities.user.AvoirFonction;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.user.AvoirFonctionService;
import io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.user.AvoirFonctionRepository;
import io.gmss.fiscad.repositories.user.AvoirFonctionRepository;
import io.gmss.fiscad.repositories.user.AvoirFonctionRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
@@ -22,27 +24,25 @@ public class AvoirFonctionServiceImpl implements AvoirFonctionService {
private final EntityFromPayLoadService entityFromPayLoadService ;
@Override
public AvoirFonctionPaylaodWeb createAvoirFonction(AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws BadRequestException {
public AvoirFonction createAvoirFonction(AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws BadRequestException {
if (avoirFonctionPaylaodWeb.getId() != null) {
throw new BadRequestException("A new avoirFonction id to save must be null or empty.");
}
AvoirFonction avoirFonction= entityFromPayLoadService.getAvoirFonctionFromPayLoadWeb(avoirFonctionPaylaodWeb);
avoirFonction=avoirFonctionRepository.save(avoirFonction);
return avoirFonctionRepository.findAvoirFonctionToDtoById(avoirFonction.getId()).orElse(null);
AvoirFonction avoirFonction = entityFromPayLoadService.getAvoirFonctionFromPayLoadWeb(avoirFonctionPaylaodWeb);
return avoirFonctionRepository.save(avoirFonction);
}
@Override
public AvoirFonctionPaylaodWeb updateAvoirFonction(Long id, AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws NotFoundException {
public AvoirFonction updateAvoirFonction(Long id, AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws NotFoundException {
if (avoirFonctionPaylaodWeb.getId() == null) {
throw new BadRequestException("La fonction utilisateur à modifier n'est pas précisée");
throw new BadRequestException("A new avoirFonction id to save must be null or empty.");
}
Optional<AvoirFonction> optionalAvoirFonction= avoirFonctionRepository.findById(avoirFonctionPaylaodWeb.getId());
Optional<AvoirFonction> optionalAvoirFonction= avoirFonctionRepository.findAvoirFonctionById(avoirFonctionPaylaodWeb.getId());
if(optionalAvoirFonction.isEmpty()){
throw new BadRequestException("Impossible de trouver la Fonction utilisateur à modifier");
}
AvoirFonction avoirFonction= entityFromPayLoadService.getAvoirFonctionFromPayLoadWeb(avoirFonctionPaylaodWeb);
avoirFonction=avoirFonctionRepository.save(avoirFonction);
return avoirFonctionRepository.findAvoirFonctionToDtoById(avoirFonction.getId()).orElse(null);
AvoirFonction avoirFonction = entityFromPayLoadService.getAvoirFonctionFromPayLoadWeb(avoirFonctionPaylaodWeb);
return avoirFonctionRepository.save(avoirFonction);
}
@Override
@@ -50,7 +50,7 @@ public class AvoirFonctionServiceImpl implements AvoirFonctionService {
if (id == null) {
throw new BadRequestException("Impossible de supprimer un avoirFonction null ");
}
Optional<AvoirFonction> optionalAvoirFonction= avoirFonctionRepository.findById(id);
Optional<AvoirFonction> optionalAvoirFonction= avoirFonctionRepository.findAvoirFonctionById(id);
if(optionalAvoirFonction.isEmpty()){
throw new BadRequestException("Impossible de trouver le avoirFonction à supprimer");
}
@@ -58,28 +58,25 @@ public class AvoirFonctionServiceImpl implements AvoirFonctionService {
}
@Override
public Page<AvoirFonctionPaylaodWeb> getAvoirFonctionList(Pageable pageable) {
return avoirFonctionRepository.findAllAvoirFonctionToDtoPageable(pageable);
public Page<AvoirFonction> getAvoirFonctionList(Pageable pageable) {
return avoirFonctionRepository.findAll(pageable);
}
@Override
public List<AvoirFonctionPaylaodWeb> getAvoirFonctionList() {
return avoirFonctionRepository.findAllAvoirFonctionToDto();
public List<AvoirFonction> getAvoirFonctionList() {
return avoirFonctionRepository.findAll();
}
@Override
public Optional<AvoirFonction> getAvoirFonctionById(Long id) {
return avoirFonctionRepository.findAvoirFonctionById(id);
}
@Override
public Optional<AvoirFonctionPaylaodWeb> getAvoirFonctionById(Long id) {
return avoirFonctionRepository.findAvoirFonctionToDtoById(id);
public List<AvoirFonction> getUserAvoirFonctionById(Long userId) {
return avoirFonctionRepository.findAvoirFonctionByUser_Id(userId);
}
@Override
public List<AvoirFonctionPaylaodWeb> getAvoirFonctionByUserId(Long userId) {
return avoirFonctionRepository.findAllAvoirFonctionByUserToDto(userId);
}
@Override
public Page<AvoirFonctionPaylaodWeb> getAvoirFonctionByUserId(Long userId, Pageable pageable) {
return avoirFonctionRepository.findAllAvoirFonctionByUserToDtoPageable(userId,pageable);
}
}

View File

@@ -8,7 +8,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.user.DemandeReinitialisationMPService;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.persistence.repositories.user.DemandeReinitialisationMPRepository;
import io.gmss.fiscad.repositories.user.DemandeReinitialisationMPRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -6,7 +6,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.user.ProfileService;
import io.gmss.fiscad.paylaods.request.crudweb.ProfilePaylaodWeb;
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
import io.gmss.fiscad.repositories.user.ProfileRepository;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;

View File

@@ -5,7 +5,7 @@ import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.interfaces.user.RoleService;
import io.gmss.fiscad.persistence.repositories.user.RoleRepository;
import io.gmss.fiscad.repositories.user.RoleRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

View File

@@ -1,6 +1,7 @@
package io.gmss.fiscad.implementations.user;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
import io.gmss.fiscad.entities.user.Role;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.exceptions.BadRequestException;
@@ -12,11 +13,8 @@ import io.gmss.fiscad.paylaods.JwtAuthenticationResponse;
import io.gmss.fiscad.paylaods.Login;
import io.gmss.fiscad.paylaods.UserListByStructureResponse;
import io.gmss.fiscad.paylaods.UserResponse;
import io.gmss.fiscad.paylaods.request.crudweb.UserPaylaodWeb;
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
import io.gmss.fiscad.repositories.user.UserRepository;
import io.gmss.fiscad.security.TokenAuthentificationProvider;
import io.gmss.fiscad.service.EntityFromPayLoadService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.authentication.AuthenticationManager;
@@ -29,7 +27,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@AllArgsConstructor
@Service
public class UserServiceImpl implements UserService {
@@ -39,27 +37,42 @@ public class UserServiceImpl implements UserService {
private final AuthenticationManager authenticationManager;
private final TokenAuthentificationProvider tokenAuthentificationProvider;
private final StructureService structureService;
private final EntityFromPayLoadService entityFromPayLoadService;
public UserServiceImpl(UserRepository userRepository, PasswordEncoder passwordEncoder, RoleService roleService, AuthenticationManager authenticationManager, TokenAuthentificationProvider tokenAuthentificationProvider, StructureService structureService) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
this.roleService = roleService;
this.authenticationManager = authenticationManager;
this.tokenAuthentificationProvider = tokenAuthentificationProvider;
this.structureService = structureService;
}
@Override
public UserPaylaodWeb createUser(UserPaylaodWeb userPaylaodWeb) {
public User createUser(User user, boolean resetPassword) {
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isPresent())
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isPresent())) {
throw new BadRequestException("Cet utilisateur existe déjà.");
}
if (userPaylaodWeb.getId() != null) {
throw new BadRequestException("Cet utilisateur existe déjà.");
if (userRepository.findByUsername(user.getUsername()).isPresent()) {
throw new BadRequestException("Ce nom d'utilisateur existe déjà.");
}
User user = entityFromPayLoadService.getUserFromPayLoadWeb(userPaylaodWeb);
user.setPassword(passwordEncoder.encode(userPaylaodWeb.getPassword()));
if (user.getId() != null) {
throw new BadRequestException("Cet utilisateur existe déjà dans la base de donnéees.");
}
// Set<Role> roleSet = new HashSet<>();
// user.getRoles().stream().forEach(role -> {
// if (roleService.roleExistByRoleName(role.getNom())) {
// roleSet.add(roleService.retrieveRoleByRoleName(role.getNom()));
// }
// });
user.setUsername(user.getEmail());
user.setResetPassword(resetPassword);
// user.setRoles(roleSet);
user.setPassword(passwordEncoder.encode(user.getPassword()));
userRepository.save(user);
return userRepository.findUserToDtoById(userPaylaodWeb.getId()).orElse(null);
return user;
}
@Override
@@ -86,23 +99,29 @@ public class UserServiceImpl implements UserService {
}
@Override
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
public User updateUser(Long id, User user) {
User user1 = userRepository.findById(id)
.orElseThrow(() -> new NotFoundException(
String.format("L'utilisateur ayant pour id %s n'existe pas.", id)
)
);
// if (user.getRoles() == null || user.getRoles().isEmpty()) {
// user.setRoles(user1.getRoles());
// }
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
throw new BadRequestException("Cet utilisateur n'existe pas.");
if (user.getPassword() == null || user.getPassword().isBlank()) {
user.setPassword(user1.getPassword());
} else {
user.setPassword(passwordEncoder.encode(user.getPassword()));
}
if (userPaylaodWeb.getId() == null) {
throw new BadRequestException("Cet utilisateur n'existe déjà.");
if (user.getEmail() == null || user.getEmail().isEmpty()) {
user.setEmail(user1.getEmail());
} else {
user.setEmail(user.getEmail());
}
if(userRepository.findUserToDtoById(userPaylaodWeb.getId()).isEmpty()){
throw new BadRequestException("Cet utilisateur n'existe pas.");
}
User user = entityFromPayLoadService.getUserFromPayLoadWeb(userPaylaodWeb);
user.setActive(true);
user.setResetPassword(false);
userRepository.save(user);
return userRepository.findUserToDtoById(userPaylaodWeb.getId()).orElse(null);
user.setResetPassword(user1.isResetPassword());
return userRepository.save(user);
}
@Override
@@ -127,29 +146,43 @@ public class UserServiceImpl implements UserService {
}
@Override
public Page<UserPaylaodWeb> getUserList(Pageable pageable) {
return userRepository.findAllUserToDtoPageable(pageable);
public Page<User> getUserList(Pageable pageable) {
return userRepository.findAll(pageable);
}
@Override
public List<UserPaylaodWeb> getUserList() {
return userRepository.findAllUserToDto();
public List<User> getUserList() {
return userRepository.findAll();
}
@Override
public List<UserResponse> getAllUserListResponse() {
return null ;//getUserResponses(getUserList());
return getUserResponses(getUserList());
}
@Override
public List<User> getActivatedUserListByStructure(Long structureId) {
// Set<Role> roleSet = new HashSet<>();
// roleSet.add(roleService.retrieveRoleByRoleName(UserRole.ROLE_ANONYMOUS));
// Optional<Structure> structureOptional = structureService.getStructureById(structureId);
// if (structureOptional.isPresent()) {
// return userRepository.findAllByStructureAndRolesNotIn(structureOptional.get(), roleSet);
// } else {
// throw new NotFoundException("Impossible de trouver la structure spécifiée.");
// }
return null;
}
@Override
public List<User> getUserUnActivatedListByStructure(Long structureId) {
// Set<Role> roleSet = new HashSet<>();
// roleSet.add(roleService.retrieveRoleByRoleName(UserRole.ROLE_ANONYMOUS));
// Optional<Structure> structureOptional = structureService.getStructureById(structureId);
// if (structureOptional.isPresent()) {
// return userRepository.findAllByStructureAndRolesIn(structureOptional.get(), roleSet);
// } else {
// throw new NotFoundException("Impossible de trouver la structure spécifiée.");
// }
return null;
}
@@ -179,13 +212,19 @@ public class UserServiceImpl implements UserService {
@Override
public User getUserById(Long id) {
return userRepository.findById(id).orElseThrow(() -> new NotFoundException(
return userRepository.findById(id).orElseThrow(() -> new NotFoundException(
String.format("L'utilisateur ayant pour id %s n'existe pas.", id)
)
);
}
@Override
public List<User> getUserByProfil(UserRole userRole) {
//return userRepository.findAllByRolesContains(userRole);
return null;
}
@Override
public User getUserByUsername(String username) {
return userRepository.findByUsername(username).orElseThrow(() -> new NotFoundException(
@@ -208,25 +247,33 @@ public class UserServiceImpl implements UserService {
}
@Override
public UserPaylaodWeb resetPassword(String username, String password) {
public User resetPassword(String username, String password) {
User user = userRepository.findByUsername(username).orElseThrow(() -> new NotFoundException(
String.format("L'utilisateur %s n'existe pas.", username)
));
//String pwd = PasswordGenerator.generatePassword();
user.setPassword(passwordEncoder.encode(password));
user.setResetPassword(true);
user= userRepository.save(user);
Optional<UserPaylaodWeb> optionalUserPaylaodWeb = userRepository.findUserToDtoById(user.getId());
return optionalUserPaylaodWeb.orElse(null);
userRepository.save(user);
return user;
}
@Override
public User assignStructureToUser(Structure structure) {
return null;
}
@Override
public User validateUserAccount(String username) {
public User validateUserAccount(String username, UserRole userRole) {
User user = userRepository.findByUsername(username).orElseThrow(() -> new NotFoundException(
String.format("L'utilisateur %s n'existe pas.", username)
));
// Set<Role> roleSet = new HashSet<>();
// if (roleService.roleExistByRoleName(userRole)) {
// roleSet.add(roleService.retrieveRoleByRoleName(userRole));
// }
//user.setRoles(roleSet);
user.setResetPassword(false);
user.setActive(true);
return userRepository.save(user);
}
@@ -261,34 +308,19 @@ public class UserServiceImpl implements UserService {
}
@Override
public Optional<UserPaylaodWeb> getUserByToDto(String username) {
return userRepository.findUserToDtoByUserName(username);
}
@Override
public Optional<UserPaylaodWeb> getUserByIdToDto(Long id) {
return userRepository.findUserToDtoById(id);
}
@Override
public List<UserPaylaodWeb> getListUserToDto() {
return userRepository.findAllUserToDto();
}
@Override
public Page<UserPaylaodWeb> getListUserToDto(Pageable pageable) {
return userRepository.findAllUserToDtoPageable(pageable);
}
@Override
public List<UserPaylaodWeb> getListUserByStructureToDto(Long structureId) {
return userRepository.findAllUserByStructureToDto(structureId);
}
@Override
public Page<UserPaylaodWeb> getListUserByStructureToDto(Long structureId, Pageable pageable) {
return userRepository.findAllUserByStructureToDtoPageable(structureId,pageable);
}
// private static List<UserResponse> getUserResponses(List<User> users) {
// return users.stream()
// .map(user -> new UserResponse(
// user.getId(),
// user.getNom(),
// user.getPrenom(),
// user.getTel(),
// user.getEmail(),
// user.getUsername(),
// user.isActive(),
// user.isResetPassword(),
// user.getRoles(),
// user.getStructure()))
// .collect(Collectors.toList());
// }
}

View File

@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.decoupage;
import io.gmss.fiscad.entities.decoupage.Arrondissement;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -18,11 +17,11 @@ public interface ArrondissementService {
void deleteArrondissement(Long id) throws NotFoundException;
Page<Arrondissement> getArrondissementList(Pageable pageable);
Page<ArrondissementPaylaodWeb> getArrondissementList(Pageable pageable);
List<ArrondissementPaylaodWeb> getArrondissementList();
List<ArrondissementPaylaodWeb> getArrondissementListByCommuneId(Long structureId);
Page<ArrondissementPaylaodWeb> getArrondissementListByCommuneId(Long structureId,Pageable pageable);
List<Arrondissement> getArrondissementList();
Optional<ArrondissementPaylaodWeb> getArrondissementById(Long id);
Optional<Arrondissement> getArrondissementById(Long id);
List<Arrondissement> getArrondissementByComune(Long communeId);
}

View File

@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.decoupage;
import io.gmss.fiscad.entities.decoupage.Commune;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.CommunePaylaodWeb;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -18,12 +17,11 @@ public interface CommuneService {
void deleteCommune(Long id) throws NotFoundException;
Page<CommunePaylaodWeb> getCommuneList(Pageable pageable);
Page<Commune> getCommuneList(Pageable pageable);
List<CommunePaylaodWeb> getCommuneList();
List<Commune> getCommuneList();
List<CommunePaylaodWeb> getCommunesByDepartementId(Long departementId);
Page<CommunePaylaodWeb> getCommunesByDepartementId(Long departementId,Pageable pageable);
List<Commune> getCommunesByDepartement(Long departementId);
Optional<CommunePaylaodWeb> getCommuneById(Long id) ;
Optional<Commune> getCommuneById(Long id);
}

View File

@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.decoupage;
import io.gmss.fiscad.entities.decoupage.Departement;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.DepartementPaylaodWeb;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -18,9 +17,9 @@ public interface DepartementService {
void deleteDepartement(Long id) throws NotFoundException;
Page<DepartementPaylaodWeb> getDepartementList(Pageable pageable);
Page<Departement> getDepartementList(Pageable pageable);
List<DepartementPaylaodWeb> getDepartementList();
List<Departement> getDepartementList();
Optional<DepartementPaylaodWeb> getDepartementById(Long id);
Optional<Departement> getDepartementById(Long id);
}

View File

@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.decoupage;
import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.QuartierPaylaodWeb;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -18,11 +17,11 @@ public interface QuartierService {
void deleteQuartier(Long id) throws NotFoundException;
Page<Quartier> getQuartierList(Pageable pageable);
Page<QuartierPaylaodWeb> getQuartierList(Pageable pageable);
List<QuartierPaylaodWeb> getQuartierList();
List<QuartierPaylaodWeb> getQuartierListByArrondissementId(Long arrondissementId);
Page<QuartierPaylaodWeb> getQuartierListByArrondissementId(Long arrondissementId,Pageable pageable);
List<Quartier> getQuartierList();
Optional<QuartierPaylaodWeb> getQuartierById(Long id);
Optional<Quartier> getQuartierById(Long id);
List<Quartier> getQuartierByArrondissement(Long arrondissementId);
}

View File

@@ -3,9 +3,6 @@ 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 io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -14,23 +11,15 @@ import java.util.Optional;
public interface SecteurDecoupageService {
SecteurDecoupagePaylaodWeb createSecteurDecoupage(SecteurDecoupagePaylaodWeb secteur) throws BadRequestException;
SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException;
SecteurDecoupagePaylaodWeb updateSecteurDecoupage(Long id, SecteurDecoupagePaylaodWeb secteur) throws NotFoundException;
SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException;
void deleteSecteurDecoupage(Long id) throws NotFoundException;
Page<SecteurDecoupagePaylaodWeb> getSecteurDecoupageList(Pageable pageable);
Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable);
List<SecteurDecoupagePaylaodWeb> getSecteurDecoupageList();
Page<SecteurDecoupagePaylaodWeb> getSecteurDecoupageListBySecteurId(Long sectionId,Pageable pageable);
List<SecteurDecoupagePaylaodWeb> getSecteurDecoupageListBySecteurId(Long sectionId);
Optional<SecteurDecoupagePaylaodWeb> getSecteurDecoupageByIdToDto(Long id);
List<SecteurDecoupage> getSecteurDecoupageList();
Optional<SecteurDecoupage> getSecteurDecoupageById(Long id);
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
}

View File

@@ -3,7 +3,6 @@ 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.crudweb.SecteurPaylaodWeb;
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurPayload;
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
import org.springframework.data.domain.Page;
@@ -14,22 +13,20 @@ import java.util.Optional;
public interface SecteurService {
SecteurPaylaodWeb createSecteur(SecteurPaylaodWeb secteur) throws BadRequestException;
Secteur createSecteur(SecteurPayload secteur) throws BadRequestException;
SecteurPaylaodWeb updateSecteur(Long id, SecteurPaylaodWeb secteur) throws NotFoundException;
Secteur updateSecteur(Long id, SecteurPayload secteur) throws NotFoundException;
void deleteSecteur(Long id) throws NotFoundException;
Page<SecteurPaylaodWeb> getSecteurList(Pageable pageable);
Page<Secteur> getSecteurList(Pageable pageable);
List<SecteurPaylaodWeb> getSecteurList();
List<Secteur> getSecteurList();
Page<SecteurPaylaodWeb> getSecteurListBySectionId(Long sectionId,Pageable pageable);
List<SecteurPaylaodWeb> getSecteurListBySectionId(Long sectionId);
List<SecteurPaylaodWeb> getSecteurListByStructureId(Long structureId);
Page<SecteurPaylaodWeb> getSecteurListByStructureId(Long structureId,Pageable pageable);
List<Secteur> getSecteurListUneStruture(Long structureId);
Optional<SecteurPaylaodWeb> getSecteurById(Long id);
Optional<Secteur> getSecteurById(Long id);
List<Secteur> getListSecteurUserId(Long userId) ;
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long serveurId) ;
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
}

View File

@@ -1,30 +0,0 @@
package io.gmss.fiscad.interfaces.decoupage;
import io.gmss.fiscad.entities.decoupage.Section;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.SectionPaylaodWeb;
import io.gmss.fiscad.paylaods.request.crudweb.SectionPaylaodWeb;
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;
public interface SectionService {
SectionPaylaodWeb createSection(SectionPaylaodWeb sectionPaylaodWeb) throws BadRequestException;
SectionPaylaodWeb updateSection(Long id, SectionPaylaodWeb sectionPaylaodWeb) throws NotFoundException;
void deleteSection(Long id) throws NotFoundException;
Page<SectionPaylaodWeb> getSectionList(Pageable pageable);
List<SectionPaylaodWeb> getSectionList();
List<SectionPaylaodWeb> getSectionListByStructureId(Long structureId);
Page<SectionPaylaodWeb> getSectionListByStructureId(Long structureId,Pageable pageable);
Optional<SectionPaylaodWeb> getSectionById(Long id);
}

View File

@@ -7,9 +7,9 @@ import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
import io.gmss.fiscad.paylaods.response.EnqueteNonSyncResponse;
import io.gmss.fiscad.paylaods.response.EnqueteResponse;
import io.gmss.fiscad.paylaods.response.FicheResponse.FicheEnqueteResponse;
import io.gmss.fiscad.paylaods.response.FicheEnqueteResponse;
import io.gmss.fiscad.paylaods.response.UserDecoupageEnqResponses;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -29,8 +29,6 @@ public interface EnqueteService {
List<Enquete> getEnqueteList();
List<Enquete> getEnqueteListByParcelle(Long parcelleId);
List<EnqueteResponse> getEnqueteCommuneArrondBloc();
List<EnqueteFiltreResponse> getEnqueteCommuneArrondBlocFiltre(FiltreEnquetePayLoad filtreEnquetePayLoad);

View File

@@ -3,9 +3,7 @@ package io.gmss.fiscad.interfaces.infocad.metier;
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.FiltreParcellePayLoad;
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -28,6 +26,5 @@ public interface ParcelleService {
Optional<Parcelle> getParcelleById(Long id);
Page<ParcelleDataTableResponse> getParcelleDataTableListByUserId(Long userId, Pageable pageable);
Page<ParcelleDataTableResponse> getParcelleDataTableListByMultiFiltre(Long userId, FiltreParcellePayLoad filtreParcellePayLoad, Pageable pageable);
}
}

View File

@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
import io.gmss.fiscad.paylaods.response.StructureResponse;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -12,23 +11,18 @@ import java.util.List;
import java.util.Optional;
public interface StructureService {
StructurePaylaodWeb createStructure(StructurePaylaodWeb structurePaylaodWeb) throws BadRequestException;
StructurePaylaodWeb updateStructure(Long id, StructurePaylaodWeb structurePaylaodWeb) throws NotFoundException;
Structure createStructure(Structure structure) throws BadRequestException;
Structure updateStructure(Long id, Structure structure) throws NotFoundException;
void deleteStructure(Long id) throws NotFoundException;
Page<StructurePaylaodWeb> getStructureList(Pageable pageable);
List<StructurePaylaodWeb> getStructureList();
Page<Structure> getStructureList(Pageable pageable);
List<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId);
Page<StructurePaylaodWeb> getStructureListByCommuneId(Long communeId,Pageable pageable);
Optional<StructurePaylaodWeb> getStructureById(Long id);
//List<StructureResponse> getStructuresByArrondissement(Long arrondissementID);
List<Structure> getStructureList();
List<StructureResponse> getStructuresByArrondissement(Long arrondissementID);
Optional<Structure> getStructureById(Long id);
}

View File

@@ -22,9 +22,5 @@ public interface FonctionService {
List<Fonction> getFonctionList();
List<FonctionPaylaodWeb> getFonctionListToDto();
Page<FonctionPaylaodWeb> getFonctionListToDtoPageable(Pageable pageable);
Optional<Fonction> getFonctionById(Long id);
}

View File

@@ -1,6 +1,7 @@
package io.gmss.fiscad.interfaces.statistique;
import io.gmss.fiscad.paylaods.response.statistique.*;
import io.gmss.fiscad.enums.NiveauDecoupage;
import io.gmss.fiscad.paylaods.response.*;
import java.util.List;

View File

@@ -1,12 +1,15 @@
package io.gmss.fiscad.interfaces.synchronisation;
import io.gmss.fiscad.entities.infocad.metier.Upload;
import io.gmss.fiscad.entities.metadata.MobileDataUpload;
import io.gmss.fiscad.paylaods.request.EnqueteAllDataPayload;
import io.gmss.fiscad.paylaods.request.synchronisation.*;
import io.gmss.fiscad.paylaods.response.synchronisation.ReferencesSyncResponses;
import io.gmss.fiscad.paylaods.response.synchronisation.SyncEnqueteAllDataResponse;
import io.gmss.fiscad.paylaods.response.synchronisation.SyncResponse;
import io.gmss.fiscad.paylaods.response.synchronisation.UserDecoupageSyncResponses;
import io.gmss.fiscad.paylaods.request.synchronisation.*;
import io.gmss.fiscad.paylaods.response.ReferencesSyncResponses;
import io.gmss.fiscad.paylaods.response.SyncEnqueteAllDataResponse;
import io.gmss.fiscad.paylaods.response.SyncResponse;
import io.gmss.fiscad.paylaods.response.UserDecoupageSyncResponses;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;

View File

@@ -12,18 +12,17 @@ import java.util.Optional;
public interface AvoirFonctionService {
AvoirFonctionPaylaodWeb createAvoirFonction(AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws BadRequestException;
AvoirFonction createAvoirFonction(AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws BadRequestException;
AvoirFonctionPaylaodWeb updateAvoirFonction(Long id, AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws NotFoundException;
AvoirFonction updateAvoirFonction(Long id, AvoirFonctionPaylaodWeb avoirFonctionPaylaodWeb) throws NotFoundException;
void deleteAvoirFonction(Long id) throws NotFoundException;
Page<AvoirFonctionPaylaodWeb> getAvoirFonctionList(Pageable pageable);
Page<AvoirFonction> getAvoirFonctionList(Pageable pageable);
List<AvoirFonctionPaylaodWeb> getAvoirFonctionList();
List<AvoirFonction> getAvoirFonctionList();
Optional<AvoirFonctionPaylaodWeb> getAvoirFonctionById(Long id);
List<AvoirFonctionPaylaodWeb> getAvoirFonctionByUserId(Long userId);
Page<AvoirFonctionPaylaodWeb> getAvoirFonctionByUserId(Long userId,Pageable pageable);
Optional<AvoirFonction> getAvoirFonctionById(Long id);
List<AvoirFonction> getUserAvoirFonctionById(Long userId);
}

Some files were not shown because too many files have changed in this diff Show More