first commit
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
package dev.lions.unionflow.client.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AssociationDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "Le nom de l'association est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
private String adresse;
|
||||
private String telephone;
|
||||
private String email;
|
||||
private String siteWeb;
|
||||
|
||||
@NotNull(message = "Le type d'association est obligatoire")
|
||||
private String typeAssociation;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateCreation;
|
||||
|
||||
private String numeroRegistre;
|
||||
private String statut;
|
||||
private Integer nombreMembres;
|
||||
private String responsablePrincipal;
|
||||
private String telephoneResponsable;
|
||||
private String emailResponsable;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereActivite;
|
||||
|
||||
private String region;
|
||||
private String ville;
|
||||
private String quartier;
|
||||
|
||||
// Constructeurs
|
||||
public AssociationDTO() {}
|
||||
|
||||
public AssociationDTO(String nom, String typeAssociation) {
|
||||
this.nom = nom;
|
||||
this.typeAssociation = typeAssociation;
|
||||
this.statut = "ACTIVE";
|
||||
this.dateCreation = LocalDate.now();
|
||||
this.nombreMembres = 0;
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public String getNom() { return nom; }
|
||||
public void setNom(String nom) { this.nom = nom; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public String getAdresse() { return adresse; }
|
||||
public void setAdresse(String adresse) { this.adresse = adresse; }
|
||||
|
||||
public String getTelephone() { return telephone; }
|
||||
public void setTelephone(String telephone) { this.telephone = telephone; }
|
||||
|
||||
public String getEmail() { return email; }
|
||||
public void setEmail(String email) { this.email = email; }
|
||||
|
||||
public String getSiteWeb() { return siteWeb; }
|
||||
public void setSiteWeb(String siteWeb) { this.siteWeb = siteWeb; }
|
||||
|
||||
public String getTypeAssociation() { return typeAssociation; }
|
||||
public void setTypeAssociation(String typeAssociation) { this.typeAssociation = typeAssociation; }
|
||||
|
||||
public LocalDate getDateCreation() { return dateCreation; }
|
||||
public void setDateCreation(LocalDate dateCreation) { this.dateCreation = dateCreation; }
|
||||
|
||||
public String getNumeroRegistre() { return numeroRegistre; }
|
||||
public void setNumeroRegistre(String numeroRegistre) { this.numeroRegistre = numeroRegistre; }
|
||||
|
||||
public String getStatut() { return statut; }
|
||||
public void setStatut(String statut) { this.statut = statut; }
|
||||
|
||||
public Integer getNombreMembres() { return nombreMembres; }
|
||||
public void setNombreMembres(Integer nombreMembres) { this.nombreMembres = nombreMembres; }
|
||||
|
||||
public String getResponsablePrincipal() { return responsablePrincipal; }
|
||||
public void setResponsablePrincipal(String responsablePrincipal) { this.responsablePrincipal = responsablePrincipal; }
|
||||
|
||||
public String getTelephoneResponsable() { return telephoneResponsable; }
|
||||
public void setTelephoneResponsable(String telephoneResponsable) { this.telephoneResponsable = telephoneResponsable; }
|
||||
|
||||
public String getEmailResponsable() { return emailResponsable; }
|
||||
public void setEmailResponsable(String emailResponsable) { this.emailResponsable = emailResponsable; }
|
||||
|
||||
public LocalDateTime getDateDerniereActivite() { return dateDerniereActivite; }
|
||||
public void setDateDerniereActivite(LocalDateTime dateDerniereActivite) { this.dateDerniereActivite = dateDerniereActivite; }
|
||||
|
||||
public String getRegion() { return region; }
|
||||
public void setRegion(String region) { this.region = region; }
|
||||
|
||||
public String getVille() { return ville; }
|
||||
public void setVille(String ville) { this.ville = ville; }
|
||||
|
||||
public String getQuartier() { return quartier; }
|
||||
public void setQuartier(String quartier) { this.quartier = quartier; }
|
||||
|
||||
// Propriétés dérivées
|
||||
public String getTypeLibelle() {
|
||||
return switch (typeAssociation != null ? typeAssociation : "") {
|
||||
case "LIONS_CLUB" -> "Club Lions";
|
||||
case "ASSOCIATION_LOCALE" -> "Association Locale";
|
||||
case "FEDERATION" -> "Fédération";
|
||||
case "COOPERATIVE" -> "Coopérative";
|
||||
case "MUTUELLE" -> "Mutuelle";
|
||||
case "SYNDICAT" -> "Syndicat";
|
||||
default -> typeAssociation;
|
||||
};
|
||||
}
|
||||
|
||||
public String getStatutLibelle() {
|
||||
return switch (statut != null ? statut : "") {
|
||||
case "ACTIVE" -> "Active";
|
||||
case "INACTIVE" -> "Inactive";
|
||||
case "SUSPENDUE" -> "Suspendue";
|
||||
case "DISSOUTE" -> "Dissoute";
|
||||
default -> statut;
|
||||
};
|
||||
}
|
||||
|
||||
public String getStatutSeverity() {
|
||||
return switch (statut != null ? statut : "") {
|
||||
case "ACTIVE" -> "success";
|
||||
case "INACTIVE" -> "warning";
|
||||
case "SUSPENDUE" -> "danger";
|
||||
case "DISSOUTE" -> "secondary";
|
||||
default -> "info";
|
||||
};
|
||||
}
|
||||
|
||||
public String getAdresseComplete() {
|
||||
StringBuilder addr = new StringBuilder();
|
||||
if (adresse != null && !adresse.trim().isEmpty()) {
|
||||
addr.append(adresse);
|
||||
}
|
||||
if (quartier != null && !quartier.trim().isEmpty()) {
|
||||
if (addr.length() > 0) addr.append(", ");
|
||||
addr.append(quartier);
|
||||
}
|
||||
if (ville != null && !ville.trim().isEmpty()) {
|
||||
if (addr.length() > 0) addr.append(", ");
|
||||
addr.append(ville);
|
||||
}
|
||||
if (region != null && !region.trim().isEmpty()) {
|
||||
if (addr.length() > 0) addr.append(", ");
|
||||
addr.append(region);
|
||||
}
|
||||
return addr.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AssociationDTO{" +
|
||||
"id=" + id +
|
||||
", nom='" + nom + '\'' +
|
||||
", typeAssociation='" + typeAssociation + '\'' +
|
||||
", statut='" + statut + '\'' +
|
||||
", nombreMembres=" + nombreMembres +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package dev.lions.unionflow.client.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class FormulaireDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull
|
||||
@Positive
|
||||
private Integer quotaMaxMembres;
|
||||
|
||||
@NotNull
|
||||
private BigDecimal prixMensuel;
|
||||
|
||||
@NotNull
|
||||
private BigDecimal prixAnnuel;
|
||||
|
||||
private String deviseCode = "XOF"; // Franc CFA
|
||||
|
||||
private boolean actif = true;
|
||||
|
||||
private boolean recommande = false;
|
||||
|
||||
private String couleurTheme;
|
||||
|
||||
private String iconeFormulaire;
|
||||
|
||||
// Fonctionnalités incluses
|
||||
private boolean gestionMembres = true;
|
||||
private boolean gestionCotisations = true;
|
||||
private boolean gestionEvenements = false;
|
||||
private boolean gestionAides = false;
|
||||
private boolean rapportsAvances = false;
|
||||
private boolean supportPrioritaire = false;
|
||||
private boolean sauvegardeAutomatique = false;
|
||||
private boolean personnalisationAvancee = false;
|
||||
private boolean integrationPaiement = false;
|
||||
private boolean notificationsEmail = false;
|
||||
private boolean notificationsSMS = false;
|
||||
private boolean gestionDocuments = false;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
private LocalDateTime dateMiseAJour;
|
||||
private String creePar;
|
||||
private String modifiePar;
|
||||
|
||||
public FormulaireDTO() {}
|
||||
|
||||
// Getters et Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public String getNom() { return nom; }
|
||||
public void setNom(String nom) { this.nom = nom; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public Integer getQuotaMaxMembres() { return quotaMaxMembres; }
|
||||
public void setQuotaMaxMembres(Integer quotaMaxMembres) { this.quotaMaxMembres = quotaMaxMembres; }
|
||||
|
||||
public BigDecimal getPrixMensuel() { return prixMensuel; }
|
||||
public void setPrixMensuel(BigDecimal prixMensuel) { this.prixMensuel = prixMensuel; }
|
||||
|
||||
public BigDecimal getPrixAnnuel() { return prixAnnuel; }
|
||||
public void setPrixAnnuel(BigDecimal prixAnnuel) { this.prixAnnuel = prixAnnuel; }
|
||||
|
||||
public String getDeviseCode() { return deviseCode; }
|
||||
public void setDeviseCode(String deviseCode) { this.deviseCode = deviseCode; }
|
||||
|
||||
public boolean isActif() { return actif; }
|
||||
public void setActif(boolean actif) { this.actif = actif; }
|
||||
|
||||
public boolean isRecommande() { return recommande; }
|
||||
public void setRecommande(boolean recommande) { this.recommande = recommande; }
|
||||
|
||||
public String getCouleurTheme() { return couleurTheme; }
|
||||
public void setCouleurTheme(String couleurTheme) { this.couleurTheme = couleurTheme; }
|
||||
|
||||
public String getIconeFormulaire() { return iconeFormulaire; }
|
||||
public void setIconeFormulaire(String iconeFormulaire) { this.iconeFormulaire = iconeFormulaire; }
|
||||
|
||||
// Fonctionnalités
|
||||
public boolean isGestionMembres() { return gestionMembres; }
|
||||
public void setGestionMembres(boolean gestionMembres) { this.gestionMembres = gestionMembres; }
|
||||
|
||||
public boolean isGestionCotisations() { return gestionCotisations; }
|
||||
public void setGestionCotisations(boolean gestionCotisations) { this.gestionCotisations = gestionCotisations; }
|
||||
|
||||
public boolean isGestionEvenements() { return gestionEvenements; }
|
||||
public void setGestionEvenements(boolean gestionEvenements) { this.gestionEvenements = gestionEvenements; }
|
||||
|
||||
public boolean isGestionAides() { return gestionAides; }
|
||||
public void setGestionAides(boolean gestionAides) { this.gestionAides = gestionAides; }
|
||||
|
||||
public boolean isRapportsAvances() { return rapportsAvances; }
|
||||
public void setRapportsAvances(boolean rapportsAvances) { this.rapportsAvances = rapportsAvances; }
|
||||
|
||||
public boolean isSupportPrioritaire() { return supportPrioritaire; }
|
||||
public void setSupportPrioritaire(boolean supportPrioritaire) { this.supportPrioritaire = supportPrioritaire; }
|
||||
|
||||
public boolean isSauvegardeAutomatique() { return sauvegardeAutomatique; }
|
||||
public void setSauvegardeAutomatique(boolean sauvegardeAutomatique) { this.sauvegardeAutomatique = sauvegardeAutomatique; }
|
||||
|
||||
public boolean isPersonnalisationAvancee() { return personnalisationAvancee; }
|
||||
public void setPersonnalisationAvancee(boolean personnalisationAvancee) { this.personnalisationAvancee = personnalisationAvancee; }
|
||||
|
||||
public boolean isIntegrationPaiement() { return integrationPaiement; }
|
||||
public void setIntegrationPaiement(boolean integrationPaiement) { this.integrationPaiement = integrationPaiement; }
|
||||
|
||||
public boolean isNotificationsEmail() { return notificationsEmail; }
|
||||
public void setNotificationsEmail(boolean notificationsEmail) { this.notificationsEmail = notificationsEmail; }
|
||||
|
||||
public boolean isNotificationsSMS() { return notificationsSMS; }
|
||||
public void setNotificationsSMS(boolean notificationsSMS) { this.notificationsSMS = notificationsSMS; }
|
||||
|
||||
public boolean isGestionDocuments() { return gestionDocuments; }
|
||||
public void setGestionDocuments(boolean gestionDocuments) { this.gestionDocuments = gestionDocuments; }
|
||||
|
||||
// Métadonnées
|
||||
public LocalDateTime getDateCreation() { return dateCreation; }
|
||||
public void setDateCreation(LocalDateTime dateCreation) { this.dateCreation = dateCreation; }
|
||||
|
||||
public LocalDateTime getDateMiseAJour() { return dateMiseAJour; }
|
||||
public void setDateMiseAJour(LocalDateTime dateMiseAJour) { this.dateMiseAJour = dateMiseAJour; }
|
||||
|
||||
public String getCreePar() { return creePar; }
|
||||
public void setCreePar(String creePar) { this.creePar = creePar; }
|
||||
|
||||
public String getModifiePar() { return modifiePar; }
|
||||
public void setModifiePar(String modifiePar) { this.modifiePar = modifiePar; }
|
||||
|
||||
// Méthodes utilitaires
|
||||
public String getPrixMensuelFormat() {
|
||||
return String.format("%,.0f %s", prixMensuel, deviseCode);
|
||||
}
|
||||
|
||||
public String getPrixAnnuelFormat() {
|
||||
return String.format("%,.0f %s", prixAnnuel, deviseCode);
|
||||
}
|
||||
|
||||
public BigDecimal getEconomieAnnuelle() {
|
||||
if (prixMensuel != null && prixAnnuel != null) {
|
||||
BigDecimal coutMensuelAnnuel = prixMensuel.multiply(BigDecimal.valueOf(12));
|
||||
return coutMensuelAnnuel.subtract(prixAnnuel);
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public String getEconomieAnnuelleFormat() {
|
||||
BigDecimal economie = getEconomieAnnuelle();
|
||||
return String.format("%,.0f %s", economie, deviseCode);
|
||||
}
|
||||
|
||||
public int getPourcentageEconomie() {
|
||||
if (prixMensuel != null && prixAnnuel != null) {
|
||||
BigDecimal coutMensuelAnnuel = prixMensuel.multiply(BigDecimal.valueOf(12));
|
||||
BigDecimal economie = getEconomieAnnuelle();
|
||||
if (coutMensuelAnnuel.compareTo(BigDecimal.ZERO) > 0) {
|
||||
return economie.multiply(BigDecimal.valueOf(100))
|
||||
.divide(coutMensuelAnnuel, 0, BigDecimal.ROUND_HALF_UP)
|
||||
.intValue();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package dev.lions.unionflow.client.dto;
|
||||
|
||||
import dev.lions.unionflow.client.validation.ValidPhoneNumber;
|
||||
import dev.lions.unionflow.client.validation.ValidMemberNumber;
|
||||
import dev.lions.unionflow.client.validation.ValidationGroups;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MembreDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "Le numéro de membre est obligatoire", groups = {ValidationGroups.CreateMember.class, ValidationGroups.FullRegistration.class})
|
||||
@ValidMemberNumber(groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.FullRegistration.class})
|
||||
private String numeroMembre;
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire", groups = {ValidationGroups.CreateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
@Size(min = 2, max = 50, message = "Le nom doit contenir entre 2 et 50 caractères", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
@Pattern(regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$", message = "Le nom ne peut contenir que des lettres, espaces, tirets et apostrophes", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le prénom est obligatoire", groups = {ValidationGroups.CreateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
@Size(min = 2, max = 50, message = "Le prénom doit contenir entre 2 et 50 caractères", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
@Pattern(regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$", message = "Le prénom ne peut contenir que des lettres, espaces, tirets et apostrophes", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
private String prenom;
|
||||
|
||||
@Email(message = "Format d'email invalide", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
@Size(max = 100, message = "L'email ne peut pas dépasser 100 caractères", groups = {ValidationGroups.CreateMember.class, ValidationGroups.UpdateMember.class, ValidationGroups.QuickRegistration.class, ValidationGroups.FullRegistration.class})
|
||||
private String email;
|
||||
|
||||
@ValidPhoneNumber
|
||||
private String telephone;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Past(message = "La date de naissance doit être dans le passé")
|
||||
private LocalDate dateNaissance;
|
||||
|
||||
@Size(max = 200, message = "L'adresse ne peut pas dépasser 200 caractères")
|
||||
private String adresse;
|
||||
|
||||
@Size(max = 100, message = "La profession ne peut pas dépasser 100 caractères")
|
||||
private String profession;
|
||||
|
||||
@Size(max = 20, message = "Le statut matrimonial ne peut pas dépasser 20 caractères")
|
||||
private String statutMatrimonial;
|
||||
|
||||
@Size(max = 50, message = "La nationalité ne peut pas dépasser 50 caractères")
|
||||
private String nationalite;
|
||||
|
||||
@Size(max = 50, message = "Le numéro d'identité ne peut pas dépasser 50 caractères")
|
||||
private String numeroIdentite;
|
||||
|
||||
@Size(max = 20, message = "Le type d'identité ne peut pas dépasser 20 caractères")
|
||||
private String typeIdentite;
|
||||
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
private String statut;
|
||||
|
||||
@NotNull(message = "L'association est obligatoire")
|
||||
private Long associationId;
|
||||
|
||||
private String associationNom;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateInscription;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereModification;
|
||||
|
||||
private String creePar;
|
||||
private String modifiePar;
|
||||
|
||||
// Constructeurs
|
||||
public MembreDTO() {}
|
||||
|
||||
public MembreDTO(String numeroMembre, String nom, String prenom, String email) {
|
||||
this.numeroMembre = numeroMembre;
|
||||
this.nom = nom;
|
||||
this.prenom = prenom;
|
||||
this.email = email;
|
||||
this.statut = "ACTIF";
|
||||
this.dateInscription = LocalDateTime.now();
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public String getNumeroMembre() { return numeroMembre; }
|
||||
public void setNumeroMembre(String numeroMembre) { this.numeroMembre = numeroMembre; }
|
||||
|
||||
public String getNom() { return nom; }
|
||||
public void setNom(String nom) { this.nom = nom; }
|
||||
|
||||
public String getPrenom() { return prenom; }
|
||||
public void setPrenom(String prenom) { this.prenom = prenom; }
|
||||
|
||||
public String getEmail() { return email; }
|
||||
public void setEmail(String email) { this.email = email; }
|
||||
|
||||
public String getTelephone() { return telephone; }
|
||||
public void setTelephone(String telephone) { this.telephone = telephone; }
|
||||
|
||||
public LocalDate getDateNaissance() { return dateNaissance; }
|
||||
public void setDateNaissance(LocalDate dateNaissance) { this.dateNaissance = dateNaissance; }
|
||||
|
||||
public String getAdresse() { return adresse; }
|
||||
public void setAdresse(String adresse) { this.adresse = adresse; }
|
||||
|
||||
public String getProfession() { return profession; }
|
||||
public void setProfession(String profession) { this.profession = profession; }
|
||||
|
||||
public String getStatutMatrimonial() { return statutMatrimonial; }
|
||||
public void setStatutMatrimonial(String statutMatrimonial) { this.statutMatrimonial = statutMatrimonial; }
|
||||
|
||||
public String getNationalite() { return nationalite; }
|
||||
public void setNationalite(String nationalite) { this.nationalite = nationalite; }
|
||||
|
||||
public String getNumeroIdentite() { return numeroIdentite; }
|
||||
public void setNumeroIdentite(String numeroIdentite) { this.numeroIdentite = numeroIdentite; }
|
||||
|
||||
public String getTypeIdentite() { return typeIdentite; }
|
||||
public void setTypeIdentite(String typeIdentite) { this.typeIdentite = typeIdentite; }
|
||||
|
||||
public String getStatut() { return statut; }
|
||||
public void setStatut(String statut) { this.statut = statut; }
|
||||
|
||||
public Long getAssociationId() { return associationId; }
|
||||
public void setAssociationId(Long associationId) { this.associationId = associationId; }
|
||||
|
||||
public String getAssociationNom() { return associationNom; }
|
||||
public void setAssociationNom(String associationNom) { this.associationNom = associationNom; }
|
||||
|
||||
public LocalDateTime getDateInscription() { return dateInscription; }
|
||||
public void setDateInscription(LocalDateTime dateInscription) { this.dateInscription = dateInscription; }
|
||||
|
||||
public LocalDateTime getDateDerniereModification() { return dateDerniereModification; }
|
||||
public void setDateDerniereModification(LocalDateTime dateDerniereModification) { this.dateDerniereModification = dateDerniereModification; }
|
||||
|
||||
public String getCreePar() { return creePar; }
|
||||
public void setCreePar(String creePar) { this.creePar = creePar; }
|
||||
|
||||
public String getModifiePar() { return modifiePar; }
|
||||
public void setModifiePar(String modifiePar) { this.modifiePar = modifiePar; }
|
||||
|
||||
// Propriétés dérivées
|
||||
public String getNomComplet() {
|
||||
return (prenom != null ? prenom : "") + " " + (nom != null ? nom : "");
|
||||
}
|
||||
|
||||
public String getStatutLibelle() {
|
||||
return switch (statut != null ? statut : "") {
|
||||
case "ACTIF" -> "Actif";
|
||||
case "INACTIF" -> "Inactif";
|
||||
case "SUSPENDU" -> "Suspendu";
|
||||
case "RADIE" -> "Radié";
|
||||
default -> statut;
|
||||
};
|
||||
}
|
||||
|
||||
public String getStatutSeverity() {
|
||||
return switch (statut != null ? statut : "") {
|
||||
case "ACTIF" -> "success";
|
||||
case "INACTIF" -> "warning";
|
||||
case "SUSPENDU" -> "danger";
|
||||
case "RADIE" -> "secondary";
|
||||
default -> "info";
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MembreDTO{" +
|
||||
"id=" + id +
|
||||
", numeroMembre='" + numeroMembre + '\'' +
|
||||
", nom='" + nom + '\'' +
|
||||
", prenom='" + prenom + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", statut='" + statut + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package dev.lions.unionflow.client.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class SouscriptionDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum StatutSouscription {
|
||||
ACTIVE("Actif", "text-green-600", "bg-green-100"),
|
||||
SUSPENDUE("Suspendue", "text-orange-600", "bg-orange-100"),
|
||||
EXPIREE("Expirée", "text-red-600", "bg-red-100"),
|
||||
EN_ATTENTE_PAIEMENT("En attente de paiement", "text-blue-600", "bg-blue-100"),
|
||||
ANNULEE("Annulée", "text-gray-600", "bg-gray-100");
|
||||
|
||||
private final String libelle;
|
||||
private final String couleurTexte;
|
||||
private final String couleurFond;
|
||||
|
||||
StatutSouscription(String libelle, String couleurTexte, String couleurFond) {
|
||||
this.libelle = libelle;
|
||||
this.couleurTexte = couleurTexte;
|
||||
this.couleurFond = couleurFond;
|
||||
}
|
||||
|
||||
public String getLibelle() { return libelle; }
|
||||
public String getCouleurTexte() { return couleurTexte; }
|
||||
public String getCouleurFond() { return couleurFond; }
|
||||
}
|
||||
|
||||
public enum TypeFacturation {
|
||||
MENSUEL("Mensuel"),
|
||||
ANNUEL("Annuel");
|
||||
|
||||
private final String libelle;
|
||||
|
||||
TypeFacturation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() { return libelle; }
|
||||
}
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
private Long organisationId;
|
||||
private String organisationNom;
|
||||
|
||||
@NotNull
|
||||
private Long formulaireId;
|
||||
private String formulaireNom;
|
||||
|
||||
@NotNull
|
||||
private StatutSouscription statut;
|
||||
|
||||
@NotNull
|
||||
private TypeFacturation typeFacturation;
|
||||
|
||||
@NotNull
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull
|
||||
private LocalDate dateFin;
|
||||
|
||||
private LocalDate dateDernierPaiement;
|
||||
private LocalDate dateProchainPaiement;
|
||||
|
||||
@NotNull
|
||||
private Integer quotaMaxMembres;
|
||||
|
||||
private Integer membresActuels = 0;
|
||||
|
||||
@NotNull
|
||||
private BigDecimal montantSouscription;
|
||||
|
||||
private String deviseCode = "XOF";
|
||||
|
||||
private String numeroFacture;
|
||||
private String referencePaiement;
|
||||
|
||||
// Informations de renouvellement automatique
|
||||
private boolean renouvellementAutomatique = false;
|
||||
private String methodePaiementDefaut;
|
||||
|
||||
// Notifications
|
||||
private boolean notificationExpiration = true;
|
||||
private boolean notificationQuotaAtteint = true;
|
||||
private int joursAvantNotificationExpiration = 30;
|
||||
|
||||
// Audit
|
||||
private LocalDateTime dateCreation;
|
||||
private LocalDateTime dateMiseAJour;
|
||||
private String creePar;
|
||||
private String modifiePar;
|
||||
|
||||
public SouscriptionDTO() {}
|
||||
|
||||
// Getters et Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public Long getOrganisationId() { return organisationId; }
|
||||
public void setOrganisationId(Long organisationId) { this.organisationId = organisationId; }
|
||||
|
||||
public String getOrganisationNom() { return organisationNom; }
|
||||
public void setOrganisationNom(String organisationNom) { this.organisationNom = organisationNom; }
|
||||
|
||||
public Long getFormulaireId() { return formulaireId; }
|
||||
public void setFormulaireId(Long formulaireId) { this.formulaireId = formulaireId; }
|
||||
|
||||
public String getFormulaireNom() { return formulaireNom; }
|
||||
public void setFormulaireNom(String formulaireNom) { this.formulaireNom = formulaireNom; }
|
||||
|
||||
public StatutSouscription getStatut() { return statut; }
|
||||
public void setStatut(StatutSouscription statut) { this.statut = statut; }
|
||||
|
||||
public TypeFacturation getTypeFacturation() { return typeFacturation; }
|
||||
public void setTypeFacturation(TypeFacturation typeFacturation) { this.typeFacturation = typeFacturation; }
|
||||
|
||||
public LocalDate getDateDebut() { return dateDebut; }
|
||||
public void setDateDebut(LocalDate dateDebut) { this.dateDebut = dateDebut; }
|
||||
|
||||
public LocalDate getDateFin() { return dateFin; }
|
||||
public void setDateFin(LocalDate dateFin) { this.dateFin = dateFin; }
|
||||
|
||||
public LocalDate getDateDernierPaiement() { return dateDernierPaiement; }
|
||||
public void setDateDernierPaiement(LocalDate dateDernierPaiement) { this.dateDernierPaiement = dateDernierPaiement; }
|
||||
|
||||
public LocalDate getDateProchainPaiement() { return dateProchainPaiement; }
|
||||
public void setDateProchainPaiement(LocalDate dateProchainPaiement) { this.dateProchainPaiement = dateProchainPaiement; }
|
||||
|
||||
public Integer getQuotaMaxMembres() { return quotaMaxMembres; }
|
||||
public void setQuotaMaxMembres(Integer quotaMaxMembres) { this.quotaMaxMembres = quotaMaxMembres; }
|
||||
|
||||
public Integer getMembresActuels() { return membresActuels; }
|
||||
public void setMembresActuels(Integer membresActuels) { this.membresActuels = membresActuels; }
|
||||
|
||||
public BigDecimal getMontantSouscription() { return montantSouscription; }
|
||||
public void setMontantSouscription(BigDecimal montantSouscription) { this.montantSouscription = montantSouscription; }
|
||||
|
||||
public String getDeviseCode() { return deviseCode; }
|
||||
public void setDeviseCode(String deviseCode) { this.deviseCode = deviseCode; }
|
||||
|
||||
public String getNumeroFacture() { return numeroFacture; }
|
||||
public void setNumeroFacture(String numeroFacture) { this.numeroFacture = numeroFacture; }
|
||||
|
||||
public String getReferencePaiement() { return referencePaiement; }
|
||||
public void setReferencePaiement(String referencePaiement) { this.referencePaiement = referencePaiement; }
|
||||
|
||||
public boolean isRenouvellementAutomatique() { return renouvellementAutomatique; }
|
||||
public void setRenouvellementAutomatique(boolean renouvellementAutomatique) { this.renouvellementAutomatique = renouvellementAutomatique; }
|
||||
|
||||
public String getMethodePaiementDefaut() { return methodePaiementDefaut; }
|
||||
public void setMethodePaiementDefaut(String methodePaiementDefaut) { this.methodePaiementDefaut = methodePaiementDefaut; }
|
||||
|
||||
public boolean isNotificationExpiration() { return notificationExpiration; }
|
||||
public void setNotificationExpiration(boolean notificationExpiration) { this.notificationExpiration = notificationExpiration; }
|
||||
|
||||
public boolean isNotificationQuotaAtteint() { return notificationQuotaAtteint; }
|
||||
public void setNotificationQuotaAtteint(boolean notificationQuotaAtteint) { this.notificationQuotaAtteint = notificationQuotaAtteint; }
|
||||
|
||||
public int getJoursAvantNotificationExpiration() { return joursAvantNotificationExpiration; }
|
||||
public void setJoursAvantNotificationExpiration(int joursAvantNotificationExpiration) { this.joursAvantNotificationExpiration = joursAvantNotificationExpiration; }
|
||||
|
||||
public LocalDateTime getDateCreation() { return dateCreation; }
|
||||
public void setDateCreation(LocalDateTime dateCreation) { this.dateCreation = dateCreation; }
|
||||
|
||||
public LocalDateTime getDateMiseAJour() { return dateMiseAJour; }
|
||||
public void setDateMiseAJour(LocalDateTime dateMiseAJour) { this.dateMiseAJour = dateMiseAJour; }
|
||||
|
||||
public String getCreePar() { return creePar; }
|
||||
public void setCreePar(String creePar) { this.creePar = creePar; }
|
||||
|
||||
public String getModifiePar() { return modifiePar; }
|
||||
public void setModifiePar(String modifiePar) { this.modifiePar = modifiePar; }
|
||||
|
||||
// Méthodes utilitaires
|
||||
public boolean isActive() {
|
||||
return statut == StatutSouscription.ACTIVE && !isExpiree();
|
||||
}
|
||||
|
||||
public boolean isExpiree() {
|
||||
return LocalDate.now().isAfter(dateFin);
|
||||
}
|
||||
|
||||
public boolean isQuotaAtteint() {
|
||||
return membresActuels != null && quotaMaxMembres != null &&
|
||||
membresActuels >= quotaMaxMembres;
|
||||
}
|
||||
|
||||
public int getMembresRestants() {
|
||||
if (membresActuels != null && quotaMaxMembres != null) {
|
||||
return Math.max(0, quotaMaxMembres - membresActuels);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getPourcentageUtilisation() {
|
||||
if (membresActuels != null && quotaMaxMembres != null && quotaMaxMembres > 0) {
|
||||
return (membresActuels * 100) / quotaMaxMembres;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getMontantFormat() {
|
||||
if (montantSouscription != null) {
|
||||
return String.format("%,.0f %s", montantSouscription, deviseCode);
|
||||
}
|
||||
return "0 " + deviseCode;
|
||||
}
|
||||
|
||||
public String getStatutCouleurClass() {
|
||||
return statut != null ? statut.getCouleurTexte() : "text-gray-600";
|
||||
}
|
||||
|
||||
public String getStatutFondClass() {
|
||||
return statut != null ? statut.getCouleurFond() : "bg-gray-100";
|
||||
}
|
||||
|
||||
public String getStatutLibelle() {
|
||||
return statut != null ? statut.getLibelle() : "Inconnu";
|
||||
}
|
||||
|
||||
public long getJoursRestants() {
|
||||
if (dateFin != null) {
|
||||
return LocalDate.now().until(dateFin).getDays();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isExpirationProche() {
|
||||
long joursRestants = getJoursRestants();
|
||||
return joursRestants <= joursAvantNotificationExpiration && joursRestants > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package dev.lions.unionflow.client.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class LoginRequest {
|
||||
|
||||
@NotBlank(message = "L'email ou nom d'utilisateur est requis")
|
||||
@Size(min = 3, max = 100, message = "L'email ou nom d'utilisateur doit contenir entre 3 et 100 caractères")
|
||||
private String username;
|
||||
|
||||
@NotBlank(message = "Le mot de passe est requis")
|
||||
@Size(min = 6, message = "Le mot de passe doit contenir au moins 6 caractères")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "Le type de compte est requis")
|
||||
private String typeCompte;
|
||||
|
||||
private boolean rememberMe;
|
||||
|
||||
public LoginRequest() {}
|
||||
|
||||
public LoginRequest(String username, String password, String typeCompte) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.typeCompte = typeCompte;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getTypeCompte() {
|
||||
return typeCompte;
|
||||
}
|
||||
|
||||
public void setTypeCompte(String typeCompte) {
|
||||
this.typeCompte = typeCompte;
|
||||
}
|
||||
|
||||
public boolean isRememberMe() {
|
||||
return rememberMe;
|
||||
}
|
||||
|
||||
public void setRememberMe(boolean rememberMe) {
|
||||
this.rememberMe = rememberMe;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package dev.lions.unionflow.client.dto.auth;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class LoginResponse {
|
||||
|
||||
private String accessToken;
|
||||
private String refreshToken;
|
||||
private String tokenType = "Bearer";
|
||||
private Long expiresIn;
|
||||
private LocalDateTime expirationDate;
|
||||
|
||||
private UserInfo user;
|
||||
|
||||
public LoginResponse() {}
|
||||
|
||||
public LoginResponse(String accessToken, String refreshToken, Long expiresIn, UserInfo user) {
|
||||
this.accessToken = accessToken;
|
||||
this.refreshToken = refreshToken;
|
||||
this.expiresIn = expiresIn;
|
||||
this.user = user;
|
||||
this.expirationDate = LocalDateTime.now().plusSeconds(expiresIn);
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
public void setTokenType(String tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public Long getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(Long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
if (expiresIn != null) {
|
||||
this.expirationDate = LocalDateTime.now().plusSeconds(expiresIn);
|
||||
}
|
||||
}
|
||||
|
||||
public LocalDateTime getExpirationDate() {
|
||||
return expirationDate;
|
||||
}
|
||||
|
||||
public void setExpirationDate(LocalDateTime expirationDate) {
|
||||
this.expirationDate = expirationDate;
|
||||
}
|
||||
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
return expirationDate != null && LocalDateTime.now().isAfter(expirationDate);
|
||||
}
|
||||
|
||||
public static class UserInfo {
|
||||
private Long id;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String email;
|
||||
private String username;
|
||||
private String typeCompte;
|
||||
private List<String> roles;
|
||||
private List<String> permissions;
|
||||
private EntiteInfo entite;
|
||||
|
||||
public UserInfo() {}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom;
|
||||
}
|
||||
|
||||
public void setPrenom(String prenom) {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTypeCompte() {
|
||||
return typeCompte;
|
||||
}
|
||||
|
||||
public void setTypeCompte(String typeCompte) {
|
||||
this.typeCompte = typeCompte;
|
||||
}
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public List<String> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(List<String> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public EntiteInfo getEntite() {
|
||||
return entite;
|
||||
}
|
||||
|
||||
public void setEntite(EntiteInfo entite) {
|
||||
this.entite = entite;
|
||||
}
|
||||
|
||||
public String getNomComplet() {
|
||||
if (prenom != null && nom != null) {
|
||||
return prenom + " " + nom;
|
||||
}
|
||||
return nom != null ? nom : username;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntiteInfo {
|
||||
private Long id;
|
||||
private String nom;
|
||||
private String type;
|
||||
private String pays;
|
||||
private String ville;
|
||||
|
||||
public EntiteInfo() {}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getPays() {
|
||||
return pays;
|
||||
}
|
||||
|
||||
public void setPays(String pays) {
|
||||
this.pays = pays;
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return ville;
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
this.ville = ville;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user