Merge pull request 'features/fiche_refonte' (#284) from features/fiche_refonte into develop
Reviewed-on: #284
This commit was merged in pull request #284.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class DonneesImpositionTfuController {
|
||||
|
||||
@GetMapping("/donnees-non-homologable/{idImpositionTfu}")
|
||||
@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 {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
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}")
|
||||
@PreAuthorize("hasAuthority('DELETE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> deleteDonneesImpositionTfu(@PathVariable Long id) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -342,4 +342,10 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@ public interface StructureService {
|
||||
|
||||
|
||||
public List<Structure> getListStructureUserId(Long userId) ;
|
||||
public List<StructurePaylaodWeb> getListStructureAvoirFonctionId(Long avoirFonctionId) ;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public interface DonneesImpositionTfuService {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -28,4 +29,5 @@ public interface ImpositionsTfuService {
|
||||
|
||||
Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id);
|
||||
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId);
|
||||
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByStructureIdByStatut(Long structureId, StatusAvis statusAvis);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@Transactional
|
||||
@Query("""
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -1094,18 +1094,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());
|
||||
|
||||
@@ -2,16 +2,16 @@ server.port=8282
|
||||
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.url=jdbc:postgresql://193.181.208.4:5432/fiscad_db
|
||||
spring.datasource.username=fiscad_user
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
|
||||
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
|
||||
|
||||
|
||||
app.default-user.username=fiscad_admin
|
||||
app.default-user.password=1234567890
|
||||
|
||||
|
||||
Reference in New Issue
Block a user