Compare commits
22 Commits
87306e6c42
...
features/f
| Author | SHA1 | Date | |
|---|---|---|---|
| b3c1e10da6 | |||
| b0e0caf3bb | |||
| c9f7afb23d | |||
| 08a4762a83 | |||
| d38784b682 | |||
| a475a0d298 | |||
| 0a24ef47c3 | |||
| cd336225a3 | |||
| 3119060aa2 | |||
| 774611f0b8 | |||
| 7885169c9a | |||
| 70f7d6ba58 | |||
| 86eb1f4b9a | |||
| c6a4e68d38 | |||
| d78a6aa669 | |||
| 415186bd33 | |||
| 6a9b942a51 | |||
| a14088e7c0 | |||
| c93994652d | |||
| d19dab4e68 | |||
| cb885cfd93 | |||
| 28f361dcc4 |
@@ -0,0 +1,63 @@
|
||||
package io.gmss.fiscad.controllers.audit;
|
||||
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.audit.HistoriqueConnexionService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
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;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/historique-connexion", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Historique des connexion")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class HistoriqueConnexionController {
|
||||
|
||||
private final HistoriqueConnexionService historiqueConnexionService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(HistoriqueConnexionController.class);
|
||||
|
||||
public HistoriqueConnexionController(HistoriqueConnexionService historiqueConnexionService) {
|
||||
this.historiqueConnexionService = historiqueConnexionService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user/{userId}")
|
||||
@PreAuthorize("hasAuthority('READ_HISTORIQUECONNEXION')")
|
||||
public ResponseEntity<?> getHistoriqueConnexionByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, historiqueConnexionService.gethistoriqueConnexionListByUserIdPage(userId), "Liste des historiqueConnexions 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.decoupage.QuartierService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.QuartierPaylaodWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -38,11 +39,11 @@ public class QuartierController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_QUARTIER')")
|
||||
public ResponseEntity<?> createQuartier(@RequestBody @Valid @Validated Quartier quartier) {
|
||||
public ResponseEntity<?> createQuartier(@RequestBody QuartierPaylaodWeb quartierPaylaodWeb) {
|
||||
try {
|
||||
quartier = quartierService.createQuartier(quartier);
|
||||
quartierPaylaodWeb = quartierService.createQuartier(quartierPaylaodWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartier, "Quartier créé avec succès."),
|
||||
new ApiResponse<>(true, quartierPaylaodWeb, "Quartier créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -63,10 +64,10 @@ public class QuartierController {
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_QUARTIER')")
|
||||
public ResponseEntity<?> updateQuartier(@PathVariable Long id, @RequestBody Quartier quartier) {
|
||||
public ResponseEntity<?> updateQuartier(@PathVariable Long id, @RequestBody QuartierPaylaodWeb quartierPaylaodWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, quartierService.updateQuartier(id, quartier), "Quartier mis à jour avec succès."),
|
||||
new ApiResponse<>(true, quartierService.updateQuartier(id, quartierPaylaodWeb), "Quartier mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -283,8 +283,29 @@ public class SecteurDecoupageController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete/user-id/profil-id/{userId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_SECTEUR_DECOUPAGE')")
|
||||
public ResponseEntity<?> getArborescenceEnqueteByUserId(@PathVariable Long userId, @PathVariable Long profilId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserIdByProfilId(userId, profilId), "SecteurDecoupage 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) {
|
||||
e.printStackTrace();
|
||||
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("/arbre/enquete-valide/user-id/{userId}")
|
||||
@@ -362,6 +383,30 @@ public class SecteurDecoupageController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment/user-id/profil-id/{userId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_SECTEUR_DECOUPAGE')")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentEncoursByUserIdByProfilId(@PathVariable Long userId,@PathVariable Long profilId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserIdByProfilId(userId, profilId), "SecteurDecoupage 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) {
|
||||
e.printStackTrace();
|
||||
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("/arbre/enquete-batiment-valide/user-id/{userId}")
|
||||
@PreAuthorize("hasAuthority('READ_SECTEUR_DECOUPAGE')")
|
||||
@@ -438,6 +483,31 @@ public class SecteurDecoupageController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog/user-id/profil-id/{userId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_SECTEUR_DECOUPAGE')")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogByUserIdByProfilId(@PathVariable Long userId, @PathVariable Long profilId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserIdByProfilId(userId, profilId), "SecteurDecoupage 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) {
|
||||
e.printStackTrace();
|
||||
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("/arbre/enquete-unitlog-valide/user-id/{userId}")
|
||||
@PreAuthorize("hasAuthority('READ_SECTEUR_DECOUPAGE')")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogValideByUserId(@PathVariable Long userId) {
|
||||
|
||||
@@ -101,7 +101,7 @@ public class EnqueteController {
|
||||
}
|
||||
|
||||
@PutMapping("/validation")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETE') And hasAuthority('VALIDATE_ENQUETE') ")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -124,8 +124,32 @@ public class EnqueteController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/controle")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controlerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.controlerEnquete(enqueteTraitementPayLoad), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETE')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
@@ -150,7 +174,7 @@ public class EnqueteController {
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETE')")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -173,8 +197,31 @@ public class EnqueteController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/controle-lot")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controlerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.controlerEnquete(enqueteTraitementPayLoads), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
@PutMapping("/rejet-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETE')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -536,6 +583,38 @@ public class EnqueteController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/by-quartier-id/by-profil-id/{quartierId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETE')")
|
||||
public ResponseEntity<?> getAllEnqueteEncoursByQuartierPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId,@PathVariable Long profilId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteListByQuartierByProfilByStatutPageableToDto(userId,quartierId, profilId, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETE')")
|
||||
public ResponseEntity<?> getAllEnqueteClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.ModeAcquisitionService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -39,11 +40,11 @@ public class ModeAcquisitionController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_MODEACQUISITION')")
|
||||
public ResponseEntity<?> createModeAcquisition(@RequestBody @Valid @Validated ModeAcquisition modeAcquisition) {
|
||||
public ResponseEntity<?> createModeAcquisition(@RequestBody @Valid @Validated ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) {
|
||||
try {
|
||||
modeAcquisition = modeAcquisitionService.createModeAcquisition(modeAcquisition);
|
||||
modeAcquisitionPayloadWeb = modeAcquisitionService.createModeAcquisition(modeAcquisitionPayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisition, "Mode acquisition créé avec succès."),
|
||||
new ApiResponse<>(true, modeAcquisitionPayloadWeb, "Mode acquisition créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -64,10 +65,10 @@ public class ModeAcquisitionController {
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_MODEACQUISITION')")
|
||||
public ResponseEntity<?> updateModeAcquisition(@PathVariable Long id, @RequestBody ModeAcquisition modeAcquisition) {
|
||||
public ResponseEntity<?> updateModeAcquisition(@PathVariable Long id, @RequestBody ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisition), "Mode d'acquisition mis à jour avec succès."),
|
||||
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisitionPayloadWeb), "Mode d'acquisition mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -237,4 +237,29 @@ public class StructureController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/by-avoir-fonction/{avoirFonctionId}")
|
||||
@PreAuthorize("hasAuthority('READ_STRUCTURE')")
|
||||
public ResponseEntity<?> getAllStructureListByAvoirFonction(@PathVariable Long avoirFonctionId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, structureService.getListStructureAvoirFonctionId(avoirFonctionId), "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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
@@ -28,6 +30,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@@ -95,6 +98,109 @@ public class DonneesImpositionTfuController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/maj-non-homologable")
|
||||
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS')")
|
||||
public ResponseEntity<?> majNonHomologableDonneesImpositionTfu(@RequestBody List<DonneesImpositionPaylaodWeb> donneesImpositionTfuWebs) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.setDonneesFiscalesNonHomologable(donneesImpositionTfuWebs), "DonneesImpositionTfu mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/maj-homologable")
|
||||
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS')")
|
||||
public ResponseEntity<?> majHomologableDonneesImpositionTfu(@RequestBody List<DonneesImpositionPaylaodWeb> donneesImpositionTfuWebs) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.setDonneesFiscalesHomologable(donneesImpositionTfuWebs), "DonneesImpositionTfu mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/donnees-non-homologable/{idImpositionTfu}")
|
||||
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS') or hasAuthority('READ_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> getNonHomologableDonneesImpositionTfu(@PathVariable Long idImpositionTfu,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesNonHomologable(idImpositionTfu,pageable), "Donnees Imposition Tfu récupéré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("/donnees-homologable/{idImpositionTfu}")
|
||||
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS') or hasAuthority('READ_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> getHomologableDonneesImpositionTfu(@PathVariable Long idImpositionTfu,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesHomologable(idImpositionTfu,pageable), "Donnees Imposition Tfu récupéré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);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@PreAuthorize("hasAuthority('DELETE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> deleteDonneesImpositionTfu(@PathVariable Long id) {
|
||||
@@ -120,54 +226,6 @@ public class DonneesImpositionTfuController {
|
||||
}
|
||||
}
|
||||
|
||||
// @GetMapping("/all")
|
||||
// public ResponseEntity<?> getAllDonneesImpositionTfuList() {
|
||||
// try {
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(), "Liste des impositions chargée avec succès."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// } catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
// } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
// FileStorageException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @GetMapping("/all-paged")
|
||||
// public ResponseEntity<?> getAllDonneesImpositionTfuPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
// try {
|
||||
// Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(pageable), "Liste des impositions 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-page/by-imposition-id/{impositionId}")
|
||||
@PreAuthorize("hasAuthority('READ_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByImpositionIdPaged(@PathVariable Long impositionId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
@@ -351,7 +409,7 @@ public class DonneesImpositionTfuController {
|
||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu =impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
@@ -359,14 +417,6 @@ public class DonneesImpositionTfuController {
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
// if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.TFU_FNB_GENERE)){
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||
@@ -375,6 +425,7 @@ public class DonneesImpositionTfuController {
|
||||
}
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||
|
||||
System.out.println("OK apres sorti bati une parcelle");
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -413,7 +464,7 @@ public class DonneesImpositionTfuController {
|
||||
);
|
||||
}
|
||||
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.GENERATION_AUTORISE)){
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.CLOTURE)){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||
HttpStatus.OK
|
||||
@@ -458,7 +509,7 @@ public class DonneesImpositionTfuController {
|
||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu = impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
@@ -467,19 +518,13 @@ public class DonneesImpositionTfuController {
|
||||
);
|
||||
}
|
||||
|
||||
// if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.GENERATION_AUTORISE)){
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||
// HttpStatus.OK
|
||||
// );
|
||||
// }
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -272,6 +272,38 @@ public class EnqueteBatimentController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/by-quartier-id/by-profil-id/{quartierId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETEBATIMENT')")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentByQuartierByProfilPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @PathVariable Long profilId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentListByQuartierByProfilPageableToDto(userId,quartierId, profilId, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETEBATIMENT')")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
@@ -305,7 +337,7 @@ public class EnqueteBatimentController {
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEBATIMENT')")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -328,8 +360,32 @@ public class EnqueteBatimentController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/controle")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controlerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.controlerEnquete(enqueteTraitementPayLoad), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEBATIMENT')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
@@ -354,7 +410,7 @@ public class EnqueteBatimentController {
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEBATIMENT')")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -377,8 +433,33 @@ public class EnqueteBatimentController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/controle-lot")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controlerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.controlerEnquete(enqueteTraitementPayLoads), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEBATIMENT')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -272,6 +272,38 @@ public class EnqueteUniteLogementController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/by-quartier-id/by-profil-id/{quartierId}/{profilId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETEUNITELOGEMENT')")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementByQuartierByProfilPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @PathVariable Long profilId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementListByQuartierByProfilPageableToDto(userId,quartierId, profilId, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
@PreAuthorize("hasAuthority('READ_ENQUETEUNITELOGEMENT')")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
@@ -305,7 +337,7 @@ public class EnqueteUniteLogementController {
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEUNITELOGEMENT')")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -328,8 +360,32 @@ public class EnqueteUniteLogementController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/controle")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controleEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.controlerEnquete(enqueteTraitementPayLoad), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEUNITELOGEMENT')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
@@ -354,7 +410,7 @@ public class EnqueteUniteLogementController {
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEUNITELOGEMENT')")
|
||||
@PreAuthorize("hasAuthority('VALIDE_ENQUETE')")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
@@ -377,8 +433,32 @@ public class EnqueteUniteLogementController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/controle-lot")
|
||||
@PreAuthorize("hasAuthority('CONTROLE_ENQUETE')")
|
||||
public ResponseEntity<?> controleEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.controlerEnquete(enqueteTraitementPayLoads), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
@PreAuthorize("hasAuthority('UPDATE_ENQUETEUNITELOGEMENT')")
|
||||
@PreAuthorize("hasAuthority('REJETE_ENQUETE')")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -29,6 +32,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@@ -39,6 +44,8 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
public class ImpositionsTfuController {
|
||||
|
||||
private final ImpositionsTfuService impositionsTfuService;
|
||||
private final StructureService structureService;
|
||||
|
||||
private final EnqueteService enqueteService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||
|
||||
@@ -54,11 +61,22 @@ public class ImpositionsTfuController {
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
User user=currentUser.getUser();
|
||||
|
||||
if(impositionsTfuPaylaodWeb.getStructureId()==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Veuillez préciser la strucuture."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
User user = currentUser.getUser();
|
||||
|
||||
StructurePaylaodWeb st = structureService.getStructureById(impositionsTfuPaylaodWeb.getStructureId()).orElseGet(null);
|
||||
|
||||
|
||||
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource."),
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource. Votre centre : "+ user.getStructure().getNom() +" le centre de liquidation : "+ st.getNom()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@@ -177,6 +195,30 @@ public class ImpositionsTfuController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/homologuer")
|
||||
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS')")
|
||||
public ResponseEntity<?> HomologueImpositionsTfu(@RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.homologuerImpositionsTfu(impositionsTfuPaylaodWeb), "Unite de logement mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejeter")
|
||||
@PreAuthorize("hasAuthority('UPDATE_IMPOSITIONSTFU')")
|
||||
public ResponseEntity<?> annulerImpositionsTfu(@RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
@@ -307,4 +349,30 @@ public class ImpositionsTfuController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-generer/by-structure-id/{structureId}")
|
||||
@PreAuthorize("hasAuthority('READ_IMPOSITIONSTFU')")
|
||||
public ResponseEntity<?> getImpositionsTfuGenererByStructureId(@PathVariable Long structureId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuByStructureIdByStatut(structureId, StatusAvis.GENERE), "liste imposition TFU 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/participer", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Participer")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class ParticiperController {
|
||||
|
||||
private final ParticiperService participerService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ParticiperController.class);
|
||||
|
||||
public ParticiperController(ParticiperService participerService) {
|
||||
this.participerService = participerService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_PARTICIPER')")
|
||||
public ResponseEntity<?> createParticiper(@RequestBody @Valid @Validated ParticiperPayloadWeb participerPaylaodWeb) {
|
||||
try {
|
||||
participerPaylaodWeb = participerService.createParticiper(participerPaylaodWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerPaylaodWeb, "Participer créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_PARTICIPER')")
|
||||
public ResponseEntity<?> updateParticiper(@PathVariable Long id, @RequestBody ParticiperPayloadWeb participerPaylaodWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.updateParticiper(id,participerPaylaodWeb), "Participer mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@PreAuthorize("hasAuthority('DELETE_PARTICIPER')")
|
||||
public ResponseEntity<?> deleteParticiper(@PathVariable Long id) {
|
||||
try {
|
||||
participerService.deleteParticiper(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Participer supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
||||
public ResponseEntity<?> getAllParticiperList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.getParticiperList(), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
||||
public ResponseEntity<?> getAllParticiperPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.getParticiperList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all/by-equipe-id/{equipeId}")
|
||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
||||
public ResponseEntity<?> getAllParticiperByParcelleList(@PathVariable Long equipeId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.getParticiperListByEquipe(equipeId), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/by-equipe-id/{equipeId}")
|
||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
||||
public ResponseEntity<?> getAllParticiperByParcellePaged(@PathVariable Long equipeId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.getParticiperListByEquipePageable(equipeId,pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
||||
public ResponseEntity<?> getParticiperById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, participerService.getParticiperById(id), "Participer 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -37,11 +38,11 @@ public class CampagneController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_CAMPAGNE')")
|
||||
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated Campagne campagne) {
|
||||
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated CampagnePayloadWeb campagnePayloadWeb) {
|
||||
try {
|
||||
campagne = campagneService.createCampagne(campagne);
|
||||
campagnePayloadWeb = campagneService.createCampagne(campagnePayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
|
||||
new ApiResponse<>(true, campagnePayloadWeb, "Campagne créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -62,10 +63,10 @@ public class CampagneController {
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_CAMPAGNE')")
|
||||
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody Campagne campagne) {
|
||||
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody CampagnePayloadWeb campagnePayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
|
||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagnePayloadWeb), "Campagne mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -207,5 +208,111 @@ public class CampagneController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-exercice-id/{exerciceId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId), "Liste des campagne par type 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-exercice-id/{exerciceId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId,pageable), "Liste des campagne par type 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("/by-structure-id/{structureId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId), "Liste des campagne par type 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-structure-id/{structureId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId,pageable), "Liste des campagne par type 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.CaracteristiqueService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -36,11 +37,11 @@ public class CaracteristiqueController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_CARACTERISTIQUE')")
|
||||
public ResponseEntity<?> createCaracteristique(@RequestBody @Valid @Validated Caracteristique caracteristique) {
|
||||
public ResponseEntity<?> createCaracteristique(@RequestBody @Valid @Validated CaracteristiquePayloadWeb caracteristiquePayloadWeb) {
|
||||
try {
|
||||
caracteristique = caracteristiqueService.createCaracteristique(caracteristique);
|
||||
caracteristiquePayloadWeb = caracteristiqueService.createCaracteristique(caracteristiquePayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristique, "Caracteristique créé avec succès."),
|
||||
new ApiResponse<>(true, caracteristiquePayloadWeb, "Caracteristique créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -61,10 +62,10 @@ public class CaracteristiqueController {
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_CARACTERISTIQUE')")
|
||||
public ResponseEntity<?> updateCaracteristique(@PathVariable Long id, @RequestBody Caracteristique caracteristique) {
|
||||
public ResponseEntity<?> updateCaracteristique(@PathVariable Long id, @RequestBody CaracteristiquePayloadWeb caracteristiquePayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristique), "Caracteristique mise à jour avec succès."),
|
||||
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristiquePayloadWeb), "Caracteristique mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -139,7 +140,7 @@ public class CaracteristiqueController {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueListPage(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -36,12 +37,12 @@ public class EquipeController {
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_EQUIPE')")
|
||||
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated EquipePayload equipePayload) {
|
||||
// @PreAuthorize("hasAuthority('CREATE_EQUIPE')")
|
||||
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated EquipePayloadWeb equipePayloadWeb) {
|
||||
try {
|
||||
Equipe equipe = equipeService.createEquipe(equipePayload);
|
||||
equipePayloadWeb = equipeService.create(equipePayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
|
||||
new ApiResponse<>(true, equipePayloadWeb, "Equipe créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -55,17 +56,18 @@ public class EquipeController {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_EQUIPE')")
|
||||
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody EquipePayload equipePayload) {
|
||||
// @PreAuthorize("hasAuthority('UPDATE_EQUIPE')")
|
||||
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody EquipePayloadWeb equipePayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
|
||||
new ApiResponse<>(true, equipeService.update(id, equipePayloadWeb), "Equipe mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -88,7 +90,7 @@ public class EquipeController {
|
||||
@PreAuthorize("hasAuthority('DELETE_EQUIPE')")
|
||||
public ResponseEntity<?> deleteEquiper(@PathVariable Long id) {
|
||||
try {
|
||||
equipeService.deleteEquipe(id);
|
||||
equipeService.delete(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Equipe supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -104,17 +106,18 @@ public class EquipeController {
|
||||
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")
|
||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||
//@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||
public ResponseEntity<?> getAllEquipeList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.getEquipeList(), "Liste des equipes chargée avec succès."),
|
||||
new ApiResponse<>(true, equipeService.findAll(), "Liste des equipes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -140,7 +143,7 @@ public class EquipeController {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.getEquipeList(pageable), "Liste des equipes chargée avec succès."),
|
||||
new ApiResponse<>(true, equipeService.findAll(pageable), "Liste des equipes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -164,7 +167,81 @@ public class EquipeController {
|
||||
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.getEquipeById(id), "Equipe trouvée avec succès."),
|
||||
new ApiResponse<>(true, equipeService.findById(id), "Equipe 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-compagne-id/{campagneId}")
|
||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||
public ResponseEntity<?> getEquipeByCompagneId(@PathVariable Long campagneId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.findByCampagneId(campagneId), "Equipe 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-secteur-id/{secteurId}")
|
||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||
public ResponseEntity<?> getEquipeBySecteurId(@PathVariable Long secteurId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.findBySecteurId(secteurId), "Equipe 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/by-quartier-id/{quartierId}")
|
||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||
public ResponseEntity<?> getEquipeByQuartierId(@PathVariable Long quartierId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, equipeService.findByQuartierId(quartierId), "Equipe trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -38,6 +38,8 @@ public class ExerciceController {
|
||||
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
||||
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
||||
try {
|
||||
|
||||
|
||||
exercice = exerciceService.createExercice(exercice);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
||||
|
||||
@@ -215,6 +215,44 @@ public class StatistiqueController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
)
|
||||
@GetMapping(path = "/nombre-enquete/par-objet/profil-id/{profilId}")
|
||||
public ResponseEntity<?> getStatistiquesEnqueteParObjetParProfilId(@CurrentUser UserPrincipal currentUser,@PathVariable Long profilId) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatNombreEnqueteParObjetUserConnectProfil(userId,profilId), "Statistique des personne par type."),
|
||||
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 = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
|
||||
@@ -70,10 +70,44 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
// @PostMapping("/change-password")
|
||||
// @PreAuthorize("hasAuthority('UPDATE_USER')")
|
||||
// public ResponseEntity<?> changeUserPassword(@RequestBody Login login) {
|
||||
// try {
|
||||
// userService.updatePassword(login.getUsername(), login.getPassword());
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, "Votre mot de passe à été modifié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);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/change-password")
|
||||
@PreAuthorize("hasAuthority('UPDATE_USER')")
|
||||
public ResponseEntity<?> changeUserPassword(@RequestBody @Valid @Validated Login login) {
|
||||
//@PreAuthorize("hasAuthority('CHANGE_MY_PASSWORD')")
|
||||
public ResponseEntity<?> changeMyPassword(@CurrentUser UserPrincipal currentUser, @RequestBody Login login) {
|
||||
try {
|
||||
User user = currentUser.getUser() ;
|
||||
if(!user.getUsername().equals(login.getUsername())){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, "Echec de changement de mot de passe : Utilisateur non identifié"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
|
||||
}
|
||||
userService.updatePassword(login.getUsername(), login.getPassword());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."),
|
||||
@@ -355,6 +389,33 @@ public class UserController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-by-fonction/{fonctionId}")
|
||||
@PreAuthorize("hasAuthority('READ_USER')")
|
||||
public ResponseEntity<?> getAllByFonction(@PathVariable Long fonctionId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.getUsersByFonctionId(fonctionId), "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}")
|
||||
@PreAuthorize("hasAuthority('READ_USER')")
|
||||
public ResponseEntity<?> getAllByStructurePaged(@PathVariable Long structureId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.gmss.fiscad.entities.audit;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class HistoriqueConnexion extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDateTime dateConnexion;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
@@ -183,6 +184,14 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
private Integer nbreIndivisiaire;
|
||||
private String autreAdresse;
|
||||
private Float superficie ;
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (bat.id))
|
||||
FROM enquete e
|
||||
join batiment bat on bat.parcelle_id =e.parcelle_id
|
||||
WHERE bat.parcelle_id = parcelle_id
|
||||
)
|
||||
""")
|
||||
private Integer nbreBatiment;
|
||||
private Integer nbrePiscine;
|
||||
private Long montantMensuelleLocation;
|
||||
|
||||
@@ -94,6 +94,8 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
private Long nombrePiscine;
|
||||
private Long nombreUlog;
|
||||
private Long nombreBat;
|
||||
//@Column(nullable = true, columnDefinition = "boolean default true")
|
||||
private Boolean homologable ;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
|
||||
@@ -8,15 +8,13 @@ import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
@@ -53,20 +51,58 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
private String datePieceAdmin;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusAvis statusAvis;
|
||||
|
||||
private StatusAvis statusAvis;
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||
FROM donnees_imposition_tfu d
|
||||
WHERE d.impositions_tfu_id = id
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvis;
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||
FROM donnees_imposition_tfu d
|
||||
WHERE d.impositions_tfu_id = id
|
||||
and (d.nature_impot='FNB' or d.nature_impot='FB')
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisFnb;
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||
FROM donnees_imposition_tfu d
|
||||
WHERE d.impositions_tfu_id = id
|
||||
and d.nature_impot='FB'
|
||||
and d.batiment_id is not null
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisBatiment;
|
||||
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||
FROM donnees_imposition_tfu d
|
||||
WHERE d.impositions_tfu_id = id
|
||||
and d.nature_impot='FB'
|
||||
and d.unite_logement_id is not null
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisUniteLog;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String motif;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "impositions_tfu_id")
|
||||
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
// @JoinColumn(name = "impositions_tfu_id")
|
||||
// private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -21,7 +22,15 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
//@Where(clause = " deleted = false")
|
||||
@Table(
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(
|
||||
name = "uk_participer_equipe_user",
|
||||
columnNames = {"equipe_id", "user_id"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public class Participer extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -39,12 +40,12 @@ public class Campagne extends BaseEntity implements Serializable {
|
||||
private LocalDate dateFin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeCampagne typeCampagne;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "campagne")
|
||||
// private List<Equipe> equipes;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "campagne")
|
||||
// private List<Enquete> enquetes;
|
||||
@ManyToOne
|
||||
private Exercice exercice ;
|
||||
|
||||
@ManyToOne
|
||||
private Structure structure ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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.Quartier;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -13,6 +16,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -32,6 +36,10 @@ public class Equipe extends BaseEntity implements Serializable {
|
||||
private Bloc bloc;
|
||||
@ManyToOne
|
||||
private Secteur secteur;
|
||||
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
|
||||
@ManyToOne
|
||||
private Campagne campagne;
|
||||
|
||||
@@ -39,6 +47,14 @@ public class Equipe extends BaseEntity implements Serializable {
|
||||
@JoinColumn(name = "equipe_id")
|
||||
private List<Participer> participers;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "equipe")
|
||||
// private List<Enquete> enquetes;
|
||||
|
||||
@@ -21,6 +21,11 @@ import java.time.LocalDate;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
@Table(
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(name = "uk_exercice_annee", columnNames = "annee")
|
||||
}
|
||||
)
|
||||
public class Exercice extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
package io.gmss.fiscad.entities.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.enums.UserRole;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -19,7 +13,6 @@ import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -4,11 +4,10 @@ public enum StatusAvis {
|
||||
EN_COURS,
|
||||
|
||||
CLOTURE,
|
||||
GENERATION_AUTORISE,
|
||||
|
||||
// GENERATION_AUTORISE,
|
||||
REJETE,
|
||||
TFU_FNB_GENERE,
|
||||
GENERE,
|
||||
APPROVAL
|
||||
HOMOLOGUE
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,13 @@ package io.gmss.fiscad.enums;
|
||||
public enum StatutEnquete {
|
||||
EN_COURS,
|
||||
FINALISE,
|
||||
|
||||
REJETE,
|
||||
|
||||
CONTROLE,
|
||||
VALIDE,
|
||||
|
||||
ECHEC,
|
||||
|
||||
CLOTURE
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package io.gmss.fiscad.enums;
|
||||
|
||||
public enum UserRole {
|
||||
VALIDE_ENQUETE,
|
||||
APPROVAL_AVIS,
|
||||
REJETE_ENQUETE,
|
||||
CONTROLE_ENQUETE,
|
||||
HOMOLOGUE_AVIS,
|
||||
//CHANGE_MY_PASSWORD,
|
||||
CREATE_ARRONDISSEMENT,
|
||||
READ_ARRONDISSEMENT,
|
||||
UPDATE_ARRONDISSEMENT,
|
||||
@@ -278,6 +281,10 @@ public enum UserRole {
|
||||
CREATE_PROFILEMODULEFONCTIONNALITE,
|
||||
READ_PROFILEMODULEFONCTIONNALITE,
|
||||
UPDATE_PROFILEMODULEFONCTIONNALITE,
|
||||
DELETE_PROFILEMODULEFONCTIONNALITE
|
||||
DELETE_PROFILEMODULEFONCTIONNALITE,
|
||||
CREATE_HISTORIQUECONNEXION,
|
||||
READ_HISTORIQUECONNEXION,
|
||||
UPDATE_HISTORIQUECONNEXION,
|
||||
DELETE_HISTORIQUECONNEXION
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.gmss.fiscad.implementations.audit;
|
||||
|
||||
import io.gmss.fiscad.interfaces.audit.HistoriqueConnexionService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.audit.HistoriqueConnexionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class HistoriqueConnexionServiceImpl implements HistoriqueConnexionService {
|
||||
private final HistoriqueConnexionRepository historiqueConnexionRepository ;
|
||||
|
||||
@Override
|
||||
public List<HistoriqueConnexionPaylaodWeb> gethistoriqueConnexionListByUserIdPage(Long userId) {
|
||||
return historiqueConnexionRepository.findTop5HistoriqueConnexionByUserId(userId, PageRequest.of(0, 5));
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,10 @@ 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.ArrondissementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.QuartierRepository;
|
||||
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;
|
||||
@@ -16,33 +19,59 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QuartierServiceImpl implements QuartierService {
|
||||
|
||||
private final QuartierRepository quartierRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final ArrondissementService arrondissementService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
|
||||
public QuartierServiceImpl(QuartierRepository quartierRepository, ArrondissementService arrondissementService) {
|
||||
this.quartierRepository = quartierRepository;
|
||||
this.arrondissementService = arrondissementService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quartier createQuartier(Quartier quartier) throws BadRequestException {
|
||||
if (quartier.getId() != null) {
|
||||
public QuartierPaylaodWeb createQuartier(QuartierPaylaodWeb quartierPaylaodWeb) throws BadRequestException {
|
||||
if (quartierPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau quartier ayant un id non null.");
|
||||
}
|
||||
return quartierRepository.save(quartier);
|
||||
|
||||
if (quartierPaylaodWeb.getArrondissementId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau quartier : Veuillez préciser l'arrondissement");
|
||||
}
|
||||
|
||||
|
||||
if (!arrondissementRepository.existsById(quartierPaylaodWeb.getArrondissementId())) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau quartier : l'arrondissement n'existe pas");
|
||||
}
|
||||
Quartier quartier = entityFromPayLoadService.getQuartierFromPayLoadWeb(quartierPaylaodWeb);
|
||||
quartier = quartierRepository.save(quartier);
|
||||
|
||||
|
||||
Optional<QuartierPaylaodWeb> optionalQuartierPaylaodWeb = quartierRepository.findQuartierToDtoById(quartier.getId());
|
||||
|
||||
return optionalQuartierPaylaodWeb.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quartier updateQuartier(Long id, Quartier quartier) throws NotFoundException {
|
||||
if (quartier.getId() == null) {
|
||||
public QuartierPaylaodWeb updateQuartier(Long id, QuartierPaylaodWeb quartierPaylaodWeb) throws NotFoundException {
|
||||
if (quartierPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau quartier ayant un id null.");
|
||||
}
|
||||
if (!quartierRepository.existsById(quartier.getId())) {
|
||||
if (!quartierRepository.existsById(quartierPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le quartier spécifié dans notre base de données.");
|
||||
}
|
||||
return quartierRepository.save(quartier);
|
||||
|
||||
if (quartierPaylaodWeb.getArrondissementId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau quartier : Veuillez préciser l'arrondissement");
|
||||
}
|
||||
Quartier quartier = entityFromPayLoadService.getQuartierFromPayLoadWeb(quartierPaylaodWeb);
|
||||
quartier = quartierRepository.save(quartier);
|
||||
|
||||
|
||||
Optional<QuartierPaylaodWeb> optionalQuartierPaylaodWeb = quartierRepository.findQuartierToDtoById(quartier.getId());
|
||||
|
||||
return optionalQuartierPaylaodWeb.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,9 @@ package io.gmss.fiscad.implementations.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.enums.UserProfile;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
@@ -15,6 +17,7 @@ import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository
|
||||
import io.gmss.fiscad.persistence.repositories.interface_sigibe.EdeclarationProprieteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -34,6 +37,7 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
private final EdeclarationProprieteRepository edeclarationProprieteRepository;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final ProfileRepository profileRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@@ -131,6 +135,20 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
return enqueteRepository.findStatsEnqueteBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserIdByProfilId(Long userId, Long profilId) {
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
List<ParcelleStatsProjectionUnSecteur> parcelleStatsProjectionUnSecteurs= new ArrayList<>();
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteDecoupageByUserId(userId,StatutEnquete.EN_COURS.toString());
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteDecoupageByUserId(userId,StatutEnquete.CONTROLE.toString());
|
||||
}
|
||||
}
|
||||
return parcelleStatsProjectionUnSecteurs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
@@ -142,6 +160,22 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
return enqueteBatimentRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserIdByProfilId(Long userId, Long profilId) {
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
List<ParcelleStatsProjectionUnSecteur> parcelleStatsProjectionUnSecteurs= new ArrayList<>();
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteBatimentDecoupageByUserId(userId,StatutEnquete.EN_COURS.toString());
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteBatimentDecoupageByUserId(userId,StatutEnquete.CONTROLE.toString());
|
||||
}
|
||||
}
|
||||
return parcelleStatsProjectionUnSecteurs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
@@ -151,6 +185,21 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
return enqueteUniteLogementRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserIdByProfilId(Long userId, Long profilId) {
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
List<ParcelleStatsProjectionUnSecteur> parcelleStatsProjectionUnSecteurs= new ArrayList<>();
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteUniteLogementDecoupageByUserId(userId,StatutEnquete.EN_COURS.toString());
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
parcelleStatsProjectionUnSecteurs= getStatEnqueteUniteLogementDecoupageByUserId(userId,StatutEnquete.CONTROLE.toString());
|
||||
}
|
||||
}
|
||||
return parcelleStatsProjectionUnSecteurs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatDeclarationProprieteByUserId(Long userId, String statutDeclcarationPropriete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
|
||||
@@ -10,9 +10,11 @@ import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEdeclarationPropriete;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.enums.UserProfile;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
@@ -46,6 +48,7 @@ import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentReposit
|
||||
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.ProfileRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.persistence.EntityManager;
|
||||
@@ -56,6 +59,7 @@ import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@@ -91,6 +95,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
private final SecteurService secteurService ;
|
||||
private final EdeclarationProprieteService edeclarationProprieteService ;
|
||||
private final QuartierRepository quartierRepository ;
|
||||
private final ProfileRepository profileRepository ;
|
||||
;
|
||||
|
||||
@PersistenceContext
|
||||
@@ -419,6 +424,35 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnquetePayLoadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnquete.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.REJETE||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnquete.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
System.out.println("ICIC");
|
||||
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateValidation(LocalDate.now());
|
||||
enquete.setStatutEnquete(StatutEnquete.CONTROLE);
|
||||
enquete.setSynchronise(true);
|
||||
enquete= enqueteRepository.save(enquete);
|
||||
if(enquete.getEdeclarationPropriete()!=null) {
|
||||
edeclarationProprieteService.updateEdeclarationProprieteStatut(enquete.getEdeclarationPropriete().getId(), StatutEdeclarationPropriete.TRAITE);
|
||||
}
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad.getIdBackend() == null) {
|
||||
@@ -454,6 +488,21 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnquetePayLoadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enquetePayLoadWebs.add(controlerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enquetePayLoadWebs.add(null);
|
||||
}
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
@@ -635,6 +684,27 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return enqueteRepository.findAllEnqueteByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<EnquetePayLoadWeb> getEnqueteListByQuartierByProfilByStatutPageableToDto(Long userId, Long quartierId, Long profilId, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
Page<EnquetePayLoadWeb> enquetePayLoadWebs = Page.empty(pageable);
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
enquetePayLoadWebs=enqueteRepository.findAllEnqueteByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.EN_COURS,pageable);
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
enquetePayLoadWebs=enqueteRepository.findAllEnqueteByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.CONTROLE,pageable);
|
||||
}
|
||||
}
|
||||
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long structureId,Long exerciceId) {
|
||||
|
||||
@@ -267,7 +267,6 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
}
|
||||
|
||||
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
||||
|
||||
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
||||
if(!personnePayLoadWebs.isEmpty())
|
||||
return personnePayLoadWebs;
|
||||
@@ -277,13 +276,14 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
|
||||
result = recherchePersonneLocal(request);
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
if (result != null && ! result.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
// Conversion date en String format yyyy-MM-dd
|
||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||
.orElse(null);
|
||||
|
||||
// Construction du body IFU
|
||||
IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody();
|
||||
ifuRequest.setNom(request.getNom());
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package io.gmss.fiscad.implementations.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
||||
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.infocad.parametre.ModeAcquisitionService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.ModeAcquisitionRepository;
|
||||
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;
|
||||
@@ -16,28 +20,35 @@ import java.util.Optional;
|
||||
public class ModeAcquisitionServiceImpl implements ModeAcquisitionService {
|
||||
|
||||
private final ModeAcquisitionRepository modeAcquisitionRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
public ModeAcquisitionServiceImpl(ModeAcquisitionRepository modeAcquisitionRepository) {
|
||||
public ModeAcquisitionServiceImpl(ModeAcquisitionRepository modeAcquisitionRepository, EntityFromPayLoadService entityFromPayLoadService) {
|
||||
this.modeAcquisitionRepository = modeAcquisitionRepository;
|
||||
this.entityFromPayLoadService = entityFromPayLoadService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ModeAcquisition createModeAcquisition(ModeAcquisition modeAcquisition) throws BadRequestException {
|
||||
if (modeAcquisition.getId() != null) {
|
||||
public ModeAcquisitionPayloadWeb createModeAcquisition(ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) throws BadRequestException {
|
||||
if (modeAcquisitionPayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau mode d'acquisition ayant un id non null.");
|
||||
}
|
||||
return modeAcquisitionRepository.save(modeAcquisition);
|
||||
ModeAcquisition modeAcquisition = entityFromPayLoadService.getModeAcquisitionFromPayLoadWeb(modeAcquisitionPayloadWeb);
|
||||
modeAcquisition = modeAcquisitionRepository.save(modeAcquisition);
|
||||
return modeAcquisitionRepository.findPayloadById(modeAcquisition.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModeAcquisition updateModeAcquisition(Long id, ModeAcquisition modeAcquisition) throws NotFoundException {
|
||||
if (modeAcquisition.getId() == null) {
|
||||
public ModeAcquisitionPayloadWeb updateModeAcquisition(Long id, ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) throws NotFoundException {
|
||||
if (modeAcquisitionPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau mode d'acquisition ayant un id null.");
|
||||
}
|
||||
if (!modeAcquisitionRepository.existsById(modeAcquisition.getId())) {
|
||||
if (!modeAcquisitionRepository.existsById(modeAcquisitionPayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le mode d'acquisition spécifié dans notre base de données.");
|
||||
}
|
||||
return modeAcquisitionRepository.save(modeAcquisition);
|
||||
ModeAcquisition modeAcquisition = entityFromPayLoadService.getModeAcquisitionFromPayLoadWeb(modeAcquisitionPayloadWeb);
|
||||
modeAcquisition = modeAcquisitionRepository.save(modeAcquisition);
|
||||
return modeAcquisitionRepository.findPayloadById(modeAcquisition.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,19 +62,19 @@ public class ModeAcquisitionServiceImpl implements ModeAcquisitionService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ModeAcquisition> getModeAcquisitionList(Pageable pageable) {
|
||||
return modeAcquisitionRepository.findAll(pageable);
|
||||
public Page<ModeAcquisitionPayloadWeb> getModeAcquisitionList(Pageable pageable) {
|
||||
return modeAcquisitionRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModeAcquisition> getModeAcquisitionList() {
|
||||
return modeAcquisitionRepository.findAll();
|
||||
public List<ModeAcquisitionPayloadWeb> getModeAcquisitionList() {
|
||||
return modeAcquisitionRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ModeAcquisition> getModeAcquisitionById(Long id) {
|
||||
public Optional<ModeAcquisitionPayloadWeb> getModeAcquisitionById(Long id) {
|
||||
if (modeAcquisitionRepository.existsById(id)) {
|
||||
return modeAcquisitionRepository.findById(id);
|
||||
return modeAcquisitionRepository.findPayloadById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le mode d'acquisition spécifié dans la base de données.");
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class StructureServiceImpl implements StructureService {
|
||||
avoirFonctions.stream()
|
||||
.filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now()))
|
||||
.forEach(avoirFonction -> {
|
||||
if(avoirFonction.getFonction().getStructure()!=null){
|
||||
if(avoirFonction.getFonction().getStructure()!=null && avoirFonction.getFonction().getDepartement()==null){
|
||||
structures.addAll(List.of(avoirFonction.getFonction().getStructure()));
|
||||
}else if (avoirFonction.getFonction().getDepartement()!=null){
|
||||
structures.addAll(structureRepository.findDistinctByCommune_Departement_Id(avoirFonction.getFonction().getDepartement().getId()));
|
||||
@@ -111,6 +111,33 @@ public class StructureServiceImpl implements StructureService {
|
||||
return structures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StructurePaylaodWeb> getListStructureAvoirFonctionId(Long avoirFonctionId) {
|
||||
Optional<AvoirFonction> optionalAvoirFonction= avoirFonctionRepository.findById(avoirFonctionId);
|
||||
|
||||
List<AvoirFonction> avoirFonctions= new ArrayList<>() ;
|
||||
if(optionalAvoirFonction.isPresent()){
|
||||
avoirFonctions.add(optionalAvoirFonction.get());
|
||||
}
|
||||
|
||||
List<Structure> structures = new ArrayList<>();
|
||||
avoirFonctions.stream()
|
||||
.filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now()))
|
||||
.forEach(avoirFonction -> {
|
||||
if(avoirFonction.getFonction().getStructure()!=null && avoirFonction.getFonction().getDepartement()==null){
|
||||
structures.addAll(List.of(avoirFonction.getFonction().getStructure()));
|
||||
}else if (avoirFonction.getFonction().getDepartement()!=null){
|
||||
structures.addAll(structureRepository.findDistinctByCommune_Departement_Id(avoirFonction.getFonction().getDepartement().getId()));
|
||||
}
|
||||
});
|
||||
List<StructurePaylaodWeb> structurePaylaodWebs=new ArrayList<>();
|
||||
structures.forEach(structure -> {
|
||||
structurePaylaodWebs.add(structureRepository.findStructureToDtoById(structure.getId()).orElse(null));
|
||||
});
|
||||
|
||||
return structurePaylaodWebs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public List<Long> getStructureIdListForUser(Long userId) {
|
||||
|
||||
@@ -38,30 +38,30 @@ public class CommuneCentreAssignationServiceImpl implements CommuneCentreAssigna
|
||||
public CommuneCentreAssignationPaylaodWeb createCommuneCentreAssignation(User user, CommuneCentreAssignationPaylaodWeb communeCentreAssignationPaylaodWeb) throws BadRequestException {
|
||||
|
||||
if (user.getStructure() == null) {
|
||||
throw new BadRequestException("Impossible de créer l'assignation: Votre centre doit être précisé.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation: Votre centre doit être précisé.");
|
||||
}
|
||||
|
||||
if (user.getStructure().getCommune() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau communeCentreAssignation: votre commune doit être précisée.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation : votre commune doit être précisée.");
|
||||
}
|
||||
|
||||
if (communeCentreAssignationPaylaodWeb.getPersonneId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau communeCentreAssignation: Le contribuable doit être précisée.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation : Le contribuable doit être précisée.");
|
||||
}else {
|
||||
if(!personneRepository.existsById(communeCentreAssignationPaylaodWeb.getPersonneId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau communeCentreAssignation: Le contribuable doit être précisée.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation : Le contribuable doit être précisée.");
|
||||
}
|
||||
|
||||
if (communeCentreAssignationPaylaodWeb.getParcelleContactId() == null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle assignation de centre : La parcelle de contact doit être précisée.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation : La parcelle de contact doit être précisée.");
|
||||
}else {
|
||||
if(!parcelleRepository.existsById(communeCentreAssignationPaylaodWeb.getParcelleContactId()))
|
||||
throw new BadRequestException("Impossible de créer une nouvelle assignation de centre: La parcelle précisée n'existe pas.");
|
||||
throw new BadRequestException("Impossible de finaliser l'assignation : La parcelle précisée n'existe pas.");
|
||||
}
|
||||
|
||||
Optional<CommuneCentreAssignationPaylaodWeb> communeCentreAssignationPaylaodWebOptional=communeCentreAssignationRepository.findbyCommuneAndPersonne(user.getStructure().getCommune().getId(),communeCentreAssignationPaylaodWeb.getPersonneId());
|
||||
if(communeCentreAssignationPaylaodWeb.getId()==null && communeCentreAssignationPaylaodWebOptional.isPresent()){
|
||||
throw new NotAcceptableException("Impossible de créer une nouvelle assignation de centre: Le contribuable est déjà assigné au centre : "+communeCentreAssignationPaylaodWebOptional.get().getStructureNom());
|
||||
throw new NotAcceptableException("Impossible de finaliser l'assignation : Le contribuable est déjà assigné au centre : "+communeCentreAssignationPaylaodWebOptional.get().getStructureNom());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
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.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
@@ -17,6 +19,7 @@ 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.BaremRfuRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ExerciceRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
@@ -40,7 +43,9 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository;
|
||||
private final ExerciceRepository exerciceRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final BaremRfuRepository baremRfuRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final StructureService structureService;
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +107,7 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvisFnb(nb);
|
||||
//impositionsTfu.setNombreAvisFnb(nb);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
@@ -112,18 +117,39 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
@Override
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
||||
// System.out.println("User : " +userId);
|
||||
// System.out.println("Parcelle : " +parcelleId);
|
||||
// System.out.println("Imposition : " +impositionsTfuPaylaodWeb.getId());
|
||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId,parcelleId);
|
||||
// System.out.println(nb);
|
||||
|
||||
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
||||
|
||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||
|
||||
String nomQuartier="";
|
||||
String nomArrondissement="";
|
||||
String nomCommune="";
|
||||
if(optionalParcelle.isPresent()){
|
||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||
|
||||
}
|
||||
if(!existsBareme){
|
||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomQuartier);
|
||||
}
|
||||
|
||||
List<Structure> structures = structureService.getListStructureUserId(userId);
|
||||
|
||||
boolean existe = structures.stream()
|
||||
.anyMatch(s -> s.getId().equals(impositionsTfuPaylaodWeb.getStructureId()));
|
||||
|
||||
if (!existe) {
|
||||
throw new BadRequestException("Impossible de continuer la liquidation : La parcelle ne se trouve pas dans votre territoire ");
|
||||
}
|
||||
|
||||
|
||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(), userId, parcelleId);
|
||||
|
||||
System.out.println(nb);
|
||||
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvisFnb(nb);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@@ -148,9 +174,9 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvis(nbb+nbulo+ (impositionsTfu.getNombreAvisFnb()==null?0:impositionsTfu.getNombreAvisFnb()));
|
||||
impositionsTfu.setNombreAvisBatiment(nbb);
|
||||
impositionsTfu.setNombreAvisUniteLog(nbulo);
|
||||
//impositionsTfu.setNombreAvis(nbb+nbulo+ (impositionsTfu.getNombreAvisFnb()==null?0:impositionsTfu.getNombreAvisFnb()));
|
||||
//impositionsTfu.setNombreAvisBatiment(nbb);
|
||||
//impositionsTfu.setNombreAvisUniteLog(nbulo);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
@@ -162,6 +188,27 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId) {
|
||||
|
||||
Optional<ImpositionsTfuPaylaodWeb> imp=impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||
if(imp.isPresent()){
|
||||
boolean dejaLiquide = donneesImpositionTfuRepository.existsByImpositionAnneeAndParcelle(Long.valueOf(imp.get().getExerciceAnnee()),parcelleId);
|
||||
if(dejaLiquide){
|
||||
return imp.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
||||
|
||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||
String nomQuartier="";
|
||||
String nomArrondissement="";
|
||||
String nomCommune="";
|
||||
if(optionalParcelle.isPresent()){
|
||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||
}
|
||||
if(!existsBareme){
|
||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
||||
}
|
||||
|
||||
Integer nbb= donneesImpositionTfuRepository.genererDonneesTfuBatie(impositionsTfuPaylaodWeb.getId(),userId,parcelleId);
|
||||
|
||||
Integer nbirfbtPlusieursBati = donneesImpositionTfuRepository.majDonneesTfuBatiePlusieursBatiment(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
||||
@@ -176,20 +223,17 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
|
||||
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
||||
|
||||
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvis(nbb+nbulo+ (impositionsTfu.getNombreAvisFnb()==null?0:impositionsTfu.getNombreAvisFnb()));
|
||||
impositionsTfu.setNombreAvisBatiment(nbb);
|
||||
impositionsTfu.setNombreAvisUniteLog(nbulo);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImposition(Long impositionsId) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuId(impositionsId);
|
||||
@@ -259,4 +303,58 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByPersonneId(Long personneId) {
|
||||
return donneesImpositionTfuRepository.findAllByPersonneId(personneId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer setDonneesFiscalesNonHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs) {
|
||||
int nb=0;
|
||||
if(donneesImpositionPaylaodWebs!=null){
|
||||
for(DonneesImpositionPaylaodWeb donneesImpositionPaylaodWeb:donneesImpositionPaylaodWebs){
|
||||
Optional<DonneesImpositionTfu> optionalDonneesImpositionTfu = donneesImpositionTfuRepository.findById(donneesImpositionPaylaodWeb.getId());
|
||||
if(optionalDonneesImpositionTfu.isPresent()){
|
||||
DonneesImpositionTfu donneesImpositionTfu=optionalDonneesImpositionTfu.get();
|
||||
donneesImpositionTfu.setHomologable(false);
|
||||
donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
nb++ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nb ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setDonneesFiscalesHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs) {
|
||||
int nb=0;
|
||||
if(donneesImpositionPaylaodWebs!=null){
|
||||
for(DonneesImpositionPaylaodWeb donneesImpositionPaylaodWeb:donneesImpositionPaylaodWebs){
|
||||
Optional<DonneesImpositionTfu> optionalDonneesImpositionTfu = donneesImpositionTfuRepository.findById(donneesImpositionPaylaodWeb.getId());
|
||||
if(optionalDonneesImpositionTfu.isPresent()){
|
||||
DonneesImpositionTfu donneesImpositionTfu=optionalDonneesImpositionTfu.get();
|
||||
donneesImpositionTfu.setHomologable(null);
|
||||
donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
nb++ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nb ;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer homologuer(Long impositionTfuId) {
|
||||
return donneesImpositionTfuRepository.homologuerDonneesImposition(impositionTfuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdNonHomologablePageable(impositionTfuId,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesHomologable(Long impositionTfuId,Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdHomologablePageable(impositionTfuId,pageable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ 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.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.enums.StatutEdeclarationPropriete;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.enums.UserProfile;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -27,6 +29,7 @@ import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneReposit
|
||||
import io.gmss.fiscad.persistence.repositories.interface_sigibe.EdeclarationProprieteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
@@ -48,6 +51,7 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final BatimentService batimentService;
|
||||
private final SecteurService secteurService;
|
||||
private final ProfileRepository profileRepository;
|
||||
|
||||
|
||||
|
||||
@@ -187,6 +191,28 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByProfilPageableToDto(Long userId, Long quartierId, Long profilId, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
Page<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = Page.empty(pageable);
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
enqueteBatimentPayloadWebs=enqueteBatimentRepository.findAllEnqueteBatimentByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.EN_COURS,pageable);
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
enqueteBatimentPayloadWebs=enqueteBatimentRepository.findAllEnqueteBatimentByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.CONTROLE,pageable);
|
||||
}
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
@@ -213,6 +239,30 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment = enqueteBatimentRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteBatiment.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.REJETE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CONTROLE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteBatiment.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteBatiment enqueteBatiment = optionalEnqueteBatiment.get();
|
||||
enqueteBatiment.setDateValidation(LocalDate.now());
|
||||
enqueteBatiment.setStatutEnquete(StatutEnquete.CONTROLE);
|
||||
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
@@ -247,6 +297,19 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteBatimentPayloadWebs.add(controlerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteBatimentPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
|
||||
@@ -5,8 +5,10 @@ import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.enums.StatutEdeclarationPropriete;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.enums.UserProfile;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -23,6 +25,7 @@ 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.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
@@ -45,6 +48,7 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
private final UniteLogementService uniteLogementService ;
|
||||
private final SecteurService secteurService ;
|
||||
private final EdeclarationProprieteService edeclarationProprieteService ;
|
||||
private final ProfileRepository profileRepository ;
|
||||
|
||||
|
||||
|
||||
@@ -187,6 +191,25 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
return enqueteUniteLogementRepository.findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByProfilPageableToDto(Long userId, Long quartierId, Long profilId, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
Page<EnqueteUniteLogementPayloadWeb> uniteLogementPayloadWebs = Page.empty(pageable);
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
uniteLogementPayloadWebs=enqueteUniteLogementRepository.findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.EN_COURS,pageable);
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
uniteLogementPayloadWebs=enqueteUniteLogementRepository.findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(quartierId,secteurIds,StatutEnquete.CONTROLE,pageable);
|
||||
}
|
||||
}
|
||||
return uniteLogementPayloadWebs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
@@ -214,6 +237,29 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteUniteLogement.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.REJETE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CONTROLE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteUniteLogement.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteUniteLogement enqueteUniteLogement = optionalEnqueteUniteLogement.get();
|
||||
enqueteUniteLogement.setDateValidation(LocalDate.now());
|
||||
enqueteUniteLogement.setStatutEnquete(StatutEnquete.CONTROLE);
|
||||
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
@@ -248,6 +294,20 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteUniteLogementPayloadWebs.add(controlerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteUniteLogementPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
@@ -28,6 +29,7 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository;
|
||||
private final StructureService structureService;
|
||||
private final DonneesImpositionTfuService donneesImpositionTfuService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final EnqueteService enqueteService;
|
||||
|
||||
@@ -52,7 +54,8 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
List<StatusAvis> statusAvis= new ArrayList<>();
|
||||
statusAvis.add(StatusAvis.EN_COURS);
|
||||
statusAvis.add(StatusAvis.CLOTURE);
|
||||
statusAvis.add(StatusAvis.GENERATION_AUTORISE);
|
||||
statusAvis.add(StatusAvis.GENERE);
|
||||
statusAvis.add(StatusAvis.HOMOLOGUE);
|
||||
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu= impositionsTfuRepository.findDistinctByStructure_IdAndExercice_IdAndStatusAvisIn(impositionsTfuPaylaodWeb.getStructureId(),impositionsTfuPaylaodWeb.getExerciceId(),statusAvis);
|
||||
|
||||
@@ -113,6 +116,28 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
@Override
|
||||
public ImpositionsTfuPaylaodWeb autoriserGenerationImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
// if (impositionsTfuPaylaodWeb.getId() == null) {
|
||||
// throw new BadRequestException("Impossible de valider une imposition ayant un id null.");
|
||||
// }
|
||||
// if (!impositionsTfuRepository.existsById(impositionsTfuPaylaodWeb.getId())) {
|
||||
// throw new NotFoundException("Impossible de trouver l'imposition spécifiée dans notre base de données.");
|
||||
// }
|
||||
//
|
||||
// ImpositionsTfu impositionsTfu= entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
//
|
||||
// if(!impositionsTfu.getStatusAvis().equals(StatusAvis.CLOTURE)){
|
||||
// throw new NotFoundException("L'état actuel : "+impositionsTfu.getStatusAvis()+ " ne permet pas de passer à l'état Autorisé");
|
||||
// }
|
||||
// impositionsTfu.setDateGeneration(LocalDate.now());
|
||||
// impositionsTfu.setStatusAvis(StatusAvis.GENERATION_AUTORISE);
|
||||
// impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
// return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ImpositionsTfuPaylaodWeb homologuerImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
if (impositionsTfuPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de valider une imposition ayant un id null.");
|
||||
}
|
||||
@@ -122,12 +147,13 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
ImpositionsTfu impositionsTfu= entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
if(!impositionsTfu.getStatusAvis().equals(StatusAvis.CLOTURE)){
|
||||
if(!impositionsTfu.getStatusAvis().equals(StatusAvis.GENERE)){
|
||||
throw new NotFoundException("L'état actuel : "+impositionsTfu.getStatusAvis()+ " ne permet pas de passer à l'état Autorisé");
|
||||
}
|
||||
impositionsTfu.setDateGeneration(LocalDate.now());
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERATION_AUTORISE);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.HOMOLOGUE);
|
||||
impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
donneesImpositionTfuService.homologuer(impositionsTfu.getId());
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@@ -185,4 +211,9 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
System.out.println(structureIds.get(0));
|
||||
return impositionsTfuRepository.findByStructureIdsToDto(structureIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByStructureIdByStatut(Long structureId, StatusAvis statusAvis) {
|
||||
return impositionsTfuRepository.findByStructureIdByStatutToDto(structureId,statusAvis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ParticiperRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
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 ParticiperServiceImpl implements ParticiperService {
|
||||
|
||||
private final ParticiperRepository participerRepository;
|
||||
private final EquipeRepository equipeRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@Override
|
||||
public ParticiperPayloadWeb createParticiper(ParticiperPayloadWeb participerPaylaodWeb) throws BadRequestException {
|
||||
if (participerPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer ayant un id non null.");
|
||||
}
|
||||
if (participerPaylaodWeb.getEquipeId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
||||
}else {
|
||||
if(!equipeRepository.existsById(participerPaylaodWeb.getEquipeId()))
|
||||
throw new BadRequestException("Impossible de créer la participation: L'équipe doit être précisée.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (participerPaylaodWeb.getUserId() == null) {
|
||||
throw new BadRequestException("Impossible de créer la participation : Le participant doit être précisé.");
|
||||
}else {
|
||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
||||
}
|
||||
|
||||
if (participerRepository.existsByEquipeIdAndUserId(
|
||||
participerPaylaodWeb.getEquipeId(),
|
||||
participerPaylaodWeb.getUserId())) {
|
||||
throw new ApplicationException("Cet utilisateur participe déjà à cette équipe.");
|
||||
}
|
||||
|
||||
|
||||
Participer participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
||||
participer= participerRepository.save(participer);
|
||||
|
||||
return participerRepository.findPayloadById(participer.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticiperPayloadWeb updateParticiper(Long id,ParticiperPayloadWeb participerPaylaodWeb) throws NotFoundException {
|
||||
if (participerPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Participation non spécifiée");
|
||||
}
|
||||
if (!participerRepository.existsById(participerPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la participation.");
|
||||
}
|
||||
|
||||
if (participerPaylaodWeb.getEquipeId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
||||
}else {
|
||||
if(!equipeRepository.existsById(participerPaylaodWeb.getEquipeId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
||||
}
|
||||
|
||||
if (participerPaylaodWeb.getUserId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
||||
}else {
|
||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
||||
}
|
||||
Participer participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
||||
participer= participerRepository.save(participer);
|
||||
|
||||
return participerRepository.findPayloadById(participer.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteParticiper(Long id) throws NotFoundException {
|
||||
Optional<Participer> participerOptional = participerRepository.findById(id);
|
||||
if (participerOptional.isPresent()) {
|
||||
participerRepository.deleteById(participerOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le participer spécifié dans notre base de données.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParticiperPayloadWeb> getParticiperList(Pageable pageable) {
|
||||
return participerRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParticiperPayloadWeb> getParticiperList() {
|
||||
return participerRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParticiperPayloadWeb> getParticiperListByEquipePageable(Long equipeId, Pageable pageable) {
|
||||
return participerRepository.findAllPayloadByEquipeId(equipeId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParticiperPayloadWeb> getParticiperListByEquipe(Long equipeId) {
|
||||
return participerRepository.findAllPayloadByEquipeId(equipeId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<ParticiperPayloadWeb> getParticiperById(Long id) {
|
||||
if (participerRepository.existsById(id)) {
|
||||
return participerRepository.findPayloadById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la participation spécifiée dans la base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
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.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
|
||||
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;
|
||||
@@ -14,29 +19,36 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CampagneServiceImpl implements CampagneService {
|
||||
private final CampagneRepository campagneRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
public CampagneServiceImpl(CampagneRepository campagneRepository) {
|
||||
this.campagneRepository = campagneRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Campagne createCampagne(Campagne campagne) throws BadRequestException {
|
||||
if (campagne.getId() != null) {
|
||||
public CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException {
|
||||
if (campagnePayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
}
|
||||
return campagneRepository.save(campagne);
|
||||
|
||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
||||
campagne= campagneRepository.save(campagne);
|
||||
|
||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException {
|
||||
if (campagne.getId() == null) {
|
||||
public CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException {
|
||||
if (campagnePayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle campagne ayant un id null.");
|
||||
}
|
||||
if (!campagneRepository.existsById(campagne.getId())) {
|
||||
if (!campagneRepository.existsById(campagnePayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la campagne spécifiée dans notre base de données.");
|
||||
}
|
||||
return campagneRepository.save(campagne);
|
||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
||||
campagne= campagneRepository.save(campagne);
|
||||
|
||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,13 +61,13 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Page<Campagne> getCampagneList(Pageable pageable) {
|
||||
return campagneRepository.findAll(pageable);
|
||||
public Page<CampagnePayloadWeb> getCampagneList(Pageable pageable) {
|
||||
return campagneRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Campagne> getCampagneList() {
|
||||
return campagneRepository.findAll();
|
||||
public List<CampagnePayloadWeb> getCampagneList() {
|
||||
return campagneRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,8 +76,28 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Campagne> getCampagneById(Long id) {
|
||||
return campagneRepository.findById(id);
|
||||
public Optional<CampagnePayloadWeb> getCampagneById(Long id) {
|
||||
return campagneRepository.findPayloadById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId) {
|
||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId, Pageable pageable) {
|
||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId) {
|
||||
return campagneRepository.findAllPayloadByStructureId(structureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable) {
|
||||
return campagneRepository.findAllPayloadByStructureId(structureId,pageable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
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.paylaods.request.crudweb.CaracteristiquePayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CaracteristiqueRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -16,28 +19,36 @@ import java.util.Optional;
|
||||
public class CaracteristiqueServiceImpl implements CaracteristiqueService {
|
||||
|
||||
private final CaracteristiqueRepository caracteristiqueRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
public CaracteristiqueServiceImpl(CaracteristiqueRepository caracteristiqueRepository) {
|
||||
public CaracteristiqueServiceImpl(CaracteristiqueRepository caracteristiqueRepository, EntityFromPayLoadService entityFromPayLoadService) {
|
||||
this.caracteristiqueRepository = caracteristiqueRepository;
|
||||
this.entityFromPayLoadService = entityFromPayLoadService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Caracteristique createCaracteristique(Caracteristique caracteristique) throws BadRequestException {
|
||||
if (caracteristique.getId() != null) {
|
||||
public CaracteristiquePayloadWeb createCaracteristique(CaracteristiquePayloadWeb caracteristiquePayloadWeb) throws BadRequestException {
|
||||
if (caracteristiquePayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle caracteristique ayant un id non null.");
|
||||
}
|
||||
return caracteristiqueRepository.save(caracteristique);
|
||||
Caracteristique caracteristique = entityFromPayLoadService.getCaracteristiqueFromPayLoadWeb(caracteristiquePayloadWeb);
|
||||
caracteristique = caracteristiqueRepository.save(caracteristique);
|
||||
return caracteristiqueRepository.findPayloadById(caracteristique.getId()).orElse(null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Caracteristique updateCaracteristique(Long id, Caracteristique caracteristique) throws NotFoundException {
|
||||
if (caracteristique.getId() == null) {
|
||||
public CaracteristiquePayloadWeb updateCaracteristique(Long id, CaracteristiquePayloadWeb caracteristiquePayloadWeb) throws NotFoundException {
|
||||
if (caracteristiquePayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle caracteristique ayant un id null.");
|
||||
}
|
||||
if (!caracteristiqueRepository.existsById(caracteristique.getId())) {
|
||||
if (!caracteristiqueRepository.existsById(caracteristiquePayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans notre base de données.");
|
||||
}
|
||||
return caracteristiqueRepository.save(caracteristique);
|
||||
Caracteristique caracteristique = entityFromPayLoadService.getCaracteristiqueFromPayLoadWeb(caracteristiquePayloadWeb);
|
||||
caracteristique = caracteristiqueRepository.save(caracteristique);
|
||||
return caracteristiqueRepository.findPayloadById(caracteristique.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,20 +62,20 @@ public class CaracteristiqueServiceImpl implements CaracteristiqueService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Caracteristique> getCaracteristiqueList(Pageable pageable) {
|
||||
return caracteristiqueRepository.findAll(pageable);
|
||||
public List<CaracteristiquePayloadWeb> getCaracteristiqueList() {
|
||||
return caracteristiqueRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Caracteristique> getCaracteristiqueList() {
|
||||
return caracteristiqueRepository.findAll();
|
||||
public Page<CaracteristiquePayloadWeb> getCaracteristiqueListPage(Pageable pageable) {
|
||||
return caracteristiqueRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<Caracteristique> getCaracteristiqueById(Long id) {
|
||||
public Optional<CaracteristiquePayloadWeb> getCaracteristiqueById(Long id) {
|
||||
if (caracteristiqueRepository.existsById(id)) {
|
||||
return caracteristiqueRepository.findById(id);
|
||||
return caracteristiqueRepository.findPayloadById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans la base de données.");
|
||||
}
|
||||
|
||||
@@ -1,121 +1,131 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||
import io.gmss.fiscad.paylaods.request.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.paylaods.request.crudweb.EquipePayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class EquipeServiceImpl implements EquipeService {
|
||||
private final EquipeRepository equipeRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final BlocRepository blocRepository;
|
||||
private final SecteurRepository secteurRepository;
|
||||
private final CampagneRepository campagneRepository;
|
||||
|
||||
public EquipeServiceImpl(EquipeRepository equipeRepository, UserRepository userRepository, BlocRepository blocRepository, SecteurRepository secteurRepository, CampagneRepository campagneRepository) {
|
||||
this.equipeRepository = equipeRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.blocRepository = blocRepository;
|
||||
this.secteurRepository = secteurRepository;
|
||||
this.campagneRepository = campagneRepository;
|
||||
}
|
||||
|
||||
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final EquipeRepository equipeRepository;
|
||||
@Override
|
||||
public Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException {
|
||||
if (equipePayload.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle equipe ayant un id non null.");
|
||||
public EquipePayloadWeb create(EquipePayloadWeb equipePayloadWeb) {
|
||||
if (equipePayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle caracteristique ayant un id non null.");
|
||||
}
|
||||
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||
return equipeRepository.save(equipe);
|
||||
}
|
||||
|
||||
private Equipe getEquipeFromPayload(EquipePayload equipePayload) {
|
||||
Equipe equipe = new Equipe();
|
||||
Optional<Bloc> optionalBloc = blocRepository.findById(equipePayload.getBlocId());
|
||||
equipe.setBloc(optionalBloc.orElse(null));
|
||||
equipe.setId(equipePayload.getId());
|
||||
equipe.setCode(equipePayload.getCode());
|
||||
equipe.setNom(equipePayload.getNom());
|
||||
Optional<Secteur> optionalSecteur = secteurRepository.findById(equipePayload.getSecteurId());
|
||||
equipe.setSecteur(optionalSecteur.orElse(null));
|
||||
Optional<Campagne> optionalCampagne = campagneRepository.findById(equipePayload.getCampagneId());
|
||||
equipe.setCampagne(optionalCampagne.orElse(null));
|
||||
|
||||
List<Participer> participerList = new ArrayList<>();
|
||||
|
||||
for (ParticiperPayload pp : equipePayload.getParticiperPayloads()) {
|
||||
Participer part = new Participer();
|
||||
part.setId(pp.getId());
|
||||
if (pp.getEquipeId() != null && equipeRepository.existsById(equipe.getId())) {
|
||||
part.setEquipe(equipeRepository.findById(equipe.getId()).orElse(null));
|
||||
}
|
||||
if (pp.getUserId() != null && userRepository.existsById(pp.getUserId())) {
|
||||
part.setUser(userRepository.findById(pp.getUserId()).orElse(null));
|
||||
}
|
||||
part.setDateDebut(pp.getDateDebut());
|
||||
part.setDateFin(pp.getDateFin());
|
||||
participerList.add(part);
|
||||
}
|
||||
equipe.setParticipers(participerList);
|
||||
|
||||
return equipe;
|
||||
Equipe equipe = entityFromPayLoadService.getEquipeFromPayLoadWeb(equipePayloadWeb);
|
||||
equipe = equipeRepository.save(equipe);
|
||||
return equipeRepository.findPayloadById(equipe.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException {
|
||||
if (equipePayload.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle equipe ayant un id null.");
|
||||
public EquipePayloadWeb update(Long id, EquipePayloadWeb equipePayloadWeb) {
|
||||
if (equipePayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de faire la mise à jour: Equipe non fournie");
|
||||
}
|
||||
if (!equipeRepository.existsById(equipePayload.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la equipe spécifiée dans notre base de données.");
|
||||
Optional<Equipe> optionalEquipe=Optional.empty();
|
||||
if(!equipeRepository.existsById(equipePayloadWeb.getId())){
|
||||
throw new BadRequestException("Impossible de faire la mise à jour: Equipe non fournie");
|
||||
}
|
||||
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||
return equipeRepository.save(equipe);
|
||||
|
||||
Equipe equipe = entityFromPayLoadService.getEquipeFromPayLoadWeb(equipePayloadWeb);
|
||||
equipe = equipeRepository.save(equipe);
|
||||
return equipeRepository.findPayloadById(equipe.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEquipe(Long id) throws NotFoundException {
|
||||
Optional<Equipe> equipeOptional = equipeRepository.findById(id);
|
||||
if (equipeOptional.isPresent()) {
|
||||
equipeRepository.deleteById(equipeOptional.get().getId());
|
||||
public void delete(Long id) {
|
||||
Optional<Equipe> optionalEquipe = equipeRepository.findById(id);
|
||||
if (optionalEquipe.isPresent()) {
|
||||
equipeRepository.deleteById(optionalEquipe.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la equipe spécifiée dans notre base de données.");
|
||||
throw new NotFoundException("Impossible de trouver l'équipe spécifiée.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Equipe> getEquipeList(Pageable pageable) {
|
||||
return equipeRepository.findAll(pageable);
|
||||
public EquipePayloadWeb findById(Long id) {
|
||||
if (equipeRepository.existsById(id)) {
|
||||
return equipeRepository.findPayloadById(id).orElse(null);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans la base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Equipe> getEquipeList() {
|
||||
return equipeRepository.findAll();
|
||||
public List<EquipePayloadWeb> findAll() {
|
||||
return equipeRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EquipePayloadWeb> findAll(Pageable pageable) {
|
||||
return equipeRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Equipe> getEquipeById(Long id) {
|
||||
return equipeRepository.findById(id);
|
||||
public List<EquipePayloadWeb> findByCampagneId(Long campagneId) {
|
||||
return equipeRepository.findAllPayloadByCampagneId(campagneId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EquipePayloadWeb> findByCampagneId(Long campagneId, Pageable pageable) {
|
||||
return equipeRepository.findAllPayloadByCampagneId(campagneId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipePayloadWeb> findBySecteurId(Long secteurId) {
|
||||
return equipeRepository.findAllPayloadBySecteurId(secteurId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EquipePayloadWeb> findBySecteurId(Long secteurId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipePayloadWeb> findByQuartierId(Long quartierId) {
|
||||
return equipeRepository.findAllPayloadByQuartierId(quartierId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EquipePayloadWeb> findByQuartierId(Long quartierId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipePayloadWeb> findByBlocId(Long blocId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EquipePayloadWeb> findByBlocId(Long blocId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsById(Long id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByCode(String code) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Equipe> findEntityById(Long id) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
||||
@@ -22,8 +23,14 @@ public class ExerciceServiceImpl implements ExerciceService {
|
||||
|
||||
@Override
|
||||
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
||||
if (exercice.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
if (exercice.getId() == null) {
|
||||
if (exerciceRepository.existsByAnnee(exercice.getAnnee())) {
|
||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
||||
}
|
||||
} else {
|
||||
if (exerciceRepository.existsByAnneeAndIdNot(exercice.getAnnee(), exercice.getId())) {
|
||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
||||
}
|
||||
}
|
||||
return exerciceRepository.save(exercice);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package io.gmss.fiscad.implementations.statistiques;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.user.Profile;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.enums.UserProfile;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.fiscad.interfaces.user.UserService;
|
||||
@@ -15,6 +17,7 @@ import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
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.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -24,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
@@ -37,8 +41,9 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
private final SecteurService secteurService;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final ProfileRepository profileRepository;
|
||||
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository, SecteurService secteurService, EnqueteBatimentRepository enqueteBatimentRepository, EnqueteUniteLogementRepository enqueteUniteLogementRepository) {
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository, SecteurService secteurService, EnqueteBatimentRepository enqueteBatimentRepository, EnqueteUniteLogementRepository enqueteUniteLogementRepository, ProfileRepository profileRepository) {
|
||||
this.userService = userService;
|
||||
this.enqueteRepository = enqueteRepository;
|
||||
this.parcelleRepository = parcelleRepository;
|
||||
@@ -48,6 +53,7 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
this.secteurService = secteurService;
|
||||
this.enqueteBatimentRepository = enqueteBatimentRepository;
|
||||
this.enqueteUniteLogementRepository = enqueteUniteLogementRepository;
|
||||
this.profileRepository = profileRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,4 +135,28 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
return nombreEnquetesParObjet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnectProfil(Long userId, Long profilId) {
|
||||
NombreEnquetesParObjet nombreEnquetesParObjet= new NombreEnquetesParObjet();
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
Optional<Profile> optionalProfile= profileRepository.findProfileById(profilId);
|
||||
if(optionalProfile.isPresent()){
|
||||
if (optionalProfile.get().getNom().equals(UserProfile.GESSECTCHEF)){
|
||||
nombreEnquetesParObjet.setNombreEnqueteUniteLogement(enqueteUniteLogementRepository.getNombreEnqueteUniteLogementByUserConnecte(secteurIds,StatutEnquete.EN_COURS.toString()));
|
||||
nombreEnquetesParObjet.setNombreEnqueteParcelle(enqueteRepository.getNombreEnqueteByUserConnecte(secteurIds,StatutEnquete.EN_COURS.toString()));
|
||||
nombreEnquetesParObjet.setNombreEnqueteBatiment(enqueteBatimentRepository.getNombreEnqueteBatimentByUserConnecte(secteurIds,StatutEnquete.EN_COURS.toString()));
|
||||
|
||||
}else if(optionalProfile.get().getNom().equals(UserProfile.GESCHEF) || optionalProfile.get().getNom().equals(UserProfile.GESCENTRE)){
|
||||
nombreEnquetesParObjet.setNombreEnqueteUniteLogement(enqueteUniteLogementRepository.getNombreEnqueteUniteLogementByUserConnecte(secteurIds,StatutEnquete.CONTROLE.toString()));
|
||||
nombreEnquetesParObjet.setNombreEnqueteParcelle(enqueteRepository.getNombreEnqueteByUserConnecte(secteurIds,StatutEnquete.CONTROLE.toString()));
|
||||
nombreEnquetesParObjet.setNombreEnqueteBatiment(enqueteBatimentRepository.getNombreEnqueteBatimentByUserConnecte(secteurIds,StatutEnquete.CONTROLE.toString()));
|
||||
}
|
||||
}
|
||||
return nombreEnquetesParObjet;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.implementations.user;
|
||||
|
||||
import io.gmss.fiscad.entities.audit.HistoriqueConnexion;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.UserRole;
|
||||
@@ -14,6 +15,7 @@ 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.audit.HistoriqueConnexionRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||
import io.gmss.fiscad.security.TokenAuthentificationProvider;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
@@ -49,6 +51,7 @@ public class UserServiceImpl implements UserService {
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final StringService stringService ;
|
||||
private final MailService mailService ;
|
||||
private final HistoriqueConnexionRepository historiqueConnexionRepository ;
|
||||
|
||||
@Value("${dgi.sigibe-foncier.reset-pw.url}")
|
||||
private String reseturl ;
|
||||
@@ -56,9 +59,7 @@ public class UserServiceImpl implements UserService {
|
||||
@Value("${dgi.sigibe-foncier.reset-pw.token-delay}")
|
||||
private String tokenDelay ;
|
||||
|
||||
|
||||
|
||||
public UserServiceImpl(UserRepository userRepository, PasswordEncoder passwordEncoder, RoleService roleService, AuthenticationManager authenticationManager, TokenAuthentificationProvider tokenAuthentificationProvider, StructureService structureService, EntityFromPayLoadService entityFromPayLoadService, StringService stringService, MailService mailService) {
|
||||
public UserServiceImpl(UserRepository userRepository, PasswordEncoder passwordEncoder, RoleService roleService, AuthenticationManager authenticationManager, TokenAuthentificationProvider tokenAuthentificationProvider, StructureService structureService, EntityFromPayLoadService entityFromPayLoadService, StringService stringService, MailService mailService, HistoriqueConnexionRepository historiqueConnexionRepository) {
|
||||
this.userRepository = userRepository;
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.roleService = roleService;
|
||||
@@ -68,6 +69,7 @@ public class UserServiceImpl implements UserService {
|
||||
this.entityFromPayLoadService = entityFromPayLoadService;
|
||||
this.stringService = stringService;
|
||||
this.mailService = mailService;
|
||||
this.historiqueConnexionRepository = historiqueConnexionRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +123,13 @@ public class UserServiceImpl implements UserService {
|
||||
);
|
||||
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
HistoriqueConnexion historiqueConnexion = new HistoriqueConnexion();
|
||||
|
||||
historiqueConnexion.setDateConnexion(LocalDateTime.now());
|
||||
historiqueConnexion.setUser(user);
|
||||
historiqueConnexionRepository.save(historiqueConnexion);
|
||||
|
||||
return tokenAuthentificationProvider.generateToken(authentication);
|
||||
}
|
||||
|
||||
@@ -128,9 +137,10 @@ public class UserServiceImpl implements UserService {
|
||||
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
||||
|
||||
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
||||
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||
&& (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
||||
}
|
||||
|
||||
if (userPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
||||
}
|
||||
@@ -369,6 +379,11 @@ public class UserServiceImpl implements UserService {
|
||||
return !isTokenExpired(tokenDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserPaylaodWeb> getUsersByFonctionId(Long fonctionId) {
|
||||
return userRepository.findAllUserByFonctionToDto(fonctionId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calcule la date d'expiration du token en ajoutant 24h à sa date de génération.
|
||||
@@ -393,9 +408,7 @@ public class UserServiceImpl implements UserService {
|
||||
if (dateToken == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LocalDateTime dateExpiration = calculerDateExpiration(dateToken);
|
||||
|
||||
return LocalDateTime.now().isAfter(dateExpiration);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package io.gmss.fiscad.interfaces.audit;
|
||||
|
||||
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 io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface HistoriqueConnexionService {
|
||||
List<HistoriqueConnexionPaylaodWeb> gethistoriqueConnexionListByUserIdPage(Long UserId);
|
||||
}
|
||||
@@ -12,9 +12,9 @@ import java.util.Optional;
|
||||
|
||||
public interface QuartierService {
|
||||
|
||||
Quartier createQuartier(Quartier quartier) throws BadRequestException;
|
||||
QuartierPaylaodWeb createQuartier(QuartierPaylaodWeb quartierPaylaodWeb) throws BadRequestException;
|
||||
|
||||
Quartier updateQuartier(Long id, Quartier quartier) throws NotFoundException;
|
||||
QuartierPaylaodWeb updateQuartier(Long id, QuartierPaylaodWeb quartierPaylaodWeb) throws NotFoundException;
|
||||
|
||||
void deleteQuartier(Long id) throws NotFoundException;
|
||||
|
||||
|
||||
@@ -34,8 +34,11 @@ public interface SecteurDecoupageService {
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserIdByProfilId(Long userId, Long profilId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserIdByProfilId(Long userId, Long profilId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserIdByProfilId(Long userId, Long profilId ) ;
|
||||
|
||||
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatDeclarationProprieteByUserId(Long userId, String statutDeclcarationPropriete) ;
|
||||
|
||||
@@ -41,10 +41,12 @@ public interface EnqueteService {
|
||||
Optional<EnquetePayLoadWeb> getEnqueteById(Long id);
|
||||
|
||||
EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnquetePayLoadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnquetePayLoadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
@@ -65,5 +67,6 @@ public interface EnqueteService {
|
||||
|
||||
|
||||
Page<EnquetePayLoadWeb> getEnqueteListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
Page<EnquetePayLoadWeb> getEnqueteListByQuartierByProfilByStatutPageableToDto(Long userId, Long quartierId, Long profilId,Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.infocad.parametre;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,15 +12,15 @@ import java.util.Optional;
|
||||
|
||||
public interface ModeAcquisitionService {
|
||||
|
||||
ModeAcquisition createModeAcquisition(ModeAcquisition modeAcquisition) throws BadRequestException;
|
||||
ModeAcquisitionPayloadWeb createModeAcquisition(ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) throws BadRequestException;
|
||||
|
||||
ModeAcquisition updateModeAcquisition(Long id, ModeAcquisition modeAcquisition) throws NotFoundException;
|
||||
ModeAcquisitionPayloadWeb updateModeAcquisition(Long id, ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteModeAcquisition(Long id) throws NotFoundException;
|
||||
|
||||
Page<ModeAcquisition> getModeAcquisitionList(Pageable pageable);
|
||||
Page<ModeAcquisitionPayloadWeb> getModeAcquisitionList(Pageable pageable);
|
||||
|
||||
List<ModeAcquisition> getModeAcquisitionList();
|
||||
List<ModeAcquisitionPayloadWeb> getModeAcquisitionList();
|
||||
|
||||
Optional<ModeAcquisition> getModeAcquisitionById(Long id);
|
||||
Optional<ModeAcquisitionPayloadWeb> getModeAcquisitionById(Long id);
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@ public interface StructureService {
|
||||
|
||||
|
||||
public List<Structure> getListStructureUserId(Long userId) ;
|
||||
public List<StructurePaylaodWeb> getListStructureAvoirFonctionId(Long avoirFonctionId) ;
|
||||
|
||||
}
|
||||
|
||||
@@ -51,4 +51,11 @@ public interface DonneesImpositionTfuService {
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId);
|
||||
|
||||
|
||||
//List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByParcelleIdAndExercice(Long parcelleId, Long exerciceId);
|
||||
Integer setDonneesFiscalesNonHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs);
|
||||
Integer setDonneesFiscalesHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesHomologable(Long impositionTfuId,Pageable pageable);
|
||||
|
||||
public Integer homologuer(Long impositionTfuId);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,15 @@ public interface EnqueteBatimentService {
|
||||
List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId);
|
||||
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByProfilPageableToDto(Long userId, Long quartierId, Long profilId, Pageable pageable);
|
||||
|
||||
EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnqueteBatimentPayloadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnqueteBatimentPayloadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
|
||||
@@ -32,12 +32,15 @@ public interface EnqueteUniteLogementService {
|
||||
Optional<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementById(Long enqueteUniteLogement);
|
||||
|
||||
Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByProfilPageableToDto(Long userId, Long quartierId, Long profilId, Pageable pageable);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnqueteUniteLogementPayloadWeb controlerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnqueteUniteLogementPayloadWeb> controlerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
@@ -16,6 +17,7 @@ public interface ImpositionsTfuService {
|
||||
ImpositionsTfuPaylaodWeb rejeterImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb cloturerImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb autoriserGenerationImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb homologuerImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
|
||||
ImpositionsTfuPaylaodWeb updateImpositionsTfu(Long id, ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws NotFoundException;
|
||||
|
||||
@@ -27,4 +29,5 @@ public interface ImpositionsTfuService {
|
||||
|
||||
Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id);
|
||||
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId);
|
||||
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByStructureIdByStatut(Long structureId, StatusAvis statusAvis);
|
||||
}
|
||||
|
||||
30
src/main/java/io/gmss/fiscad/interfaces/rfu/metier/ParticiperService.java
Executable file
30
src/main/java/io/gmss/fiscad/interfaces/rfu/metier/ParticiperService.java
Executable file
@@ -0,0 +1,30 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParticiperService {
|
||||
|
||||
ParticiperPayloadWeb createParticiper(ParticiperPayloadWeb participerPayloadWeb) throws BadRequestException;
|
||||
|
||||
ParticiperPayloadWeb updateParticiper(Long id,ParticiperPayloadWeb participerPayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteParticiper(Long id) throws NotFoundException;
|
||||
|
||||
Page<ParticiperPayloadWeb> getParticiperList(Pageable pageable);
|
||||
|
||||
List<ParticiperPayloadWeb> getParticiperList();
|
||||
|
||||
Page<ParticiperPayloadWeb> getParticiperListByEquipePageable(Long equipeId, Pageable pageable);
|
||||
|
||||
List<ParticiperPayloadWeb> getParticiperListByEquipe(Long equipeId);
|
||||
|
||||
Optional<ParticiperPayloadWeb> getParticiperById(Long id);
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -12,18 +13,23 @@ import java.util.Optional;
|
||||
|
||||
public interface CampagneService {
|
||||
|
||||
Campagne createCampagne(Campagne campagne) throws BadRequestException;
|
||||
CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException;
|
||||
|
||||
Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException;
|
||||
CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteCampagne(Long id) throws NotFoundException;
|
||||
|
||||
Page<Campagne> getCampagneList(Pageable pageable);
|
||||
Page<CampagnePayloadWeb> getCampagneList(Pageable pageable);
|
||||
|
||||
List<Campagne> getCampagneList();
|
||||
List<CampagnePayloadWeb> getCampagneList();
|
||||
|
||||
List<Campagne> getCampagnesByType(TypeCampagne typeCampagne);
|
||||
|
||||
Optional<Campagne> getCampagneById(Long id);
|
||||
Optional<CampagnePayloadWeb> getCampagneById(Long id);
|
||||
List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId);
|
||||
Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId,Pageable pageable);
|
||||
List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId);
|
||||
Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,15 +12,16 @@ import java.util.Optional;
|
||||
|
||||
public interface CaracteristiqueService {
|
||||
|
||||
Caracteristique createCaracteristique(Caracteristique caracteristique) throws BadRequestException;
|
||||
CaracteristiquePayloadWeb createCaracteristique(CaracteristiquePayloadWeb caracteristiquePayloadWeb) throws BadRequestException;
|
||||
|
||||
Caracteristique updateCaracteristique(Long id, Caracteristique caracteristique) throws NotFoundException;
|
||||
CaracteristiquePayloadWeb updateCaracteristique(Long id, CaracteristiquePayloadWeb caracteristiquePayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteCaracteristique(Long id) throws NotFoundException;
|
||||
|
||||
Page<Caracteristique> getCaracteristiqueList(Pageable pageable);
|
||||
Page<CaracteristiquePayloadWeb> getCaracteristiqueListPage(Pageable pageable);
|
||||
List<CaracteristiquePayloadWeb> getCaracteristiqueList();
|
||||
|
||||
List<Caracteristique> getCaracteristiqueList();
|
||||
//List<CaracteristiquePayloadWeb> getCaracteristiqueListByTypeImmeuble(Long typeImmeubleId);
|
||||
|
||||
Optional<Caracteristique> getCaracteristiqueById(Long id);
|
||||
Optional<CaracteristiquePayloadWeb> getCaracteristiqueById(Long id);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -12,16 +13,42 @@ import java.util.Optional;
|
||||
|
||||
public interface EquipeService {
|
||||
|
||||
Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException;
|
||||
// CRUD
|
||||
EquipePayloadWeb create(EquipePayloadWeb payload);
|
||||
|
||||
Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException;
|
||||
EquipePayloadWeb update(Long id, EquipePayloadWeb payload);
|
||||
|
||||
void deleteEquipe(Long id) throws NotFoundException;
|
||||
void delete(Long id);
|
||||
|
||||
Page<Equipe> getEquipeList(Pageable pageable);
|
||||
// Recherche
|
||||
EquipePayloadWeb findById(Long id);
|
||||
|
||||
List<Equipe> getEquipeList();
|
||||
List<EquipePayloadWeb> findAll();
|
||||
|
||||
Optional<Equipe> getEquipeById(Long id);
|
||||
Page<EquipePayloadWeb> findAll(Pageable pageable);
|
||||
|
||||
// Filtres
|
||||
List<EquipePayloadWeb> findByCampagneId(Long campagneId);
|
||||
|
||||
Page<EquipePayloadWeb> findByCampagneId(Long campagneId, Pageable pageable);
|
||||
|
||||
List<EquipePayloadWeb> findBySecteurId(Long secteurId);
|
||||
|
||||
Page<EquipePayloadWeb> findBySecteurId(Long secteurId, Pageable pageable);
|
||||
|
||||
List<EquipePayloadWeb> findByQuartierId(Long quartierId);
|
||||
|
||||
Page<EquipePayloadWeb> findByQuartierId(Long quartierId, Pageable pageable);
|
||||
|
||||
List<EquipePayloadWeb> findByBlocId(Long blocId);
|
||||
|
||||
Page<EquipePayloadWeb> findByBlocId(Long blocId, Pageable pageable);
|
||||
|
||||
// Vérifications
|
||||
boolean existsById(Long id);
|
||||
|
||||
boolean existsByCode(String code);
|
||||
|
||||
Optional<Equipe> findEntityById(Long id);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,4 +12,5 @@ public interface StatistiquesService {
|
||||
StatNombreTotalObjet getStatNombreTotalObjet(String codeDecoupageAdmin);
|
||||
List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie();
|
||||
NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete);
|
||||
NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnectProfil(Long userId, Long profilId);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface UserService {
|
||||
|
||||
Boolean validationTokenResetPassword(String token);
|
||||
|
||||
List<UserPaylaodWeb> getUsersByFonctionId(Long fonctionId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class CampagnePayloadWeb {
|
||||
|
||||
private Long id;
|
||||
private String refAdministrative;
|
||||
private String nom;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeCampagne typeCampagne;
|
||||
private Long exerciceId ;
|
||||
private Integer exerciceAnnee ;
|
||||
|
||||
private Long structureId ;
|
||||
private String structureCode ;
|
||||
private String structureNom ;
|
||||
|
||||
public CampagnePayloadWeb(Long id, String refAdministrative, String nom, LocalDate dateDebut, LocalDate dateFin, TypeCampagne typeCampagne, Long exerciceId, Integer exerciceAnnee, Long structureId, String structureCode, String structureNom) {
|
||||
this.id = id;
|
||||
this.refAdministrative = refAdministrative;
|
||||
this.nom = nom;
|
||||
this.dateDebut = dateDebut;
|
||||
this.dateFin = dateFin;
|
||||
this.typeCampagne = typeCampagne;
|
||||
this.exerciceId = exerciceId;
|
||||
this.exerciceAnnee = exerciceAnnee;
|
||||
this.structureId = structureId;
|
||||
this.structureCode = structureCode;
|
||||
this.structureNom = structureNom;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.TypeCaracteristique;
|
||||
import io.gmss.fiscad.enums.TypeImmeuble;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class CaracteristiquePayloadWeb {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String libelle;
|
||||
private boolean actif;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeImmeuble typeImmeuble;
|
||||
private Long typeCaracteristiqueId;
|
||||
private String typeCaracteristiqueCode;
|
||||
private String typeCaracteristiqueLibelle;
|
||||
|
||||
public CaracteristiquePayloadWeb(Long id, String code, String libelle, boolean actif, TypeImmeuble typeImmeuble, Long typeCaracteristiqueId, String typeCaracteristiqueCode, String typeCaracteristiqueLibelle) {
|
||||
this.id = id;
|
||||
this.code = code;
|
||||
this.libelle = libelle;
|
||||
this.actif = actif;
|
||||
this.typeImmeuble = typeImmeuble;
|
||||
this.typeCaracteristiqueId = typeCaracteristiqueId;
|
||||
this.typeCaracteristiqueCode = typeCaracteristiqueCode;
|
||||
this.typeCaracteristiqueLibelle = typeCaracteristiqueLibelle;
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,7 @@ public class DonneesImpositionPaylaodWeb {
|
||||
private Long valeurLocativeAdmMetreCarre;
|
||||
private Long valeurAdminParcelleNbMetreCarre;
|
||||
private Float montantTaxe;
|
||||
private Boolean homologable ;
|
||||
|
||||
public DonneesImpositionPaylaodWeb(Long id,
|
||||
Long annee,
|
||||
@@ -135,7 +136,8 @@ public class DonneesImpositionPaylaodWeb {
|
||||
Long valeurParcelle,
|
||||
Long valeurLocativeAdmMetreCarre,
|
||||
Long valeurAdministrativeParcelleNonBatiAuMetreCarre,
|
||||
Float montantTaxe
|
||||
Float montantTaxe,
|
||||
Boolean homologable
|
||||
) {
|
||||
this.id = id;
|
||||
this.annee = annee;
|
||||
@@ -197,5 +199,6 @@ public class DonneesImpositionPaylaodWeb {
|
||||
this.valeurLocativeAdmMetreCarre = valeurLocativeAdmMetreCarre;
|
||||
this.valeurAdminParcelleNbMetreCarre = valeurAdministrativeParcelleNonBatiAuMetreCarre;
|
||||
this.montantTaxe = montantTaxe;
|
||||
this.homologable = homologable == null || homologable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class EnquetePayLoadWeb {
|
||||
private Long zoneRfuId;
|
||||
private String zoneRfuNom;
|
||||
private Long personneId;
|
||||
private String personneIfu;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class EquipePayloadWeb {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
|
||||
private Long blocId;
|
||||
private String blocCode;
|
||||
|
||||
private Long secteurId;
|
||||
private String secteurCode;
|
||||
private String secteurNom;
|
||||
|
||||
private Long campagneId;
|
||||
private String campagneNom;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Long quartierId;
|
||||
private String quartierCode;
|
||||
private String quartierNom;
|
||||
|
||||
|
||||
public EquipePayloadWeb(Long id, String code, String nom, Long blocId, String blocCode, Long secteurId, String secteurCode, String secteurNom, Long campagneId, String campagneNom, LocalDate dateDebut, LocalDate dateFin, Long quartierId, String quartierCode, String quartierNom) {
|
||||
this.id = id;
|
||||
this.code = code;
|
||||
this.nom = nom;
|
||||
this.blocId = blocId;
|
||||
this.blocCode = blocCode;
|
||||
this.secteurId = secteurId;
|
||||
this.secteurCode = secteurCode;
|
||||
this.secteurNom = secteurNom;
|
||||
this.campagneId = campagneId;
|
||||
this.campagneNom = campagneNom;
|
||||
this.dateDebut = dateDebut;
|
||||
this.dateFin = dateFin;
|
||||
this.quartierId = quartierId;
|
||||
this.quartierCode = quartierCode;
|
||||
this.quartierNom = quartierNom;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class HistoriqueConnexionPaylaodWeb {
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDateTime dateConnexion;
|
||||
private Long userId;
|
||||
private String userLogin;
|
||||
private String userNom;
|
||||
private String userPrenom;
|
||||
|
||||
public HistoriqueConnexionPaylaodWeb(Long id, LocalDateTime dateConnexion, Long userId, String userLogin, String userNom, String userPrenom) {
|
||||
this.id = id;
|
||||
this.dateConnexion = dateConnexion;
|
||||
this.userId = userId;
|
||||
this.userLogin = userLogin;
|
||||
this.userNom = userNom;
|
||||
this.userPrenom = userPrenom;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import io.gmss.fiscad.enums.StatusAvis;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.TypePersonne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ModeAcquisitionPayloadWeb {
|
||||
private Long id;
|
||||
private String libelle;
|
||||
|
||||
public ModeAcquisitionPayloadWeb(Long id, String libelle) {
|
||||
this.id = id;
|
||||
this.libelle = libelle;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ParticiperPayloadWeb {
|
||||
private Long id;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Long equipeId;
|
||||
private String equipeCode;
|
||||
private String equipeNom;
|
||||
|
||||
private Long userId;
|
||||
private String userNom;
|
||||
private String userPrenom;
|
||||
|
||||
public ParticiperPayloadWeb(Long id, LocalDate dateDebut, LocalDate dateFin, Long equipeId, String equipeCode, String equipeNom, Long userId, String userNom, String userPrenom) {
|
||||
this.id = id;
|
||||
this.dateDebut = dateDebut;
|
||||
this.dateFin = dateFin;
|
||||
this.equipeId = equipeId;
|
||||
this.equipeCode = equipeCode;
|
||||
this.equipeNom = equipeNom;
|
||||
this.userId = userId;
|
||||
this.userNom = userNom;
|
||||
this.userPrenom = userPrenom;
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,5 @@ public class ProfilePaylaodWeb {
|
||||
private UserProfile nom ;
|
||||
private String description;
|
||||
private Set<Role> roles;
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class UserPaylaodWeb {
|
||||
private Long structureId;
|
||||
private String structureCode;
|
||||
private String structureNom;
|
||||
private Boolean actif;
|
||||
private Boolean active;
|
||||
private Boolean resetPassword;
|
||||
|
||||
public UserPaylaodWeb(Long id,
|
||||
@@ -36,7 +36,7 @@ public class UserPaylaodWeb {
|
||||
Long structureId,
|
||||
String structureCode,
|
||||
String structureNom,
|
||||
Boolean actif,
|
||||
Boolean active,
|
||||
Boolean resetPassword) {
|
||||
this.id = id;
|
||||
this.nom = nom;
|
||||
@@ -47,7 +47,7 @@ public class UserPaylaodWeb {
|
||||
this.structureId = structureId;
|
||||
this.structureCode = structureCode;
|
||||
this.structureNom = structureNom;
|
||||
this.actif = actif;
|
||||
this.active = active;
|
||||
this.resetPassword = resetPassword;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ public class ParcelleRepositoryCustomImpl implements ParcelleRepositoryCustom {
|
||||
r.numero as rueNumero,
|
||||
r.nom as rueNom,
|
||||
|
||||
pers.id as personneId,
|
||||
pers.ifu as ifu,
|
||||
pers.npi as npi,
|
||||
pers.nom as nom,
|
||||
pers.prenom as prenom,
|
||||
pers.raison_sociale as raisonSociale,
|
||||
pers.id as proprietaireId,
|
||||
pers.ifu as proprietaireIfu,
|
||||
pers.npi as proprietaireNpi,
|
||||
pers.nom as proprietaireNom,
|
||||
pers.prenom as proprietairePrenom,
|
||||
pers.raison_sociale as proprietaireRaisonSociale,
|
||||
|
||||
de.id as enqueteCouranteId
|
||||
|
||||
|
||||
@@ -1,75 +1,3 @@
|
||||
----------------
|
||||
/*
|
||||
create or replace view e_avis_view as
|
||||
WITH first_parcelle_imposition AS (
|
||||
SELECT DISTINCT ON (personne_id)
|
||||
personne_id,
|
||||
parcelle_id
|
||||
FROM donnees_imposition_tfu
|
||||
ORDER BY personne_id, annee,parcelle_id
|
||||
),
|
||||
cca_unique AS (
|
||||
SELECT DISTINCT ON (cc.commune_id, cc.personne_id)
|
||||
cc.structure_id,
|
||||
cc.personne_id,
|
||||
cc.commune_id,
|
||||
COALESCE(qu.code, qu_imp.code) AS r_quartier_contact,
|
||||
COALESCE(parc.q, parc_imp.q) AS q_contact,
|
||||
COALESCE(parc.i, parc_imp.i) AS i_contact,
|
||||
COALESCE(parc.p, parc_imp.p) AS p_contact
|
||||
|
||||
FROM commune_centre_assignation cc
|
||||
|
||||
LEFT JOIN parcelle parc
|
||||
ON parc.id = cc.parcelle_id
|
||||
|
||||
LEFT JOIN quartier qu
|
||||
ON qu.id = parc.quartier_id
|
||||
|
||||
LEFT JOIN first_parcelle_imposition dpi
|
||||
ON dpi.personne_id = cc.personne_id
|
||||
|
||||
LEFT JOIN parcelle parc_imp
|
||||
ON parc_imp.id = dpi.parcelle_id
|
||||
|
||||
LEFT JOIN quartier qu_imp
|
||||
ON qu_imp.id = parc_imp.quartier_id
|
||||
ORDER BY cc.commune_id, cc.personne_id, cc.structure_id
|
||||
)
|
||||
SELECT distinct
|
||||
null as id_avis,
|
||||
concat(c.code,'-',dimp.ifu,'-',exo.annee) as r_avis,
|
||||
exo.annee as exercice,
|
||||
c.code as r_commune,
|
||||
st.code as r_centre_impot,
|
||||
dimp.personne_id as id_contribuable_foncier,
|
||||
dimp.ifu as ifu,
|
||||
dimp.npi as npi,
|
||||
dimp.ifu as nc,
|
||||
dimp.raison_sociale as raison_sociale,
|
||||
dimp.nom_prop as nom ,
|
||||
dimp.prenom_prop as prenom,
|
||||
imp.date_generation as date_liquidation,
|
||||
current_date as date_information,
|
||||
cca.r_quartier_contact,
|
||||
cca.q_contact,
|
||||
cca.i_contact,
|
||||
cca.p_contact
|
||||
FROM impositions_tfu imp
|
||||
INNER JOIN donnees_imposition_tfu dimp
|
||||
ON dimp.impositions_tfu_id = imp.id
|
||||
LEFT JOIN exercice exo
|
||||
ON exo.id = imp.exercice_id
|
||||
LEFT JOIN commune c
|
||||
ON c.id = imp.commune_id
|
||||
LEFT JOIN cca_unique cca
|
||||
ON cca.personne_id = dimp.personne_id
|
||||
AND cca.commune_id = imp.commune_id
|
||||
LEFT JOIN structure st
|
||||
ON st.id = cca.structure_id
|
||||
order by c.code,st.code,r_quartier_contact,i_contact,p_contact; */
|
||||
|
||||
|
||||
create or replace view e_avis_view as
|
||||
WITH first_parcelle_imposition AS (
|
||||
SELECT DISTINCT ON (personne_id)
|
||||
@@ -193,6 +121,10 @@ FROM impositions_tfu imp
|
||||
order by exo.annee,dimp.parcelle_id,dimp.nature_impot, dimp.montant_taxe-coalesce(dimp.acompte,0)-coalesce(dimp.retenu_irf,0) desc ;
|
||||
|
||||
|
||||
select * from e_avis_view
|
||||
|
||||
select *
|
||||
from impositions_tfu;
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
|
||||
@@ -1,289 +1,3 @@
|
||||
/*CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_batie(
|
||||
p_impositions_tfu_id BIGINT,
|
||||
p_user_id BIGINT
|
||||
)
|
||||
RETURNS INTEGER
|
||||
LANGUAGE plpgsql
|
||||
AS
|
||||
$$
|
||||
DECLARE
|
||||
v_rows_inserted INTEGER;
|
||||
v_annee BIGINT;
|
||||
v_structure_id BIGINT;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
v_taux_irf NUMERIC;
|
||||
BEGIN
|
||||
|
||||
-- récupération de l'année
|
||||
SELECT ex.annee, it.structure_id
|
||||
INTO STRICT v_annee, v_structure_id
|
||||
FROM impositions_tfu it
|
||||
join exercice ex on ex.id =it.exercice_id
|
||||
WHERE it.id = p_impositions_tfu_id;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_irf
|
||||
from parameters
|
||||
where name ='TAUX_IRF';
|
||||
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
INSERT INTO donnees_imposition_tfu(
|
||||
annee,
|
||||
code_departement,
|
||||
nom_departement,
|
||||
code_commune,
|
||||
nom_commune,
|
||||
code_arrondissement,
|
||||
nom_arrondissement,
|
||||
code_quartier_village,
|
||||
nom_quartier_village,
|
||||
q,
|
||||
ilot,
|
||||
parcelle,
|
||||
nup,
|
||||
titre_foncier,
|
||||
num_batiment,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
SELECT
|
||||
v_annee,
|
||||
d.code,
|
||||
d.nom,
|
||||
c.code,
|
||||
c.nom,
|
||||
a.code,
|
||||
a.nom,
|
||||
q.code,
|
||||
q.nom,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
ep.numero_titre_foncier,
|
||||
b.nub,
|
||||
pers.ifu,
|
||||
pers.npi,
|
||||
pers.tel1,
|
||||
pers.email,
|
||||
pers.nom,
|
||||
pers.prenom,
|
||||
pers.raison_sociale,
|
||||
pers.adresse,
|
||||
ep.representant_tel,
|
||||
ep.representant_nom,
|
||||
ep.representant_prenom,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
eb.nombre_piscine,
|
||||
eb.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'IRF',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
case -------valeur_batiment
|
||||
WHEN eb.valeur_batiment_reel IS NOT NULL AND eb.valeur_batiment_reel <> 0 THEN eb.valeur_batiment_reel
|
||||
WHEN eb.valeur_batiment_calcule IS NOT NULL AND eb.valeur_batiment_calcule <> 0 THEN eb.valeur_batiment_calcule
|
||||
WHEN eb.valeur_batiment_estime IS NOT NULL AND eb.valeur_batiment_estime <> 0 THEN eb.valeur_batiment_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
case ----- montant_loyer_annuel
|
||||
WHEN eb.montant_locatif_annuel_declare IS NOT NULL AND eb.montant_locatif_annuel_declare <> 0 THEN eb.montant_locatif_annuel_declare
|
||||
WHEN eb.montant_locatif_annuel_calcule IS NOT NULL AND eb.montant_locatif_annuel_calcule <> 0 THEN eb.montant_locatif_annuel_calcule
|
||||
WHEN eb.montant_locatif_annuel_estime IS NOT NULL AND eb.montant_locatif_annuel_estime <> 0 THEN eb.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date ,
|
||||
p_user_id ,
|
||||
'FISCAD',
|
||||
current_date ,
|
||||
p_user_id,
|
||||
eb.categorie_usage,
|
||||
p.superficie*v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
(p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative,
|
||||
0,
|
||||
eb.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
v_taux_irf,
|
||||
p.id,
|
||||
b.id,
|
||||
null,
|
||||
eb.superficie_louee
|
||||
FROM parcelle p
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT ON (parcelle_id)
|
||||
parcelle_id,
|
||||
superficie,
|
||||
personne_id,
|
||||
numero_titre_foncier,
|
||||
date_enquete,
|
||||
representant_tel,
|
||||
representant_nom,
|
||||
representant_prenom,
|
||||
representant_npi,
|
||||
date_debut_exemption,
|
||||
date_fin_exemption,
|
||||
zone_rfu_id
|
||||
FROM enquete
|
||||
ORDER BY parcelle_id, date_enquete DESC, id DESC
|
||||
) ep ON ep.parcelle_id = p.id
|
||||
LEFT JOIN personne pers
|
||||
ON pers.id = ep.personne_id
|
||||
JOIN quartier q ON q.id = p.quartier_id
|
||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||
JOIN commune c ON c.id = a.commune_id
|
||||
JOIN departement d ON d.id = c.departement_id
|
||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||
JOIN section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage,
|
||||
superficie_louee
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
where superficie_louee*montant_locatif_annuel_declare>0
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eb.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm=montant_loyer_annuel,
|
||||
montant_taxe = montant_loyer_annuel * v_taux_irf/100
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;*/
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_batie(
|
||||
p_impositions_tfu_id BIGINT,
|
||||
p_user_id BIGINT
|
||||
|
||||
@@ -1,347 +1,3 @@
|
||||
/*CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_batie_unite_logement(
|
||||
p_impositions_tfu_id BIGINT,
|
||||
p_user_id BIGINT
|
||||
)
|
||||
RETURNS INTEGER
|
||||
LANGUAGE plpgsql
|
||||
AS
|
||||
$$
|
||||
DECLARE
|
||||
v_rows_inserted INTEGER;
|
||||
v_annee BIGINT;
|
||||
v_structure_id BIGINT;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_irf NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
BEGIN
|
||||
|
||||
-- récupération de l'année
|
||||
SELECT ex.annee, it.structure_id
|
||||
INTO STRICT v_annee, v_structure_id
|
||||
FROM impositions_tfu it
|
||||
join exercice ex on ex.id =it.exercice_id
|
||||
WHERE it.id = p_impositions_tfu_id;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_irf
|
||||
from parameters
|
||||
where name ='TAUX_IRF';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
INSERT INTO donnees_imposition_tfu(
|
||||
annee,
|
||||
code_departement,
|
||||
nom_departement,
|
||||
code_commune,
|
||||
nom_commune,
|
||||
code_arrondissement,
|
||||
nom_arrondissement,
|
||||
code_quartier_village,
|
||||
nom_quartier_village,
|
||||
q,
|
||||
ilot,
|
||||
parcelle,
|
||||
nup,
|
||||
titre_foncier,
|
||||
num_batiment,
|
||||
num_unite_logement,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
unite_logement_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
superficie_au_sol_ulog,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
SELECT
|
||||
v_annee,
|
||||
d.code,
|
||||
d.nom,
|
||||
c.code,
|
||||
c.nom,
|
||||
a.code,
|
||||
a.nom,
|
||||
q.code,
|
||||
q.nom,
|
||||
p.q,
|
||||
p.i,
|
||||
p.p,
|
||||
p.nup,
|
||||
ep.numero_titre_foncier,
|
||||
b.nub,
|
||||
ul.nul,
|
||||
eul.ifu,
|
||||
eul.npi,
|
||||
eul.tel1,
|
||||
eul.email,
|
||||
eul.nom,
|
||||
eul.prenom,
|
||||
eul.raison_sociale,
|
||||
eul.adresse,
|
||||
eul.representant_tel,
|
||||
eul.representant_nom,
|
||||
eul.representant_prenom,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eul.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(eul.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
CASE
|
||||
WHEN eul.nombre_piscine is null then 0
|
||||
else eul.nombre_piscine
|
||||
END,
|
||||
eul.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'IRF',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
eul.superficie_au_sol,
|
||||
CASE -------valeur_batiment
|
||||
WHEN eul.valeur_unite_logement_reel IS NOT NULL AND eul.valeur_unite_logement_reel <> 0 THEN eul.valeur_unite_logement_reel
|
||||
WHEN eul.valeur_unite_logement_calcule IS NOT NULL AND eul.valeur_unite_logement_calcule <> 0 THEN eul.valeur_unite_logement_calcule
|
||||
WHEN eul.valeur_unite_logement_estime IS NOT NULL AND eul.valeur_unite_logement_estime <> 0 THEN eul.valeur_unite_logement_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
CASE ----- montant_loyer_annuel
|
||||
WHEN eul.montant_locatif_annuel_declare IS NOT NULL AND eul.montant_locatif_annuel_declare <> 0 THEN eul.montant_locatif_annuel_declare
|
||||
WHEN eul.montant_locatif_annuel_calcule IS NOT NULL AND eul.montant_locatif_annuel_calcule <> 0 THEN eul.montant_locatif_annuel_calcule
|
||||
WHEN eul.montant_locatif_annuel_estime IS NOT NULL AND eul.montant_locatif_annuel_estime <> 0 THEN eul.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date,
|
||||
p_user_id,
|
||||
'FISCAD',
|
||||
current_date,
|
||||
p_user_id,
|
||||
eul.categorie_usage,
|
||||
p.superficie * v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
case ----valeur_locative_adm70pour100
|
||||
when eul.categorie_usage = 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
0,
|
||||
eul.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
v_taux_irf,
|
||||
p.id,
|
||||
b.id,
|
||||
ul.id,
|
||||
eul.superficie_louee
|
||||
FROM parcelle p
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT ON (parcelle_id)
|
||||
parcelle_id,
|
||||
superficie,
|
||||
personne_id,
|
||||
numero_titre_foncier,
|
||||
date_enquete,
|
||||
representant_tel,
|
||||
representant_nom,
|
||||
representant_prenom,
|
||||
representant_npi,
|
||||
date_debut_exemption,
|
||||
date_fin_exemption,
|
||||
zone_rfu_id
|
||||
FROM enquete
|
||||
ORDER BY parcelle_id, date_enquete DESC, id DESC
|
||||
) ep ON ep.parcelle_id = p.id
|
||||
LEFT JOIN personne pers
|
||||
ON pers.id = ep.personne_id
|
||||
JOIN quartier q ON q.id = p.quartier_id
|
||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||
JOIN commune c ON c.id = a.commune_id
|
||||
JOIN departement d ON d.id = c.departement_id
|
||||
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (quartier_id)
|
||||
quartier_id,
|
||||
secteur_id
|
||||
FROM secteur_decoupage
|
||||
ORDER BY quartier_id
|
||||
) sd ON sd.quartier_id = q.id
|
||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||
JOIN section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN unite_logement ul on ul.batiment_id = b.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (eult.unite_logement_id)
|
||||
eult.unite_logement_id,
|
||||
pers1.id,
|
||||
pers1.ifu,
|
||||
pers1.npi,
|
||||
pers1.tel1,
|
||||
pers1.email,
|
||||
pers1.nom,
|
||||
pers1.prenom,
|
||||
pers1.raison_sociale,
|
||||
pers1.adresse,
|
||||
eult.nombre_piscine,
|
||||
eult.categorie_batiment_id,
|
||||
eult.superficie_au_sol,
|
||||
eult.superficie_louee,
|
||||
eult.nbre_piece,
|
||||
eult.date_enquete,
|
||||
eult.montant_locatif_annuel_calcule,
|
||||
eult.montant_locatif_annuel_declare,
|
||||
eult.montant_locatif_annuel_estime,
|
||||
eult.date_debut_exemption,
|
||||
eult.date_fin_exemption,
|
||||
eult.representant_nom,
|
||||
eult.representant_prenom,
|
||||
eult.representant_tel,
|
||||
eult.valeur_unite_logement_reel,
|
||||
eult.valeur_unite_logement_calcule,
|
||||
eult.valeur_unite_logement_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_unite_logement eult
|
||||
join usage u on u.id=eult.usage_id
|
||||
left join personne pers1 on pers1.id = eult.personne_id
|
||||
where superficie_louee*montant_locatif_annuel_declare>0
|
||||
ORDER BY unite_logement_id, date_enquete DESC, eult.id DESC
|
||||
) eul ON eul.unite_logement_id = ul.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eul.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm=montant_loyer_annuel,
|
||||
montant_taxe = montant_loyer_annuel * v_taux_irf/100
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_batie_unite_logement(
|
||||
p_impositions_tfu_id BIGINT,
|
||||
p_user_id BIGINT
|
||||
|
||||
@@ -63,6 +63,15 @@ $$;
|
||||
|
||||
call integrer_eavis();
|
||||
|
||||
select * from eavis
|
||||
call integrer_eavis_detail();
|
||||
|
||||
delete from eavis;
|
||||
select *
|
||||
from e_avis_view ;
|
||||
|
||||
select * from eavis;
|
||||
|
||||
|
||||
select * from eavis_detail;
|
||||
|
||||
select *
|
||||
from donnees_imposition_tfu;
|
||||
@@ -25,8 +25,11 @@ BEGIN
|
||||
montant_valeur_locative = v.montant_valeur_locative,
|
||||
taux = v.taux,
|
||||
montant_du = v.montant_du,
|
||||
booleen_parcelle_contact = v.booleen_parcelle_contact,
|
||||
penalite = v.penalite
|
||||
booleen_parcelle_contact = case v.booleen_parcelle_contact
|
||||
when true then 'OUI'
|
||||
when false then 'NON' end,
|
||||
penalite = v.penalite,
|
||||
r_avis = v.r_avis
|
||||
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT
|
||||
@@ -47,7 +50,8 @@ BEGIN
|
||||
taux,
|
||||
montant_du,
|
||||
booleen_parcelle_contact,
|
||||
penalite
|
||||
penalite,
|
||||
r_avis
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -66,8 +70,11 @@ BEGIN
|
||||
v.montant_valeur_locative,
|
||||
v.taux,
|
||||
v.montant_du,
|
||||
v.booleen_parcelle_contact,
|
||||
v.penalite
|
||||
case v.booleen_parcelle_contact
|
||||
when true then 'OUI'
|
||||
when false then 'NON' end,
|
||||
v.penalite,
|
||||
v.r_avis
|
||||
);
|
||||
END;
|
||||
$$;
|
||||
|
||||
@@ -147,3 +147,11 @@ select * from arrondissement
|
||||
|
||||
select left(code,4) as code_commune_fiscad, code as code_quartier_fiscad,nom as nom_quartier_fiscad
|
||||
from quartier;
|
||||
|
||||
|
||||
create function get_dblink_connection_sigibe() returns text
|
||||
language sql
|
||||
as
|
||||
$$
|
||||
SELECT 'host=193.181.208.4 port=5433 dbname=sigibe_test user=sigibe_test_user password=sigibe_test_pwd';
|
||||
$$;
|
||||
@@ -0,0 +1,71 @@
|
||||
package io.gmss.fiscad.persistence.repositories.audit;
|
||||
|
||||
import io.gmss.fiscad.entities.audit.HistoriqueConnexion;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.ArrondissementEnqResponse;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.ArrondissementSyncResponse;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface HistoriqueConnexionRepository extends JpaRepository<HistoriqueConnexion, Long> {
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb(
|
||||
h.id,
|
||||
h.dateConnexion,
|
||||
h.user.id,
|
||||
h.user.username,
|
||||
h.user.nom,
|
||||
h.user.prenom
|
||||
)
|
||||
FROM HistoriqueConnexion h
|
||||
ORDER BY h.dateConnexion DESC
|
||||
""")
|
||||
List<HistoriqueConnexionPaylaodWeb> findHistoriqueConnexion();
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb(
|
||||
h.id,
|
||||
h.dateConnexion,
|
||||
h.user.id,
|
||||
h.user.username,
|
||||
h.user.nom,
|
||||
h.user.prenom
|
||||
)
|
||||
FROM HistoriqueConnexion h
|
||||
WHERE h.user.id = :userId
|
||||
ORDER BY h.dateConnexion DESC
|
||||
""")
|
||||
List<HistoriqueConnexionPaylaodWeb> findHistoriqueConnexionByUserId(
|
||||
@Param("userId") Long userId
|
||||
);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.HistoriqueConnexionPaylaodWeb(
|
||||
h.id,
|
||||
h.dateConnexion,
|
||||
h.user.id,
|
||||
h.user.username,
|
||||
h.user.nom,
|
||||
h.user.prenom
|
||||
)
|
||||
FROM HistoriqueConnexion h
|
||||
WHERE h.user.id = :userId
|
||||
ORDER BY h.dateConnexion DESC
|
||||
""")
|
||||
List<HistoriqueConnexionPaylaodWeb> findTop5HistoriqueConnexionByUserId(
|
||||
@Param("userId") Long userId,
|
||||
Pageable pageable
|
||||
);
|
||||
}
|
||||
@@ -70,6 +70,25 @@ public interface ArrondissementRepository extends JpaRepository<Arrondissement,
|
||||
""")
|
||||
Optional<ArrondissementPaylaodWeb> findArrondissementToDtoById(@Param("arrondissementId") Long arrondissementId);
|
||||
|
||||
|
||||
|
||||
// @Query("""
|
||||
// SELECT new io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb(
|
||||
// arr.id,
|
||||
// arr.code,
|
||||
// arr.nom,
|
||||
// com.id,
|
||||
// com.code,
|
||||
// com.nom
|
||||
// )
|
||||
// FROM Parcelle p
|
||||
// INNER JOIN p.quartier q
|
||||
// INNER JOIN q.arrondissement arr
|
||||
// INNER JOIN arr.commune com
|
||||
// WHERE p.id = :parcelleId
|
||||
// """)
|
||||
// Optional<ArrondissementPaylaodWeb> findArrondissementToDtoByQuartierId(@Param("quartierId") Long quartierId);
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb(
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package io.gmss.fiscad.persistence.repositories.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.ModesAcquisitionTypePersonneSyncResponse;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ModeAcquisitionRepository extends JpaRepository<ModeAcquisition, Long> {
|
||||
@Query(value = "select ma.id, ma.libelle,mat.type_personne_id as typePersonneId " +
|
||||
@@ -13,4 +18,34 @@ public interface ModeAcquisitionRepository extends JpaRepository<ModeAcquisition
|
||||
" inner join mode_acquisition_type_personne mat on mat.mode_acquisition_id=ma.id " +
|
||||
" where ma.deleted is false ", nativeQuery = true)
|
||||
List<ModesAcquisitionTypePersonneSyncResponse> getModeAcquisitionTypePersonne();
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb(
|
||||
m.id,
|
||||
m.libelle
|
||||
)
|
||||
FROM ModeAcquisition m
|
||||
WHERE m.id = :id
|
||||
""")
|
||||
Optional<ModeAcquisitionPayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb(
|
||||
m.id,
|
||||
m.libelle
|
||||
)
|
||||
FROM ModeAcquisition m
|
||||
ORDER BY m.libelle
|
||||
""")
|
||||
List<ModeAcquisitionPayloadWeb> findAllPayload();
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ModeAcquisitionPayloadWeb(
|
||||
m.id,
|
||||
m.libelle
|
||||
)
|
||||
FROM ModeAcquisition m
|
||||
""")
|
||||
Page<ModeAcquisitionPayloadWeb> findAllPayload(Pageable pageable);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
@@ -77,7 +79,7 @@ public interface DonneesImpositionTfuRepository extends JpaRepository<DonneesImp
|
||||
e.nbre_batiment as nombreBat,
|
||||
e.nbre_piscine as nombrePiscine,
|
||||
e.id as enquete_id,
|
||||
e.zone_rfu_id as zoneRfuId,
|
||||
-- e.zone_rfu_id as zoneRfuId,
|
||||
ul.surface as superficieAuSolUlog,
|
||||
ba.nom as categorieBat,
|
||||
ba.libelle as standingBat,
|
||||
@@ -187,7 +189,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -201,6 +204,9 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.id,
|
||||
@@ -262,7 +268,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -338,7 +345,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -415,7 +423,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -493,7 +502,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -508,6 +518,176 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.id,
|
||||
d.annee,
|
||||
d.codeDepartement,
|
||||
d.nomDepartement,
|
||||
d.codeCommune,
|
||||
d.nomCommune,
|
||||
d.codeArrondissement,
|
||||
d.nomArrondissement,
|
||||
d.codeQuartierVillage,
|
||||
d.nomQuartierVillage,
|
||||
d.q,
|
||||
d.ilot,
|
||||
d.parcelle,
|
||||
d.nup,
|
||||
d.titreFoncier,
|
||||
d.numBatiment,
|
||||
d.numUniteLogement,
|
||||
d.ifu,
|
||||
d.npi,
|
||||
d.telProp,
|
||||
d.emailProp,
|
||||
d.nomProp,
|
||||
d.prenomProp,
|
||||
d.raisonSociale,
|
||||
d.adresseProp,
|
||||
d.telSc,
|
||||
d.emailSc,
|
||||
d.nomSc,
|
||||
d.prenomSc,
|
||||
d.adresseSc,
|
||||
d.longitude,
|
||||
d.latitude,
|
||||
d.superficieParc,
|
||||
d.superficieAuSolBat,
|
||||
d.superficieAuSolUlog,
|
||||
d.batie,
|
||||
d.exonere,
|
||||
d.batimentExonere,
|
||||
d.uniteLogementExonere,
|
||||
d.valeurLocativeAdm,
|
||||
d.montantLoyerAnnuel,
|
||||
d.tfuMetreCarre,
|
||||
d.tfuMinimum,
|
||||
d.standingBat,
|
||||
d.categorieBat,
|
||||
d.nombrePiscine,
|
||||
d.nombreUlog,
|
||||
d.nombreBat,
|
||||
d.dateEnquete,
|
||||
s.id,
|
||||
z.id,
|
||||
d.valeurAdminParcelleNb,
|
||||
d.natureImpot,
|
||||
s.code,
|
||||
z.nom,
|
||||
d.valeurBatiment,
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
LEFT join d.structure s
|
||||
LEFT join d.zoneRfu z
|
||||
WHERE itfu.id = :impositionTfuId
|
||||
and d.homologable is false
|
||||
order by d.nomProp,d.nomProp asc
|
||||
""")
|
||||
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdNonHomologablePageable(
|
||||
Long impositionTfuId,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.id,
|
||||
d.annee,
|
||||
d.codeDepartement,
|
||||
d.nomDepartement,
|
||||
d.codeCommune,
|
||||
d.nomCommune,
|
||||
d.codeArrondissement,
|
||||
d.nomArrondissement,
|
||||
d.codeQuartierVillage,
|
||||
d.nomQuartierVillage,
|
||||
d.q,
|
||||
d.ilot,
|
||||
d.parcelle,
|
||||
d.nup,
|
||||
d.titreFoncier,
|
||||
d.numBatiment,
|
||||
d.numUniteLogement,
|
||||
d.ifu,
|
||||
d.npi,
|
||||
d.telProp,
|
||||
d.emailProp,
|
||||
d.nomProp,
|
||||
d.prenomProp,
|
||||
d.raisonSociale,
|
||||
d.adresseProp,
|
||||
d.telSc,
|
||||
d.emailSc,
|
||||
d.nomSc,
|
||||
d.prenomSc,
|
||||
d.adresseSc,
|
||||
d.longitude,
|
||||
d.latitude,
|
||||
d.superficieParc,
|
||||
d.superficieAuSolBat,
|
||||
d.superficieAuSolUlog,
|
||||
d.batie,
|
||||
d.exonere,
|
||||
d.batimentExonere,
|
||||
d.uniteLogementExonere,
|
||||
d.valeurLocativeAdm,
|
||||
d.montantLoyerAnnuel,
|
||||
d.tfuMetreCarre,
|
||||
d.tfuMinimum,
|
||||
d.standingBat,
|
||||
d.categorieBat,
|
||||
d.nombrePiscine,
|
||||
d.nombreUlog,
|
||||
d.nombreBat,
|
||||
d.dateEnquete,
|
||||
s.id,
|
||||
z.id,
|
||||
d.valeurAdminParcelleNb,
|
||||
d.natureImpot,
|
||||
s.code,
|
||||
z.nom,
|
||||
d.valeurBatiment,
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
LEFT join d.structure s
|
||||
LEFT join d.zoneRfu z
|
||||
WHERE itfu.id = :impositionTfuId
|
||||
and d.homologable is null
|
||||
order by d.nomProp,d.nomProp asc
|
||||
""")
|
||||
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdHomologablePageable(
|
||||
Long impositionTfuId,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("""
|
||||
UPDATE DonneesImpositionTfu d
|
||||
SET d.homologable = true
|
||||
WHERE d.impositionsTfu.id = :impositionsTfuId
|
||||
AND d.homologable IS NULL
|
||||
""")
|
||||
int homologuerDonneesImposition(
|
||||
@Param("impositionsTfuId") Long impositionsTfuId
|
||||
);
|
||||
|
||||
@Query(value = "SELECT generer_donnees_imposition_tfu_batie(:impositionId, :userId)", nativeQuery = true)
|
||||
Integer genererDonneesTfuBatie(
|
||||
@Param("impositionId") Long impositionId,
|
||||
@@ -692,7 +872,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -780,7 +961,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -862,7 +1044,8 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
d.valeurParcelle,
|
||||
d.valeurLocativeAdmMetreCarre,
|
||||
d.valeurAdminParcelleNbMetreCarre,
|
||||
d.montantTaxe
|
||||
d.montantTaxe,
|
||||
d.homologable
|
||||
)
|
||||
FROM DonneesImpositionTfu d
|
||||
JOIN d.impositionsTfu itfu
|
||||
@@ -876,4 +1059,16 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||
List<DonneesImpositionPaylaodWeb> findAllByPersonneId(
|
||||
@Param("personneId") Long personneId
|
||||
);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT COUNT(d) > 0
|
||||
FROM DonneesImpositionTfu d
|
||||
WHERE d.annee = :annee
|
||||
AND d.parcelleImposee.id = :parcelleId
|
||||
""")
|
||||
boolean existsByImpositionAnneeAndParcelle(
|
||||
@Param("annee") Long annee,
|
||||
@Param("parcelleId") Long parcelleId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -194,4 +194,36 @@ public interface ImpositionsTfuRepository extends JpaRepository<ImpositionsTfu,
|
||||
WHERE d.id= :departementId
|
||||
""")
|
||||
List<ImpositionsTfuPaylaodWeb> findByDepartementIdToDto(@Param("departementId") Long departementId);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb(
|
||||
i.id,
|
||||
i.dateGeneration,
|
||||
i.dateCloture,
|
||||
i.referencePieceAdmin,
|
||||
i.datePieceAdmin,
|
||||
i.statusAvis,
|
||||
i.nombreAvis,
|
||||
i.motif,
|
||||
e.id,
|
||||
e.annee,
|
||||
c.id,
|
||||
c.code,
|
||||
c.nom,
|
||||
s.id,
|
||||
s.nom,
|
||||
i.nombreAvisFnb,
|
||||
i.nombreAvisBatiment,
|
||||
i.nombreAvisUniteLog
|
||||
)
|
||||
FROM ImpositionsTfu i
|
||||
LEFT JOIN i.exercice e
|
||||
LEFT JOIN i.commune c
|
||||
LEFT JOIN i.structure s
|
||||
WHERE s.id = :structureId
|
||||
AND i.statusAvis = :statutAvis
|
||||
""")
|
||||
List<ImpositionsTfuPaylaodWeb> findByStructureIdByStatutToDto(@Param("structureId") Long structureId, @Param("statutAvis") StatusAvis statutAvis);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParticiperRepository extends JpaRepository<Participer, Long> {
|
||||
boolean existsByEquipeIdAndUserId(Long equipeId, Long userId);
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
WHERE p.id = :id
|
||||
""")
|
||||
Optional<ParticiperPayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
ORDER BY e.nom, u.nom, u.prenom
|
||||
""")
|
||||
List<ParticiperPayloadWeb> findAllPayload();
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(p)
|
||||
FROM Participer p
|
||||
""")
|
||||
Page<ParticiperPayloadWeb> findAllPayload(Pageable pageable);
|
||||
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
WHERE e.id = :equipeId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(p)
|
||||
FROM Participer p
|
||||
WHERE p.equipe.id = :equipeId
|
||||
""")
|
||||
Page<ParticiperPayloadWeb> findAllPayloadByEquipeId(
|
||||
@Param("equipeId") Long equipeId,
|
||||
Pageable pageable);
|
||||
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
WHERE u.id = :userId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(p)
|
||||
FROM Participer p
|
||||
WHERE p.user.id = :userId
|
||||
""")
|
||||
Page<ParticiperPayloadWeb> findAllPayloadByUserId(
|
||||
@Param("userId") Long userId,
|
||||
Pageable pageable);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
WHERE e.id = :equipeId
|
||||
ORDER BY u.nom, u.prenom
|
||||
""")
|
||||
List<ParticiperPayloadWeb> findAllPayloadByEquipeId(@Param("equipeId") Long equipeId);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
p.dateDebut,
|
||||
p.dateFin,
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom
|
||||
)
|
||||
FROM Participer p
|
||||
LEFT JOIN p.equipe e
|
||||
LEFT JOIN p.user u
|
||||
WHERE u.id = :userId
|
||||
ORDER BY e.nom
|
||||
""")
|
||||
List<ParticiperPayloadWeb> findAllPayloadByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -143,5 +143,25 @@ Optional<BaremRfuNonBati> findAllByCommune_IdAndZoneRfu_Id(Long communeId,Long z
|
||||
@Param("communeId") Long communeId,
|
||||
@Param("zoneId") Long zoneId
|
||||
);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT COUNT(barem) > 0
|
||||
FROM Parcelle p
|
||||
JOIN p.quartier q
|
||||
JOIN q.arrondissement a
|
||||
JOIN Enquete ep
|
||||
ON ep.parcelle=p
|
||||
JOIN BaremRfuNonBati barem
|
||||
ON (barem.commune = a.commune)
|
||||
WHERE p.id = :parcelleId
|
||||
AND ep.dateEnquete = (
|
||||
SELECT MAX(ep2.dateEnquete)
|
||||
FROM Enquete ep2
|
||||
WHERE ep2.parcelle = p
|
||||
)
|
||||
AND barem.zoneRfu = ep.zoneRfu
|
||||
""")
|
||||
boolean existsBaremForParcelleNonBati(@Param("parcelleId") Long parcelleId);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,5 +252,29 @@ public interface BaremRfuRepository extends JpaRepository<BaremRfuBati, Long> {
|
||||
@Param("quartierId") Long quartierId,
|
||||
@Param("categorieBatimentId") Long categorieBatimentId
|
||||
);
|
||||
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT COUNT(barem) > 0
|
||||
FROM Parcelle p
|
||||
JOIN p.quartier q
|
||||
JOIN q.arrondissement a
|
||||
JOIN Batiment b
|
||||
ON b.parcelle = p
|
||||
JOIN EnqueteBatiment eb
|
||||
ON eb.batiment=b
|
||||
JOIN BaremRfuBati barem
|
||||
ON (barem.quartier = q OR barem.arrondissement = a)
|
||||
WHERE p.id = :parcelleId
|
||||
AND eb.dateEnquete = (
|
||||
SELECT MAX(eb2.dateEnquete)
|
||||
FROM EnqueteBatiment eb2
|
||||
WHERE eb2.batiment = b
|
||||
)
|
||||
AND barem.categorieBatiment = eb.categorieBatiment
|
||||
""")
|
||||
boolean existsBaremForParcelle(@Param("parcelleId") Long parcelleId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,186 @@ package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CampagneRepository extends JpaRepository<Campagne, Long> {
|
||||
List<Campagne> findAllByTypeCampagne(TypeCampagne typeCampagne);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE c.id = :id
|
||||
""")
|
||||
Optional<CampagnePayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayload();
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayload(Pageable pageable);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE e.id = :exerciceId
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayloadByExerciceId(@Param("exerciceId") Long exerciceId);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE e.id = :exerciceId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
WHERE c.exercice.id = :exerciceId
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayloadByExerciceId(
|
||||
@Param("exerciceId") Long exerciceId,
|
||||
Pageable pageable);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE s.id = :structureId
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayloadByStructureId(@Param("structureId") Long structureId);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE s.id = :structureId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
WHERE c.structure.id = :structureId
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayloadByStructureId(
|
||||
@Param("exerciceId") Long structureId,
|
||||
Pageable pageable);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,91 @@
|
||||
package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
|
||||
import io.gmss.fiscad.enums.TypeImmeuble;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public interface CaracteristiqueRepository extends JpaRepository<Caracteristique, Long> {
|
||||
|
||||
List<Caracteristique> findAllByActifIsTrue();
|
||||
//Optional<Caracteristique> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb(
|
||||
c.id,
|
||||
c.code,
|
||||
c.libelle,
|
||||
c.actif,
|
||||
c.typeImmeuble,
|
||||
tc.id,
|
||||
tc.code,
|
||||
tc.libelle
|
||||
)
|
||||
FROM Caracteristique c
|
||||
LEFT JOIN c.typeCaracteristique tc
|
||||
WHERE c.id = :id
|
||||
""")
|
||||
Optional<CaracteristiquePayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb(
|
||||
c.id,
|
||||
c.code,
|
||||
c.libelle,
|
||||
c.actif,
|
||||
c.typeImmeuble,
|
||||
tc.id,
|
||||
tc.code,
|
||||
tc.libelle
|
||||
)
|
||||
FROM Caracteristique c
|
||||
LEFT JOIN c.typeCaracteristique tc
|
||||
WHERE c.typeImmeuble = :typeImmeuble
|
||||
ORDER BY tc.libelle, c.libelle
|
||||
""")
|
||||
List<CaracteristiquePayloadWeb> findByTypeImmeuble(
|
||||
@Param("typeImmeuble") TypeImmeuble typeImmeuble
|
||||
);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb(
|
||||
c.id,
|
||||
c.code,
|
||||
c.libelle,
|
||||
c.actif,
|
||||
c.typeImmeuble,
|
||||
tc.id,
|
||||
tc.code,
|
||||
tc.libelle
|
||||
)
|
||||
FROM Caracteristique c
|
||||
LEFT JOIN c.typeCaracteristique tc
|
||||
ORDER BY tc.libelle, c.libelle
|
||||
""")
|
||||
List<CaracteristiquePayloadWeb> findAllPayload();
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CaracteristiquePayloadWeb(
|
||||
c.id,
|
||||
c.code,
|
||||
c.libelle,
|
||||
c.actif,
|
||||
c.typeImmeuble,
|
||||
tc.id,
|
||||
tc.code,
|
||||
tc.libelle
|
||||
)
|
||||
FROM Caracteristique c
|
||||
LEFT JOIN c.typeCaracteristique tc
|
||||
""")
|
||||
Page<CaracteristiquePayloadWeb> findAllPayload(Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,292 @@
|
||||
package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface EquipeRepository extends JpaRepository<Equipe, Long> {
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE e.id = :id
|
||||
""")
|
||||
Optional<EquipePayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
ORDER BY e.nom
|
||||
""")
|
||||
List<EquipePayloadWeb> findAllPayload();
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
FROM Equipe e
|
||||
""")
|
||||
Page<EquipePayloadWeb> findAllPayload(Pageable pageable);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE c.id = :campagneId
|
||||
ORDER BY e.nom
|
||||
""")
|
||||
List<EquipePayloadWeb> findAllPayloadByCampagneId(@Param("campagneId") Long campagneId);
|
||||
|
||||
|
||||
@Query(value ="""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE c.id = :campagneId
|
||||
ORDER BY e.nom
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
FROM Equipe e
|
||||
where e.campagne.id= :campagneId
|
||||
""")
|
||||
Page<EquipePayloadWeb> findAllPayloadByCampagneId(@Param("campagneId") Long campagneId,Pageable pageable);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE s.id = :secteurId
|
||||
ORDER BY e.nom
|
||||
""")
|
||||
List<EquipePayloadWeb> findAllPayloadBySecteurId(@Param("secteurId") Long secteurId);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE e.quartier.id = :quartierId
|
||||
ORDER BY e.nom
|
||||
""")
|
||||
List<EquipePayloadWeb> findAllPayloadByQuartierId(@Param("quartierId") Long quartierId);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE e.quartier.id = :quartierId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
FROM Equipe e
|
||||
WHERE e.quartier.id = :quartierId
|
||||
""")
|
||||
Page<EquipePayloadWeb> findAllPayloadByQuartierId(
|
||||
@Param("quartierId") Long quartierId,
|
||||
Pageable pageable);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
||||
e.id,
|
||||
e.code,
|
||||
e.nom,
|
||||
b.id,
|
||||
b.cote,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
c.id,
|
||||
c.nom,
|
||||
e.dateDebut,
|
||||
e.dateFin,
|
||||
q.id,
|
||||
q.code,
|
||||
q.nom
|
||||
)
|
||||
FROM Equipe e
|
||||
LEFT JOIN e.bloc b
|
||||
LEFT JOIN e.secteur s
|
||||
LEFT JOIN e.campagne c
|
||||
LEFT JOIN e.quartier q
|
||||
WHERE e.secteur.id = :secteurId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
FROM Equipe e
|
||||
WHERE e.secteur.id = :secteurId
|
||||
""")
|
||||
Page<EquipePayloadWeb> findAllPayloadBySecteurId(
|
||||
@Param("secteurId") Long secteurId,
|
||||
Pageable pageable);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,5 +10,8 @@ import java.util.Optional;
|
||||
|
||||
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
||||
Optional<Exercice> findFirstByAnnee(int annee);
|
||||
boolean existsByAnnee(Integer annee);
|
||||
|
||||
boolean existsByAnneeAndIdNot(Integer annee, Long id);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,25 +88,26 @@ public interface AvoirFonctionRepository extends JpaRepository<AvoirFonction, Lo
|
||||
Page<AvoirFonctionPaylaodWeb> findAllAvoirFonctionToDtoPageable(Pageable pageable);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
||||
af.id,
|
||||
af.dateDebut,
|
||||
af.dateFin,
|
||||
f.id,
|
||||
f.code,
|
||||
f.nom,
|
||||
u.id,
|
||||
u.username,
|
||||
u.nom,
|
||||
u.prenom,
|
||||
u.email,
|
||||
af.titre
|
||||
)
|
||||
FROM AvoirFonction af
|
||||
LEFT JOIN af.user u
|
||||
LEFT JOIN af.fonction f
|
||||
WHERE u.id = :userId
|
||||
""")
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
||||
af.id,
|
||||
af.dateDebut,
|
||||
af.dateFin,
|
||||
f.id,
|
||||
f.code,
|
||||
f.nom,
|
||||
u.id,
|
||||
u.username,
|
||||
u.nom,
|
||||
u.prenom,
|
||||
u.email,
|
||||
af.titre
|
||||
)
|
||||
FROM AvoirFonction af
|
||||
LEFT JOIN af.user u
|
||||
LEFT JOIN af.fonction f
|
||||
WHERE u.id = :userId
|
||||
AND (af.dateFin IS NULL OR af.dateFin >= CURRENT_DATE)
|
||||
""")
|
||||
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ package io.gmss.fiscad.persistence.repositories.user;
|
||||
import io.gmss.fiscad.entities.user.Role;
|
||||
import io.gmss.fiscad.enums.UserRole;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface RoleRepository extends JpaRepository<Role, Long> {
|
||||
@@ -14,4 +16,5 @@ public interface RoleRepository extends JpaRepository<Role, Long> {
|
||||
boolean existsByNom(UserRole userRole);
|
||||
|
||||
Role getRolesByNom(UserRole userRole);
|
||||
|
||||
}
|
||||
|
||||
@@ -159,4 +159,26 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
WHERE st.id = :structureId
|
||||
""")
|
||||
Page<UserPaylaodWeb> findAllUserByStructureToDtoPageable(@Param("structureId") Long structureId, Pageable pageable);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.UserPaylaodWeb(
|
||||
u.id,
|
||||
u.nom,
|
||||
u.prenom,
|
||||
u.tel,
|
||||
u.username,
|
||||
u.email,
|
||||
st.id,
|
||||
st.code,
|
||||
st.nom,
|
||||
u.active,
|
||||
u.resetPassword
|
||||
)
|
||||
FROM AvoirFonction af
|
||||
JOIN af.user u
|
||||
LEFT JOIN u.structure st
|
||||
WHERE af.fonction.id = :fonctionId
|
||||
""")
|
||||
List<UserPaylaodWeb> findAllUserByFonctionToDto(@Param("fonctionId") Long fonctionId);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ import io.gmss.fiscad.persistence.repositories.frontend.ModuleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.*;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CaracteristiqueRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ExerciceRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.*;
|
||||
import io.gmss.fiscad.persistence.repositories.user.AvoirFonctionRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileModuleFonctionnaliteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.ProfileRepository;
|
||||
@@ -41,6 +38,9 @@ public class EntityFromPayLoadService {
|
||||
private final TypePieceRepository typePieceRepository;
|
||||
private final PieceRepository pieceRepository;
|
||||
private final CaracteristiqueRepository caracteristiqueRepository;
|
||||
private final EquipeRepository equipeRepository;
|
||||
private final BlocRepository blocRepository;
|
||||
private final CampagneRepository campagneRepository;
|
||||
private final ModeAcquisitionRepository modeAcquisitionRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final SourceDroitRepository sourceDroitRepository;
|
||||
@@ -81,7 +81,9 @@ public class EntityFromPayLoadService {
|
||||
private final CommuneCentreAssignationRepository communeCentreAssignationRepository ;
|
||||
private final ModuleRepository moduleRepository ;
|
||||
private final FonctionnaliteRepository fonctionnaliteRepository ;
|
||||
private final ParticiperRepository participerRepository ;
|
||||
private final ProfileModuleFonctionnaliteRepository profileModuleFonctionnaliteRepository ;
|
||||
private final TypeCaracteristiqueRepository typeCaracteristiqueRepository ;
|
||||
|
||||
|
||||
public CaracteristiqueParcelle getCaracteristiqueParcelleFromPayLoadWeb(CaracteristiqueParcellePayloadWeb caracteristiqueParcellePayloadWeb){
|
||||
@@ -104,6 +106,94 @@ public class EntityFromPayLoadService {
|
||||
return caracteristiqueParcelle;
|
||||
}
|
||||
|
||||
public Quartier getQuartierFromPayLoadWeb(QuartierPaylaodWeb quartierPaylaodWeb){
|
||||
Quartier quartier=new Quartier();
|
||||
if(quartierPaylaodWeb.getId()!=null)
|
||||
quartier = quartierRepository.findById(quartierPaylaodWeb.getId()).orElse(new Quartier());
|
||||
|
||||
Optional<Arrondissement> optionalArrondissement=Optional.empty();
|
||||
|
||||
if(quartierPaylaodWeb.getArrondissementId()!=null)
|
||||
optionalArrondissement=arrondissementRepository.findById(quartierPaylaodWeb.getArrondissementId());
|
||||
|
||||
quartier.setId(quartierPaylaodWeb.getId());
|
||||
quartier.setArrondissement(optionalArrondissement.orElse(null));
|
||||
quartier.setCode(quartierPaylaodWeb.getCode());
|
||||
quartier.setNom(quartierPaylaodWeb.getNom());
|
||||
return quartier;
|
||||
}
|
||||
|
||||
public Caracteristique getCaracteristiqueFromPayLoadWeb(CaracteristiquePayloadWeb caracteristiquePayloadWeb){
|
||||
Caracteristique caracteristique=new Caracteristique();
|
||||
if(caracteristiquePayloadWeb.getId()!=null)
|
||||
caracteristique = caracteristiqueRepository.findById(caracteristiquePayloadWeb.getId()).orElse(new Caracteristique());
|
||||
|
||||
Optional<TypeCaracteristique> optionalTypeCaracteristique=Optional.empty();
|
||||
|
||||
if(caracteristiquePayloadWeb.getTypeCaracteristiqueId()!=null)
|
||||
optionalTypeCaracteristique=typeCaracteristiqueRepository.findById(caracteristiquePayloadWeb.getTypeCaracteristiqueId());
|
||||
|
||||
caracteristique.setId(caracteristiquePayloadWeb.getId());
|
||||
caracteristique.setTypeCaracteristique(optionalTypeCaracteristique.orElse(null));
|
||||
caracteristique.setCode(caracteristiquePayloadWeb.getCode());
|
||||
caracteristique.setLibelle(caracteristiquePayloadWeb.getLibelle());
|
||||
caracteristique.setActif(caracteristiquePayloadWeb.isActif());
|
||||
caracteristique.setTypeImmeuble(caracteristiquePayloadWeb.getTypeImmeuble());
|
||||
return caracteristique;
|
||||
}
|
||||
|
||||
|
||||
public Equipe getEquipeFromPayLoadWeb(EquipePayloadWeb equipePayloadWeb){
|
||||
Equipe equipe=new Equipe();
|
||||
if(equipePayloadWeb.getId()!=null)
|
||||
equipe = equipeRepository.findById(equipePayloadWeb.getId()).orElse(new Equipe());
|
||||
|
||||
Optional<Campagne> optionalCampagne=Optional.empty();
|
||||
Optional<Secteur> optionalSecteur=Optional.empty();
|
||||
Optional<Quartier> optionalQuartier=Optional.empty();
|
||||
Optional<Bloc> optionalBloc=Optional.empty();
|
||||
|
||||
if(equipePayloadWeb.getBlocId()!=null)
|
||||
optionalBloc=blocRepository.findById(equipePayloadWeb.getBlocId());
|
||||
|
||||
|
||||
if(equipePayloadWeb.getCampagneId()!=null)
|
||||
optionalCampagne=campagneRepository.findById(equipePayloadWeb.getCampagneId());
|
||||
if(equipePayloadWeb.getSecteurId()!=null)
|
||||
optionalSecteur=secteurRepository.findById(equipePayloadWeb.getSecteurId());
|
||||
if(equipePayloadWeb.getQuartierId()!=null)
|
||||
optionalQuartier=quartierRepository.findById(equipePayloadWeb.getQuartierId());
|
||||
|
||||
if(optionalBloc.isPresent())
|
||||
equipe.setBloc(optionalBloc.get());
|
||||
|
||||
if(optionalCampagne.isPresent())
|
||||
equipe.setCampagne(optionalCampagne.get());
|
||||
if(optionalSecteur.isPresent())
|
||||
equipe.setSecteur(optionalSecteur.get());
|
||||
if(optionalQuartier.isPresent())
|
||||
equipe.setQuartier(optionalQuartier.get());
|
||||
|
||||
equipe.setId(equipePayloadWeb.getId());
|
||||
equipe.setNom(equipePayloadWeb.getNom());
|
||||
equipe.setCode(equipePayloadWeb.getCode());
|
||||
equipe.setDateDebut(equipePayloadWeb.getDateDebut());
|
||||
equipe.setDateFin(equipePayloadWeb.getDateFin());
|
||||
return equipe;
|
||||
}
|
||||
|
||||
|
||||
public ModeAcquisition getModeAcquisitionFromPayLoadWeb(ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb){
|
||||
ModeAcquisition modeAcquisition=new ModeAcquisition();
|
||||
if(modeAcquisitionPayloadWeb.getId()!=null)
|
||||
modeAcquisition = modeAcquisitionRepository.findById(modeAcquisitionPayloadWeb.getId()).orElse(new ModeAcquisition());
|
||||
|
||||
modeAcquisition.setId(modeAcquisitionPayloadWeb.getId());
|
||||
modeAcquisition.setLibelle(modeAcquisitionPayloadWeb.getLibelle());
|
||||
|
||||
return modeAcquisition;
|
||||
}
|
||||
|
||||
|
||||
public CaracteristiqueBatiment getCaracteristiqueBatimentFromPayLoadWeb(CaracteristiqueBatimentPayloadWeb caracteristiqueBatimentPayloadWeb){
|
||||
CaracteristiqueBatiment caracteristiqueBatiment=new CaracteristiqueBatiment();
|
||||
@@ -1049,18 +1139,6 @@ public class EntityFromPayLoadService {
|
||||
|
||||
communeCentreAssignation.setAdresseContact(communeCentreAssignationPaylaodWeb.getAdresseContact());
|
||||
|
||||
// if (communeCentreAssignationPaylaodWeb.getCommuneId() != null) {
|
||||
// Commune commune = new Commune();
|
||||
// commune.setId(communeCentreAssignationPaylaodWeb.getCommuneId());
|
||||
// communeCentreAssignation.setCommune(commune);
|
||||
// }
|
||||
|
||||
// if (communeCentreAssignationPaylaodWeb.getStructureId() != null) {
|
||||
// Structure structure = new Structure();
|
||||
// structure.setId(communeCentreAssignationPaylaodWeb.getStructureId());
|
||||
// communeCentreAssignation.setStructure(structure);
|
||||
// }
|
||||
|
||||
if (communeCentreAssignationPaylaodWeb.getParcelleContactId() != null) {
|
||||
Parcelle parcelle = new Parcelle();
|
||||
parcelle.setId(communeCentreAssignationPaylaodWeb.getParcelleContactId());
|
||||
@@ -1128,4 +1206,56 @@ public class EntityFromPayLoadService {
|
||||
|
||||
return profileModuleFonctionnalite ;
|
||||
}
|
||||
|
||||
public Participer getParticiperFromPayLoadWeb(ParticiperPayloadWeb participerPayloadWeb) {
|
||||
Participer participer =new Participer();
|
||||
if(participerPayloadWeb.getId()!=null)
|
||||
participer = participerRepository.findById(participerPayloadWeb.getId()).orElse(new Participer());
|
||||
|
||||
if (participerPayloadWeb.getEquipeId() != null) {
|
||||
Equipe equipe = new Equipe();
|
||||
equipe.setId(participerPayloadWeb.getEquipeId());
|
||||
participer.setEquipe(equipe);
|
||||
}
|
||||
|
||||
|
||||
if (participerPayloadWeb.getUserId() != null) {
|
||||
User user = new User();
|
||||
user.setId(participerPayloadWeb.getUserId());
|
||||
participer.setUser(user);
|
||||
}
|
||||
|
||||
participer.setId(participerPayloadWeb.getId());
|
||||
participer.setDateDebut(participerPayloadWeb.getDateDebut());
|
||||
participer.setDateFin(participerPayloadWeb.getDateFin());
|
||||
return participer ;
|
||||
|
||||
}
|
||||
|
||||
public Campagne getCampagneFromPayLoadWeb(CampagnePayloadWeb campagnePayloadWeb) {
|
||||
Campagne campagne =new Campagne();
|
||||
if(campagnePayloadWeb.getId()!=null)
|
||||
campagne = campagneRepository.findById(campagnePayloadWeb.getId()).orElse(new Campagne());
|
||||
|
||||
if (campagnePayloadWeb.getExerciceId() != null) {
|
||||
Exercice exercice = new Exercice();
|
||||
exercice.setId(campagnePayloadWeb.getExerciceId());
|
||||
campagne.setExercice(exercice);
|
||||
}
|
||||
|
||||
if (campagnePayloadWeb.getStructureId() != null) {
|
||||
Structure structure = new Structure();
|
||||
structure.setId(campagnePayloadWeb.getStructureId());
|
||||
campagne.setStructure(structure);
|
||||
}
|
||||
|
||||
campagne.setId(campagnePayloadWeb.getId());
|
||||
campagne.setDateDebut(campagnePayloadWeb.getDateDebut());
|
||||
campagne.setDateFin(campagnePayloadWeb.getDateFin());
|
||||
campagne.setTypeCampagne(campagnePayloadWeb.getTypeCampagne());
|
||||
campagne.setRefAdministrative(campagnePayloadWeb.getRefAdministrative());
|
||||
campagne.setNom(campagnePayloadWeb.getNom());
|
||||
|
||||
return campagne ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ io.gmss.fiscad.profile=test
|
||||
# LOCAL ENV TEST
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
|
||||
#spring.datasource.username=infocad_user
|
||||
@spring.datasource.password=W5fwD({9*q53
|
||||
#spring.datasource.password=W5fwD({9*q53
|
||||
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://193.181.208.4:5432/fiscad_db
|
||||
|
||||
Reference in New Issue
Block a user