116 lines
3.5 KiB
Java
116 lines
3.5 KiB
Java
package dev.lions.quote;
|
|
|
|
import jakarta.persistence.*;
|
|
|
|
/**
|
|
* Module/ligne d'un devis
|
|
*/
|
|
@Entity
|
|
@Table(name = "quote_modules")
|
|
public class QuoteModule {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "quote_id", nullable = false)
|
|
private Quote quote;
|
|
|
|
@Column(nullable = false)
|
|
private String moduleCode; // CRM, STOCK, COMPTA, RH, INFRA
|
|
|
|
@Column(nullable = false)
|
|
private String moduleName;
|
|
|
|
@Column(length = 1000)
|
|
private String description;
|
|
|
|
@Column(nullable = false)
|
|
private Double unitPrice; // Prix unitaire HT
|
|
|
|
@Column(nullable = false)
|
|
private Integer quantity = 1;
|
|
|
|
private String unit = "licence"; // licence, heure, mois, etc.
|
|
|
|
// Détails techniques
|
|
@Column(length = 2000)
|
|
private String technicalSpecs;
|
|
|
|
@Column(length = 1000)
|
|
private String deliverables;
|
|
|
|
private Integer implementationDays; // Jours d'implémentation
|
|
|
|
// Niveau de complexité basé sur l'audit
|
|
@Enumerated(EnumType.STRING)
|
|
private ComplexityLevel complexity = ComplexityLevel.STANDARD;
|
|
|
|
// Constructeurs
|
|
public QuoteModule() {}
|
|
|
|
public QuoteModule(String moduleCode, String moduleName, Double unitPrice) {
|
|
this.moduleCode = moduleCode;
|
|
this.moduleName = moduleName;
|
|
this.unitPrice = unitPrice;
|
|
}
|
|
|
|
// Méthodes métier
|
|
public Double getTotalPrice() {
|
|
return unitPrice * quantity;
|
|
}
|
|
|
|
public Double getComplexityMultiplier() {
|
|
return switch (complexity) {
|
|
case BASIC -> 0.8;
|
|
case STANDARD -> 1.0;
|
|
case ADVANCED -> 1.3;
|
|
case ENTERPRISE -> 1.6;
|
|
};
|
|
}
|
|
|
|
public Double getAdjustedPrice() {
|
|
return unitPrice * getComplexityMultiplier();
|
|
}
|
|
|
|
// Getters et Setters
|
|
public Long getId() { return id; }
|
|
public void setId(Long id) { this.id = id; }
|
|
|
|
public Quote getQuote() { return quote; }
|
|
public void setQuote(Quote quote) { this.quote = quote; }
|
|
|
|
public String getModuleCode() { return moduleCode; }
|
|
public void setModuleCode(String moduleCode) { this.moduleCode = moduleCode; }
|
|
|
|
public String getModuleName() { return moduleName; }
|
|
public void setModuleName(String moduleName) { this.moduleName = moduleName; }
|
|
|
|
public String getDescription() { return description; }
|
|
public void setDescription(String description) { this.description = description; }
|
|
|
|
public Double getUnitPrice() { return unitPrice; }
|
|
public void setUnitPrice(Double unitPrice) { this.unitPrice = unitPrice; }
|
|
|
|
public Integer getQuantity() { return quantity; }
|
|
public void setQuantity(Integer quantity) { this.quantity = quantity; }
|
|
|
|
public String getUnit() { return unit; }
|
|
public void setUnit(String unit) { this.unit = unit; }
|
|
|
|
public String getTechnicalSpecs() { return technicalSpecs; }
|
|
public void setTechnicalSpecs(String technicalSpecs) { this.technicalSpecs = technicalSpecs; }
|
|
|
|
public String getDeliverables() { return deliverables; }
|
|
public void setDeliverables(String deliverables) { this.deliverables = deliverables; }
|
|
|
|
public Integer getImplementationDays() { return implementationDays; }
|
|
public void setImplementationDays(Integer implementationDays) { this.implementationDays = implementationDays; }
|
|
|
|
public ComplexityLevel getComplexity() { return complexity; }
|
|
public void setComplexity(ComplexityLevel complexity) { this.complexity = complexity; }
|
|
}
|
|
|
|
|