18 Commits

Author SHA1 Message Date
f378b1f0eb Merge pull request 'reajustement workflow' (#310) from features/fiche_refonte into develop
Reviewed-on: #310
2026-08-05 18:20:43 +00:00
b0e0caf3bb reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 35s
2026-08-05 19:20:16 +01:00
4ae2620fc0 Merge pull request 'reajustement workflow' (#308) from features/fiche_refonte into develop
Reviewed-on: #308
2026-08-05 18:10:17 +00:00
c9f7afb23d reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 40s
2026-08-05 19:07:05 +01:00
93732ef18b Merge pull request 'reajustement workflow' (#306) from features/fiche_refonte into develop
Reviewed-on: #306
2026-08-04 19:51:42 +00:00
08a4762a83 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 58s
2026-08-04 20:46:21 +01:00
cb012adedb Merge pull request 'reajustement workflow' (#304) from features/fiche_refonte into develop
Reviewed-on: #304
2026-08-04 11:21:33 +00:00
d38784b682 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 44s
2026-08-04 12:18:55 +01:00
a6fe645909 Merge pull request 'reajustement workflow' (#302) from features/fiche_refonte into develop
Reviewed-on: #302
2026-08-03 13:25:55 +00:00
a475a0d298 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 36s
2026-08-03 14:24:51 +01:00
d5f868a79e Merge pull request 'reajustement workflow' (#300) from features/fiche_refonte into develop
Reviewed-on: #300
2026-08-03 12:48:39 +00:00
0a24ef47c3 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 36s
2026-08-03 13:48:11 +01:00
1805ea92e1 Merge pull request 'reajustement workflow' (#298) from features/fiche_refonte into develop
Reviewed-on: #298
2026-08-03 08:14:43 +00:00
cd336225a3 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 42s
2026-08-03 09:14:06 +01:00
37b967a6fe Merge pull request 'reajustement workflow' (#296) from features/fiche_refonte into develop
Reviewed-on: #296
2026-08-02 21:11:43 +00:00
3119060aa2 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 32s
2026-08-02 22:10:44 +01:00
2c4461979f Merge pull request 'reajustement workflow' (#294) from features/fiche_refonte into develop
Reviewed-on: #294
2026-08-02 17:58:08 +00:00
774611f0b8 reajustement workflow
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 36s
2026-08-02 18:57:14 +01:00
28 changed files with 332 additions and 84 deletions

View File

@@ -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<>(

View File

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

View File

@@ -212,7 +212,7 @@ public class CampagneController {
@GetMapping("/by-exercice-id/{exerciceId}") @GetMapping("/by-exercice-id/{exerciceId}")
@PreAuthorize("hasAuthority('READ_CAMPAGNE')") @PreAuthorize("hasAuthority('READ_CAMPAGNE')")
public ResponseEntity<?> getCampagneByType(@PathVariable Long exerciceId) { public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId) {
try { try {
return new ResponseEntity<>( return new ResponseEntity<>(
@@ -238,7 +238,7 @@ public class CampagneController {
@GetMapping("/page/by-exercice-id/{exerciceId}") @GetMapping("/page/by-exercice-id/{exerciceId}")
@PreAuthorize("hasAuthority('READ_CAMPAGNE')") @PreAuthorize("hasAuthority('READ_CAMPAGNE')")
public ResponseEntity<?> getCampagneByType(@PathVariable Long exerciceId,@RequestParam int pageNo, @RequestParam int pageSize) { public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId,@RequestParam int pageNo, @RequestParam int pageSize) {
try { try {
Pageable pageable = PageRequest.of(pageNo, pageSize); Pageable pageable = PageRequest.of(pageNo, pageSize);
@@ -261,5 +261,58 @@ public class CampagneController {
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-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);
}
}
} }

View File

@@ -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."),

View File

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

View File

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

View File

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

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.gmss.fiscad.deserializer.LocalDateDeserializer; import io.gmss.fiscad.deserializer.LocalDateDeserializer;
import io.gmss.fiscad.entities.BaseEntity; import io.gmss.fiscad.entities.BaseEntity;
import io.gmss.fiscad.entities.infocad.metier.Enquete; import io.gmss.fiscad.entities.infocad.metier.Enquete;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
import io.gmss.fiscad.enums.TypeCampagne; import io.gmss.fiscad.enums.TypeCampagne;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -42,6 +43,9 @@ public class Campagne extends BaseEntity implements Serializable {
@ManyToOne @ManyToOne
private Exercice exercice ; private Exercice exercice ;
@ManyToOne
private Structure structure ;
} }

View File

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

View File

@@ -267,7 +267,6 @@ public class PersonneServiceImpl implements PersonneService {
} }
if(request.getNpi()!=null && !request.getNpi().equals("")){ if(request.getNpi()!=null && !request.getNpi().equals("")){
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi()); List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
if(!personnePayLoadWebs.isEmpty()) if(!personnePayLoadWebs.isEmpty())
return personnePayLoadWebs; return personnePayLoadWebs;
@@ -277,13 +276,14 @@ public class PersonneServiceImpl implements PersonneService {
result = recherchePersonneLocal(request); result = recherchePersonneLocal(request);
if (result != null && !result.isEmpty()) { if (result != null && ! result.isEmpty()) {
return result; return result;
} }
// Conversion date en String format yyyy-MM-dd // Conversion date en String format yyyy-MM-dd
String dateNaissance = Optional.ofNullable(request.getDateNaissance()) String dateNaissance = Optional.ofNullable(request.getDateNaissance())
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE)) .map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
.orElse(null); .orElse(null);
// Construction du body IFU // Construction du body IFU
IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody(); IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody();
ifuRequest.setNom(request.getNom()); ifuRequest.setNom(request.getNom());

View File

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

View File

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

View File

@@ -30,6 +30,7 @@ public class CampagneServiceImpl implements CampagneService {
if (campagnePayloadWeb.getId() != null) { if (campagnePayloadWeb.getId() != null) {
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null."); throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
} }
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb); Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
campagne= campagneRepository.save(campagne); campagne= campagneRepository.save(campagne);
@@ -88,5 +89,15 @@ public class CampagneServiceImpl implements CampagneService {
public Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId, Pageable pageable) { public Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId, Pageable pageable) {
return campagneRepository.findAllPayloadByExerciceId(exerciceId,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);
}
} }

View File

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

View File

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

View File

@@ -28,6 +28,8 @@ public interface CampagneService {
Optional<CampagnePayloadWeb> getCampagneById(Long id); Optional<CampagnePayloadWeb> getCampagneById(Long id);
List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId); List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId);
Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId,Pageable pageable); Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId,Pageable pageable);
List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId);
Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable);
} }

View File

@@ -29,7 +29,11 @@ public class CampagnePayloadWeb {
private Long exerciceId ; private Long exerciceId ;
private Integer exerciceAnnee ; private Integer exerciceAnnee ;
public CampagnePayloadWeb(Long id, String refAdministrative, String nom, LocalDate dateDebut, LocalDate dateFin, TypeCampagne typeCampagne, Long exerciceId, 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.id = id;
this.refAdministrative = refAdministrative; this.refAdministrative = refAdministrative;
this.nom = nom; this.nom = nom;
@@ -38,5 +42,8 @@ public class CampagnePayloadWeb {
this.typeCampagne = typeCampagne; this.typeCampagne = typeCampagne;
this.exerciceId = exerciceId; this.exerciceId = exerciceId;
this.exerciceAnnee = exerciceAnnee; this.exerciceAnnee = exerciceAnnee;
this.structureId = structureId;
this.structureCode = structureCode;
this.structureNom = structureNom;
} }
} }

View File

@@ -36,6 +36,7 @@ public class EnquetePayLoadWeb {
private Long zoneRfuId; private Long zoneRfuId;
private String zoneRfuNom; private String zoneRfuNom;
private Long personneId; private Long personneId;
private String personneIfu;
private String personneNom; private String personneNom;
private String personnePrenom; private String personnePrenom;
private String personneRaisonSociale; private String personneRaisonSociale;

View File

@@ -73,12 +73,12 @@ public class ParcelleRepositoryCustomImpl implements ParcelleRepositoryCustom {
r.numero as rueNumero, r.numero as rueNumero,
r.nom as rueNom, r.nom as rueNom,
pers.id as personneId, pers.id as proprietaireId,
pers.ifu as ifu, pers.ifu as proprietaireIfu,
pers.npi as npi, pers.npi as proprietaireNpi,
pers.nom as nom, pers.nom as proprietaireNom,
pers.prenom as prenom, pers.prenom as proprietairePrenom,
pers.raison_sociale as raisonSociale, pers.raison_sociale as proprietaireRaisonSociale,
de.id as enqueteCouranteId de.id as enqueteCouranteId

View File

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

View File

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

View File

@@ -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';
$$;

View File

@@ -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,

View File

@@ -24,10 +24,14 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
c.dateFin, c.dateFin,
c.typeCampagne, c.typeCampagne,
e.id, e.id,
e.annee e.annee,
s.id,
s.code,
s.nom
) )
FROM Campagne c FROM Campagne c
LEFT JOIN c.exercice e LEFT JOIN c.exercice e
LEFT JOIN c.structure s
WHERE c.id = :id WHERE c.id = :id
""") """)
Optional<CampagnePayloadWeb> findPayloadById(@Param("id") Long id); Optional<CampagnePayloadWeb> findPayloadById(@Param("id") Long id);
@@ -41,10 +45,14 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
c.dateFin, c.dateFin,
c.typeCampagne, c.typeCampagne,
e.id, e.id,
e.annee e.annee,
s.id,
s.code,
s.nom
) )
FROM Campagne c FROM Campagne c
LEFT JOIN c.exercice e LEFT JOIN c.exercice e
LEFT JOIN c.structure s
ORDER BY c.dateDebut DESC ORDER BY c.dateDebut DESC
""") """)
List<CampagnePayloadWeb> findAllPayload(); List<CampagnePayloadWeb> findAllPayload();
@@ -58,10 +66,14 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
c.dateFin, c.dateFin,
c.typeCampagne, c.typeCampagne,
e.id, e.id,
e.annee e.annee,
s.id,
s.code,
s.nom
) )
FROM Campagne c FROM Campagne c
LEFT JOIN c.exercice e LEFT JOIN c.exercice e
LEFT JOIN c.structure s
""", """,
countQuery = """ countQuery = """
SELECT COUNT(c) SELECT COUNT(c)
@@ -78,10 +90,14 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
c.dateFin, c.dateFin,
c.typeCampagne, c.typeCampagne,
e.id, e.id,
e.annee e.annee,
s.id,
s.code,
s.nom
) )
FROM Campagne c FROM Campagne c
LEFT JOIN c.exercice e LEFT JOIN c.exercice e
LEFT JOIN c.structure s
WHERE e.id = :exerciceId WHERE e.id = :exerciceId
ORDER BY c.dateDebut DESC ORDER BY c.dateDebut DESC
""") """)
@@ -97,10 +113,14 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
c.dateFin, c.dateFin,
c.typeCampagne, c.typeCampagne,
e.id, e.id,
e.annee e.annee,
s.id,
s.code,
s.nom
) )
FROM Campagne c FROM Campagne c
LEFT JOIN c.exercice e LEFT JOIN c.exercice e
LEFT JOIN c.structure s
WHERE e.id = :exerciceId WHERE e.id = :exerciceId
""", """,
countQuery = """ countQuery = """
@@ -111,5 +131,57 @@ public interface CampagneRepository extends JpaRepository<Campagne, Long> {
Page<CampagnePayloadWeb> findAllPayloadByExerciceId( Page<CampagnePayloadWeb> findAllPayloadByExerciceId(
@Param("exerciceId") Long exerciceId, @Param("exerciceId") Long exerciceId,
Pageable pageable); 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);
} }

View File

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

View File

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

View File

@@ -1243,6 +1243,12 @@ public class EntityFromPayLoadService {
campagne.setExercice(exercice); campagne.setExercice(exercice);
} }
if (campagnePayloadWeb.getStructureId() != null) {
Structure structure = new Structure();
structure.setId(campagnePayloadWeb.getStructureId());
campagne.setStructure(structure);
}
campagne.setId(campagnePayloadWeb.getId()); campagne.setId(campagnePayloadWeb.getId());
campagne.setDateDebut(campagnePayloadWeb.getDateDebut()); campagne.setDateDebut(campagnePayloadWeb.getDateDebut());
campagne.setDateFin(campagnePayloadWeb.getDateFin()); campagne.setDateFin(campagnePayloadWeb.getDateFin());

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