Compare commits
18 Commits
4e72d329ed
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cb2ba8474 | |||
| f378b1f0eb | |||
| b0e0caf3bb | |||
| 57022e1def | |||
| 4ae2620fc0 | |||
| c9f7afb23d | |||
| 22a2519b89 | |||
| 93732ef18b | |||
| 08a4762a83 | |||
| 9b6ea82e15 | |||
| cb012adedb | |||
| d38784b682 | |||
| 8fcd7d2e50 | |||
| a6fe645909 | |||
| a475a0d298 | |||
| 917bd4b6c5 | |||
| d5f868a79e | |||
| 0a24ef47c3 |
@@ -6,6 +6,7 @@ import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
|||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
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.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||||
@@ -408,7 +409,7 @@ public class DonneesImpositionTfuController {
|
|||||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||||
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
||||||
try {
|
try {
|
||||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu =impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||||
|
|
||||||
if(optionalImpositionsTfu.isEmpty()){
|
if(optionalImpositionsTfu.isEmpty()){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
@@ -424,6 +425,7 @@ public class DonneesImpositionTfuController {
|
|||||||
}
|
}
|
||||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||||
|
|
||||||
|
System.out.println("OK apres sorti bati une parcelle");
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
@@ -507,7 +509,7 @@ public class DonneesImpositionTfuController {
|
|||||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||||
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
||||||
try {
|
try {
|
||||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu = impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||||
|
|
||||||
if(optionalImpositionsTfu.isEmpty()){
|
if(optionalImpositionsTfu.isEmpty()){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
@@ -516,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){
|
if(userPrincipal==null){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
package io.gmss.fiscad.controllers.rfu.metier;
|
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.rfu.metier.ImpositionsTfu;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
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.interfaces.rfu.metier.ImpositionsTfuService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
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.CurrentUser;
|
||||||
import io.gmss.fiscad.security.UserPrincipal;
|
import io.gmss.fiscad.security.UserPrincipal;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
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.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -39,6 +44,8 @@ import org.springframework.web.client.HttpClientErrorException;
|
|||||||
public class ImpositionsTfuController {
|
public class ImpositionsTfuController {
|
||||||
|
|
||||||
private final ImpositionsTfuService impositionsTfuService;
|
private final ImpositionsTfuService impositionsTfuService;
|
||||||
|
private final StructureService structureService;
|
||||||
|
|
||||||
private final EnqueteService enqueteService;
|
private final EnqueteService enqueteService;
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||||
|
|
||||||
@@ -54,11 +61,22 @@ public class ImpositionsTfuController {
|
|||||||
HttpStatus.OK
|
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()){
|
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||||
return new ResponseEntity<>(
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ public class ExerciceController {
|
|||||||
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
||||||
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
exercice = exerciceService.createExercice(exercice);
|
exercice = exerciceService.createExercice(exercice);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.annotations.Formula;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -183,6 +184,14 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
private Integer nbreIndivisiaire;
|
private Integer nbreIndivisiaire;
|
||||||
private String autreAdresse;
|
private String autreAdresse;
|
||||||
private Float superficie ;
|
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 nbreBatiment;
|
||||||
private Integer nbrePiscine;
|
private Integer nbrePiscine;
|
||||||
private Long montantMensuelleLocation;
|
private Long montantMensuelleLocation;
|
||||||
|
|||||||
@@ -93,10 +93,10 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
@Column(columnDefinition = "TEXT")
|
@Column(columnDefinition = "TEXT")
|
||||||
private String motif;
|
private String motif;
|
||||||
|
|
||||||
@JsonIgnore
|
// @JsonIgnore
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "impositions_tfu_id")
|
// @JoinColumn(name = "impositions_tfu_id")
|
||||||
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
// private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,15 @@ import java.time.LocalDate;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@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 {
|
public class Participer extends BaseEntity implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ import java.time.LocalDate;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Where(clause = " deleted = false")
|
@Where(clause = " deleted = false")
|
||||||
|
@Table(
|
||||||
|
uniqueConstraints = {
|
||||||
|
@UniqueConstraint(name = "uk_exercice_annee", columnNames = "annee")
|
||||||
|
}
|
||||||
|
)
|
||||||
public class Exercice extends BaseEntity implements Serializable {
|
public class Exercice extends BaseEntity implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package io.gmss.fiscad.implementations.rfu.metier;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
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.DonneesImpositionTfu;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||||
import io.gmss.fiscad.enums.StatusAvis;
|
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.interfaces.infocad.parametre.StructureService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
|
||||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||||
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||||
@@ -45,6 +45,7 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
private final ArrondissementRepository arrondissementRepository;
|
private final ArrondissementRepository arrondissementRepository;
|
||||||
private final BaremRfuRepository baremRfuRepository;
|
private final BaremRfuRepository baremRfuRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
|
private final StructureService structureService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -116,23 +117,38 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
||||||
|
|
||||||
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
||||||
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
|
||||||
|
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||||
|
|
||||||
String nomQuartier="";
|
String nomQuartier="";
|
||||||
String nomArrondissement="";
|
String nomArrondissement="";
|
||||||
String nomCommune="";
|
String nomCommune="";
|
||||||
if(optionalParcelle.isPresent()){
|
if(optionalParcelle.isPresent()){
|
||||||
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||||
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
|
||||||
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
|
||||||
}
|
}
|
||||||
if(!existsBareme){
|
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);
|
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomQuartier);
|
||||||
}
|
}
|
||||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId,parcelleId);
|
|
||||||
|
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 impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||||
//impositionsTfu.setNombreAvisFnb(nb);
|
|
||||||
impositionsTfuRepository.save(impositionsTfu);
|
impositionsTfuRepository.save(impositionsTfu);
|
||||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
@@ -173,23 +189,21 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId) {
|
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId) {
|
||||||
|
|
||||||
Optional<ImpositionsTfuPaylaodWeb> imp=impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfuPaylaodWeb> imp=impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||||
if(imp.isPresent()){
|
if(imp.isPresent()){
|
||||||
boolean dejaLiquide = donneesImpositionTfuRepository.existsByImpositionAnneeAndParcelle(Long.valueOf(imp.get().getExerciceAnnee()),parcelleId);
|
boolean dejaLiquide = donneesImpositionTfuRepository.existsByImpositionAnneeAndParcelle(Long.valueOf(imp.get().getExerciceAnnee()),parcelleId);
|
||||||
if(dejaLiquide){
|
if(dejaLiquide){
|
||||||
return imp.orElse(null);
|
return imp.orElse(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
||||||
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
|
||||||
|
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||||
String nomQuartier="";
|
String nomQuartier="";
|
||||||
String nomArrondissement="";
|
String nomArrondissement="";
|
||||||
String nomCommune="";
|
String nomCommune="";
|
||||||
if(optionalParcelle.isPresent()){
|
if(optionalParcelle.isPresent()){
|
||||||
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||||
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
|
||||||
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
|
||||||
}
|
}
|
||||||
if(!existsBareme){
|
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);
|
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);
|
||||||
@@ -209,15 +223,10 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
|
|
||||||
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
||||||
|
|
||||||
|
|
||||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
|
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||||
|
|
||||||
//impositionsTfu.setNombreAvis(impositionsTfu.getNombreAvis()+1);
|
|
||||||
//impositionsTfu.setNombreAvisBatiment(impositionsTfu.getNombreAvisFnb()+1);
|
|
||||||
//impositionsTfu.setNombreAvisUniteLog(impositionsTfu.getNombreAvisUniteLog()+1);
|
|
||||||
|
|
||||||
impositionsTfuRepository.save(impositionsTfu);
|
impositionsTfuRepository.save(impositionsTfu);
|
||||||
|
|
||||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.implementations.rfu.metier;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
||||||
@@ -41,12 +42,22 @@ public class ParticiperServiceImpl implements ParticiperService {
|
|||||||
throw new BadRequestException("Impossible de créer la participation: L'équipe doit être précisée.");
|
throw new BadRequestException("Impossible de créer la participation: L'équipe doit être précisée.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (participerPaylaodWeb.getUserId() == null) {
|
if (participerPaylaodWeb.getUserId() == null) {
|
||||||
throw new BadRequestException("Impossible de créer la participation : Le participant doit être précisé.");
|
throw new BadRequestException("Impossible de créer la participation : Le participant doit être précisé.");
|
||||||
}else {
|
}else {
|
||||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
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 participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
||||||
participer= participerRepository.save(participer);
|
participer= participerRepository.save(participer);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
||||||
@@ -22,8 +23,14 @@ public class ExerciceServiceImpl implements ExerciceService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
||||||
if (exercice.getId() != null) {
|
if (exercice.getId() == null) {
|
||||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non 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);
|
return exerciceRepository.save(exercice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,9 +137,10 @@ public class UserServiceImpl implements UserService {
|
|||||||
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
||||||
|
|
||||||
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
||||||
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
&& (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||||
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userPaylaodWeb.getId() == null) {
|
if (userPaylaodWeb.getId() == null) {
|
||||||
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,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 ;
|
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;
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ $$;
|
|||||||
|
|
||||||
call integrer_eavis();
|
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;
|
||||||
@@ -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
|
select left(code,4) as code_commune_fiscad, code as code_quartier_fiscad,nom as nom_quartier_fiscad
|
||||||
from quartier;
|
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';
|
||||||
|
$$;
|
||||||
@@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface ParticiperRepository extends JpaRepository<Participer, Long> {
|
public interface ParticiperRepository extends JpaRepository<Participer, Long> {
|
||||||
|
boolean existsByEquipeIdAndUserId(Long equipeId, Long userId);
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
||||||
Optional<Exercice> findFirstByAnnee(int annee);
|
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);
|
Page<AvoirFonctionPaylaodWeb> findAllAvoirFonctionToDtoPageable(Pageable pageable);
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
||||||
af.id,
|
af.id,
|
||||||
af.dateDebut,
|
af.dateDebut,
|
||||||
af.dateFin,
|
af.dateFin,
|
||||||
f.id,
|
f.id,
|
||||||
f.code,
|
f.code,
|
||||||
f.nom,
|
f.nom,
|
||||||
u.id,
|
u.id,
|
||||||
u.username,
|
u.username,
|
||||||
u.nom,
|
u.nom,
|
||||||
u.prenom,
|
u.prenom,
|
||||||
u.email,
|
u.email,
|
||||||
af.titre
|
af.titre
|
||||||
)
|
)
|
||||||
FROM AvoirFonction af
|
FROM AvoirFonction af
|
||||||
LEFT JOIN af.user u
|
LEFT JOIN af.user u
|
||||||
LEFT JOIN af.fonction f
|
LEFT JOIN af.fonction f
|
||||||
WHERE u.id = :userId
|
WHERE u.id = :userId
|
||||||
""")
|
AND (af.dateFin IS NULL OR af.dateFin >= CURRENT_DATE)
|
||||||
|
""")
|
||||||
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user