331 lines
14 KiB
Java
331 lines
14 KiB
Java
package dev.lions.unionflow.client.dto;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import jakarta.validation.constraints.NotBlank;
|
|
import jakarta.validation.constraints.NotNull;
|
|
import java.io.Serializable;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* DTO client pour les organisations (alias historique Association).
|
|
*
|
|
* Harmonisé avec le contrat serveur `OrganisationDTO`:
|
|
* - `dateCreation`/`dateModification` d'audit (LocalDateTime) alignés sur BaseDTO avec pattern JSON
|
|
* - `dateFondation` (LocalDate) pour la date de création fonctionnelle de l'organisation
|
|
*/
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
public class AssociationDTO implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private UUID id;
|
|
|
|
@NotBlank(message = "Le nom de l'association est obligatoire")
|
|
private String nom;
|
|
|
|
// Aligné sur OrganisationDTO.nomCourt
|
|
private String nomCourt;
|
|
|
|
private String description;
|
|
private String adresse;
|
|
private String telephone;
|
|
private String email;
|
|
private String siteWeb;
|
|
// Aligné sur OrganisationDTO.logo (URL ou chemin du logo)
|
|
private String logo;
|
|
|
|
@NotNull(message = "Le type d'association est obligatoire")
|
|
@JsonProperty("typeOrganisation")
|
|
private String typeAssociation;
|
|
|
|
// Date de fondation (fonctionnelle), côté serveur: OrganisationDTO.dateFondation
|
|
@JsonProperty("dateFondation")
|
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
private LocalDate dateFondation;
|
|
|
|
// Côté serveur: OrganisationDTO.numeroEnregistrement
|
|
@JsonProperty("numeroEnregistrement")
|
|
private String numeroRegistre;
|
|
private String statut;
|
|
private Integer nombreMembres;
|
|
// Aligné sur OrganisationDTO.nombreAdministrateurs
|
|
private Integer nombreAdministrateurs;
|
|
private String responsablePrincipal;
|
|
private String telephoneResponsable;
|
|
private String emailResponsable;
|
|
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
private LocalDateTime dateDerniereActivite;
|
|
|
|
// Champs d'audit issus de BaseDTO (côté serveur)
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
private LocalDateTime dateCreation;
|
|
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
private LocalDateTime dateModification;
|
|
|
|
private Long version;
|
|
private Boolean actif;
|
|
|
|
private String region;
|
|
private String ville;
|
|
private String quartier;
|
|
private String pays;
|
|
// Aligné sur OrganisationDTO.codePostal
|
|
private String codePostal;
|
|
|
|
// Aligné sur OrganisationDTO.activitesPrincipales
|
|
private String activitesPrincipales;
|
|
|
|
// Aligné sur OrganisationDTO.objectifs / partenaires / certifications / reseauxSociaux / notes
|
|
private String objectifs;
|
|
private String partenaires;
|
|
private String certifications;
|
|
private String reseauxSociaux;
|
|
private String notes;
|
|
|
|
// Aligné sur OrganisationDTO.organisationPublique / accepteNouveauxMembres / cotisationObligatoire
|
|
private Boolean organisationPublique;
|
|
private Boolean accepteNouveauxMembres;
|
|
private Boolean cotisationObligatoire;
|
|
|
|
// Aligné sur OrganisationDTO.budgetAnnuel / devise / montantCotisationAnnuelle
|
|
private BigDecimal budgetAnnuel;
|
|
private String devise;
|
|
private BigDecimal montantCotisationAnnuelle;
|
|
|
|
// Aligné sur OrganisationDTO.telephoneSecondaire / emailSecondaire
|
|
private String telephoneSecondaire;
|
|
private String emailSecondaire;
|
|
|
|
// Aligné sur OrganisationDTO.organisationParenteId / nomOrganisationParente / niveauHierarchique
|
|
private UUID organisationParenteId;
|
|
private String nomOrganisationParente;
|
|
private Integer niveauHierarchique;
|
|
|
|
// Aligné sur OrganisationDTO.latitude / longitude
|
|
private BigDecimal latitude;
|
|
private BigDecimal longitude;
|
|
|
|
// Constructeurs
|
|
public AssociationDTO() {}
|
|
|
|
public AssociationDTO(String nom, String typeAssociation) {
|
|
this.nom = nom;
|
|
this.typeAssociation = typeAssociation;
|
|
this.statut = "ACTIVE";
|
|
this.dateFondation = LocalDate.now();
|
|
this.nombreMembres = 0;
|
|
}
|
|
|
|
// Getters et Setters
|
|
public UUID getId() { return id; }
|
|
public void setId(UUID id) { this.id = id; }
|
|
|
|
public String getNom() { return nom; }
|
|
public void setNom(String nom) { this.nom = nom; }
|
|
|
|
public String getNomCourt() { return nomCourt; }
|
|
public void setNomCourt(String nomCourt) { this.nomCourt = nomCourt; }
|
|
|
|
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 getLogo() { return logo; }
|
|
public void setLogo(String logo) { this.logo = logo; }
|
|
|
|
public String getTypeAssociation() { return typeAssociation; }
|
|
public void setTypeAssociation(String typeAssociation) { this.typeAssociation = typeAssociation; }
|
|
|
|
public LocalDate getDateFondation() { return dateFondation; }
|
|
public void setDateFondation(LocalDate dateFondation) { this.dateFondation = dateFondation; }
|
|
|
|
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 Integer getNombreAdministrateurs() { return nombreAdministrateurs; }
|
|
public void setNombreAdministrateurs(Integer nombreAdministrateurs) { this.nombreAdministrateurs = nombreAdministrateurs; }
|
|
|
|
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; }
|
|
|
|
public String getPays() { return pays; }
|
|
public void setPays(String pays) { this.pays = pays; }
|
|
|
|
public String getCodePostal() { return codePostal; }
|
|
public void setCodePostal(String codePostal) { this.codePostal = codePostal; }
|
|
|
|
public String getActivitesPrincipales() { return activitesPrincipales; }
|
|
public void setActivitesPrincipales(String activitesPrincipales) { this.activitesPrincipales = activitesPrincipales; }
|
|
|
|
public String getObjectifs() { return objectifs; }
|
|
public void setObjectifs(String objectifs) { this.objectifs = objectifs; }
|
|
|
|
public String getPartenaires() { return partenaires; }
|
|
public void setPartenaires(String partenaires) { this.partenaires = partenaires; }
|
|
|
|
public String getCertifications() { return certifications; }
|
|
public void setCertifications(String certifications) { this.certifications = certifications; }
|
|
|
|
public String getReseauxSociaux() { return reseauxSociaux; }
|
|
public void setReseauxSociaux(String reseauxSociaux) { this.reseauxSociaux = reseauxSociaux; }
|
|
|
|
public String getNotes() { return notes; }
|
|
public void setNotes(String notes) { this.notes = notes; }
|
|
|
|
public Boolean getOrganisationPublique() { return organisationPublique; }
|
|
public void setOrganisationPublique(Boolean organisationPublique) { this.organisationPublique = organisationPublique; }
|
|
|
|
public Boolean getAccepteNouveauxMembres() { return accepteNouveauxMembres; }
|
|
public void setAccepteNouveauxMembres(Boolean accepteNouveauxMembres) { this.accepteNouveauxMembres = accepteNouveauxMembres; }
|
|
|
|
public Boolean getCotisationObligatoire() { return cotisationObligatoire; }
|
|
public void setCotisationObligatoire(Boolean cotisationObligatoire) { this.cotisationObligatoire = cotisationObligatoire; }
|
|
|
|
public BigDecimal getBudgetAnnuel() { return budgetAnnuel; }
|
|
public void setBudgetAnnuel(BigDecimal budgetAnnuel) { this.budgetAnnuel = budgetAnnuel; }
|
|
|
|
public String getDevise() { return devise; }
|
|
public void setDevise(String devise) { this.devise = devise; }
|
|
|
|
public BigDecimal getMontantCotisationAnnuelle() { return montantCotisationAnnuelle; }
|
|
public void setMontantCotisationAnnuelle(BigDecimal montantCotisationAnnuelle) { this.montantCotisationAnnuelle = montantCotisationAnnuelle; }
|
|
|
|
public String getTelephoneSecondaire() { return telephoneSecondaire; }
|
|
public void setTelephoneSecondaire(String telephoneSecondaire) { this.telephoneSecondaire = telephoneSecondaire; }
|
|
|
|
public String getEmailSecondaire() { return emailSecondaire; }
|
|
public void setEmailSecondaire(String emailSecondaire) { this.emailSecondaire = emailSecondaire; }
|
|
|
|
public UUID getOrganisationParenteId() { return organisationParenteId; }
|
|
public void setOrganisationParenteId(UUID organisationParenteId) { this.organisationParenteId = organisationParenteId; }
|
|
|
|
public String getNomOrganisationParente() { return nomOrganisationParente; }
|
|
public void setNomOrganisationParente(String nomOrganisationParente) { this.nomOrganisationParente = nomOrganisationParente; }
|
|
|
|
public Integer getNiveauHierarchique() { return niveauHierarchique; }
|
|
public void setNiveauHierarchique(Integer niveauHierarchique) { this.niveauHierarchique = niveauHierarchique; }
|
|
|
|
public BigDecimal getLatitude() { return latitude; }
|
|
public void setLatitude(BigDecimal latitude) { this.latitude = latitude; }
|
|
|
|
public BigDecimal getLongitude() { return longitude; }
|
|
public void setLongitude(BigDecimal longitude) { this.longitude = longitude; }
|
|
|
|
public LocalDateTime getDateCreation() { return dateCreation; }
|
|
public void setDateCreation(LocalDateTime dateCreation) { this.dateCreation = dateCreation; }
|
|
|
|
public LocalDateTime getDateModification() { return dateModification; }
|
|
public void setDateModification(LocalDateTime dateModification) { this.dateModification = dateModification; }
|
|
|
|
public Long getVersion() { return version; }
|
|
public void setVersion(Long version) { this.version = version; }
|
|
|
|
public Boolean getActif() { return actif; }
|
|
public void setActif(Boolean actif) { this.actif = actif; }
|
|
|
|
// 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 +
|
|
'}';
|
|
}
|
|
} |