Compare commits
11 Commits
c0c9f5e212
...
features/f
| Author | SHA1 | Date | |
|---|---|---|---|
| b3c1e10da6 | |||
| b0e0caf3bb | |||
| c9f7afb23d | |||
| 08a4762a83 | |||
| d38784b682 | |||
| a475a0d298 | |||
| 0a24ef47c3 | |||
| cd336225a3 | |||
| 3119060aa2 | |||
| 774611f0b8 | |||
| 7885169c9a |
@@ -6,6 +6,7 @@ import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
@@ -408,7 +409,7 @@ public class DonneesImpositionTfuController {
|
||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu =impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
@@ -424,6 +425,7 @@ public class DonneesImpositionTfuController {
|
||||
}
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||
|
||||
System.out.println("OK apres sorti bati une parcelle");
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -507,7 +509,7 @@ public class DonneesImpositionTfuController {
|
||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu = impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
@@ -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){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -29,6 +32,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@@ -39,6 +44,8 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
public class ImpositionsTfuController {
|
||||
|
||||
private final ImpositionsTfuService impositionsTfuService;
|
||||
private final StructureService structureService;
|
||||
|
||||
private final EnqueteService enqueteService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||
|
||||
@@ -54,11 +61,22 @@ public class ImpositionsTfuController {
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
User user=currentUser.getUser();
|
||||
|
||||
if(impositionsTfuPaylaodWeb.getStructureId()==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Veuillez préciser la strucuture."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
User user = currentUser.getUser();
|
||||
|
||||
StructurePaylaodWeb st = structureService.getStructureById(impositionsTfuPaylaodWeb.getStructureId()).orElseGet(null);
|
||||
|
||||
|
||||
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource."),
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource. Votre centre : "+ user.getStructure().getNom() +" le centre de liquidation : "+ st.getNom()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -37,11 +38,11 @@ public class CampagneController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasAuthority('CREATE_CAMPAGNE')")
|
||||
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated Campagne campagne) {
|
||||
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated CampagnePayloadWeb campagnePayloadWeb) {
|
||||
try {
|
||||
campagne = campagneService.createCampagne(campagne);
|
||||
campagnePayloadWeb = campagneService.createCampagne(campagnePayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
|
||||
new ApiResponse<>(true, campagnePayloadWeb, "Campagne créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -62,10 +63,10 @@ public class CampagneController {
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasAuthority('UPDATE_CAMPAGNE')")
|
||||
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody Campagne campagne) {
|
||||
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody CampagnePayloadWeb campagnePayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
|
||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagnePayloadWeb), "Campagne mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -207,5 +208,111 @@ public class CampagneController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-exercice-id/{exerciceId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId), "Liste des campagne par type chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/page/by-exercice-id/{exerciceId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId,pageable), "Liste des campagne par type chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-structure-id/{structureId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId), "Liste des campagne par type chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/page/by-structure-id/{structureId}")
|
||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId,pageable), "Liste des campagne par type chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ public class ExerciceController {
|
||||
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
||||
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
||||
try {
|
||||
|
||||
|
||||
exercice = exerciceService.createExercice(exercice);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
||||
|
||||
@@ -27,6 +27,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
@@ -183,6 +184,14 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
private Integer nbreIndivisiaire;
|
||||
private String autreAdresse;
|
||||
private Float superficie ;
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (bat.id))
|
||||
FROM enquete e
|
||||
join batiment bat on bat.parcelle_id =e.parcelle_id
|
||||
WHERE bat.parcelle_id = parcelle_id
|
||||
)
|
||||
""")
|
||||
private Integer nbreBatiment;
|
||||
private Integer nbrePiscine;
|
||||
private Long montantMensuelleLocation;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
private String datePieceAdmin;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
private StatusAvis statusAvis;
|
||||
@Formula("""
|
||||
(
|
||||
@@ -59,6 +60,7 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
WHERE d.impositions_tfu_id = id
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvis;
|
||||
@Formula("""
|
||||
(
|
||||
@@ -68,6 +70,7 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
and (d.nature_impot='FNB' or d.nature_impot='FB')
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisFnb;
|
||||
@Formula("""
|
||||
(
|
||||
@@ -78,7 +81,9 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
and d.batiment_id is not null
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisBatiment;
|
||||
|
||||
@Formula("""
|
||||
(
|
||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||
@@ -88,15 +93,16 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
and d.unite_logement_id is not null
|
||||
)
|
||||
""")
|
||||
@Transient
|
||||
private Integer nombreAvisUniteLog;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String motif;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "impositions_tfu_id")
|
||||
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
// @JoinColumn(name = "impositions_tfu_id")
|
||||
// private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,15 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
//@Where(clause = " deleted = false")
|
||||
@Table(
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(
|
||||
name = "uk_participer_equipe_user",
|
||||
columnNames = {"equipe_id", "user_id"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public class Participer extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -39,12 +40,12 @@ public class Campagne extends BaseEntity implements Serializable {
|
||||
private LocalDate dateFin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeCampagne typeCampagne;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "campagne")
|
||||
// private List<Equipe> equipes;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "campagne")
|
||||
// private List<Enquete> enquetes;
|
||||
@ManyToOne
|
||||
private Exercice exercice ;
|
||||
|
||||
@ManyToOne
|
||||
private Structure structure ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ import java.time.LocalDate;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
@Table(
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(name = "uk_exercice_annee", columnNames = "annee")
|
||||
}
|
||||
)
|
||||
public class Exercice extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
||||
@@ -267,7 +267,6 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
}
|
||||
|
||||
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
||||
|
||||
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
||||
if(!personnePayLoadWebs.isEmpty())
|
||||
return personnePayLoadWebs;
|
||||
@@ -277,13 +276,14 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
|
||||
result = recherchePersonneLocal(request);
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
if (result != null && ! result.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
// Conversion date en String format yyyy-MM-dd
|
||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||
.orElse(null);
|
||||
|
||||
// Construction du body IFU
|
||||
IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody();
|
||||
ifuRequest.setNom(request.getNom());
|
||||
|
||||
@@ -2,16 +2,16 @@ package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
@@ -45,6 +45,7 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final BaremRfuRepository baremRfuRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final StructureService structureService;
|
||||
|
||||
|
||||
|
||||
@@ -116,23 +117,38 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
@Override
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
||||
|
||||
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
||||
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
||||
|
||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||
|
||||
String nomQuartier="";
|
||||
String nomArrondissement="";
|
||||
String nomCommune="";
|
||||
if(optionalParcelle.isPresent()){
|
||||
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
||||
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
||||
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||
|
||||
}
|
||||
if(!existsBareme){
|
||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
||||
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.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||
//impositionsTfu.setNombreAvisFnb(nb);
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
@@ -180,16 +196,14 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
||||
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
||||
|
||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
||||
String nomQuartier="";
|
||||
String nomArrondissement="";
|
||||
String nomCommune="";
|
||||
if(optionalParcelle.isPresent()){
|
||||
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
||||
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
||||
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
||||
}
|
||||
if(!existsBareme){
|
||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
||||
@@ -209,15 +223,10 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
|
||||
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
||||
|
||||
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||
|
||||
//impositionsTfu.setNombreAvis(impositionsTfu.getNombreAvis()+1);
|
||||
//impositionsTfu.setNombreAvisBatiment(impositionsTfu.getNombreAvisFnb()+1);
|
||||
//impositionsTfu.setNombreAvisUniteLog(impositionsTfu.getNombreAvisUniteLog()+1);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
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.rfu.metier.Participer;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (participerPaylaodWeb.getUserId() == null) {
|
||||
throw new BadRequestException("Impossible de créer la participation : Le participant doit être précisé.");
|
||||
}else {
|
||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
||||
}
|
||||
|
||||
if (participerRepository.existsByEquipeIdAndUserId(
|
||||
participerPaylaodWeb.getEquipeId(),
|
||||
participerPaylaodWeb.getUserId())) {
|
||||
throw new ApplicationException("Cet utilisateur participe déjà à cette équipe.");
|
||||
}
|
||||
|
||||
|
||||
Participer participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
||||
participer= participerRepository.save(participer);
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -14,29 +19,36 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CampagneServiceImpl implements CampagneService {
|
||||
private final CampagneRepository campagneRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
public CampagneServiceImpl(CampagneRepository campagneRepository) {
|
||||
this.campagneRepository = campagneRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Campagne createCampagne(Campagne campagne) throws BadRequestException {
|
||||
if (campagne.getId() != null) {
|
||||
public CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException {
|
||||
if (campagnePayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
}
|
||||
return campagneRepository.save(campagne);
|
||||
|
||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
||||
campagne= campagneRepository.save(campagne);
|
||||
|
||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException {
|
||||
if (campagne.getId() == null) {
|
||||
public CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException {
|
||||
if (campagnePayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle campagne ayant un id null.");
|
||||
}
|
||||
if (!campagneRepository.existsById(campagne.getId())) {
|
||||
if (!campagneRepository.existsById(campagnePayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la campagne spécifiée dans notre base de données.");
|
||||
}
|
||||
return campagneRepository.save(campagne);
|
||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
||||
campagne= campagneRepository.save(campagne);
|
||||
|
||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,13 +61,13 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Page<Campagne> getCampagneList(Pageable pageable) {
|
||||
return campagneRepository.findAll(pageable);
|
||||
public Page<CampagnePayloadWeb> getCampagneList(Pageable pageable) {
|
||||
return campagneRepository.findAllPayload(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Campagne> getCampagneList() {
|
||||
return campagneRepository.findAll();
|
||||
public List<CampagnePayloadWeb> getCampagneList() {
|
||||
return campagneRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,8 +76,28 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Campagne> getCampagneById(Long id) {
|
||||
return campagneRepository.findById(id);
|
||||
public Optional<CampagnePayloadWeb> getCampagneById(Long id) {
|
||||
return campagneRepository.findPayloadById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId) {
|
||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId, Pageable pageable) {
|
||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId) {
|
||||
return campagneRepository.findAllPayloadByStructureId(structureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable) {
|
||||
return campagneRepository.findAllPayloadByStructureId(structureId,pageable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
||||
@@ -22,8 +23,14 @@ public class ExerciceServiceImpl implements ExerciceService {
|
||||
|
||||
@Override
|
||||
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
||||
if (exercice.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
if (exercice.getId() == null) {
|
||||
if (exerciceRepository.existsByAnnee(exercice.getAnnee())) {
|
||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
||||
}
|
||||
} else {
|
||||
if (exerciceRepository.existsByAnneeAndIdNot(exercice.getAnnee(), exercice.getId())) {
|
||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
||||
}
|
||||
}
|
||||
return exerciceRepository.save(exercice);
|
||||
}
|
||||
|
||||
@@ -137,9 +137,10 @@ public class UserServiceImpl implements UserService {
|
||||
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
||||
|
||||
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
||||
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||
&& (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
||||
}
|
||||
|
||||
if (userPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -12,18 +13,23 @@ import java.util.Optional;
|
||||
|
||||
public interface CampagneService {
|
||||
|
||||
Campagne createCampagne(Campagne campagne) throws BadRequestException;
|
||||
CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException;
|
||||
|
||||
Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException;
|
||||
CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteCampagne(Long id) throws NotFoundException;
|
||||
|
||||
Page<Campagne> getCampagneList(Pageable pageable);
|
||||
Page<CampagnePayloadWeb> getCampagneList(Pageable pageable);
|
||||
|
||||
List<Campagne> getCampagneList();
|
||||
List<CampagnePayloadWeb> getCampagneList();
|
||||
|
||||
List<Campagne> getCampagnesByType(TypeCampagne typeCampagne);
|
||||
|
||||
Optional<Campagne> getCampagneById(Long id);
|
||||
Optional<CampagnePayloadWeb> getCampagneById(Long id);
|
||||
List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId);
|
||||
Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId,Pageable pageable);
|
||||
List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId);
|
||||
Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class CampagnePayloadWeb {
|
||||
|
||||
private Long id;
|
||||
private String refAdministrative;
|
||||
private String nom;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TypeCampagne typeCampagne;
|
||||
private Long exerciceId ;
|
||||
private Integer exerciceAnnee ;
|
||||
|
||||
private Long structureId ;
|
||||
private String structureCode ;
|
||||
private String structureNom ;
|
||||
|
||||
public CampagnePayloadWeb(Long id, String refAdministrative, String nom, LocalDate dateDebut, LocalDate dateFin, TypeCampagne typeCampagne, Long exerciceId, Integer exerciceAnnee, Long structureId, String structureCode, String structureNom) {
|
||||
this.id = id;
|
||||
this.refAdministrative = refAdministrative;
|
||||
this.nom = nom;
|
||||
this.dateDebut = dateDebut;
|
||||
this.dateFin = dateFin;
|
||||
this.typeCampagne = typeCampagne;
|
||||
this.exerciceId = exerciceId;
|
||||
this.exerciceAnnee = exerciceAnnee;
|
||||
this.structureId = structureId;
|
||||
this.structureCode = structureCode;
|
||||
this.structureNom = structureNom;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class EnquetePayLoadWeb {
|
||||
private Long zoneRfuId;
|
||||
private String zoneRfuNom;
|
||||
private Long personneId;
|
||||
private String personneIfu;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
|
||||
@@ -73,12 +73,12 @@ public class ParcelleRepositoryCustomImpl implements ParcelleRepositoryCustom {
|
||||
r.numero as rueNumero,
|
||||
r.nom as rueNom,
|
||||
|
||||
pers.id as personneId,
|
||||
pers.ifu as ifu,
|
||||
pers.npi as npi,
|
||||
pers.nom as nom,
|
||||
pers.prenom as prenom,
|
||||
pers.raison_sociale as raisonSociale,
|
||||
pers.id as proprietaireId,
|
||||
pers.ifu as proprietaireIfu,
|
||||
pers.npi as proprietaireNpi,
|
||||
pers.nom as proprietaireNom,
|
||||
pers.prenom as proprietairePrenom,
|
||||
pers.raison_sociale as proprietaireRaisonSociale,
|
||||
|
||||
de.id as enqueteCouranteId
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
|
||||
select * from e_avis_view
|
||||
|
||||
select *
|
||||
from impositions_tfu;
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
|
||||
@@ -63,6 +63,15 @@ $$;
|
||||
|
||||
call integrer_eavis();
|
||||
|
||||
select * from eavis
|
||||
call integrer_eavis_detail();
|
||||
|
||||
delete from eavis;
|
||||
select *
|
||||
from e_avis_view ;
|
||||
|
||||
select * from eavis;
|
||||
|
||||
|
||||
select * from eavis_detail;
|
||||
|
||||
select *
|
||||
from donnees_imposition_tfu;
|
||||
@@ -147,3 +147,11 @@ select * from arrondissement
|
||||
|
||||
select left(code,4) as code_commune_fiscad, code as code_quartier_fiscad,nom as nom_quartier_fiscad
|
||||
from quartier;
|
||||
|
||||
|
||||
create function get_dblink_connection_sigibe() returns text
|
||||
language sql
|
||||
as
|
||||
$$
|
||||
SELECT 'host=193.181.208.4 port=5433 dbname=sigibe_test user=sigibe_test_user password=sigibe_test_pwd';
|
||||
$$;
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParticiperRepository extends JpaRepository<Participer, Long> {
|
||||
boolean existsByEquipeIdAndUserId(Long equipeId, Long userId);
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
||||
p.id,
|
||||
|
||||
@@ -2,11 +2,186 @@ package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CampagneRepository extends JpaRepository<Campagne, Long> {
|
||||
List<Campagne> findAllByTypeCampagne(TypeCampagne typeCampagne);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE c.id = :id
|
||||
""")
|
||||
Optional<CampagnePayloadWeb> findPayloadById(@Param("id") Long id);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayload();
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayload(Pageable pageable);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE e.id = :exerciceId
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayloadByExerciceId(@Param("exerciceId") Long exerciceId);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE e.id = :exerciceId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
WHERE c.exercice.id = :exerciceId
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayloadByExerciceId(
|
||||
@Param("exerciceId") Long exerciceId,
|
||||
Pageable pageable);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE s.id = :structureId
|
||||
ORDER BY c.dateDebut DESC
|
||||
""")
|
||||
List<CampagnePayloadWeb> findAllPayloadByStructureId(@Param("structureId") Long structureId);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
||||
c.id,
|
||||
c.refAdministrative,
|
||||
c.nom,
|
||||
c.dateDebut,
|
||||
c.dateFin,
|
||||
c.typeCampagne,
|
||||
e.id,
|
||||
e.annee,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom
|
||||
)
|
||||
FROM Campagne c
|
||||
LEFT JOIN c.exercice e
|
||||
LEFT JOIN c.structure s
|
||||
WHERE s.id = :structureId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(c)
|
||||
FROM Campagne c
|
||||
WHERE c.structure.id = :structureId
|
||||
""")
|
||||
Page<CampagnePayloadWeb> findAllPayloadByStructureId(
|
||||
@Param("exerciceId") Long structureId,
|
||||
Pageable pageable);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,5 +10,8 @@ import java.util.Optional;
|
||||
|
||||
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
||||
Optional<Exercice> findFirstByAnnee(int annee);
|
||||
boolean existsByAnnee(Integer annee);
|
||||
|
||||
boolean existsByAnneeAndIdNot(Integer annee, Long id);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ public interface AvoirFonctionRepository extends JpaRepository<AvoirFonction, Lo
|
||||
LEFT JOIN af.user u
|
||||
LEFT JOIN af.fonction f
|
||||
WHERE u.id = :userId
|
||||
AND (af.dateFin IS NULL OR af.dateFin >= CURRENT_DATE)
|
||||
""")
|
||||
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
||||
|
||||
|
||||
@@ -1231,4 +1231,31 @@ public class EntityFromPayLoadService {
|
||||
return participer ;
|
||||
|
||||
}
|
||||
|
||||
public Campagne getCampagneFromPayLoadWeb(CampagnePayloadWeb campagnePayloadWeb) {
|
||||
Campagne campagne =new Campagne();
|
||||
if(campagnePayloadWeb.getId()!=null)
|
||||
campagne = campagneRepository.findById(campagnePayloadWeb.getId()).orElse(new Campagne());
|
||||
|
||||
if (campagnePayloadWeb.getExerciceId() != null) {
|
||||
Exercice exercice = new Exercice();
|
||||
exercice.setId(campagnePayloadWeb.getExerciceId());
|
||||
campagne.setExercice(exercice);
|
||||
}
|
||||
|
||||
if (campagnePayloadWeb.getStructureId() != null) {
|
||||
Structure structure = new Structure();
|
||||
structure.setId(campagnePayloadWeb.getStructureId());
|
||||
campagne.setStructure(structure);
|
||||
}
|
||||
|
||||
campagne.setId(campagnePayloadWeb.getId());
|
||||
campagne.setDateDebut(campagnePayloadWeb.getDateDebut());
|
||||
campagne.setDateFin(campagnePayloadWeb.getDateFin());
|
||||
campagne.setTypeCampagne(campagnePayloadWeb.getTypeCampagne());
|
||||
campagne.setRefAdministrative(campagnePayloadWeb.getRefAdministrative());
|
||||
campagne.setNom(campagnePayloadWeb.getNom());
|
||||
|
||||
return campagne ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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