develop #285

Merged
judaur2005 merged 3 commits from develop into main 2026-07-30 13:24:55 +00:00
15 changed files with 246 additions and 30 deletions
Showing only changes of commit 415186bd33 - Show all commits

View File

@@ -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); 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);
}
}
} }

View File

@@ -151,7 +151,7 @@ public class DonneesImpositionTfuController {
@GetMapping("/donnees-non-homologable/{idImpositionTfu}") @GetMapping("/donnees-non-homologable/{idImpositionTfu}")
@PreAuthorize("hasAuthority('HOMOLOGUE_AVIS') or hasAuthority('READ_DONNEESIMPOSITIONTFU')") @PreAuthorize("hasAuthority('HOMOLOGUE_AVIS') or hasAuthority('READ_DONNEESIMPOSITIONTFU')")
public ResponseEntity<?> getHomologableDonneesImpositionTfu(@PathVariable Long idImpositionTfu,@RequestParam int pageNo, @RequestParam int pageSize) { public ResponseEntity<?> getNonHomologableDonneesImpositionTfu(@PathVariable Long idImpositionTfu,@RequestParam int pageNo, @RequestParam int pageSize) {
try { try {
Pageable pageable = PageRequest.of(pageNo, pageSize); Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>( return new ResponseEntity<>(
@@ -174,6 +174,32 @@ public class DonneesImpositionTfuController {
} }
} }
@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}") @DeleteMapping("/delete/{id}")
@PreAuthorize("hasAuthority('DELETE_DONNEESIMPOSITIONTFU')") @PreAuthorize("hasAuthority('DELETE_DONNEESIMPOSITIONTFU')")
public ResponseEntity<?> deleteDonneesImpositionTfu(@PathVariable Long id) { public ResponseEntity<?> deleteDonneesImpositionTfu(@PathVariable Long id) {

View File

@@ -331,4 +331,30 @@ public class ImpositionsTfuController {
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK); 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);
}
}
} }

View File

@@ -102,7 +102,7 @@ public class StructureServiceImpl implements StructureService {
avoirFonctions.stream() avoirFonctions.stream()
.filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now())) .filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now()))
.forEach(avoirFonction -> { .forEach(avoirFonction -> {
if(avoirFonction.getFonction().getStructure()!=null){ if(avoirFonction.getFonction().getStructure()!=null && avoirFonction.getFonction().getDepartement()==null){
structures.addAll(List.of(avoirFonction.getFonction().getStructure())); structures.addAll(List.of(avoirFonction.getFonction().getStructure()));
}else if (avoirFonction.getFonction().getDepartement()!=null){ }else if (avoirFonction.getFonction().getDepartement()!=null){
structures.addAll(structureRepository.findDistinctByCommune_Departement_Id(avoirFonction.getFonction().getDepartement().getId())); structures.addAll(structureRepository.findDistinctByCommune_Departement_Id(avoirFonction.getFonction().getDepartement().getId()));
@@ -111,6 +111,33 @@ public class StructureServiceImpl implements StructureService {
return structures; 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) { // public List<Long> getStructureIdListForUser(Long userId) {

View File

@@ -38,30 +38,30 @@ public class CommuneCentreAssignationServiceImpl implements CommuneCentreAssigna
public CommuneCentreAssignationPaylaodWeb createCommuneCentreAssignation(User user, CommuneCentreAssignationPaylaodWeb communeCentreAssignationPaylaodWeb) throws BadRequestException { public CommuneCentreAssignationPaylaodWeb createCommuneCentreAssignation(User user, CommuneCentreAssignationPaylaodWeb communeCentreAssignationPaylaodWeb) throws BadRequestException {
if (user.getStructure() == null) { 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) { 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) { 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 { }else {
if(!personneRepository.existsById(communeCentreAssignationPaylaodWeb.getPersonneId())) 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) { 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 { }else {
if(!parcelleRepository.existsById(communeCentreAssignationPaylaodWeb.getParcelleContactId())) 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()); Optional<CommuneCentreAssignationPaylaodWeb> communeCentreAssignationPaylaodWebOptional=communeCentreAssignationRepository.findbyCommuneAndPersonne(user.getStructure().getCommune().getId(),communeCentreAssignationPaylaodWeb.getPersonneId());
if(communeCentreAssignationPaylaodWeb.getId()==null && communeCentreAssignationPaylaodWebOptional.isPresent()){ 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());
} }

View File

@@ -342,4 +342,10 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable) { public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable) {
return donneesImpositionTfuRepository.findAllByImpositionTfuIdNonHomologablePageable(impositionTfuId,pageable); return donneesImpositionTfuRepository.findAllByImpositionTfuIdNonHomologablePageable(impositionTfuId,pageable);
} }
@Override
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesHomologable(Long impositionTfuId,Pageable pageable) {
return donneesImpositionTfuRepository.findAllByImpositionTfuIdHomologablePageable(impositionTfuId,pageable);
}
} }

View File

@@ -211,4 +211,9 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
System.out.println(structureIds.get(0)); System.out.println(structureIds.get(0));
return impositionsTfuRepository.findByStructureIdsToDto(structureIds); return impositionsTfuRepository.findByStructureIdsToDto(structureIds);
} }
@Override
public List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByStructureIdByStatut(Long structureId, StatusAvis statusAvis) {
return impositionsTfuRepository.findByStructureIdByStatutToDto(structureId,statusAvis);
}
} }

View File

@@ -36,5 +36,6 @@ public interface StructureService {
public List<Structure> getListStructureUserId(Long userId) ; public List<Structure> getListStructureUserId(Long userId) ;
public List<StructurePaylaodWeb> getListStructureAvoirFonctionId(Long avoirFonctionId) ;
} }

View File

@@ -55,6 +55,7 @@ public interface DonneesImpositionTfuService {
Integer setDonneesFiscalesNonHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs); Integer setDonneesFiscalesNonHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs);
Integer setDonneesFiscalesHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs); Integer setDonneesFiscalesHomologable(List<DonneesImpositionPaylaodWeb> donneesImpositionPaylaodWebs);
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable); Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesNonHomologable(Long impositionTfuId,Pageable pageable);
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesHomologable(Long impositionTfuId,Pageable pageable);
public Integer homologuer(Long impositionTfuId); public Integer homologuer(Long impositionTfuId);
} }

View File

@@ -1,6 +1,7 @@
package io.gmss.fiscad.interfaces.rfu.metier; package io.gmss.fiscad.interfaces.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu; 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.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException; import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb; import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
@@ -28,4 +29,5 @@ public interface ImpositionsTfuService {
Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id); Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id);
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId); List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId);
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByStructureIdByStatut(Long structureId, StatusAvis statusAvis);
} }

View File

@@ -592,6 +592,83 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
); );
@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
)
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 true or d.homologable is null)
order by d.nomProp,d.nomProp asc
""")
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdHomologablePageable(
Long impositionTfuId,
Pageable pageable
);
@Modifying @Modifying
@Transactional @Transactional
@Query(""" @Query("""

View File

@@ -194,4 +194,36 @@ public interface ImpositionsTfuRepository extends JpaRepository<ImpositionsTfu,
WHERE d.id= :departementId WHERE d.id= :departementId
""") """)
List<ImpositionsTfuPaylaodWeb> findByDepartementIdToDto(@Param("departementId") Long 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);
} }

View File

@@ -1094,18 +1094,6 @@ public class EntityFromPayLoadService {
communeCentreAssignation.setAdresseContact(communeCentreAssignationPaylaodWeb.getAdresseContact()); 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) { if (communeCentreAssignationPaylaodWeb.getParcelleContactId() != null) {
Parcelle parcelle = new Parcelle(); Parcelle parcelle = new Parcelle();
parcelle.setId(communeCentreAssignationPaylaodWeb.getParcelleContactId()); parcelle.setId(communeCentreAssignationPaylaodWeb.getParcelleContactId());

View File

@@ -2,16 +2,16 @@ server.port=8282
io.gmss.fiscad.profile=test io.gmss.fiscad.profile=test
# LOCAL ENV TEST # LOCAL ENV TEST
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
#spring.datasource.username=infocad_user spring.datasource.username=infocad_user
@spring.datasource.password=W5fwD({9*q53
spring.datasource.url=jdbc:postgresql://193.181.208.4:5432/fiscad_db
spring.datasource.username=fiscad_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
#spring.datasource.username=fiscad_user
#spring.datasource.password=W5fwD({9*q53
app.default-user.username=fiscad_admin app.default-user.username=fiscad_admin
app.default-user.password=1234567890 app.default-user.password=1234567890

View File

@@ -1,6 +1,6 @@
spring.profiles.active=${SPRING_PROFILES_ACTIVE} #spring.profiles.active=${SPRING_PROFILES_ACTIVE}
#spring.profiles.active=abomey #spring.profiles.active=abomey
#spring.profiles.active=test spring.profiles.active=test
spring.jpa.properties.hibernate.id.new_generator_mappings=false spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.open-in-view=false spring.jpa.open-in-view=false